summaryrefslogtreecommitdiff
path: root/fpcdocs/ide.tex
blob: b0d34574ad2381dc43808b47319f9166b19434ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
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
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
%
%   $Id: ide.tex,v 1.10 2005/04/29 07:52:18 michael Exp $
%   This file is part of the FPC documentation.
%   Copyright (C) 2000 by Florian Klaempfl
%
%   The FPC documentation is free text; you can redistribute it and/or
%   modify it under the terms of the GNU Library General Public License as
%   published by the Free Software Foundation; either version 2 of the
%   License, or (at your option) any later version.
%
%   The FPC Documentation is distributed in the hope that it will be useful,
%   but WITHOUT ANY WARRANTY; without even the implied warranty of
%   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
%   Library General Public License for more details.
%
%   You should have received a copy of the GNU Library General Public
%   License along with the FPC documentation; see the file COPYING.LIB.  If not,
%   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
%   Boston, MA 02111-1307, USA.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% The IDE
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{The IDE}

The IDE (\textbf{I}ntegrated \textbf{D}evelopment \textbf{E}nvironment)
provides a comfortable user interface to the compiler. It contains an
editor with syntax highlighting, a debugger, symbol browser etc.
The IDE is a text-mode application which has the same look and feel
on all supported operating systems. It is modelled after the IDE of Turbo
Pascal, so many people should feel comfortable using it.

Currently, the IDE is available for \dos, \windows and \linux.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% First steps with the IDE
\section{First steps with the IDE}
%
% Starting the IDE
%
\subsection{Starting the IDE}
The IDE is started by entering the command:
\begin{verbatim}
fp
\end{verbatim}
at the command line. It can also be started from a graphical user
interface such as \windows.
\begin{remark}
Under \windows, it is possible to switch between windowed mode and
full screen mode by pressing \key{Alt-Enter}.
\end{remark}
%
% IDE command-line options.
%
\subsection{IDE command line options}
When starting the IDE, command line options can be passed:
\begin{verbatim}
fp [-option] [-option] ... <file name> ...
\end{verbatim}
\var{Option} is one of the following switches (the option letters
are case insensitive):
\begin{description}
\item [-N] (\dos only) Do not use long file names. \windows 95 and later
versions of \windows provide an interface to DOS applications to access
long file names.
The IDE uses this interface by default to access files. Under certain
circumstances, this can lead to problems. This switch tells the IDE not to
use the long filenames.
\item [-Cfilename] Read IDE options from \file{filename}. 
There should be no whitespace between the file name and the \var{-C}.
\item [-F] Use alternative graphic characters. This can be used to run the
IDE on \linux in an X-term or through a telnet session.
\item [-R] After starting the IDE, change automatically to the directory
which was active when the IDE exited the last time.
\item [-S] Disable the mouse. When this option is used, the use of a mouse is
disabled, even if a mouse is present.
\item[-Tttyname] (\linux/Unix only) Send program output to tty \var{ttyname}.
This avoids having to continually switch between program output and the IDE.
\end{description}
The files given at the command line are loaded into edit windows automatically.

\begin{remark}
Under DOS/Win32, the first character of a command line option can be a \var{/}
character instead of a \var{-} character. So \var{/S} is equivalent to \var{-S}.
\end{remark}

\subsection{The IDE screen}

After start up, the screen of the IDE can look like \seefig{idestart}.

\FPCpic{The IDE screen immediately after startup}{}{idestart}

At the top of the screen the \emph{menu bar} is visible, at the bottom
the \emph{status bar}. The empty space between them is called the
\emph{desktop}.

The status bar shows the keyboard shortcuts for frequently used
commands, and allows quick access to these commands by clicking
them with the mouse.
At the right edge of the status bar, the current amount of unused
memory is displayed. This is only an indication, since the IDE
tries to allocate more memory from the operating system if it
runs out of memory.

The menu provides access to all of the IDE's functionality, and
at the right edge of the menu, a clock is displayed.

The IDE can be exited by selecting \menu{File|Exit} in the menu
\footnote{\menu{File|Exit} means select the item 'Exit' in the menu 'File'.}
or by pressing \key{Alt-X}.

\begin{remark}
If a file \file{fp.ans} is found in the current directory,
then it is loaded and used to paint the background.
This file should contain ANSI drawing commands to draw on a screen.
\end{remark}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Navigating in the IDE
\section{Navigating in the IDE}
The IDE can be navigated both with the keyboard and with a mouse, if the
system is equipped with a mouse.
%
% Using the keyboard
%
\subsection{Using the keyboard}
All functionality of the IDE is available through use of the keyboard.
\begin{itemize}
\item It is used for typing and navigating through the sources.
\item Editing commands such as copying and pasting text.
\item Moving and resizing windows.
\item It can be used to access the menu, by pressing \key{ALT} and the
appropriate highlighted menu letter, or by pressing \key{F10} and
navigating through the menu with the arrow keys.
More information on the menu can be found in \sees{idemenu}.
\item Many commands in the IDE are bound to shortcuts, i.e. typing a special
combination of keys will execute a command immediately.
\end{itemize}
\begin{remark}
\begin{itemize}
\item When working in a \linux X-Term or through a telnet session, the
key combination with \key{Alt} may not be available. To remedy this, the
\key{Ctrl-Z} combination can be typed first. This means that e.g. \key{Alt-X}
can be replaced by \key{Ctrl-Z X}.
\item Alternatively, you can try the key combination ESC-X for \key{Alt-X}
when working on \linux.
\item A complete reference of all keyboard shortcuts can be found in
\sees{keyshortcuts}.
\end{itemize}
\end{remark}
%
% Using the mouse
%
\subsection{Using the mouse}
\label{suse:mouseusage}
If the system is equipped with a mouse, it can be used to work with the
IDE. The left button is used to select menu items, press buttons, select
text blocks etc.

The right mouse button is used to access the local menu, if available.
Holding down the \key{Ctrl} or \key{Alt} key and clicking the right
button will execute user defined functions. See \sees{prefmouse}.

\begin{remark}
\begin{enumerate}
\item Occasionally, the manual uses the term "drag the mouse". This
means that the mouse is moved while the left mouse button is being
pressed.
\item
The action of mouse buttons may be reversed, i.e. the actions of the left
mouse button can be assigned to the right mouse button and vice versa
\footnote{See \sees{prefmouse} for more information on how to reverse the
actions of the mouse buttons.}. Throughout the manual, it is assumed
that the actions of the mouse buttons are not reversed.
\item
The mouse is not always available, even if a mouse is installed:
\begin{itemize}
\item The IDE is running under \linux through a telnet connection from
a \windows machine.
\item The IDE is running under \linux in an X-term under X-windows. In this
case it depends on the terminal program: under Konsole (the KDE terminal) it
works.
\end{itemize}
\item On Windows, the console has an option 'Quick edit', allowing text
to be copied to the clipboard by selecting text in the console window. If this
mode is enabled, the mouse will not work. The 'Quick edit' option should be
disabled in the console window's properties in order for the IDE to receive mouse
events.
\end{enumerate}
\end{remark}
%
% Navigating in dialogs
%
\subsection{Navigating in dialogs}
\label{se:navigatingdialogs}
Dialogs usually have a lot of elements in them such as buttons, edit fields,
memo fields, list boxes and so on. To activate one of these fields, choose
one of the following methods:
\begin{enumerate}
\item Click on the element with the mouse.
\item Press the \key{Tab} key till the focus reaches the element.
\item Press the highlighted letter in the element's label. If the focus
is currently on an element that allows editing, then \key{Alt} should be
pressed simultaneously with the highlighted letter. For a button, the action
associated with the button will then be executed.
\end{enumerate}
Inside edit fields, list boxes and memos, navigation is carried out with the
usual arrow key commands.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Windows
\section{Windows}
\label{se:windows}
Nowadays, working with windowed applications should be no problem for
most \windows and \linux users. Nevertheless, the following section
describes how the windows work in order to derive the most benefit from the
Free Pascal IDE.
%
% Window basics
%
\subsection{Window basics}
\label{se:windowbasics}

A common IDE window is displayed in \seefig{idewin}.

\FPCpic{A common IDE window}{}{idewin}

The window is surrounded by a so-called \emph{frame}, the white double
line around the window.

At the top of the window 4 things are displayed:
\begin{itemize}
\item
At the upper left corner of the window, a \emph{close icon} is shown.
When clicked, the window will be closed. It can also be closed by
 pressing \key{Alt-F3} or by selecting the menu item \menu{Window|Close}.
All open windows can be closed by selecting the menu item
\menu{Window|Close all}.
\item In the middle, the title of the window is displayed.
\item Almost at the upper right corner, a number is visible.
This number identifies the editor window, and pressing \key{Alt-Number}
will jump to this window. Only the first 9 windows will get such a number.
\item At the upper right corner, a small green arrow is visible.
Clicking this arrow zooms the window so it covers the whole desktop.
Clicking this arrow on a zoomed window will restore the old size of the
window. Pressing the \key{F5} key has the same effect as clicking
that arrow. The same effect can be achieved with the menu item
\menu{Window|Zoom}.
Windows and dialogs which aren't resizeable can't be zoomed, either.
\end{itemize}

The right edge and bottom edges of a window contain scrollbars.
They can be used to scroll the window contents with the mouse.
The arrows at the ends of the scrollbars can be clicked to scroll the
contents line by line. Clicking on the dotted area between the arrows
and the cyan-coloured rectangle will scroll the window's content
page by page. By dragging the rectangle the content can be scrolled
continuously.

The star and the numbers in the lower left corner of the window
display information about the contents of the window. They
are explained in the section about the editor, see \sees{editingtext}.

%
% Sizing+moving windows
%
\subsection{Sizing and moving windows}
\label{se:windowsizingmoving}
A window can be moved and sized using the mouse and the keyboard.

To move a window:
\begin{itemize}
\item Using the mouse, click on the title bar and drag the window
with the mouse.
\item Using the keyboard, go into the size/move mode
by pressing \key{Ctrl-F5} or selecting the menu item
\menu{Window|Size/Move}. The window  frame will change to green to 
indicate that the IDE is in  size/move mode. Now the cursor keys 
can be used to move the  window. Press \key{Enter} to leave the 
size/move mode. In this case, the window will keep its size and 
position. Alternatively, pressing \key{Esc} will restore the old 
position.
\end{itemize}
To resize a window:
\begin{itemize}
\item Using the mouse, click on the lower right corner of the window
and drag it.
\item Using the keyboard, go into the size/move mode by pressing \key{Ctrl-F5} or selecting the menu item
\menu{Window|Size/Move}. The window frame will change to green to 
indicate that the IDE is in size/move mode. Now hold down the SHIFT 
key and press one of the cursor keys in order to resize the window. 
Press \key{Enter} to leave the size/move mode.
Pressing \key{Esc} will restore the old size.
\end{itemize}
Not all windows can be resized. This applies, for example, to
\emph{dialog windows} (\sees{dialogwindow}).

A window can also be hidden. To hide a window, the \key{Ctrl-F6} key
combination can be used, or the \menu{Window|Hide} menu may be selected.
To restore a Hidden window, it is necessary to select it from the window
list. More information about the window list can be found in the next
section.
%
% Multiple windows
%
\subsection{Working with multiple windows}
\label{se:multiplewindows}
When working with larger projects, it is likely that multiple windows
will appear on the desktop. However, only one of these windows will be
the active window; all other windows will be inactive.

An inactive window is identified by a grey frame. An inactive window can
be made active in one of several ways:
\begin{itemize}
\item Using the mouse, activate a window by clicking on it.
\item Using the keyboard, pressing \key{F6} will step through all open
windows. To activate the previously activated window, \key{Shift-F6} can
be used.
\item The menu item \menu{Window|Next} can be used to activate the next
window in the list of windows, while \var{Window|Previous} will select
the previous window.
\item If the window has a number in the upper right corner, it can be
activated by pressing \key{Alt-<number>}.
\item Pressing \key{Alt-0} will pop up a dialog with all
available windows which allows a quick activation of windows which
don't have a number.
\end{itemize}

The windows can be ordered and placed on the IDE desktop by zooming and
resizing them with the mouse or keyboard. This is a time-consuming task,
and particularly difficult with the keyboard. Instead, the menu items
\menu{Window|Tile} and \menu{Window|Cascade} can be used:
\begin{description}
\item[Tile] will divide the whole desktop space evenly between all resizable
windows.
\item[Cascade] puts all the windows in a cascaded arrangement.
\end{description}

In very rare cases the screen of the IDE may become mixed up. In this
case the whole IDE screen can be refreshed by selecting the menu item
\menu{Window|Refresh display}.
%
% Dialog windows
%
\subsection{Dialog windows}
\label{se:dialogwindow}
In many cases the IDE displays a dialog window to get user input.
The main difference to normal windows is that other windows cannot be
activated while a dialog is active. Also the menu is not accessible while in
a dialog. This behaviour is called \emph{modal}. To activate another window,
the modal window or dialog must be closed first.

A typical dialog window is shown in \seefig{idedlg}.

\FPCpic{A typical dialog window}{}{idedlg}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% The menu
\section{The Menu}
\label{se:idemenu}
The main menu (the gray bar at the top of the IDE) provides access to all the
functionality of the IDE. It also contains a clock, displaying the current
time. The menu is always available, except when a dialog is opened. If a
dialog is opened, it must be closed first in order to access the menu.

In certain windows, a local menu is also available. The local menu will
appear where the cursor is, and provides additional commands that are
context-sensitive.
%
% Accessing the menu
%
\subsection{Accessing the menu}
The menu can be accessed in a number of ways:
\begin{enumerate}
\item By using the mouse to select items. The mouse cursor should be located
over the desired menu item, and a left mouse click will then select it.
\item By pressing \key{F10}. This will switch the IDE focus to the menu.
The arrow keys can then be used to navigate in the menu. The
\key{Enter} key should be used to select items.
\item To access menu items directly, \key{Alt-<highlighted menu letter>}
can be used to select a menu item. Afterwards submenu entries can be selected
by pressing the highlighted letter, but without \key{Alt}.
E.g. \key{Alt-S G} is a fast way to display the \emph{goto line} dialog.
\end{enumerate}
Every menu item is explained by a short text in the status bar.

When a local menu is available, it can be accessed by pressing
the right mouse button or \key{Alt-F10}.

To exit any menu without taking any action, press the \key{ESC} key
twice.

In the following, all menu entries and their actions are described.
%
% The file menu
%
\subsection{The File menu}
\label{se:menufile}
The \menu{File} menu contains all menu items that allow the user 
to load and save files, as well as to exit the IDE.
\begin{description}
\item[New] Opens a new, empty editor window.
\item[New from template] Prompts for a template to be used, asks to fill in
any parameters, and then starts a new editor window with the template.
\item[Open] (\key{F3}) Presents a file selection dialog, and opens
the selected file in a new editor window.
\item[Print] print the contents of the current edit window.
\item[Print setup] set up the printer properties.
\item[Reload] Reload a file from disk.
\item[Save] (\key{F2}) Saves the contents of the current edit window
with the current filename. If the current edit window does not yet have
a filename, a dialog is presented to enter a new filename.
\item[Save as] Presents a dialog in which a filename can be entered. The
current window's contents are then saved to this new filename, and the
filename is stored for further save actions.
\item[Save all] Saves the contents of all edit windows.

\item[Change dir] Presents a dialog in which a directory can be selected.
The current working directory is then changed to the selected directory.
\item[Command shell] Executes a command shell. After the shell is exited, the
IDE resumes. Which command shell is executed depends on the system.
\item[Exit] (\key{ALT-X}) Exits the IDE. If any unsaved files are
in the editor, the IDE will ask if these files should be saved.
\end{description}
Under the \menu{Exit} menu appear some filenames of recently used files.
These entries can be used to quickly reload these files in the editor.

%
% The edit menu
%
\subsection{The Edit menu}
\label{se:menuedit}
The \menu{Edit} menu contains entries for accessing the clipboard, and
undoing or redoing editing actions. Most of these functions have shortcut
keys associated with them.
\begin{description}
\item[Undo] (\key{ALT-BKSP}) Reverses the effect of the last editing action.
The editing actions are stored in a buffer.
Selecting this mechanism will move backwards through this buffer, i.e.
multiple undo levels are possible. 
However, any selections that may have been made are not reproduced.
\item[Redo] Repeats the last action that was just undone with Undo.
Redo can redo multiple undone actions.
%\item[Dump undo]
%Shows the contents of the UNDO list in the messages window.
%\item[Undo all]
%Undo all actions in the undo buffer. If a new empty file was started, this
%action should clear the window contents again.
%\item[Redo all]
%Redo all editing actions that were undone.
\item[Cut] (\key{Shift-DEL}) Deletes the selected text from the window and
copies it to the clipboard. Any previous clipboard contents are lost. 
The new clipboard contents are available for pasting elsewhere.
\item[Copy] (\key{Ctrl-INS}) Copies the current selection to the clipboard.
Any previous clipboard contents are lost. The new clipboard
contents are available for pasting elsewhere.
\item[Paste] (\key{Shift-INS}) Inserts the current clipboard contents in the
text at the cursor position. The clipboard contents remain as they were.  
\item[Clear] (\key{Ctrl-DEL}) Clears (i.e. deletes) the current
selection.
\item[Select All] Selects all text in the current window. The selected
text can then be cut or copied to the clipboard.
\item[Unselect] undo the selection.
\item[Show clipboard] Opens a window in which the current clipboard contents
are shown.
\end{description}
When running an IDE under \windows, the \menu{Edit} menu has two
additional entries. The IDE maintains a separate clipboard which does
not share its contents with the \windows clipboard. To access the \windows
clipboard, the following two entries are also present:
\begin{description}
\item[Copy to Windows] Copy the selection to the \windows clipboard.
\item[Paste from Windows] Insert the contents of the \windows clipboard 
(if it contains text) in the edit window at the current cursor position.
\end{description}

%
% The Search menu
%
\subsection{The Search menu}
\label{se:menusearch}
The \menu{Search} menu provides access to the search and replace dialogs, as well as
access to the symbol browser of the IDE.
\begin{description}
\item[Find] (\key{Ctrl-Q F}) Presents the search dialog. A search text
can be entered, and when the dialog is closed, the entered text is searched
for in the active window. If the text is found, it will be selected.
\item[Replace] (\key{Ctrl-Q A}) Presents the search and replace dialog.
After the dialog is closed, the search text will be replaced by the replace
text in the active window.
\item[Search again] (\key{CTRL-L}) Repeats the last search or search and replace action,
 using  the same parameters.
\item[Go to line number] (\key{Alt-G}) Prompts for a line number, and
then jumps to this line number.
\end{description}
When the program and units are compiled with browse information, then
the following menu entries are also enabled:
\begin{description}
\item[Find procedure]
Not yet implemented.
\item[Objects]
Asks for the name of an object and opens a browse window for this object.
\item[Modules]
Asks for the name of a module and opens a browse window for this module.
\item[Globals]
Asks for the name of a global symbol and opens a browse window for this
global symbol.
\item[Symbol]
Opens a window with all known symbols, so a symbol can be selected. After
the symbol is selected, a browse window for that symbol is opened.
\end{description}
%
% The Run menu
%
\subsection{The Run menu}
\label{se:menurun}
The \menu{Run} menu contains all entries related to running a program,
\begin{description}
\item[Run] (\key{Ctrl-F9})
If the sources were modified, compiles the program. If the compile is
successful, the program is executed. If the primary file  was set, then
that is used to determine which program to execute. See \sees{menucompile}
for more information on how to set the primary file.
\item[Step over] (\key{F8})
Run the program until the next source line is reached. If any calls to
procedures are made, these will be executed completely as well.
\item[Trace into] (\key{F7})
Execute the current line. If the current line contains a call to another
procedure, the process will stop at the entry point of the called procedure.
\item[Goto cursor] (\key{F4})
Run the program until the execution point matches the line where the cursor
is.
\item[Until return] Runs the current procedure until it exits.
\item[Run directory] Set the working directory to change to when 
executing the program.
\item[Parameters]
Permits the entry of parameters that will be passed to the program when 
it is being executed.
\item[Program reset] (\key{Ctrl-F2}) if the program is being run or
debugged, the debug session is aborted, and the running program is killed.
\end{description}
%
% The compile menu
%
\subsection{The Compile menu}
\label{se:menucompile}
The \menu{Compile} menu contains all entries related to compiling a program or
unit.
\begin{description}
\item[Compile] (\key{Alt-F9}) Compiles the contents of the active window,
irrespective of the primary file setting.
\item[Make] (\key{F9}) Compiles the contents of the active window, and
any files that the unit or program depends on and that were modified since
the last compile.
If the primary file was set, the primary file is compiled instead.
\item[Build]
Compiles the contents of the active window, and any files that the unit or
program depends on, whether they were modified or not.
If the primary file was set, the primary file is compiled instead.
\item[Target] Sets the target operating system for which the program should be compiled.
\item[Primary file] Sets the primary file. If set, any run or compile command
will act on the primary file instead of on the active window. The primary
file need not be loaded in the IDE for this to have effect.
\item[Clear primary file]
Clears the primary file. After this command, any run or compile action will
act on the active window.
%\item[Information] Displays some information about the current program.
\item[Compiler messages] (\key{F12}) Displays the compiler messages
window. This window will display the messages generated by the compiler
during the most recent compile.
\end{description}
%
% The debug menu
%
\subsection{The Debug menu}
\label{se:menudebug}
The \menu{Debug} menu contains menu entries to aid in debugging a program, such as
setting breakpoints and watches.
\begin{description}
\item[Output] Show user program output in a window.
\item[User screen] (\key{Alt-F5})
Switches to the screen as it was last left by the running program.
\item[Add watch] (\key{Ctrl-F7}) Adds a watch. A watch is an expression
that can be evaluated by the IDE and will be shown in a special window.
Usually this is the content of some variable.
\item[Watches]
Shows the current list of watches in a separate window.
\item[Breakpoint] (\key{Ctrl-F8})
Sets a breakpoint at the current line. When debugging, program execution
will stop at this breakpoint.
\item[Breakpoint list]
Shows the current list of breakpoints in a separate window.
\item[Evaluate]
\item[Call stack] (\key{Ctrl-F3})
Shows the call stack. The call stack is the list of addresses (and
filenames and line numbers, if this information was compiled in) of
procedures that are currently being called by the running program.
\item[Disassemble] Shows the call stack.
\item[Registers]
Shows the current content of the CPU registers.
\item[Floating point unit] 
Shows the current content of the FPU registers.
\item[Vector unit]
Shows the current content of the MMX (or equivalent) registers.
\item[GDB window]
Shows the GDB debugger console. This can be used to interact with the debugger
directly; here arbitrary GDB commands can be typed and the result will be
shown in the window.
\end{description}
%
% The tools menu
%
\subsection{The Tools menu}
\label{se:menutools}
The \menu{Tools} menu defines some standard tools. If new tools are defined by the
user, they are appended to this menu as well.
\begin{description}
\item[Messages] (\key{F11}) Shows the messages window.
This window contains the output from one of the tools. For more information,
see \sees{toolsmessages}.
\item[Goto next] (\key{Alt-F8}) Goes to the next message.
\item[Goto previous] (\key{Alt-F7}) Goes to the previous message
\item[Grep] (\key{SHIFT-F2}) Prompts for a regular expression and options
to be given to grep, and then executes \file{grep} with the given expression and
options. For this to work, the \file{grep} program must be installed on the
system, and be in a directory that is in the \var{PATH}. For more
information, see \sees{grep}.
\item[Calculator]
Displays the calculator. For more information, see \sees{calculator}.
\item[Ascii table] Displays the \var{ASCII} table. For more information, see
\sees{asciitable}.
\end{description}
%
% The Options menu
%
\subsection{The Options menu}
\label{se:menuoptions}
The \menu{Options} menu is the entry point for all dialogs that are used to set
options for the compiler and the IDE, as well as the user preferences.
\begin{description}
\item[Mode] Presents a dialog to set the current mode of the compiler. The
current mode is shown at the right of the menu entry. For more information,
see \sees{compilermode}.
\item[Compiler] Presents a dialog that can be used to set common compiler
options. These options will be used when compiling a program or unit.
\item[Memory sizes]
Presents a dialog where the stack size and the heap size for the program can
be set. These options will be used when compiling a program.
\item[Linker]
Presents a dialog where some linker options can be set. These options will
be used when a program or library is compiled.
\item[Debugger]
Presents a dialog where the debugging options can be set. These options
are used when compiling units or programs. Note that the debugger will not
work unless debugging information is generated for the program.
\item[Directories]
Presents a dialog where the various directories needed by the compiler can
be set. These directories will be used when a program or unit is compiled.
\item[Browser]
Presents a dialog where the browser options can be set. The browser options
affect the behaviour of the symbol browser of the IDE.
\item[Tools]
Presents a dialog to configure the tools menu. For more information, see
\sees{addingtools}.
\item[Environment]
Presents a dialog to configure the behaviour of the IDE. A sub menu is
presented with the various aspects of the IDE:
\begin{description}
\item[Preferences]
General preferences, such as whether to save files automatically or not, 
and which files should be saved. The video mode can also be set here.
\item[Editor]
Controls various aspects of the edit windows.
\item[CodeComplete]
Used to set the words which can be automatically completed when typing in
the editor windows.
\item[Codetemplates]
Used to define code templates, which can be inserted in an edit window.
\item[Desktop]
Used to control the behaviour of the desktop, i.e. several features can be
switched on or off.
\item[Keyboard \& Mouse] Can be used to select the cut/copy/paste
convention, control the actions of the mouse, and to assign commands 
to various mouse actions.
%\item[Startup]
%Not yet implemented.
%\item[Colors]
%Here the various colors used in the IDE and the editor windows can be set.
\item[Learn keys] Let the IDE learn keystrokes to be assigned to various 
commands. This is useful mostly on \linux and Unix-like platforms, where the
actual keys sent to the IDE depend on the terminal emulation.
\end{description}
\item[Open]
Presents a dialog in which a file containing editor preferences can be selected.
After the dialog is closed, the preferences file will be read and the
preferences will be applied.
\item[Save]
Saves the current options in the default file.
\item[Save as]
Saves the current options in an alternate file. A file selection dialog box
will be presented in which the alternate settings file can be specified.
\end{description}
Please note that options are not saved automatically. They should be saved
explicitly with the \menu{Options|\-Save} command.
%
% The window menu
%
\subsection{The Window menu}
\label{se:menuwindow}
The \menu{Window} menu provides access to some window functions. 
More information on all these functions can be found in \sees{windows}
\begin{description}
\item[Tile]
Tiles all opened windows on the desktop.
\item[Cascade]
Cascades all opened windows on the desktop.
\item[Close all]
Closes all opened windows.
\item[Size/move] (\key{Ctrl-F5})
Puts the IDE in Size/move mode; after this command the active window can be
moved and resized using the arrow keys.
\item[Zoom] (\key{F5})
Zooms or unzooms the current window.
\item[Next] (\key{F6})
Activates the next window in the window list.
\item[Previous] (\key{SHIFT-F6})
Activates the previous window in the window list.
\item[Hide] (\key{Ctrl-F6})
Hides the active window.
\item[Close] (\key{ALT-F3})
Closes the active window.
\item[List] (\key{Alt-0})
Shows the list of opened windows. From there a
window can be activated, closed, shown and hidden.
\item[Refresh display]
Redraws the screen.
\end{description}
%
% The Help menu
%
\subsection{The Help menu}
\label{se:menuhelp}
The \menu{Help} menu provides entry points to all the help functionality of
the IDE, as well as the means to customize the help system.
\begin{description}
\item[Contents]
Shows the help table of contents
\item[Index] (SHIFT-F1)
Jumps to the help Index.
\item[Topic search]  (CTRL-F1)
Jumps to the topic associated with the currently highlighted text.
\item[Previous topic] (ALT-F1)
Jumps to the previously visited topic.
\item[Using help]
Displays help on using the help system.
\item[Files]
Allows the configuration of the help menu. With this menu item,  help files can be added to the help
system.
\item[About]
Displays information about the IDE. See \sees{about} for more information.
\end{description}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Editing text
\section{Editing text}
\label{se:editingtext}
In this section, the basics of editing (source) text are explained. The IDE
works like many other text editors in this respect, so mainly the
distinguishing points of the IDE will be explained.

\subsection{Insert modes}
Normally, the IDE is in insert mode. This means that any text that is typed
will be inserted before text that is present after the cursor.

In overwrite mode, any text that is typed will replace existing text.

When in insert mode, the cursor is a flat blinking line. If the IDE is in
overwrite mode, the cursor is a cube with the height of one line. Switching between
insert mode and overwrite mode happens with the \key{Insert} key or with the
\key{Ctrl-V} key.
%
% blocks
%
\subsection{Blocks}
\label{se:blocks}
The IDE handles selected text just as the \tp IDE handles it. This is
slightly different from the way e.g. \windows applications handle selected
text.

Text can be selected in 3 ways:
\begin{enumerate}
\item Using the mouse, dragging the mouse over existing text selects it.
\item Using the keyboard, press \key{Ctrl-K B} to mark the beginning of
the selected text, and \key{Ctrl-K K} to mark the end of the selected
text.
\item Using the keyboard, hold the \key{Shift} key depressed while
navigating with the cursor keys.
\end{enumerate}

There are also some special select commands:
\begin{enumerate}
\item The current line can be selected using \key{Ctrl-K L}.
\item The current word can be selected using \key{Ctrl-K T}.
\end{enumerate}

In the \fpc IDE, selected text is persistent. After selecting a range of
text, the cursor can be moved, and the selection will not be destroyed;
hence the term 'block' is more appropriate for the selection, and will be
used henceforth...

Several commands can be executed on a block:
\begin{itemize}
\item Move the block to the cursor location (\key{Ctrl-K V}).
\item Copy the block to the cursor location (\key{Ctrl-K C}).
\item Delete the block (\key{Ctrl-K Y}).
\item Write the block to a file (\key{Ctrl-K W}).
\item Read the contents of a file into a block (\key{Ctrl-K R}).
If there is already a block, this block is not replaced by this command.
The file is inserted at the current cursor position, and then the
inserted text is selected.
\item Indent a block (\key{Ctrl-K I}).
\item Undent a block (\key{Ctrl-K U}).
\item Print the block contents (\key{Ctrl-K P}).
\end{itemize}
When searching and replacing, the search can be restricted to the block
contents.

%
% Bookmarks
%
\subsection{Setting bookmarks}
\label{se:bookmarks}
The IDE provides a feature which allows the setting of a bookmark at the current
cursor position. Later, the cursor can be returned to this position
by pressing a keyboard shortcut.

Up to 9 bookmarks per source file can be set up; they are set by
\key{Ctrl-K <Number>} (where number is the number of the bookmark).
To go to a previously set bookmark, press \key{Ctrl-Q <Number>}.

\begin{remark}
Currently, the bookmarks are not saved when the IDE is exited. 
This may change in future implementations of the IDE.
\end{remark}

%
% Jumping to a source line
%
\subsection{Jumping to a source line}
It is possible to go directly to a specific source line. To do this, open
the {\em goto line} dialog via the \menu{Search|Goto line number} menu.

In the dialog that appears, the line number the IDE should jump to can be
entered. The goto line dialog is shown in \seefig{gotoline}.

\FPCpic{The goto line dialog.}{ide}{gotoline}

%
% Syntax highlighting and code completion
%
\subsection{Syntax highlighting}
\label{se:syntaxhighlighting}
The IDE is capable of syntax highlighting, i.e. the color of certain
Pascal elements can be set. As text is entered in an editor window,
the IDE will try to recognise the elements, and set the color of the
text accordingly.


The syntax highlighting can be customized in the colors preferences dialog,
using the menu option \menu{Options|\-Environment|\-Colors}. In the colors dialog, the
group "Syntax" must be selected. The item list will then display the
various syntactical elements that can be colored:
\begin{description}
\item[Whitespace] The empty text between words. Note that for whitespace,
only the background color will be used.
\item[Comments] All styles of comments in Free Pascal.
\item[Reserved words] All reserved words of Free Pascal. (See also \refref).
\item[Strings] Constant string expressions.
\item[Numbers] Numbers in decimal notation.
\item[Hex numbers] Numbers in hexadecimal notation.
\item[Assembler] Any assembler blocks.
\item[Symbols] Recognised symbols (variables, types).
\item[Directives] Compiler directives.
\item[Tabs] Tab characters in the source can be given a different color than
other whitespace.
\end{description}
The editor uses some default settings, but experimentation is the best way
to find a suitable color scheme. A good color scheme helps in detecting errors
in sources, since errors will result in wrong syntax highlighting.

% Code completion
\subsection{Code Completion}
\label{se:codecompletion}
Code completion means the editor will try to guess the text as it
is being typed. It does this by checking what text is typed, and as soon
as the typed text can be used to identify a keyword in a list of keywords,
the keyword will be presented in a small colored box under the typed text.
Pressing the \key{Enter} key will complete the word in the text.

There is no code completion yet for filling in function arguments, or choosing
object methods as in e.g. the Lazarus or \delphi IDEs.

Code completion can be customized in the Code completion dialog, reachable
through the menu option \menu{Options|\-Preferences|\-Codecomple}.
The list of keywords that can be completed can be maintained here.
The code completion dialog is shown in \seefig{codecomp}.

\FPCpic{The code completion dialog.}{ide}{codecomp}

The dialog shows in alphabetical order the currently defined keywords 
that are available for completion. The following buttons are available:
\begin{description}
\item[Ok] Saves all changes and closes the dialog.
\item[Edit] Pops up a dialog that allows the editing of the currently
highlighted keyword.
\item[New] Pops up a dialog that allows the entry of a new keyword which will be
added to the list.
\item[Delete] Deletes the currently highlighted keyword from the list.
\item[Cancel] Discards all changes and closes the dialog.
\end{description}
All keywords are saved and are available the next time the IDE is started.
Duplicate names are not allowed. If an attempt is made to add a duplicate
name to the list, an error will follow.

% Code templates
\subsection{Code Templates}
Code templates are a way to insert large pieces of code at once. Each
code templates is identified by a unique name. This name can be used to
insert the associated piece of code in the text.

For example, the name \var{ifthen} could be associated to the following
piece of code:
\begin{verbatim}
If | Then
  begin
  end
\end{verbatim}
A code template can be inserted by typing its name, and pressing \key{Ctrl-J}
when the cursor is positioned right after the template name.

If there is no template name before the cursor, a dialog will pop up to
allow selection of a template.

If a vertical bar (|) is present in the code template, the cursor is positioned
on it, and the vertical bar is deleted. In the above example, the cursor would be
positioned between the \var{if} and \var{then}, ready to type an expression.

Code templates can be added and edited in the code templates dialog, reachable via
the menu option \menu{Options|\-Environment|\-CodeTemplates}.
The code templates dialog is shown in \seefig{codetemp}.

\FPCpic{The code templates dialog.}{ide}{codetemp}

The top listbox in the code templates dialog shows the names of all
known templates. The bottom half of the dialog shows the text associated
with the currently highlighted code template.
The following buttons are available:
\begin{description}
\item[Ok] Saves all changes and closes the dialog.
\item[Edit] Pops up a dialog that allows the editing of the currently
highlighted code template. Both the name and text can be edited.
\item[New] Pops up a dialog that allows the entry of a new code template
which will be added to the list. A name must be entered for the new
template.
\item[Delete] Deletes the currently highlighted code template from the list.
\item[Cancel] Discards all changes and closes the dialog.
\end{description}
All templates are saved and are available the next time the IDE is started.
\begin{remark}
Duplicates are not allowed. If an attempt is made to add a duplicate name
to the list, an error will occur.
\end{remark}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Searching in the text
\section{Searching and replacing}
\label{se:searching}
The IDE allows you to search for text in the active editor window.
To search for text, one of the following can be done:
\begin{enumerate}
\item Select \menu{Search|Find} in the menu.
\item Press \key{Ctrl-Q F}.
\end{enumerate}
After that, the dialog shown in \seefig{search} will pop up,
and the following options can be entered:

\FPCpic{The search dialog.}{ide}{search}

\begin{description}
\item[Text to find] The text to be searched for. If a block was active when
the dialog was started, the first line of this block is proposed.
\item[Case sensitive] When checked, the search is case sensitive.
\item[Whole words only] When checked, the search text must appear in the
text as a complete word.
\item[Direction] The direction in which the search must be conducted,
starting from the specified origin.
\item[Scope] Specifies if the search should be on the whole file, or just the selected
text.
\item[Origin] Specifies if the search should start from the cursor position or the start
of the scope.
\end{description}
After the dialog has closed, the search is performed using the given options.

A search can be repeated (using the same options) in one of 2 ways:
\begin{enumerate}
\item Select \menu{Search|Search again} from the menu.
\item Press \key{Ctrl-L}.
\end{enumerate}

It is also possible to replace occurrences of a text with another text.
This can be done in a similar manner to searching for a text:
\begin{enumerate}
\item Select \menu{Search|Replace} from the menu.
\item Press \key{Ctrl-Q A}.
\end{enumerate}
A dialog, similar to the search dialog will pop up, as shown in \seefig{replace}.

\FPCpic{The replace dialog.}{ide}{replace}

In this dialog, in addition to the things that can be filled in in the
search dialog, the following things can be entered:
\begin{description}
\item [New text] Text that will replace the found text.
\item [Prompt on replace] Before a replacement is made, the IDE will ask for
confirmation.
\end{description}
If the dialog is closed with the 'OK' button, only the next occurrence of
the the search text will be replaced.
If the dialog is closed with the 'Change All' button, all occurrences of
the search text will be replaced.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% The symbol browser
\section{The symbol browser}
\label{se:browser}
The symbol browser allows searching all occurrences of a symbol. A symbol
can be a variable, type, procedure or constant that occurs in the
program or unit sources.

To enable the symbol browser, the program or unit must be compiled with
browser information. This can be done by setting the browser information
options in the compiler options dialog.

The IDE allows to browse several types of symbols:
\begin{description}
\item[Procedures] Allows quick jumping to a procedure definition or
implementation.
\item[Objects] Quickly browse for an object.
\item[Modules] Browse a module.
\item[Globals] Browse any global symbol.
\item[Arbitrary symbol] Browse an arbitrary symbol.
\end{description}
In all cases, first a symbol to be browsed must be selected. After that,
a browse window appears. In the browse window, all locations where the
symbol was encountered are shown. Selecting a location and pressing the
space bar will cause the editor to jump to that location; the line
containing the symbol will be highlighted.

If the location is in a source file that is not yet displayed, a new
window will be opened with the source file loaded.

After the desired location has been reached, the browser window can be closed
with the usual commands.

The behaviour of the browser can be customized with the browser options
dialog, using the \menu{Options|Browser} menu.
The browser options dialog looks like \seefig{obrowser}.

\FPCpic{The browser options dialog.}{ide}{obrowser}

The following options can be set in the browser options dialog:
\begin{description}
\item[Symbols] Here the types of symbols displayed in the browser can be
selected:
\begin{description}
\item[Labels] Labels are shown.
\item[Constants] Constants are shown.
\item[Types] Types are shown.
\item[Variables] Variables are shown.
\item[Procedures] Procedures are shown.
\item[Inherited]
\end{description}
\item[Sub-browsing] Specifies what the browser should do when displaying the
members of a complex symbol such as a record or class:
\begin{description}
\item[New browser] The members are shown in a new browser window.
\item[Replace current] The contents of the current window are replaced with
the members of the selected complex symbol.
\end{description}
\item[Preferred pane] Specifies what pane is shown in the browser when it is
initially opened:
\begin{description}
\item[Scope]
\item[Reference]
\end{description}
\item[Display] Determines how the browser should display the symbols:
\begin{description}
\item[Qualified symbols]
\item[Sort always] Sorts the symbols in the browser window.
\end{description}
\end{description}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Running programs
\section{Running programs}
\label{se:running}
A compiled program can be run straight from the IDE. This can be done
in one of several ways:
\begin{enumerate}
\item select the \menu{Run|Run} menu, or
\item press \key{Ctrl-F9}.
\end{enumerate}
If command line parameters should be passed to the program, then these
can be set through the \menu{Run|Parameters} menu.
The program parameters dialog looks like \seefig{params}.

\FPCpic{The program parameters dialog.}{ide}{params}

Once the program has started, it will continue to run, until
\begin{enumerate}
\item the program quits normally,
\item an error happens,
\item a breakpoint is encountered, or
\item the program is reset by the user.
\end{enumerate}
The last alternative is only possible if the program is compiled
with debug information.

Alternatively, it is possible to position the cursor somewhere in a
source file, and run the program till the execution reaches the
source line where the cursor is located. This can be done by
\begin{enumerate}
\item selecting \menu{Run|Goto Cursor} in the menu,
\item pressing \key{F4}.
\end{enumerate}
Again, this is only possible if the program was compiled with debug
information.

The program can also executed line by line. Pressing \key{F8} will
execute the next line of the program. If the program wasn't started
yet, it is started. Repeatedly pressing \key{F8} will execute the program
line by line, and the IDE will show the line to be executed
in an editor window. If somewhere in the code a call occurs to a subroutine,
then pressing \key{F8} will cause the whole routine to be executed before
control returns to the IDE. If the code of the subroutine should be stepped
through as well, then \key{F7} should be used instead. Using \key{F7} will
cause the IDE to execute line by line any subroutine that is encountered.

If a subroutine is being stepped through, then the \menu{Run|Until return} menu
will execute the program till the current subroutine ends.

If the program should be stopped before it quits by itself, then this can be
done by
\begin{enumerate}
\item selecting \menu{Run|Program reset} from the menu, or
\item pressing \key{Ctrl-F2}.
\end{enumerate}
The running program will then be aborted.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Debugging programs
\section{Debugging programs}
\label{se:debugging}
To debug a program, it must be compiled with debug information. Compiling a
program with debug information allows you to:
\begin{enumerate}
\item Execute the program line by line.
\item Run the program up to a certain point (a breakpoint).
\item Inspect the contents of variables or memory locations while the
program is running.
\end{enumerate}
%
% Using breakpoints
%
\subsection{Using breakpoints}
Breakpoints will cause a running program to stop when the execution
reaches the line where the breakpoint was set. At that moment, control
is returned to the IDE, and it is possible to continue execution.

To set a breakpoint on the current source line, use the
\menu{Debug|Breakpoint} menu entry, or press \key{Ctrl-F8}.

A list of current breakpoints can be obtained through the
\menu{Debug|Breakpoint list} menu. The breakpoint list window
is shown in \seefig{brklist}.

\FPCpic{The breakpoint list window}{ide}{brklist}

In the breakpoint list window, the following things can be done:
\begin{description}
\item[New] Shows the breakpoint property dialog where the properties
for a new breakpoint can be entered.
\item[Edit] Shows the breakpoint property dialog where the properties of
the highlighted breakpoint can be changed.
\item[Delete] Deletes the highlighted breakpoint.
\end{description}
The dialog can be closed with the 'Close' button.
The breakpoint properties dialog is shown in \seefig{brkprop}

\FPCpic{The breakpoint properties dialog}{ide}{brkprop}

The following properties can be set:
\begin{description}
\item[Type] Set the type of the breakpoint. The following types of breakpoints
exist:
\begin{description}
\item[function] Function breakpoint. The program will stop when the function
with the given name is reached.
\item[file-line] Source line breakpoint. The program will stop when the
source file with given name and line is reached.
\item[watch] Expression breakpoint. An expression may be entered, and the
program will stop as soon as the expression changes.
\item[awatch] (access watch) Expression breakpoint. An expression that references a
memory location may be entered, and the program will stop as soon as
the memory indicated by the expression is accessed.
\item[Address] stop as soon as an address is reached.
\item[rwatch] (read watch) Expression breakpoint. An expression that references a
memory location may be entered, and the program will stop as soon as
the memory indicated by the expression is read.
\end{description}
\item[Name] Name of the function or file where to stop.
\item[Conditions] Here an expression can be entered which must evaluate to
\var{True} for the program to stop at the breakpoint. The expressions that
can be entered must be valid GDB expressions.
\item[Line] Line number in the file where to stop. Only for breakpoints of
type file-line.
\item[Ignore count] The number of times the breakpoint will be ignored
before the program stops.
\end{description}
\begin{remark}
\begin{enumerate}
\item Because the IDE uses GDB to do its debugging, it is necessary to enter all
expressions in {\em uppercase}.
\item Expressions that reference memory locations should be no longer than 16
bytes on \linux or go32v2 on an Intel processor, since the Intel processor's
debug registers are used to monitor these locations.
\item Memory location watches will not function on Win32 unless a special
patch is applied.
\end{enumerate}
\end{remark}

%
% Using watches
%
\subsection{Using watches}
When debugging information is compiled in the program, watches can be used.
Watches are expressions which can be evaluated by the IDE and shown in a
separate window. When program execution stops (e.g. at a breakpoint) all
watches will be evaluated and their current values will be shown.

Setting a new watch can be done with the \menu{Debug|Add watch} menu
command or by pressing \key{Ctrl-F7}. When this is done, the watch
property dialog appears, and a new expression can be entered.
The watch property dialog is shown in \seefig{watch}.

\FPCpic{The watch property dialog}{ide}{watch}

In the dialog, the expression can be entered. Any possible previous value
and current value are shown.
\begin{remark}
Because the IDE uses GDB to do its debugging, it is necessary to enter all
expressions in {\em uppercase} in \freebsd.
\end{remark}
A list of watches and their present value is available in the watches
window, which can be opened with the \menu{Debug|Watches} menu.
The watch list window is shown in \seefig{watchlst}.

\FPCpic{The watch list window.}{ide}{watchlst}

Pressing \key{Enter} or the space bar will show the watch property dialog
for the currently highlighted watch in the watches window.

The list of watches is updated whenever the IDE resumes control when
debugging a program.
%
% The call stack
%
\subsection{The call stack}
\label{se:callstack}
The call stack helps in showing the program flow. It shows the list of
procedures that are being called at this moment, in reverse order.
The call stack window can be shown using the \menu{Debug|Call Stack} menu.
It will show the address or procedure name of all currently active
procedures with their filename and addresses. If parameters were passed
they will be shown as well. The call stack is shown in \seefig{callstck}.

\FPCpic{The call stack window.}{ide}{callstck}

By pressing the space bar in the call stack window, the line corresponding
to the call will be highlighted in the edit window.

% The GDB Window
\subsection{The GDB window}
\label{se:gdbwindow}
The GDB window provides direct interaction with the GDB debugger.
In it, GDB commands can be typed as they would be typed in GDB.
The response of GDB will be shown in the window.

Some more information on using GDB can be found in \sees{usinggdb}, but
the final reference is of course the GDB manual itself
\footnote{Available from the Free Software Foundation website.}.
The GDB window is shown in \seefig{gdbwin}.

\FPCpic{The GDB window}{ide}{gdbwin}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% The tools menu
\section{Using Tools}
\label{se:toolsmenu}
The tools menu provides easy access to external tools. It also has
three pre-defined tools for programmers: an ASCII table,  a grep tool
and a calculator. The output of the external tools can be accessed through
this menu as well.

%
% The messages window.
%
\subsection{The messages window}
\label{se:toolsmessages}
The output of the external utilities is redirected by the IDE and it
will be displayed in the messages window. The messages window is
displayed automatically, if an external tool was run. The
messages window can also be displayed manually by selecting the
menu item \menu{Tools|Messages} or by pressing the \key{F11} key.
The messages window is shown in \seefig{messages}.

\FPCpic{The messages window}{ide}{messages}

If the output of the tool contains filenames and line numbers,
the messages window can be used to navigate the source as in a browse
window:
\begin{enumerate}
\item Pressing \key{Enter} or double clicking the output line will jump
to the specified source line and close the messages window.
\item Pressing the space bar will jump to the specified source line, but
will leave the messages window open, with the focus on it. This allows the
quick selection of another message line with the arrow keys and jump to
another location in the sources.
\end{enumerate}
The algorithm which extracts the file names and line numbers from
the tool output is quite sophisticated, but in some cases it may
fail\footnote{Suggestions for improvement, or better yet, patches
that improve the algorithm, are always welcome.}.
%
% Grep
%
\subsection{Grep}
\label{se:grep}
One external tool in the Tools menu is already predefined: a
menu item to call the \file{grep} utility (\menu{Tools|Grep} or
\key{Shift-F2}). \file{Grep} searches for a given string in files and
returns the lines which contain the string. The search string can
even be a regular expression. For this menu item to work, the
\file{grep} program must be installed, since it is not distributed
with \fpc.

The messages window displayed in \seefig{messages} in the previous
section shows the output of a typical \file{grep} session. The messages
window can be used in combination with \file{grep} to find special
occurrences in the text.

\file{Grep} supports regular expressions. A regular expression is a
string with special characters which describe a whole class of
expressions. The command line in \dos or \linux has limited
support for regular expressions: entering \var{ls *.pas}
(or \var{dir *.pas}) to get a list of all Pascal files in a
directory. \file{*.pas} is something similar to a regular expression.
It uses a wildcard to describe a whole class of strings: those which
end on "\file{.pas}".
Regular expressions offer much more: for example \var{[A-Z][0-9]+}
describes all strings which begin with an upper case letter followed by
one or more digits.

It is outside the scope of this manual to describe regular expressions
in great detail. Users of a \linux system can get more information on grep
using \var{man grep} on the command line.
%
% The ASCII table.
%
\subsection{The ASCII table}
\label{se:asciitable}
The tools menu also provides an ASCII table (\menu{Tools|Ascii table}).
The ASCII table can be used to look up ASCII codes as well as to
insert characters into the window which was active when invoking the
table. 

To reveal the ASCII code of a character in the table, move the
cursor onto this character or click it with the mouse. The decimal
and hex values of the character are shown at the bottom on the
ASCII table window.

To insert a character into an editor window either:
\begin{enumerate}
\item using the mouse, double click it, or,
\item using the keyboard,  press \key{Enter} while the cursor is on it.
\end{enumerate}
This is especially useful for pasting graphical characters in a constant
string.

The ASCII table remains active till another window is explicitly activated;
thus multiple characters can be inserted at once.
The ASCII table is shown in \seefig{ascii}.

\FPCpic{The ASCII table}{ide}{ascii}

%
% The calculator
%
\subsection{The calculator}
\label{se:calculator}
The calculator allows quick calculations without leaving the IDE. It is a simple
calculator, since it does not take care of operator precedence, and
bracketing of operations is not (yet) supported.

The result of the calculations can be pasted into the text using the
\key{Ctrl-Enter} keystroke. The calculator dialog is shown in
\seefig{calc}.

\FPCpic{The calculator dialog}{ide}{calc}

The calculator supports all basic mathematical operations such as
addition, subtraction, division and multiplication. They are summarised in
\seet{calculatorbasic}.
\begin{FPCltable}{p{8cm}lll}{Basic mathematical operations}{calculatorbasic}
Operation & Button & Key \\ \hline
Add two numbers & \var{+} & \key{+} \\
Subtract two numbers & \var{\-} & \key{\-} \\
Multiply two numbers & \var{*} & \key{*} \\
Divide two numbers & \var{/} & \key{/} \\
Delete the last typed digit & \var{<-} & \key{Backspace} \\
Clear display & \var{C} & \key{C} \\
Change the sign & \var{+\-} & \\
Do per cent calculation & \var{\%} & \key{\%} \\ \hline
Get result of operation & \var{=} & \key{Enter} \\ \hline
\end{FPCltable}

But also more sophisticated mathematical operations such as exponentiation
and logarithms are supported. The advanced mathematical operations are
shown in \seet{calculatoradvanced}.
\begin{FPCltable}{p{8cm}lll}{Advanced mathematical operations}{calculatoradvanced}
Operation & Button & Key \\ \hline
Calculate power & \var{x\^{}y} & \\
Calculate the inverse value & \var{1/x} & \\
Calculate the square root & \var{sqr} & \\
Calculate the natural logarithm &  \var{log} & \\
Square the display contents & \var{x\^{}2} & \\ \hline.
\end{FPCltable}

Like many calculators, the calculator in the IDE also supports storing
a single value in memory, and several operations can be done on this memory
value. The available operations are listed in \seet{calculatormemory}
\begin{FPCltable}{p{8cm}lll}{Advanced calculator commands}{calculatormemory}
Operation & Button & Key \\ \hline
Add the displayed number to the memory & \var{M+} & \\
Subtract the displayed number from the memory & \var{M-} & \\
Move the memory contents to the display & \var{M->} & \\
Move the display contents to the memory & \var{M<-} & \\
Exchange display and memory contents & \var{M<->} & \\ \hline
\end{FPCltable}
%
% Adding new tools
%
\subsection{Adding new tools}
\label{se:addingtools}
The tools menu can be extended with any external program which is command line
oriented. The output of such a program will be caught and displayed in the
messages window.

Adding a tool to the tools menu can be done using the \menu{Options|Tools} menu.
This will display the tools dialog. The tools dialog is shown in \seefig{otools}.

\FPCpic{The tools configuration dialog}{ide}{otools}

In the tools dialog, the following actions are available:
\begin{description}
\item[New] Shows the tool properties dialog where the
properties of a new tool can be entered.
\item[Edit] Shows the tool properties dialog where the
properties of the highlighted tool can be edited.
\item[Delete] Removes the currently highlighted tool.
\item[Cancel] Discards all changes and closes the dialog.
\item[OK] Saves all changes and closes the dialog.
\end{description}
The definitions of the tools are written in the desktop
configuration file. So unless auto-saving of the desktop file
is enabled, the desktop file should be saved explicitly after
the dialog is closed.

\subsection{Meta parameters}
When specifying the command line for the called tool, meta parameters can
be used. Meta parameters are variables and and they are replaced
by their contents before passing the command line to the tool.

\begin{description}
\item[\$CAP]
Captures the output of the tool.
\item[\$CAP\_MSG()]
Captures the output of the tool and puts it in the messages window.
\item[\$CAP\_EDIT()]
Captures the output of the tool and puts it in a separate editor window.
\item[\$COL]
Replaced by the column of the cursor in the active editor window. If there is no
 active window or the active window is a dialog, then it is replaced by 0.
\item[\$CONFIG]
Replaced by the complete filename of the current configuration file.
\item[\$DIR()]
Replaced by the full directory of the filename argument, including the trailing
directory separator. e.g.
\begin{verbatim}
  $DIR('d:\data\myfile.pas')
\end{verbatim}
would return \verb|d:\data\|.
\item[\$DRIVE()]
Replaced by the drive letter of the filename argument. e.g.
\begin{verbatim}
  $DRIVE('d:\data\myfile.pas')
\end{verbatim}
would return \file{d:}.
\item[\$EDNAME]
Replaced by the complete file name of the file in the active edit window.
If there is no active edit window, this is an empty string.
\item[\$EXENAME]
Replaced by the executable name that would be created if the make command
was used. (i.e. from the 'Primary File' setting or the active edit window).
\item[\$EXT()]
Replaced by the extension of the filename argument.
The extension includes the dot.
e.g.
\begin{verbatim}
  $EXT('d:\data\myfile.pas')
\end{verbatim}
would return \file{.pas}.
\item[\$LINE]
Replaced by the line number of the cursor in the active edit window.
If no edit window is present or active, this is 0.
\item[\$NAME()]
Replaced by the name part (excluding extension and dot) of the filename
argument.
e.g.
\begin{verbatim}
  $NAME('d:\data\myfile.pas')
\end{verbatim}
would return \file{myfile}.
\item[\$NAMEEXT()]
Replaced by the name and extension part of the filename argument.
e.g.
\begin{verbatim}
  $NAMEEXT('d:\data\myfile.pas')
\end{verbatim}
would return \file{myfile.pas}.
\item[\$NOSWAP]
Does nothing in the IDE; it is provided only for compatibility with \tp.
\item[\$PROMPT()]
Prompt displays a dialog box that allows editing of all arguments that
come after it. Arguments that appear before the \var{\$PROMPT} keyword
are not presented for editing.

\var{\$PROMPT()} can also take an optional filename argument. If present, \var{\$PROMPT()} will load
a dialog description from the filename argument. E.g.
\begin{verbatim}
$PROMPT(cvsco.tdf)
\end{verbatim}
would parse the file \file{cvsco.tdf}, construct a dialog with it and
display it. After the dialog closed, the information entered by the user
is used to construct the tool command line.

See \sees{commanddialogs} for more information on how to create a dialog
description.
\item[\$SAVE]
Before executing the command, the active editor window is saved, even if it is not modified.
\item[\$SAVE\_ALL]
Before executing the command, all unsaved editor files are saved without prompting.
\item[\$SAVE\_CUR]
Before executing the command the contents of the active editor window are
saved without prompting if they are modified.
\item[\$SAVE\_PROMPT]
Before executing the command, a dialog is displayed asking whether any
unsaved files should be saved before executing the command.
\item[\$WRITEMSG()]
Writes the parsed tool output information to a file with name as in the argument.
\end{description}	

\subsection{Building a command line dialog box}
\label{se:commanddialogs}
When defining a tool, it is possible to show a dialog to the user, asking for
additional arguments, using the \var{\$PROMPT(filename)} command-macro.
The \fpc distribution contains some ready-made dialogs, such as a 'grep' dialog, a 'cvs checkout' dialog
and a 'cvs check in' dialog. The files for these dialogs are in the binary
directory and have an extension \file{.tdf}.

In this section, the file format for the dialog description file is explained.
The format of this file resembles a windows \file{.INI} file, where each section
in the file describes an element (or control) in the dialog.
An \var{OK} and a \var{Cancel} button will be added to the bottom of the dialog,
so these should not be specified in the dialog definition.

A special section is the \var{Main} section. It describes how the result of
the dialog will be passed to the command line, and the total size of the dialog.

\begin{remark}
Keywords that contain a string value should have the string value enclosed
in double quotes as in
\begin{verbatim}
Title="Dialog title"
\end{verbatim}
\end{remark}

The \var{Main} section should contain the following keywords:
\begin{description}
\item[Title] The title of the dialog. This will appear in the frame title of the dialog.
The string should be enclosed in quotes.
\item[Size] The size of the dialog, this is formatted as \var{(Cols,Rows)}, so
\begin{verbatim}
Size=(59,9)
\end{verbatim}
means the dialog is 59 characters wide, and 9 lines high. This size does not include
the border of the dialog.
\item[CommandLine] specifies how the command line will be passed to the
program, based on the entries made in the dialog. The text typed here will be passed
on after replacing some control placeholders with their values.

A control placeholder is the name of some control in the dialog, enclosed in
percent (\var{\%}) characters. The name of the control will be replaced with
the text associated with the control. Consider the following example:
\begin{verbatim}
CommandLine="-n %l% %v% %i% %w% %searchstr% %filemask%"
\end{verbatim}
Here the values associated with the controls named \var{l, v, i, w} and
\var{searchstr} and \var{filemask} will be inserted in the command line
string.
\item[Default]
The name of the control that is the default control, i.e. the control
that is to have the focus when the dialog is opened.
\end{description}
The following is an example of a valid main section:
\begin{verbatim}
[Main]
Title="GNU Grep"
Size=(56,9)
CommandLine="-n %l% %v% %i% %w% %searchstr% %filemask%"
Default="searchstr"
\end{verbatim}

After the \var{Main} section, a section must be specified for each control that
should appear on the dialog. Each section has the name of the control it
describes, as in the following example:
\begin{verbatim}
[CaseSensitive]
Type=CheckBox
Name="~C~ase sensitive"
Origin=(2,6)
Size=(25,1)
Default=On
On="-i"
\end{verbatim}
Each control section  must have at least the following keywords associated
with it:
\begin{description}
\item[Type] The type of control. Possible values are:
\begin{description}
\item[Label] A plain text label which will be shown on the dialog.
A control can be linked to this label, so it will be focused when
the user presses the highlighted letter in the label caption (if any).
\item[InputLine] An edit field where a text can be entered.
\item[CheckBox] A checkbox which can be in an on or off state.
\end{description}
\item[Origin] Specifies where the control should be located in the dialog.
The origin is specified as \var{(left,top)} and the top-left corner of
the dialog has coordinate \var{(1,1)} (not counting the frame).
\item[Size] Specifies the size of the control, which should be specified
as \var{(Cols,Rows)}.
\end{description}

Each control has some specific keywords associated with it;
they will be described below.

A label (\var{Type=Label}) has the following extra keywords associated
with it:
\begin{description}
\item[Text] the text displayed in the label. If one of the letters should
be highlighted so it can be used as a shortcut, then it should be enclosed
in tilde characters (\~{}). E.g. in
\begin{verbatim}
Text="~T~ext to find"
\end{verbatim}
the \var{T} will be highlighted.
\item[Link] The name of a control in the dialog may be specified.
If specified, pressing the label's highlighted letter in combination
with the \key{Alt} key will put the focus on the control specified here.
\end{description}
A label does not contribute to the text of the command line; it is for
informational and navigational purposes only. The following is an
example of a label description section:
\begin{verbatim}
[label2]
Type=Label
Origin=(2,3)
Size=(22,1)
Text="File ~m~ask"
Link="filemask"
\end{verbatim}

An edit control (\var{Type=InputLine}) allows entry of arbitrary text.
The text of the edit control will be pasted in the command line if it
is referenced there. The following keyword can be specified in a
inputline control section:
\begin{description}
\item[Value] A standard value (text) for the edit control can be
specified. This value will be filled in when the dialog appears.
\end{description}
The following is an example of an input line section:
\begin{verbatim}
[filemask]
Type=InputLine
Origin=(2,4)
Size=(22,1)
Value="*.pas *.pp *.inc"
\end{verbatim}

A checkbox control (\var{Type=CheckBox}) presents a checkbox which
can be in one of two states, \var{on} or \var{off}. With each of
these states, a value can be associated which will be passed on to
the command line. The following keywords can appear in a checkbox
type section:
\begin{description}
\item[Name] The text that appears after the checkbox.
If there is a highlighted letter in it, this letter can be used
to set or unset the checkbox using the \key{Alt}-letter combination.
\item[Default] Specifies whether the checkbox is checked or not when
the dialog appears (value \var{on} or \var{off}).
\item[On] The text associated with this checkbox if it is in the checked
state.
\item[Off] The text associated with this checkbox if it is in the
unchecked state.
\end{description}
The following is an example of a valid checkbox description:
\begin{verbatim}
[i]
Type=CheckBox
Name="~C~ase sensitive"
Origin=(2,6)
Size=(25,1)
Default=On
On="-i"
\end{verbatim}
If the checkbox is checked, then the value \var{-i} will be added on
the command line of the tool. If it is unchecked, no value will be added.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Project management
\section{Project management and compiler options}
\label{se:projectmanagement}
Project management in Pascal is much easier than with C. The
compiler knows from the source which units, sources etc. it needs.
So the \fpc IDE does not need a full featured project manager like
some C development environments offer. Nevertheless there are some
settings in the IDE which apply to projects.
%
% The primary file
%
\subsection{The primary file}
\label{se:primaryfile}
Without a primary file the IDE compiles/runs the source of the active
window when a program is started. If a primary file is specified,
the IDE always compiles/runs this source, even if another
source window is active. With the menu item \menu{Compile|Primary file...}
a file dialog can be opened where the primary file can be selected.
Only the menu item \menu{Compile|Compile} compiles the active window
regardless. This is useful if a large project is being edited, and 
only the syntax of the current source should be checked.

The menu item \menu{Compiler|Clear primary file} restores the default
behaviour of the IDE, i.e. the 'compile' and 'run' commands apply to the
active window.
%
% The directory dialog
%
\subsection{The directory dialog}
In the directory dialog, the directories can be specified where the
compiler should look for units, libraries, object files. It also says
where the output files should be stored. Multiple directories (except
for the output directory) can be entered, separated by semicolons.
The directories dialog is shown in \seefig{odirs}.

\FPCpic{The directories configuration dialog}{ide}{odirs}

The following directories can be specified:
\begin{description}
\item[EXE \& PPU directories] Specifies where the compiled units and
executables will go. (\seeo{FE} on the command line.)
\item[Object directories] Specifies where the compiler looks for external
object files. (\seeo{Fo} on the command line.)
\item[Library directories] Specifies where the compiler (more exactly, the
linker) looks for external libraries. (\seeo{Fl} on the command line.)
\item[Include directories] Specifies where the compiler will look for
include files, included with the \var{\{\$i \}} directive.
(\seeo{Fi} or \seeo{I} on the command line.)
\item[Unit directories] Specifies where the compiler will look for compiled
units. The compiler always looks first in the current directory, and also in
some standard directories. (\seeo{Fu} on the command line.)
\end{description}
%
% The target operating system.
%
\subsection{The target operating system}
The menu item \menu{Compile|Target} allows  specification of the target
operating system for which the sources will be compiled.
Changing the target doesn't affect any compiler switches or
directories. It does affect some defines defined by the compiler.
The settings here correspond to the option on the command line 
\seeo{T}. A sample compilation target dialog is shown in \seefig{target}:
the actual dialog will show only those targets that the IDE actually 
supports.

\FPCpic{The compilation target dialog}{ide}{target}

The following targets can be set (the list depends on the platform for
which the IDE was compiled):
\begin{description}
\item[Dos (go32v1)] This switch will dissapear in time as this target is no
longer being maintained.
\item[Dos (go32v2)] Compile for \dos, using version 2 of the Go32 extender.
\item[FreeBSD] Compile for \freebsd.
\item[Linux] Compile for \linux.
\item[OS/2] Compile for OS/2 (using the EMX extender).
\item[Windows] Compile for \windows.
\end{description}
The currently selected target operating system is shown in the 
\menu{Target} menu item in the \menu{Compile} menu. Initially, 
this will be set to the operating system for which the IDE was compiled.
%
% Other compiler options
%
\subsection{Compiler options}
The menu \menu{Options|Compiler} allow the settting of options that affect the
compilers behaviour. When this menu item is chosen, a dialog pops up that
displays several tabs.

There are six tabs:
\begin{description}
\item[Syntax] Here options can be set that affect the various syntax aspects
of the code. They correspond mostly to the \var{-S} option on the command
line (\sees{sourceoptions}).
\item[Code generation] These options control the generated code; they are
mostly concerned with the \var{-C} and \var{-X} command line options.
\item[Verbose] These set the verbosity of the compiler when compiling. The
messages of the compiler are shown in the compiler messages window (can be
called with \key{F12}).
\item[Browser] Options concerning the generated browser information. Browser
information needs to be generated for the symbol browser to work.
\item[Assembler] Options concerning the reading of assembler blocks (-R on
the command line) and the generated assembler (\var{-A} on the command line)
\item[Processor] Here the target processor can be selected.
\end{description}

On each tab page, there are two entry boxes: the first for
Conditional defines and the second for additional compiler arguments.
The symbols, and arguments, should be separated with semi-colons.

The syntax tab of the compiler options dialog is shown in \seefig{ocompa}.

\FPCpic{The syntax options tab}{ide}{ocompa}

In the syntax options dialog, the following options can be set:
\begin{description}
\item[Stop after first error]  when checked, the compiler stops after the
first error. Normally the compiler continues compiling till a fatal error is
reached. (\seeo{Se} on the command line)
\item[Allow label and goto] Allow the use of label declarations and goto
statements (\seeo{Sg} on the command line).
\item[Enable macros] Allow the use of macros (\seeo{Sm}).
\item[Allow inline] Allow the use of inlined functions (\seeo{Sc} on
the command line).
\item[Include assertion code] Include \var{Assert} statements in the code.
\item[Load kylix compat. unit] Load the Kylix compatibility unit.
\item[Allow STATIC in objects] Allow the \var{Static} modifier for object
methods (\seeo{St} on the command line) 
\item[C-like operators]
Allows the use of some extended operators such as \var{+=, -=} etc.
(\seeo{Sc} on the command line).
\item[Compiler mode] select the appropriate compiler mode:
\begin{description}
\item[Free Pascal Dialect] The default \fpc compiler mode (\var{FPC}).
\item[Object pascal extensions on] 
Enables the use of classes and exceptions (\seeo{Sd} on the command line).
\item[Turbo pascal compatible] Try to be more \tp compatible (\seeo{So} on
the command line).
\item[Delphi compatible] Try to be more \delphi compatible (\seeo{Sd} on
the command line).
\item[Macintosh Pascal dialect] Try to be Macintosh pascal compatible.
\end{description}
%\item[Strict var-strings] Not used.
%\item[Extended syntax] Not used.
%\item[Allow MMX operations] Allow MMX operations.
\end{description}

The code generation tab of the compiler options dialog is shown in
\seefig{ocompb}.

\FPCpic{The code generation options tab}{ide}{ocompb}

In the code generation dialog, the following options can be set:
\begin{description}
\item[Run-time checks] Controls what run-time checking code is generated. If
such a check fails, a run-time error is generated.
The following checking code can be generated:
\begin{description}
\item[Range checking] Checks the results of enumeration and subset
type operations (\seeo{Cr} command line option).
\item[Stack checking] Checks whether the stack limit is not
reached (\seeo{Cs} command line option).
\item[I/O checking] Checks the result of IO operations
(\seeo{Ci} command line option).
\item[Integer overflow checking] Checks the result of integer operations
(\seeo{Co} command line option).
\item[Object method call checking] Check the validity of the method pointer
prior to calling it.
\item[Position independent code] Generate PIC code.
\item[Create smartlinkable units] Create smartlinkable units.
\end{description}
\item[Optimizations] What optimizations should be used when compiling:
\begin{description}
\item[Generate faster code] Corresponds to the \var{-OG} command line option.
\item[Generate smaller code] Corresponds to the \var{-Og} command line option.
%\item[Use register variables] Corresponds to the \var{-Or} command line option.
%\item[Uncertain optimizations] Corresponds to the \var{-Ou} command line option.
%\item[Level 1 optimizations] Corresponds to the \var{O1} command line option.
%\item[Level 2 optimizations] Corresponds to the \var{O1} command line option.
\end{description}
\end{description}
More information on these switches can be found in \sees{codegen}.

The processor tab of the compiler options dialog is shown in
\seefig{ocompf}.

In the processor dialog, the target processor can be set. The
compiler can use different optimizations for different processors.

\FPCpic{The processor selection tab}{ide}{ocompf}

The verbose tab of the compiler options dialog is shown in
\seefig{ocompc}.

\FPCpic{The verbosity options tab}{ide}{ocompc}

In this dialog, the following verbosity options can be set
(on the command line: \seeo{v}):
\begin{description}
\item[Warnings] Generate warnings. 
Corresponds to \var{-vw} on the command line.
\item[Notes] Generate notes. 
Corresponds to \var{-vn} on the command line.
\item[Hints] Generate hints. 
Corresponds to \var{-vh} on the command line.
\item[General info] Generate general information. 
Corresponds to \var{-vi} on the command line.
\item[User,tried info] Generate information on used and tried files. 
Corresponds to \var{-vut} on the command line.
\item[All] Switch on full verbosity. 
Corresponds to \var{-va} on the command line.
\item[Show all procedures if error] If an error using overloaded procedure
occurs, show all procedures. 
Corresponds to \var{-vb} on the command line.
\end{description}

The browser tab of the compiler options dialog is shown in \seefig{ocompd}.

\FPCpic{The browser options tab}{ide}{ocompd}

In this dialog, the browser options can be set:
\begin{description}
\item[No browser] (default) No browser information is generated by the
compiler.
\item[Only global browser] Browser information is generated for global
symbols only, i.e. symbols defined not in a procedure or function (\var{-b} on the command line)
\item[Local and global browser] Browser information is generated for all
symbols, i.e. also for symbols that are defined in procedures or functions
 (\var{-bl} on the command line)
\end{description}
\begin{remark}
If no browser information is generated, the symbol browser of the IDE will
not work.
\end{remark}
The assembler tab of the compiler options dialog is shown in
\seefig{ocompe}. The actual dialog may vary, as it depends on the 
target CPU the IDE was compiled for.

\FPCpic{The assembler options tab}{ide}{ocompe}

In this dialog, the assembler reader and writer options can be set:
\begin{description}
\item[Assembler reader] This permits setting the style of the assembler blocks
in the sources:
\begin{description}
%\item[Direct assembler] The assembler blocks are copied as-is to the output
%(\var{-Rdirect} on the command line).
\item[AT\&T assembler] The assembler is written in \var{AT\&T} style
assembler (\var{-Ratt} on the command line).
\item[Intel style assembler] The assembler is written in \var{Intel} style
assembler blocks (\var{-Rintel} on the command line).
\end{description}
remark that this option is global, but locally the assembler style can be
changed with compiler directives.
\item[Assembler info] When writing assembler files, this option decides
which extra information is written to the assembler file in comments:
\begin{description}
\item[List source] The source lines are written to the assembler files
together with the generated assembler (\var{-al} on the command line).
\item[List register allocation] The compiler's internal register
allocation/deallocation information is written to the assembler file
(\var{-ar} on the command line).
\item[List temp allocation] The temporary register allocation/deallocation
is written to the assembler file. (\var{-at} on the command line).
\item[List node allocation] The node allocation/deallocation
is written to the assembler file. (\var{-an} on the command line).
\item[use pipe with assembler] use a pipe on unix systems when feeding the
assembler code to an external assembler.
\end{description}
The latter three of these options are mainly useful for debugging the
compiler itself, it should rarely be necessary to use these.
\item[Assembler output] This option tells the compiler what assembler output
should be generated.
\begin{description}
\item[Use default output] This depends on the target.
\item[Use GNU as] Assemble using \gnu \file{as} (\var{-Aas} on the
command line).
\item[Use NASM coff] Produce NASM coff assembler (go32v2, \var{-Anasmcoff} on the
command line)
\item[Use NASM elf] Produce NASM elf assembler (\linux, \var{-Anasmelf} on
the command line).
\item[Use NASM obj] Produce NASM obj assembler (\var{-Anasmobj} on the
command line).
\item[Use MASM] Produce MASM (Microsoft assembler) assembler (\var{-Amasm} on the
command line).
\item[Use TASM] Produce TASM (Turbo Assembler) assembler (\var{-Atasm} on the
command line).
\item[Use coff] Write binary coff files directly using the internal
assembler (go32v2, \var{-Acoff} on the command line).
\item[Use pecoff] Write binary pecoff files files directly using the
internal writer. (Win32)
\end{description}
\end{description}
%
% Linker options
%
\subsection{Linker options}
The linker options can be set in the menu \menu{Options|Linker}. 
It permits the specification of how libraries and units are linked, 
and how the linker should be called.
The linker options dialog is shown in \seefig{olinker}.

\FPCpic{The linker options dialog}{ide}{olinker}

The following options can be set:
\begin{description}
\item[Call linker after] If this option is set then a script is written
which calls the linker. This corresponds to the \var{s} option on the
command line (\seeo{s}).
\item[Only link to static library] Only use static libraries.

\item[Preferred library type] With this option, the type of library to be
linked in can be set:
\begin{description}
\item[Target default] This depends on the platform.
\item[Dynamic libraries] Tries to link in units in dynamic libraries.
(option \var{-XD} on the command line.)
\item[Static libraries] Tries to link in units in static libraries.
(option \var{-XS} on the command line.)
\item[Smart libraries] Tries to link in units in smart-linked libraries.
(option \var{-XX} on the command line.)
\end{description}
\end{description}
%
% Memory sizes dialog
%
\subsection{Memory sizes}
The memory sizes dialog (reachable via \menu{options|Memory sizes}) permits
the entry of the memory sizes for the project.
The memory sizes dialog is shown in \seefig{omemsize}.

\FPCpic{The memory sizes dialog}{ide}{omemsize}

The following sizes can be entered:
\begin{description}
\item[Stack size] Sets the size of the stack in bytes
(option \var{-Cs} on the command line). This size may be ignored on some
systems.
\item[Heap size] Sets the size of the heap in bytes; (option \var{-Ch} on
the command line). Note that the heap grows dynamically as much as the OS
allows.
\end{description}

%
% Debugging options
%
\subsection{Debug options}
\label{se:debugoptions}
In the debug options dialog (reachable via \menu{Options|Debugger}), some 
options for inclusion of debug information in the binary can be set; 
it is also possible to add additional compiler options in this dialog.
The debug options dialog is shown in \seefig{odebug}.
\FPCpic{The debug options dialog}{ide}{odebug}

The following options can be set:
\begin{description}
\item[Debugging information] tells the compiler which debug information
should be compiled in. One of the following options can be chosen:
\begin{description}
\item[Strip all debug symbols from executable] Will strip all debug and
symbol information from the binary. (option \var{-Xs} on the command line).
\item[Skip debug information generation] Do not generate debug information
at all.
\item[Generate debug symbol information] Include debug information in the
binary (option \var{-g} on the command line). Please note that no debug
information for units in the Run-Time Library will be included, unless a
version of the RTL compiled with debug information is available. Only units
specific to the current project will have debug information included.
\item[Generate also backtrace line information] Will compile with debug
information, and will additionally include the \file{lineinfo} unit in the
binary, so that in case of an error the backtrace will contain the file names and
line numbers of procedures in the call-stack. (Option \var{-gl} on the
command line.)
\item[Generate valgrind compatible debug info] Generate debug information
that can be read with valgrind (a memory checking tool).
\end{description}
\item[Profiling switches] Tells the compiler whether or not profile code
should be included in the binary.
\begin{description}
\item[No profile information] Has no effect, as it is the default.
\item[Generate Profile code for gprof] If checked, profiling code is
included in the binary (option \var{-p} on the command line).
\end{description}
%\item[Addition compiler args] Here arbitrary options can be entered as they
%would be entered on the command line, they will be passed on to the compiler
%as typed here.
\item[Use another TTY for Debuggee]
An attempt will be made to redirect the output of the program
being debugged to another window (terminal), whose file name should
be entered here.
\end{description}

%
% The switches mode.
%
\subsection{The switches mode}
\label{se:compilermode}
The IDE allows saving a set of compiler settings under a common name. 
It provides 3 names under which the switches can be saved:
\begin{description}
\item[Normal] For normal (fast) compilation.
\item[Debug] For debugging; intended to set most debug switches on. Also
useful for setting conditional defines that e.g. allow including some
debug code.
\item[Release] For a compile of the program as it should be released, debug
information should be off, the binary should be stripped, and optimizations
should be used.
\end{description}
Selecting one of these modes will load the compiler options as they were
saved the last time the selected mode was active, i.e. it doesn't
specifically set or unset options.

When setting and saving compiler options, be sure to select the correct
switch mode first; it makes little sense to set debug options while the
release switch is active.
The switches mode dialog is shown in \seefig{oswitch}.

\FPCpic{The switches mode dialog}{ide}{oswitch}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Customize the IDE
\section{Customizing the IDE}
The IDE is configurable over a wide range of parameters: colors can be changed, 
screen resolution. The configuration settings can be reached via the
sub-menu \var{Environment} in the \var{Options} menu.
%
% general preferences
%
\subsection{Preferences}
The {\em preferences dialog} is called by the menu item
\menu{Options|Environment|Preferences}.
The preferences dialog is shown in \seefig{oeprefs}.

\FPCpic{The preferences dialog}{ide}{oeprefs}

\begin{description}
\item[Video mode]
The drop down list at the top of the dialog allows selecting a video mode.
The available video modes depend on the system on which the IDE
is running.
\begin{remark}
\begin{enumerate}
\item The video mode must be selected by pressing space or clicking
on it. If the drop down list is opened while leaving the dialog,
the new video mode will not be applied.
\item For the \dos version of the IDE, the following should be noted:
When using VESA modes, the display refresh rate may be very low.
On older graphics card (1998 and before), it is possible to use the
{\em UniVBE} driver from {\em SciTech}\footnote{It can be downloaded from
\seeurl{http://www.informatik.fh-muenchen.de/~ifw98223/vbehz.htm}
{http://www.informatik.fh-muenchen.de/\~{}ifw98223/vbehz.htm}}
% It is quite outdated
%(last update somewhere in 1998).
%For newer graphics cards which support VESA 3.0, you can try to get one
%of the TSR programs
%\footnote{\textbf{T}erminate and \textbf{S}tay \textbf{R}esisdent}
% available at the net to customize the refresh rate.
%%%%!!!!!!!! footnote with URL
\end{enumerate}
\end{remark}
\item[Desktop File]
Specifies where the desktop file is saved: the current directory, or the
directory where the config file was found.
\item[Auto save]
Here it is possible to set which files are saved when a program is run or
when the IDE is exited:
\begin{description}
\item[Editor files] The contents of all open edit windows will be saved.
\item[Environment] The current environment settings will be saved.
\item[Desktop] The desktop file with all desktop settings (open windows,
history lists, breakpoints etc.) will be saved.
\end{description}
\item[Options]
Some special behaviours of the IDE can be specified here:
\begin{description}
\item[Auto track source]
\item[Close on go to source] When checked, the messages window is closed
when the 'go to source line' action is executed.
\item[Change dir on open] When a file is opened, the directory of that file
is made the current working directory.
\end{description}
\end{description}
%
% Desktop customization
%
\subsection{The desktop}
\label{se:prefdesktop}
The desktop preferences dialog allows to specify what elements of the
desktop are saved across sessions, i.e. they are saved when the IDE is left,
and they are again restored when the IDE is started the next time.
They are saved in the file \file{fp.dsk}.
The desktop preferences dialog is shown in \seefig{oedesk}.

\FPCpic{The desktop preferences dialog}{ide}{oedesk}

The following elements can be saved and restored across IDE sessions:
\begin{description}
\item[History lists] Most entry boxes have a history list where previous
entries are saved and can be selected. When this option is checked, these
entries are saved in the desktop file. On by default.
\item[Clipboard content]
When checked, the contents of the clipboard are also saved to disk. Off by
default.
\item[Watch expressions]
When checked, all watch expressions are saved in the desktop file. Off by
default.
\item[Breakpoints]
When checked, all breakpoints with their properties are saved in the
desktop file. Off by default.
\item[Open windows]
When checked, the list of files in open editor windows is saved in the
desktop file, and the windows will be restored the next time the IDE
is run. On by default.
\item[Symbol information]
When checked, the information for the symbol browser is saved in the desktop
file. Off by default.
\item[CodeComplete wordlist]
When checked, the list of codecompletion words is saved. On by default.
\item[CodeTemplates]
When checked, the defined code templates are saved. On by default.
\end{description}

\begin{remark}
The format of the desktop file changes between editor versions. So
when installing a new version, it may be necessary to delete the
\file{fp.dsk} files wherever the IDE searches for them.
\end{remark}

%
% Editor customization
%
\subsection{The Editor}
Several aspects of the editor window behaviour can be set in this dialog.
The editor preferences dialog is shown in \seefig{oeeditor}. Note that
some of these options affect only newly opened windows, not already 
opened windows (e.g. Vertical Blocks, Highlight Column/Row).

\FPCpic{The editor preferences dialog}{ide}{oeeditor}

The following elements can be set in the editor preferences dialog:
\begin{description}
\item[Create backup files]
Whenever an editor file is saved, a backup is made of the old file. On by
default.
\item[Insert mode] Start with insert mode.
\item[Auto indent mode]
Smart indenting is on. This means that pressing \key{Enter} will position the
cursor on the next line in the same column where text starts on the current
line. On by default.
\item[Use tab characters]
When the tab key is pressed, use a tab character. Normally, when the tab key
is pressed, spaces are inserted. When this option is checked, tab characters
will be inserted instead. Off by default.
\item[Backspace unindents]
Pressing the \key{Bksp} key will unindent if the beginning of the text on
the current line is reached, instead of deleting just the previous
character. On by default.
\item[Persistent blocks]
When a selection is made, and the cursor is moved, the selection is not
destroyed, i.e. the selected block stays selected. On by default.
\item[Syntax highlight]
Use syntax highlighting on the files that have an extension which appears in
the list of highlight extensions. On by default.
\item[Block insert cursor]
The insert cursor is a block instead of an underscore character. By default
the overwrite cursor is a block. This option reverses that behaviour. Off by
default.
\item[Vertical blocks]
When selecting blocks spanning several lines, the selection doesn't 
contain the entirety of the lines within the block; instead, it 
contains the lines as far as the column on which the cursor is located.
Off by default.
\item[Highlight column]
When checked, the current column (i.e. the column where the cursor is) is
highlighted. Off by default.
\item[Highlight row]
When checked, the current row (i.e. the row where the cursor is) is
highlighted. Off by default.
\item[Auto closing brackets]
When an opening bracket character is typed, the closing bracket is also
inserted at once. Off by default.
\item[Keep trailing spaces]
When saving a file, the spaces at the end of lines are stripped off. This
option disables that behaviour; i.e. any trailing spaces are also saved
to file. Off by default.
\item[Codecomplete enabled]
Enable code completion. On by default.
\item[Enable folds]
Enable code folding. Off by default.
\item[Tab size]
The number of spaces that are inserted when the \key{Tab} key is pressed.
The default value is 8.
\item[Indent size]
The number of spaces a block is indented when calling the block indent function.
The default value is 2.
\item[Highlight extensions]
When syntax highlighting is on, the list of file masks entered here will be
used to determine which files are highlighted. File masks should be
separated with semicolon (;) characters. The default is
\file{*.pas;*.pp;*.inc}.
\item[File patterns needing tabs]
Some files (such as makefiles) need actual tab characters instead of spaces.
Here a series of file masks can be entered to indicate files for which tab 
characters will always be used. Default is \file{make*;make*.*}.
\end{description}
\begin{remark}
These options will not be applied to already opened windows; only newly
opened windows will have these options.
\end{remark}
%
% Mouse customization
%
\subsection{Keyboard \& Mouse}
\label{se:prefmouse}
The Keyboard \& mouse options dialog is called by the menu item
\menu{Options|Environment|Keyboard \& Mouse}. It allows adjusting the behaviour of the
keyboard and mouse as well as the sensitivity of the mouse.
The keyboard and mouse options dialog is shown in \seefig{oemouse}.

\FPCpic{The Keyboard \& mouse options dialog}{ide}{oemouse}

\begin{description}
\item[Keys for copy, cut and paste] Set the keys to use for clipboard
operations:
\begin{itemize}
\item CUA-91 convention (Shift+Del,Ctrl+Ins,Shift+Ins)
\item Microsoft convention (Ctrl+X,Ctrl+C,Ctrl+V)
\end{itemize}
\item[Mouse double click]
The slider can be used to adjust the double click speed. Fast means that the
time between two clicks is very short; slow means that the time between two
mouse clicks can be quite long.
\item[Reverse mouse buttons]
the behaviour of the left and right mouse buttons can be swapped by
by checking the checkbox; this is especially useful for left-handed people.
\item[Ctrl+Right mouse button]
Assigns an action to a right mouse button click while holding the
\key{Ctrl} key pressed.
\item[Alt+right mouse button]
Assigns an action to right mouse button click while holding the
\key{Alt} key pressed.
\end{description}

The following actions can be assigned to \key{Ctrl}-Right mouse button or
\key{Alt}-right mouse button:
\begin{description}
\item[Nothing] No action is associated to the event.
\item [Topic search] The keyword at the mouse cursor is searched in the
help index.
\item [Go to cursor] The program is executed until the line where
the mouse cursor is located.
\item [Breakpoint] Set a breakpoint at the mouse cursor position.
\item [Evaluate] Evaluate the value of the variable at the mouse
cursor.
\item [Add watch] Add the variable at the mouse cursor to the
watch list.
\item [Browse symbol] The symbol at the mouse cursor is displayed
in the browser.
\end{description}

%
% Color customization
%
%\subsection{Colors}
%\label{se:prefcolors}
%Almost all elements of the IDE such as borders input fields, buttons and so
%on can have their color set in this dialog. The dialog sets the colors for
%all elements at once, i.e. it is not so that the color of one particular
%button can be set.
%
%The syntax highlighting colors for the editor windows of the IDE can also
%be set in this dialog.
%The colors dialog is shown in \seefig{oecolors}.
%
%\FPCpic{The colors dialog}{ide}{oecolors}
%
%The following elements are visible in the color dialog:
%\begin{description}
%\item[Group]
%Here the group to be customized is displayed; A group is a specific window
%or series of windows in the editor. A special group is {\em Syntax} which
%sets the colors for syntax highlighting.
%\begin{description}
%\item[Browser] Sets the colors for the symbol browser window.
%\item[Clock] Sets the colors for the clock in the menu.
%\item[Desktop] Sets the colors for the desktop.
%\item[Dialogs] Sets the colors for the dialog windows.
%\item[Editor] Sets the colors for the editor windows.
%\item[Help] Sets the colors for the help windows.
%\item[Menus] Sets the colors used in the menus.
%\item[Syntax] Sets the colors used when performing syntax highlighting in the
%editor windows.
%\end{description}
%\item[item]
%Here the item for the current group can be selected. The foreground and
%background of this item can be set using the color selectors on the right of
%the dialog.
%\item[Foreground]
%Sets the foreground color of the selected item.
%\item[background]
%Sets the background color of the selected item.
%\item[Sample text]
%This shows the colors of the selected item in a sample text.
%\end{description}
%Setting a good color scheme is important especially for syntax highlighting;
%a good syntax highlighting scheme helps in eliminating errors when typing,
%without needing to compile the sources.
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% The help system
\section{The help system}

More information on how to handle the IDE, or about the use of various
calls in the RTL, explanations regarding the syntax of a Pascal statement,
can be found in the \emph{help system}. The help system is activated
by pressing \key{F1}.

\subsection{Navigating in the help system}
The help system contains hyperlinks; these are sensitive locations that
lead to another topic in the help system. They are marked by a different
color. The hyperlinks can be activated in one of two ways:
\begin{enumerate}
\item by directly clicking the one you want with the mouse, or
\item by using the \key{Tab} and \key{Shift-Tab} keys to move between
the different hyperlinks of a page and then pressing the \key{Enter} 
key to activate the one you want.
\end{enumerate}

When \key{Shift-F1} is pressed, the contents of the help system are
displayed. To go back to the previous help topic, press \key{Alt-F1}.
This also works if the help window isn't displayed on the desktop; the help
window will then be activated.

%
% Working with help files.
%
\subsection{Working with help files}
The IDE contains a help system which can display the following file formats:
\begin{description}
\item[TPH] The help format for the Turbo Pascal help viewer.
\item[INF] The OS/2 help format.
\item[NG] The Norton Guide Help format.
\item[HTML] HTML files.
\end{description}
In future some more formats may be added. However, the above formats should
cover already a wide spectrum of available help files.

\begin{remark}
Concerning the support for HTML files the following should be noted:
\begin{enumerate}
\item
The HTML viewer of the  help system is limited, it can only handle the
most basic HTML files (graphics excluded), since it is only designed
to display the \fpc help files. \footnote{...but feel free to improve it and send patches to the
\fpc development team...}.
\item
When the HTML help viewer encounters a graphics file, it will try and find a
file with the same name but an extension of \file{.ans}; If this file is
found, this will be interpreted as a file with ANSI escape sequences, and
these will be used to display a text image. The displays of the IDE dialogs
in the IDE help files are made in this way.
\end{enumerate}
\end{remark}

The menu item \menu{Help|Files} permits help files to be added to, 
and deleted from, the list of files in the help table of contents.
The help files dialog is displayed in \seefig{helpfils}.

\FPCpic{The help files dialog}{ide}{helpfils}

The dialog lists the files that will be presented in the table of contents
window of the help system. Each entry has a small descriptive title and a
filename next to it. The following actions are available when adding help
files:
\begin{description}
\item[New] Adds a new file. IDE will display a prompt, in which the
location of the help file should be entered.

If the added file is an HTML file, a dialog box will be displayed
which asks for a title. This title will then be included in the
contents of help.
\item[Delete] Deletes the currently highlighted file from the help system.
It is \emph{not} deleted from the hard disk; only the help system entry is
removed.
\item[Cancel] Discards all changes and closes the dialog.
\item[OK] Saves the changes and closes the dialog.
\end{description}

The \fpc documentation in HTML format can be added to the IDE's help system.
This way the documentation can be viewed from within the IDE. If \fpc has
been installed using the installer, the installer should have added the
FPC documentation to the list of help files, if the documentation was
installed as well.

%
% The about dialog.
%
\subsection{The about dialog}
\label{se:about}
The {\em about dialog}, reachable through (\menu{Help|About...}) shows some
information about the IDE, such as the version number, the date it was built,
what compiler and debugger it uses. When reporting bugs about the IDE, please
use the information given by this dialog to identify the version of the IDE
that was used.

It also displays some copyright information.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Keyboard shortcuts
\section{Keyboard shortcuts}
\label{se:keyshortcuts}
A lot of keyboard shortcuts used by the IDE are compatible with
WordStar and should be well known to Turbo Pascal users.

Below are the following tables:
\begin{enumerate}
\item In \seet{shortcutsgeneral} some shortcuts for handling the IDE windows
and Help are listed.
\item In \seet{shortcutscompiler} the shortcuts for compiling, running and
debugging a program are presented.
\item In \seet{shortcutsnavigation} the navigation keys are described.
\item In \seet{shortcutsedit} the editing keys are listed.
\item In \seet{shortcutsblock} all block command shortcuts are listed.
\item In \seet{shortcutsselection} all selection-changing shortcuts are
presented.
\item In \seet{shortcutsmisc} some general shortcuts,
which do not fit in the previous categories, are presented.
\end{enumerate}

\begin{FPCltable}{p{5cm}ll}{General}{shortcutsgeneral}
Command & Shortcut key & Alternative \\ \hline
Help & \key{F1} & \\
Goto last help topic & \key{Alt-F1} & \\
Search word at cursor position in help & \key{Ctrl-F1} & \\
Help index & \key{Shift-F1} & \\
Close active window & \key{Alt-F3} & \\
Zoom/Unzoom window & \key{F5} & \\
Move/Zoom active window & \key{Ctrl-F5} & \\
Switch to next window & \key{F6} & \\
Switch to last window & \key{Shift-F6} & \\
Menu & \key{F10} & \\
Local menu & \key{Alt-F10} & \\
List of windows & \key{Alt-0} & \\
Active another window & \key{Alt-<digit>} & \\
Call \file{grep} utility & \key{Shift-F2} & \\
Exit IDE & \key{Alt-X} & \\
\end{FPCltable}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{FPCltable}{p{5cm}ll}{Compiler}{shortcutscompiler}
Command & Shortcut key & Alternative \\
\hline
Reset debugger/program & \key{Ctrl-F2} & \\
Display call stack & \key{Ctrl-F3} & \\
Run as far as the cursor & \key{F4} & \\
Switch to user screen & \key{Alt-F5} & \\
Trace into & \key{F7} & \\
Add watch & \key{Ctrl-F7} & \\
Step over & \key{F8} & \\
Set breakpoint at current line & \key{Ctrl-F8} & \\
Make & \key{F9} & \\
Run & \key{Ctrl-F9} & \\
Compile the active source file & \key{Alt-F9} & \\
Message & \key{F11} & \\
Compiler messages & \key{F12} & \\
\end{FPCltable}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{FPCltable}{p{5cm}ll}{Text navigation}{shortcutsnavigation}
Command & Shortcut key & Alternative \\
\hline
Char left & \key{Arrow left} & \key{Ctrl-S} \\
Char right & \key{Arrow right} & \key{Ctrl-D} \\
Line up & \key{Arrow up} & \key{Ctrl-E} \\
Line down & \key{Arrow down} & \key{Ctrl-X} \\
Word left & \key{Ctrl-Arrow left} & \key{Ctrl-A} \\
Word right & \key{Ctrl-Arrow right} & \key{Ctrl-F} \\
Scroll one line up & \key{Ctrl-W} & \\
Scroll one line down & \key{Ctrl-Z} & \\
Page up & \key{PageUp} & \key{Ctrl-R} \\
Page down & \key{PageDown} & \\
Beginning of Line & \key{Pos1} & \key{Ctrl-Q-S} \\
End of Line & \key{End} & \key{Ctrl-Q-D} \\
First line of window & \key{Ctrl-Home} & \key{Ctrl-Q-E} \\
Last line of window & \key{Ctrl-End} & \key{Ctrl-Q-X} \\
First line of file & \key{Ctrl-PageUp} & \key{Ctrl-Q-R} \\
Last line of file & \key{Ctrl-PageDown} & \key{Ctrl-Q-C} \\
Last cursor position & \key{Ctrl-Q-P} & \\
Find matching block delimiter & \key{Ctrl-Q-[} & \\
Find last matching block delimiter & \key{Ctrl-Q-]} & \\
\end{FPCltable}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{FPCltable}{p{5cm}ll}{Edit}{shortcutsedit}
Command & Shortcut key & Alternative \\
\hline
Delete char & \key{Del} & \key{Ctrl-G} \\
Delete left char & \key{Backspace} & \key{Ctrl-H} \\
Delete line & \key{Ctrl-Y} & \\
Delete til end of line & \key{Ctrl-Q-Y} & \\
Delete word & \key{Ctrl-T} & \\
Insert line & \key{Ctrl-N} & \\
Toggle insert mode & \key{Insert} & \key{Ctrl-V} \\
\end{FPCltable}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{FPCltable}{p{5cm}ll}{Block commands}{shortcutsblock}
Command & Shortcut key & Alternative \\
\hline
Goto Beginning of selected text & \key{Ctrl-Q-B} & \\
Goto end of selected text & \key{Ctrl-Q-K} & \\
Select current line & \key{Ctrl-K-L} & \\
Print selected text & \key{Ctrl-K-P} & \\
Select current word & \key{Ctrl-K-T} & \\
Delete selected text & \key{Ctrl-Del} & \key{Ctrl-K-Y} \\
Copy selected text to cursor position & \key{Ctrl-K-C} & \\
Move selected text to cursor position & \key{Ctrl-K-V} & \\
Copy selected text to clipboard & \key{Ctrl-Ins} & \\
Move selected text to the clipboard & \key{Shift-Del} & \\
Indent block one column & \key{Ctrl-K-I} & \\
Unindent block one column & \key{Ctrl-K-U} & \\
Insert text from clipboard & \key{Shift-Insert} & \\
Insert file & \key{Ctrl-K-R} & \\
Write selected text to file & \key{Ctrl-K-W} & \\
Uppercase current block & \key{Ctrl-K-N} & \\
Lowercase current block & \key{Ctrl-K-O} & \\
Uppercase word & \key{Ctrl-K-E} & \\
Lowercase word & \key{Ctrl-K-F} & \\
\end{FPCltable}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{FPCltable}{p{5cm}ll}{Change selection}{shortcutsselection}
Command & Shortcut key & Alternative \\
\hline
Mark beginning of selected text & \key{Ctrl-K-B} & \\
Mark end of selected text& \key{Ctrl-K-K} & \\
Remove selection & \key{Ctrl-K-Y} & \\
Extend selection one char to the left & \key{Shift-Arrow left} & \\
Extend selection one char to the right & \key{Shift-Arrow right} & \\
Extend selection to the beginning of the line & \key{Shift-Pos1} & \\
Extend selection to the end of the line & \key{Shift-End} & \\
Extend selection to the same column in the last row & \key{Shift-Arrow up} & \\
Extend selection to the same column in the next row & \key{Shift-Arrow down} & \\
Extend selection to the end of the line & \key{Shift-End} & \\
Extend selection one word to the left & \key{Ctrl-Shift-Arrow left} & \\
Extend selection one word to the right & \key{Ctrl-Shift-Arrow right} & \\
Extend selection one page up & \key{Shift-PageUp} & \\
Extend selection one page down & \key{Shift-PageDown} & \\
Extend selection to the beginning of the file & \key{Ctrl-Shift-Pos1} &
\key{Ctrl-Shift-PageUp} \\
Extend selection to the end of the file & \key{Ctrl-Shift-End} &
\key{Ctrl-Shift-PageUp} \\
\end{FPCltable}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{FPCltable}{p{5cm}ll}{Misc. commands}{shortcutsmisc}
Command & Shortcut key & Alternative \\
\hline
Save file & \key{F2} & \key{Ctrl-K-S} \\
Open file & \key{F3} & \\
Search & \key{Ctrl-Q-F} & \\
Search again & \key{Ctrl-L}\ & \\
Search and replace & \key{Ctrl-Q-A} & \\
Set mark & \key{Ctrl-K-n} (where n can be 0..9) & \\
Goto mark & \key{Ctrl-Q-n} (where n can be 0..9) & \\
Undo & \key{Alt-Backspace} & \\
\end{FPCltable}