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
|
unit EnvGuiOptions;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Contnrs, Math,
// LCL
Graphics, Forms, Controls,
// LazUtils
LazFileUtils, FileUtil, LazFileCache, LazUTF8, Laz2_XMLCfg, Laz2_DOM,
// BuildIntf
ProjectIntf, IDEOptionsIntf, IDEExternToolIntf, ComponentReg,
// IDEIntf
ObjectInspector, IDEWindowIntf, IDEOptEditorIntf, SrcEditorIntf,
// IdeConfig
IDEOptionDefs, EnvironmentOpts, ModeMatrixOpts, CoolBarOptions, EditorToolBarOptions;
const
DefaultRubberbandSelectsGrandChilds = false;
DefaultBorderSpacingColor = clRed;
DefaultGridColor = clBlack;
DefaultGridSize = 8;
DefaultGuideLineColorLeftTop = clBlue;
DefaultGuideLineColorRightBottom = clGreen;
type
{ Messages window }
TMsgWndFileNameStyle = (
mwfsShort, // = ExtractFilename
mwfsRelative, // = CreateRelativePath
mwfsFull
);
//TMsgWndFileNameStyles = set of TMsgWndFileNameStyle;
const
MsgWndFileNameStyleNames: array[TMsgWndFileNameStyle] of string = (
'Short', // mwfsShort
'Relative', // mwfsRelative
'Full' // mwfsFull
);
type
TMsgWndColor = (
mwBackground,
mwRunning,
mwSuccess,
mwFailed,
mwAutoHeader,
mwTextColor
);
const
MsgWndDefBackgroundColor = clWindow;
MsgWndDefHeaderBackgroundRunning = clYellow;
MsgWndDefHeaderBackgroundSuccess = TColor($60FF60); // light green
MsgWndDefHeaderBackgroundFailed = TColor($6060FF); // light red
MsgWndDefAutoHeaderBackground = clSkyBlue;
MsgWndDefTextColor = clDefault;
MsgWndDefaultColors: array[TMsgWndColor] of TColor = (
MsgWndDefBackgroundColor, // mwBackground
MsgWndDefHeaderBackgroundRunning, // mwRunning
MsgWndDefHeaderBackgroundSuccess, // mwSuccess
MsgWndDefHeaderBackgroundFailed, // mwFailed
MsgWndDefAutoHeaderBackground, // mwAutoHeader
MsgWndDefTextColor
);
MsgWndColorNames: array[TMsgWndColor] of string = (
'Background',
'Running',
'Success',
'Failed',
'AutoHeader',
'TextColor'
);
type
{ TCustomDesktopOpt }
TCustomDesktopOpt = class
protected
FName:string;
FAssociatedDebugDesktopName: String;
FConfigStore: TXMLOptionsStorage;
FIsDocked: Boolean;
FXMLCfg: TRttiXMLConfig;
function GetCompatible: Boolean; virtual;
public
constructor Create(const aName: String); virtual; overload;
constructor Create(const aName: String; const aIsDocked: Boolean); virtual; overload;
destructor Destroy; override;
procedure SetConfig(aXMLCfg: TRttiXMLConfig; aConfigStore: TXMLOptionsStorage);
procedure Load(Path: String); virtual;
procedure Save(Path: String); virtual; abstract;
property Name: String read FName write FName;
property AssociatedDebugDesktopName: String read FAssociatedDebugDesktopName write FAssociatedDebugDesktopName;
property IsDocked: Boolean read FIsDocked;
property Compatible: Boolean read GetCompatible;
end;
TDesktopOptClass = class of TCustomDesktopOpt;
TEnvGuiOptions = class;
{ TDesktopOIOptions }
TDesktopOIOptions = class(TPersistent)
private
FComponentTreeHeight: integer;
FInfoBoxHeight: integer;
FShowComponentTree: Boolean;
FShowInfoBox: boolean;
FSplitterX: array[TObjectInspectorPage] of Integer;
function GetSplitterX(const APage: TObjectInspectorPage): Integer;
procedure SetSplitterX(const APage: TObjectInspectorPage; const ASplitterX: Integer);
protected
procedure AssignTo(Dest: TPersistent); override;
public
constructor Create;
procedure ImportSettingsFromIDE(const AOptions: TEnvGuiOptions);
procedure ExportSettingsToIDE(const AOptions: TEnvGuiOptions);
procedure Load(XMLConfig: TXMLConfig; Path: String);
procedure Save(XMLConfig: TXMLConfig; Path: String);
property ShowComponentTree: Boolean read FShowComponentTree write FShowComponentTree;
property ComponentTreeHeight: integer read FComponentTreeHeight write FComponentTreeHeight;
property SplitterX[const APage: TObjectInspectorPage]: Integer read GetSplitterX write SetSplitterX;
property ShowInfoBox: boolean read FShowInfoBox write FShowInfoBox;
property InfoBoxHeight: integer read FInfoBoxHeight write FInfoBoxHeight;
end;
{ TDesktopOpt }
TDesktopOpt = class(TCustomDesktopOpt)
private const
DEFAULT_CUSTOM_TITLE = '$project(TitleNew) $EncloseBracket($project(infodir)) $(BuildModeCaption)';
private
// window layout
FIDEWindowCreatorsLayoutList: TSimpleWindowLayoutList;
FIDEDialogLayoutList: TIDEDialogLayoutList;
FObjectInspectorOptions: TDesktopOIOptions;
FSingleTaskBarButton: boolean;
FHideIDEOnRun: boolean;
FAutoAdjustIDEHeight: boolean;
FAutoAdjustIDEHeightFullCompPal: boolean;
FProjectInspectorShowProps: boolean;
// window menu
FIDENameForDesignedFormList: boolean;
// CompletionWindow
FCompletionWindowWidth: Integer;
FCompletionWindowHeight: Integer;
// title
FIDETitleStartsWithProject: boolean;
FIDETitleShowsBuildMode: boolean; // deprecated: ONLY read from XML for upgrade to IDETitleBarCustomText
FIDETitleShowsProjectDir: boolean; // deprecated: ONLY read from XML for upgrade to IDETitleBarCustomText
FIDETitleBarCustomText: string;
// IDE Coolbar
FIDECoolBarOptions: TIDECoolBarOptions;
// Editor Toolbar
FEditorToolBarOptions: TEditorToolBarOptions;
// component palette
FComponentPaletteOptions: TCompPaletteOptions;
// Docking options
FDockedOpt: TAbstractDesktopDockingOpt;
procedure InitLayoutList;
protected
function GetCompatible: Boolean; override;
public
constructor Create(const aName: String; const aIsDocked: Boolean); override; overload;
destructor Destroy; override;
procedure Assign(Source: TDesktopOpt; const AssignName: Boolean = False;
const IsCompatible: Boolean = True);
public
procedure Load(Path: String); override;
procedure Save(Path: String); override;
procedure ImportSettingsFromIDE(const AOptions: TEnvGuiOptions);
procedure ExportSettingsToIDE(const AOptions: TEnvGuiOptions);
procedure RestoreDesktop;
property IDEWindowCreatorsLayoutList: TSimpleWindowLayoutList read FIDEWindowCreatorsLayoutList write FIDEWindowCreatorsLayoutList;
property IDEDialogLayoutList: TIDEDialogLayoutList read FIDEDialogLayoutList;
property SingleTaskBarButton: boolean read FSingleTaskBarButton write FSingleTaskBarButton;
property HideIDEOnRun: boolean read FHideIDEOnRun write FHideIDEOnRun;
property AutoAdjustIDEHeight: Boolean read FAutoAdjustIDEHeight write FAutoAdjustIDEHeight;
property AutoAdjustIDEHeightFullCompPal: Boolean read FAutoAdjustIDEHeightFullCompPal
write FAutoAdjustIDEHeightFullCompPal;
property IDENameForDesignedFormList: boolean read FIDENameForDesignedFormList
write FIDENameForDesignedFormList;
property CompletionWindowWidth: Integer read FCompletionWindowWidth write FCompletionWindowWidth;
property CompletionWindowHeight: Integer read FCompletionWindowHeight write FCompletionWindowHeight;
property IDETitleStartsWithProject: boolean read FIDETitleStartsWithProject
write FIDETitleStartsWithProject;
property IDETitleShowsBuildMode: boolean read FIDETitleShowsBuildMode; // deprecated: ONLY read from XML for upgrade to IDETitleBarCustomText
property IDETitleShowsProjectDir: boolean read FIDETitleShowsProjectDir; // deprecated: ONLY read from XML for upgrade to IDETitleBarCustomText
property IDETitleBarCustomText: string read FIDETitleBarCustomText
write FIDETitleBarCustomText;
property IDECoolBarOptions: TIDECoolBarOptions read FIDECoolBarOptions;
property EditorToolBarOptions: TEditorToolBarOptions read FEditorToolBarOptions;
property ComponentPaletteOptions: TCompPaletteOptions read FComponentPaletteOptions;
property ObjectInspectorOptions: TDesktopOIOptions read FObjectInspectorOptions;
property ProjectInspectorShowProps: boolean read FProjectInspectorShowProps
write FProjectInspectorShowProps;
end;
{ TUnsupportedDesktopOpt }
TUnsupportedDesktopOpt = Class(TCustomDesktopOpt)
private
FRetainXMLData:TDOMDocument;
public
destructor Destroy; override;
procedure Load(Path: String); override;
procedure Save(Path: String); override;
end;
{ TDesktopOptList }
TDesktopOptList = class(TObjectList)
private
FXMLCfg: TRttiXMLConfig;
FConfigStore: TXMLOptionsStorage;
function GetItem(Index: Integer): TCustomDesktopOpt;
procedure SetConfig(aXMLCfg: TRttiXMLConfig; aConfigStore: TXMLOptionsStorage);
public
constructor Create;
destructor Destroy; override;
procedure AddFromCfg(Path: String);
function IndexOf(aName: string): integer;
function Find(aName: string): TCustomDesktopOpt;
property Items[Index: Integer]: TCustomDesktopOpt read GetItem; default;
end;
{ TEnvGuiOptions }
TEnvGuiOptions = class(TIDESubOptions)
private
FConfigStorage: TXMLOptionsStorage;
// hints
FShowHintsForComponentPalette: boolean;
FShowHintsForMainSpeedButtons: boolean;
// glyphs
FShowButtonGlyphs: TApplicationShowGlyphs;
FShowMenuGlyphs: TApplicationShowGlyphs;
// designer
FCreateComponentFocusNameProperty: boolean;
FSwitchToFavoritesOITab: boolean;
FShowBorderSpacing: boolean;
FBorderSpacingColor: TColor;
FShowGrid: boolean;
FSnapToGrid: boolean;
FGridSizeX: integer;
FGridSizeY: integer;
FGridColor: TColor;
FShowGuideLines: boolean;
FSnapToGuideLines: boolean;
FGuideLineColorLeftTop: TColor;
FGuideLineColorRightBottom: TColor;
FShowComponentCaptions: boolean;
FShowEditorHints: boolean;
FAutoCreateFormsOnOpen: boolean;
FRightClickSelects: boolean;
FGrabberColor: TColor;
FMarkerColor: TColor;
FNonFormBackgroundColor: TColor;
FRubberbandSelectionColor: TColor;
FRubberbandCreationColor: TColor;
FRubberbandSelectsGrandChilds: boolean;
FCheckPackagesOnFormCreate: boolean;
FFormTitleBarChangesObjectInspector: boolean;
FForceDPIScalingInDesignTime: boolean;
// component list
FComponentListKeepOpen: Boolean;
FComponentListPageIndex: Integer;
// search result view
FSearchResultViewPathStyle: TMsgWndFileNameStyle;
// object inspector
FObjectInspectorOptions: TOIOptions;
// messages
FMsgViewDblClickJumps: boolean;
FMsgViewFocus: boolean;
FShowMessagesIcons: boolean;
FMsgViewStayOnTop: boolean;
FMsgViewShowTranslations: boolean;
FMsgViewAlwaysDrawFocused: boolean;
FMsgViewFilenameStyle: TMsgWndFileNameStyle;
FMsgViewColors: array[TMsgWndColor] of TColor;
FMsgColors: array[TMessageLineUrgency] of TColor;
FMsgViewFilters: TLMsgViewFilters;
// desktops
FDesktops: TDesktopOptList;
FDesktop: TDesktopOpt;
FLastDesktopBeforeDebug: TDesktopOpt;
FActiveDesktopName: string;
FAutoSaveActiveDesktop: Boolean;
FDebugDesktopName: string;
function GetMsgColors(u: TMessageLineUrgency): TColor;
function GetMsgViewColors(c: TMsgWndColor): TColor;
procedure SetMsgColors(u: TMessageLineUrgency; AValue: TColor);
procedure SetMsgViewColors(c: TMsgWndColor; AValue: TColor);
function GetActiveDesktop: TDesktopOpt;
function GetDebugDesktop: TDesktopOpt;
public
constructor Create;
destructor Destroy; override;
procedure ReadFromXml({%H-}OnlyDesktop: boolean); override;
procedure WriteToXml({%H-}OnlyDesktop: boolean); override;
procedure InitConfig; override;
procedure UseDesktop(ADesktop: TDesktopOpt);
procedure EnableDebugDesktop;
procedure DisableDebugDesktop;
class function DesktopCanBeLoaded(const aDockMaster: string): Boolean;
// hints
property ShowHintsForComponentPalette: boolean read FShowHintsForComponentPalette
write FShowHintsForComponentPalette;
property ShowHintsForMainSpeedButtons: boolean read FShowHintsForMainSpeedButtons
write FShowHintsForMainSpeedButtons;
// glyphs
property ShowButtonGlyphs: TApplicationShowGlyphs read FShowButtonGlyphs write FShowButtonGlyphs;
property ShowMenuGlyphs: TApplicationShowGlyphs read FShowMenuGlyphs write FShowMenuGlyphs;
// form designer
property ShowBorderSpacing: boolean read FShowBorderSpacing write FShowBorderSpacing;
property BorderSpacingColor: TColor read FBorderSpacingColor write FBorderSpacingColor;
property ShowGrid: boolean read FShowGrid write FShowGrid;
property SnapToGrid: boolean read FSnapToGrid write FSnapToGrid;
property GridColor: TColor read FGridColor write FGridColor;
property GridSizeX: integer read FGridSizeX write FGridSizeX;
property GridSizeY: integer read FGridSizeY write FGridSizeY;
property ShowGuideLines: boolean read FShowGuideLines write FShowGuideLines;
property SnapToGuideLines: boolean read FSnapToGuideLines write FSnapToGuideLines;
property GuideLineColorLeftTop: TColor read FGuideLineColorLeftTop
write FGuideLineColorLeftTop;
property GuideLineColorRightBottom: TColor read FGuideLineColorRightBottom
write FGuideLineColorRightBottom;
property ShowComponentCaptions: boolean read FShowComponentCaptions
write FShowComponentCaptions;
property ShowEditorHints: boolean read FShowEditorHints
write FShowEditorHints;
property AutoCreateFormsOnOpen: boolean read FAutoCreateFormsOnOpen
write FAutoCreateFormsOnOpen;
property CheckPackagesOnFormCreate: boolean read FCheckPackagesOnFormCreate
write FCheckPackagesOnFormCreate;
property RightClickSelects: boolean read FRightClickSelects
write FRightClickSelects;
property GrabberColor: TColor read FGrabberColor write FGrabberColor;
property MarkerColor: TColor read FMarkerColor write FMarkerColor;
property NonFormBackgroundColor: TColor read FNonFormBackgroundColor
write FNonFormBackgroundColor;
property RubberbandSelectionColor: TColor read FRubberbandSelectionColor
write FRubberbandSelectionColor;
property RubberbandCreationColor: TColor read FRubberbandCreationColor
write FRubberbandCreationColor;
property RubberbandSelectsGrandChilds: boolean read FRubberbandSelectsGrandChilds
write FRubberbandSelectsGrandChilds;
property CreateComponentFocusNameProperty: boolean read FCreateComponentFocusNameProperty
write FCreateComponentFocusNameProperty;
property SwitchToFavoritesOITab: boolean read FSwitchToFavoritesOITab
write FSwitchToFavoritesOITab;
property FormTitleBarChangesObjectInspector: boolean read FFormTitleBarChangesObjectInspector
write FFormTitleBarChangesObjectInspector;
property ForceDPIScalingInDesignTime: boolean read FForceDPIScalingInDesignTime
write FForceDPIScalingInDesignTime;
// component list
property ComponentListKeepOpen: Boolean read FComponentListKeepOpen write FComponentListKeepOpen;
property ComponentListPageIndex: Integer read FComponentListPageIndex write FComponentListPageIndex;
// search result view
property SearchResultViewPathStyle: TMsgWndFileNameStyle read FSearchResultViewPathStyle write FSearchResultViewPathStyle;
// object inspector
property ObjectInspectorOptions: TOIOptions read FObjectInspectorOptions;
// messages view
property MsgViewDblClickJumps: boolean read FMsgViewDblClickJumps
write FMsgViewDblClickJumps; // true=dbl click jump to error, false=single click jumps
property MsgViewFocus: boolean read FMsgViewFocus
write FMsgViewFocus; // when showing the message window, focus it
property ShowMessagesIcons: boolean read FShowMessagesIcons write FShowMessagesIcons;
property MsgViewStayOnTop: boolean read FMsgViewStayOnTop write FMsgViewStayOnTop;
property MsgViewShowTranslations: boolean read FMsgViewShowTranslations
write FMsgViewShowTranslations;
property MsgViewAlwaysDrawFocused: boolean read FMsgViewAlwaysDrawFocused
write FMsgViewAlwaysDrawFocused;
property MsgViewFilenameStyle: TMsgWndFileNameStyle read FMsgViewFilenameStyle
write FMsgViewFilenameStyle;
property MsgViewColors[c: TMsgWndColor]: TColor read GetMsgViewColors write SetMsgViewColors;
property MsgViewFilters: TLMsgViewFilters read FMsgViewFilters;
property MsgColors[u: TMessageLineUrgency]: TColor read GetMsgColors write SetMsgColors;
// desktops
property Desktops: TDesktopOptList read FDesktops;
property Desktop: TDesktopOpt read FDesktop; // the working desktop, standalone
property DebugDesktopName: string read FDebugDesktopName write FDebugDesktopName;
property DebugDesktop: TDesktopOpt read GetDebugDesktop; // debug desktop from Desktops list
property LastDesktopBeforeDebug: TDesktopOpt read FLastDesktopBeforeDebug write FLastDesktopBeforeDebug;
property ActiveDesktopName: string read FActiveDesktopName write FActiveDesktopName;
property ActiveDesktop: TDesktopOpt read GetActiveDesktop; // active desktop from Desktops list
property AutoSaveActiveDesktop: Boolean read FAutoSaveActiveDesktop write FAutoSaveActiveDesktop;
end;
function StrToMsgWndFilenameStyle(const s: string): TMsgWndFileNameStyle;
var
EnvironmentGuiOpts: TEnvGuiOptions;
implementation
function StrToMsgWndFilenameStyle(const s: string): TMsgWndFileNameStyle;
begin
for Result in TMsgWndFileNameStyle do
if CompareText(s,MsgWndFileNameStyleNames[Result])=0 then exit;
Result:=mwfsShort;
end;
{ TCustomDesktopOpt }
function TCustomDesktopOpt.GetCompatible: Boolean;
begin
Result := false;
end;
procedure TCustomDesktopOpt.Load(Path: String);
begin
FAssociatedDebugDesktopName:=FXMLCfg.GetValue(Path+'AssociatedDebugDesktopName/Value', '');
end;
constructor TCustomDesktopOpt.Create(const aName: String);
begin
Create(aName, Assigned(IDEDockMaster));
end;
constructor TCustomDesktopOpt.Create(const aName: String; const aIsDocked: Boolean);
begin
inherited Create;
FName:=aName;
FIsDocked := aIsDocked;
end;
destructor TCustomDesktopOpt.Destroy;
begin
inherited Destroy;
end;
procedure TCustomDesktopOpt.SetConfig(aXMLCfg: TRttiXMLConfig;
aConfigStore: TXMLOptionsStorage);
begin
FXMLCfg := aXMLCfg;
FConfigStore := aConfigStore;
end;
{ TDesktopOIOptions }
constructor TDesktopOIOptions.Create;
var
I: TObjectInspectorPage;
begin
FComponentTreeHeight := -1;
FInfoBoxHeight := -1;
FShowComponentTree := True;
FShowInfoBox := True;
for I in TObjectInspectorPage do
SplitterX[I] := -1;
end;
procedure TDesktopOIOptions.AssignTo(Dest: TPersistent);
var
DDest: TDesktopOIOptions;
I: TObjectInspectorPage;
begin
if Dest is TDesktopOIOptions then
begin
DDest := TDesktopOIOptions(Dest);
for I in TObjectInspectorPage do
DDest.SplitterX[I] := SplitterX[I];
DDest.ShowInfoBox := ShowInfoBox;
DDest.ComponentTreeHeight := ComponentTreeHeight;
DDest.ShowComponentTree := ShowComponentTree;
DDest.InfoBoxHeight := InfoBoxHeight;
end else
inherited AssignTo(Dest);
end;
function TDesktopOIOptions.GetSplitterX(const APage: TObjectInspectorPage): Integer;
begin
Result := FSplitterX[APage];
end;
procedure TDesktopOIOptions.ImportSettingsFromIDE(const AOptions: TEnvGuiOptions);
var
I: TObjectInspectorPage;
o: TOIOptions;
begin
o := AOptions.ObjectInspectorOptions;
for I in TObjectInspectorPage do
FSplitterX[I] := o.GridSplitterX[I];
ShowInfoBox := o.ShowInfoBox;
ComponentTreeHeight := o.ComponentTreeHeight;
ShowComponentTree := o.ShowComponentTree;
InfoBoxHeight := o.InfoBoxHeight;
end;
procedure TDesktopOIOptions.ExportSettingsToIDE(const AOptions: TEnvGuiOptions);
var
I: TObjectInspectorPage;
o: TOIOptions;
begin
o := AOptions.ObjectInspectorOptions;
for I in TObjectInspectorPage do
if FSplitterX[I]>=0 then
o.GridSplitterX[I] := Max(10, FSplitterX[I]);
o.ShowInfoBox := ShowInfoBox;
o.ShowComponentTree := ShowComponentTree;
if ComponentTreeHeight>=0 then
o.ComponentTreeHeight := Max(10, ComponentTreeHeight);
if InfoBoxHeight>=0 then
o.InfoBoxHeight := Max(10, InfoBoxHeight);
end;
procedure TDesktopOIOptions.Load(XMLConfig: TXMLConfig; Path: String);
var
I: TObjectInspectorPage;
begin
Path := Path + 'ObjectInspectorOptions/';
for I in TObjectInspectorPage do
FSplitterX[I] := XMLConfig.GetValue(Path+'SplitterX/'+DefaultOIPageNames[I]+'/Value',-1);
ShowComponentTree := XMLConfig.GetValue(Path+'ComponentTree/Show/Value',True);
ComponentTreeHeight := XMLConfig.GetValue(Path+'ComponentTree/Height/Value',-1);
ShowInfoBox := XMLConfig.GetValue(Path+'InfoBox/Show/Value',True);
InfoBoxHeight := XMLConfig.GetValue(Path+'InfoBox/Height/Value',-1);
end;
procedure TDesktopOIOptions.Save(XMLConfig: TXMLConfig; Path: String);
var
I: TObjectInspectorPage;
begin
Path := Path + 'ObjectInspectorOptions/';
for I in TObjectInspectorPage do
XMLConfig.SetDeleteValue(Path+'SplitterX/'+DefaultOIPageNames[I]+'/Value',FSplitterX[I],-1);
XMLConfig.SetDeleteValue(Path+'ComponentTree/Show/Value',ShowComponentTree,True);
XMLConfig.SetDeleteValue(Path+'ComponentTree/Height/Value',ComponentTreeHeight,-1);
XMLConfig.SetDeleteValue(Path+'InfoBox/Show/Value',ShowInfoBox,True);
XMLConfig.SetDeleteValue(Path+'InfoBox/Height/Value',InfoBoxHeight,-1);
end;
procedure TDesktopOIOptions.SetSplitterX(const APage: TObjectInspectorPage;
const ASplitterX: Integer);
begin
FSplitterX[APage] := ASplitterX;
end;
{ TDesktopOpt }
constructor TDesktopOpt.Create(const aName: String; const aIsDocked: Boolean);
begin
if aIsDocked and not Assigned(IDEDockMaster) then
raise Exception.Create('Internal error: TEnvironmentOptions.CreateDesktop cannot create docked desktop in undocked environment.');
inherited;
if aIsDocked then
FDockedOpt := IDEDockMaster.DockedDesktopOptClass.Create;
FSingleTaskBarButton:=false;
FHideIDEOnRun:=false;
FAutoAdjustIDEHeight:=true;
FAutoAdjustIDEHeightFullCompPal := true;
// window menu
FIDENameForDesignedFormList:=false;
// CompletionWindow
FCompletionWindowWidth := 320 * Screen.PixelsPerInch div 96;
FCompletionWindowHeight := 6;
// title
FIDETitleStartsWithProject:=true;
FIDETitleShowsBuildMode:=true;
FIDETitleShowsProjectDir:=true;
FIDETitleBarCustomText:=DEFAULT_CUSTOM_TITLE;
// IDE Coolbar
FIDECoolBarOptions:=TIDECoolBarOptions.Create;
// Editor Toolbar
FEditorToolBarOptions:=TEditorToolBarOptions.Create;
// component palette
FComponentPaletteOptions:=TCompPaletteOptions.Create;
// object inspector
FObjectInspectorOptions:=TDesktopOIOptions.Create;
// project inspector
FProjectInspectorShowProps := true;
// Windows layout
InitLayoutList;
FIDEDialogLayoutList:=TIDEDialogLayoutList.Create;
FIDEWindowCreatorsLayoutList:=TSimpleWindowLayoutList.Create(False);
FIDEDialogLayoutList.Assign(IDEWindowIntf.IDEDialogLayoutList);
FIDEWindowCreatorsLayoutList.CopyItemsFrom(IDEWindowIntf.IDEWindowCreators.SimpleLayoutStorage);
end;
destructor TDesktopOpt.Destroy;
begin
FreeAndNil(FComponentPaletteOptions);
FreeAndNil(FEditorToolBarOptions);
FreeAndNil(FIDECoolBarOptions);
FreeAndNil(FDockedOpt);
FreeAndNil(FObjectInspectorOptions);
FreeAndNil(FIDEDialogLayoutList);
FreeAndNil(FIDEWindowCreatorsLayoutList);
inherited Destroy;
end;
function TDesktopOpt.GetCompatible: Boolean;
begin
Result := (IsDocked = Assigned(IDEDockMaster));
end;
procedure TDesktopOpt.Assign(Source: TDesktopOpt; const AssignName: Boolean;
const IsCompatible: Boolean);
begin
if AssignName then
FName := Source.FName;
if IsCompatible and (Assigned(FDockedOpt) <> Assigned(Source.FDockedOpt)) then
raise Exception.Create('Internal error: TDesktopOpt.Assign mixed docked/undocked desktops.');
// window layout
if IsCompatible then
begin
FIDEWindowCreatorsLayoutList.CopyItemsFrom(Source.FIDEWindowCreatorsLayoutList);
FIDEDialogLayoutList.Assign(Source.FIDEDialogLayoutList);
FAssociatedDebugDesktopName := Source.FAssociatedDebugDesktopName;
end;
FSingleTaskBarButton := Source.FSingleTaskBarButton;
FHideIDEOnRun := Source.FHideIDEOnRun;
FAutoAdjustIDEHeight := Source.FAutoAdjustIDEHeight;
FAutoAdjustIDEHeightFullCompPal := Source.FAutoAdjustIDEHeightFullCompPal;
// window menu
FIDENameForDesignedFormList := Source.FIDENameForDesignedFormList;
// CompletionWindow
FCompletionWindowWidth := Source.FCompletionWindowWidth;
FCompletionWindowHeight := Source.FCompletionWindowHeight;
// title
FIDETitleStartsWithProject := Source.FIDETitleStartsWithProject;
FIDETitleShowsBuildMode := Source.FIDETitleShowsBuildMode;
FIDETitleShowsProjectDir := Source.FIDETitleShowsProjectDir;
FIDETitleBarCustomText:= Source.FIDETitleBarCustomText;
// IDE Coolbar
FIDECoolBarOptions.Assign(Source.FIDECoolBarOptions);
// Editor Toolbar
FEditorToolBarOptions.Assign(Source.FEditorToolBarOptions);
// component palette
FComponentPaletteOptions.Assign(Source.FComponentPaletteOptions);
// object inspector
FObjectInspectorOptions.Assign(Source.FObjectInspectorOptions);
// project inspector
FProjectInspectorShowProps := Source.FProjectInspectorShowProps;
if IsCompatible and Assigned(FDockedOpt) then
FDockedOpt.Assign(Source.FDockedOpt);
end;
procedure TDesktopOpt.Load(Path: String);
begin
inherited;
// Windows layout
FIDEWindowCreatorsLayoutList.LoadFromConfig(FConfigStore, Path);
FIDEDialogLayoutList.LoadFromConfig(FConfigStore, Path+'Dialogs/');
FSingleTaskBarButton:=FXMLCfg.GetValue(Path+'SingleTaskBarButton/Value', False);
FHideIDEOnRun:=FXMLCfg.GetValue(Path+'HideIDEOnRun/Value',false);
FAutoAdjustIDEHeight:=FXMLCfg.GetValue(Path+'AutoAdjustIDEHeight/Value',true);
FAutoAdjustIDEHeightFullCompPal:=FXMLCfg.GetValue(Path+'AutoAdjustIDEHeightFullComponentPalette/Value',true);
// Window menu
FIDENameForDesignedFormList:=FXMLCfg.GetValue(Path+'IDENameForDesignedFormList/Value',false);
// title
FIDETitleStartsWithProject:=FXMLCfg.GetValue(Path+'IDETitleStartsWithProject/Value',true);
FIDETitleShowsBuildMode:=FXMLCfg.GetValue(Path+'IDETitleShowsBuildMode/Value',true);
FIDETitleShowsProjectDir:=FXMLCfg.GetValue(Path+'IDETitleShowsProjectDir/Value',true);
FIDETitleBarCustomText:=FXMLCfg.GetValue(Path+'IDETitleBarCustomText/Value',DEFAULT_CUSTOM_TITLE);
if (EnvironmentOptions.FileVersion < 112) and (FIDETitleBarCustomText = DEFAULT_CUSTOM_TITLE)
then begin
FIDETitleBarCustomText := '$project(TitleNew)';
if FIDETitleShowsProjectDir then
FIDETitleBarCustomText := FIDETitleBarCustomText + ' $EncloseBracket($project(infodir))';
if FIDETitleShowsBuildMode then
FIDETitleBarCustomText := FIDETitleBarCustomText + ' $(BuildModeCaption)';
end;
// CompletionWindow
FCompletionWindowWidth:=FXMLCfg.GetValue(Path+'CompletionWindowOptions/Width/Value', FCompletionWindowWidth);
FCompletionWindowHeight:=FXMLCfg.GetValue(Path+'CompletionWindowOptions/Height/Value', 6);
// Project Inspector
FProjectInspectorShowProps := FXMLCfg.GetValue(Path+'ProjectInspectorShowProps/Value', true);
if not FXMLCfg.HasPath(Path+'IDECoolBarOptions/', True) then
Path := ''; // Toolbars and palette were at the top level in XML.
// IDE Coolbar
FIDECoolBarOptions.Load(FXMLCfg, Path);
// Editor Toolbar
FEditorToolBarOptions.Load(FXMLCfg, Path);
// component palette
FComponentPaletteOptions.Load(FXMLCfg, Path);
// Object Inspector
FObjectInspectorOptions.Load(FXMLCfg, Path);
if Assigned(FDockedOpt) then
FDockedOpt.Load(Path, FXMLCfg);
end;
procedure TDesktopOpt.RestoreDesktop;
begin
IDEWindowCreators.RestoreSimpleLayout;
if Assigned(FDockedOpt) then
FDockedOpt.RestoreDesktop;
end;
procedure TDesktopOpt.Save(Path: String);
begin
// windows
FXMLCfg.SetDeleteValue(Path+'Name', FName, '');
if Assigned(FDockedOpt) then
FXMLCfg.SetDeleteValue(Path+'DockMaster', IDEDockMaster.ClassName, '')
else
FXMLCfg.DeleteValue(Path+'DockMaster');
FIDEWindowCreatorsLayoutList.SaveToConfig(FConfigStore, Path);
FIDEDialogLayoutList.SaveToConfig(FConfigStore,Path+'Dialogs/');
FXMLCfg.SetDeleteValue(Path+'AssociatedDebugDesktopName/Value', FAssociatedDebugDesktopName, '');
FXMLCfg.SetDeleteValue(Path+'SingleTaskBarButton/Value',FSingleTaskBarButton, False);
FXMLCfg.SetDeleteValue(Path+'HideIDEOnRun/Value',FHideIDEOnRun,false);
FXMLCfg.SetDeleteValue(Path+'AutoAdjustIDEHeight/Value',FAutoAdjustIDEHeight,true);
FXMLCfg.SetDeleteValue(Path+'AutoAdjustIDEHeightFullComponentPalette/Value',
FAutoAdjustIDEHeightFullCompPal,true);
// Window menu
FXMLCfg.SetDeleteValue(Path+'IDENameForDesignedFormList/Value',FIDENameForDesignedFormList,false);
// title
FXMLCfg.SetDeleteValue(Path+'IDETitleStartsWithProject/Value',FIDETitleStartsWithProject,true);
FXMLCfg.SetDeleteValue(Path+'IDETitleShowsBuildMode/Value',FIDETitleShowsBuildMode,true);
FXMLCfg.SetDeleteValue(Path+'IDETitleShowsProjectDir/Value',FIDETitleShowsProjectDir,true);
FXMLCfg.SetDeleteValue(Path+'IDETitleBarCustomText/Value',FIDETitleBarCustomText,DEFAULT_CUSTOM_TITLE);
// CompletionWindow
FXMLCfg.SetValue(Path+'CompletionWindowOptions/Width/Value',FCompletionWindowWidth);
FXMLCfg.SetDeleteValue(Path+'CompletionWindowOptions/Height/Value',FCompletionWindowHeight, 6);
// Project Inspector
FXMLCfg.SetDeleteValue(Path+'ProjectInspectorShowProps/Value', FProjectInspectorShowProps, true);
// IDE Coolbar
FIDECoolBarOptions.Save(FXMLCfg, Path);
// Editor Toolbar
FEditorToolBarOptions.Save(FXMLCfg, Path);
// component palette
FComponentPaletteOptions.Save(FXMLCfg, Path);
// Object Inspector
FObjectInspectorOptions.Save(FXMLCfg, Path);
if Assigned(FDockedOpt) then
FDockedOpt.Save(Path, FXMLCfg);
end;
procedure TDesktopOpt.ImportSettingsFromIDE(const AOptions: TEnvGuiOptions);
begin
IDEWindowIntf.IDEWindowCreators.SimpleLayoutStorage.StoreWindowPositions;
FIDEDialogLayoutList.Assign(IDEWindowIntf.IDEDialogLayoutList);
FIDEWindowCreatorsLayoutList.CopyItemsFrom(IDEWindowIntf.IDEWindowCreators.SimpleLayoutStorage);
FObjectInspectorOptions.ImportSettingsFromIDE(AOptions);
if Assigned(FDockedOpt) then
FDockedOpt.ImportSettingsFromIDE;
end;
procedure TDesktopOpt.ExportSettingsToIDE(const AOptions: TEnvGuiOptions);
var
ComplForm: TCustomForm;
begin
if Assigned(FDockedOpt) then
FDockedOpt.ExportSettingsToIDE;
IDEWindowIntf.IDEDialogLayoutList.Assign(FIDEDialogLayoutList);
IDEWindowIntf.IDEWindowCreators.SimpleLayoutStorage.CopyItemsFrom(FIDEWindowCreatorsLayoutList);
FObjectInspectorOptions.ExportSettingsToIDE(AOptions);
if Assigned(SourceEditorManagerIntf) then
begin
ComplForm := SourceEditorManagerIntf.DefaultSynCompletionForm;
if Assigned(ComplForm) then
ComplForm.Width := Max(50, CompletionWindowWidth);
SourceEditorManagerIntf.SynCompletionLinesInWindow := Max(3, CompletionWindowHeight);
end;
end;
procedure InitLayoutHelper(const FormID: string);
begin
with IDEWindowCreators.SimpleLayoutStorage do
if not Assigned(ItemByFormID(FormID)) then
CreateWindowLayout(FormID);
end;
procedure TDesktopOpt.InitLayoutList;
var
l: TNonModalIDEWindow;
begin
for l:=Low(TNonModalIDEWindow) to High(TNonModalIDEWindow) do
if l<>nmiwNone then
InitLayoutHelper(NonModalIDEWindowNames[l]);
InitLayoutHelper(DefaultObjectInspectorName);
end;
{ TUnsupportedDesktopOpt }
destructor TUnsupportedDesktopOpt.Destroy;
begin
freeandnil(FRetainXMLData);
inherited Destroy;
end;
procedure TUnsupportedDesktopOpt.Load(Path: string);
var
lPnode, lChldNode: TDOMNode;
begin
inherited;
FreeAndNil(FRetainXMLData);
FRetainXMLData := TDOMDocument.Create;
lPnode := FXMLCfg.FindNode(Path, False);
lChldNode := lPnode.CloneNode(True, FRetainXMLData);
FRetainXMLData.AppendChild(lChldNode);
end;
procedure TUnsupportedDesktopOpt.Save(Path: string);
var
lChldNode, lChCh: TDOMNode;
lsNodeName: DOMString;
lParentNode: TDOMNode;
PathM1, PreD, LastD: String;
begin
if Assigned(FRetainXMLData) then
begin
PathM1 := copy(Path, 1, length(Path) - 1);
PreD := ExtractFilePath(PathM1);
LastD := ExtractFileNameOnly(PathM1);
lParentNode:= FXMLCfg.FindNode(path, False);
lChldNode := FRetainXMLData.FirstChild.CloneNode(True, FXMLCfg.Document);
lsNodeName := lChldNode.NodeName;
if LastD = lsNodeName then
FXMLCfg.FindNode(PreD,False).ReplaceChild(lChldNode,FXMLCfg.FindNode(Path,False))
else
begin
try
if not assigned(lParentNode) then
begin
lParentNode:=FXMLCfg.Document.CreateElement(LastD);
FXMLCfg.FindNode(PreD, False).AppendChild(lParentNode);
end;
while lChldNode.HasChildNodes do
begin
lChCh := lChldNode.FirstChild;
lChldNode.DetachChild(lChCh);
lParentNode.AppendChild(lChCh);
end;
finally
FreeAndNil(lChldNode);
end;
end;
end;
end;
{ TDesktopOptList }
constructor TDesktopOptList.Create;
begin
inherited Create;
end;
destructor TDesktopOptList.Destroy;
begin
inherited Destroy;
end;
procedure TDesktopOptList.SetConfig(aXMLCfg: TRttiXMLConfig; aConfigStore: TXMLOptionsStorage);
begin
FXMLCfg := aXMLCfg;
FConfigStore := aConfigStore;
end;
procedure TDesktopOptList.AddFromCfg(Path: String);
var
dsk: TCustomDesktopOpt;
dskClass: TDesktopOptClass;
dskName, dskDockMaster: String;
begin
dskName := FXMLCfg.GetValue(Path+'Name', 'default');
dskDockMaster := FXMLCfg.GetValue(Path+'DockMaster', '');
if IndexOf(dskname) >=0 then
exit;
if TEnvGuiOptions.DesktopCanBeLoaded(dskDockMaster) then
dskClass := TDesktopOpt
else
dskClass := TUnsupportedDesktopOpt;
dsk := dskClass.Create(dskName, dskDockMaster<>'');
dsk.SetConfig(FXMLCfg, FConfigStore);
dsk.Load(Path);
Add(dsk);
end;
function TDesktopOptList.IndexOf(aName: string): integer;
begin
Result:=Count-1;
while (Result>=0)
and (CompareText(aName, Items[Result].Name)<>0) do
dec(Result);
end;
function TDesktopOptList.Find(aName: string): TCustomDesktopOpt;
var
i: LongInt;
begin
i:=IndexOf(aName);
if i>=0 then
Result:=Items[i]
else
Result:=nil;
end;
function TDesktopOptList.GetItem(Index: Integer): TCustomDesktopOpt;
begin
Result := TCustomDesktopOpt(inherited Items[Index]);
end;
{ TEnvGuiOptions }
constructor TEnvGuiOptions.Create;
var
c: TMsgWndColor;
u: TMessageLineUrgency;
begin
FShowHintsForComponentPalette:=true;
FShowHintsForMainSpeedButtons:=true;
// glyphs
FShowButtonGlyphs := sbgSystem;
FShowMenuGlyphs := sbgSystem;
// designer
FShowGrid:=true;
FShowBorderSpacing:=false;
FBorderSpacingColor:=DefaultBorderSpacingColor;
FGridColor:=DefaultGridColor;
FSnapToGrid:=true;
FGridSizeX:=DefaultGridSize;
FGridSizeY:=DefaultGridSize;
FShowGuideLines:=true;
FSnapToGuideLines:=true;
FGuideLineColorLeftTop:=DefaultGuideLineColorLeftTop;
FGuideLineColorRightBottom:=DefaultGuideLineColorRightBottom;
FShowComponentCaptions:=false;
FShowEditorHints:=true;
FAutoCreateFormsOnOpen:=true;
FCheckPackagesOnFormCreate:=true;
FRightClickSelects:=true;
FGrabberColor:=clBlack;
FMarkerColor:=clDkGray;
FNonFormBackgroundColor:=clWindow;
FRubberbandSelectionColor:=clNavy;
FRubberbandCreationColor:=clMaroon;
FRubberbandSelectsGrandChilds:=DefaultRubberbandSelectsGrandChilds;
FCreateComponentFocusNameProperty:=false;
FSwitchToFavoritesOITab:=false;
FFormTitleBarChangesObjectInspector:=false;
FForceDPIScalingInDesignTime:=true;
// object inspector
FObjectInspectorOptions:=TOIOptions.Create;
// messages view
fMsgViewDblClickJumps:=true;
fMsgViewFocus:=DefaultMsgViewFocus;
FShowMessagesIcons:=true;
FMsgViewStayOnTop:=false;
FMsgViewShowTranslations:=false;
FMsgViewAlwaysDrawFocused:=false;
FMsgViewFilenameStyle:=mwfsShort;
for c:=low(TMsgWndColor) to high(TMsgWndColor) do
fMsgViewColors[c]:=MsgWndDefaultColors[c];
for u:=low(TMessageLineUrgency) to high(TMessageLineUrgency) do
fMsgColors[u] := clDefault;
FMsgViewFilters:=TLMsgViewFilters.Create(nil);
// Desktop collection
FDesktops := TDesktopOptList.Create;
// FDesktop points to the IDE properties
FDesktop := TDesktopOpt.Create('');
FAutoSaveActiveDesktop := True;
end;
destructor TEnvGuiOptions.Destroy;
begin
FreeAndNil(FDesktop);
FreeAndNil(FDesktops);
FreeAndNil(FMsgViewFilters);
FreeAndNil(FObjectInspectorOptions);
FreeAndNil(FConfigStorage);
inherited Destroy;
end;
procedure TEnvGuiOptions.ReadFromXml(OnlyDesktop: boolean);
var
mwc: TMsgWndColor;
Rec: PIDEOptionsGroupRec;
Path, CurPath, NodeName: String;
u: TMessageLineUrgency;
i, j: Integer;
begin
Path:='EnvironmentOptions/';
// hints
FShowHintsForComponentPalette:=XMLCfg.GetValue(Path+'ShowHintsForComponentPalette/Value',true);
FShowHintsForMainSpeedButtons:=XMLCfg.GetValue(Path+'ShowHintsForMainSpeedButtons/Value',true);
// glyphs
FShowButtonGlyphs := TApplicationShowGlyphs(XMLCfg.GetValue(Path+'ShowButtonGlyphs/Value',
Ord(sbgSystem)));
FShowMenuGlyphs := TApplicationShowGlyphs(XMLCfg.GetValue(Path+'ShowMenuGlyphs/Value',
Ord(sbgSystem)));
// form editor
FShowGrid:=XMLCfg.GetValue(Path+'FormEditor/ShowGrid',true);
FShowBorderSpacing:=XMLCfg.GetValue(Path+'FormEditor/ShowBorderSpacing',false);
FBorderSpacingColor:=XMLCfg.GetValue(Path+'FormEditor/BorderSpacingColor',DefaultBorderSpacingColor);
FGridColor:=XMLCfg.GetValue(Path+'FormEditor/GridColor',DefaultGridColor);
FSnapToGrid:=XMLCfg.GetValue(Path+'FormEditor/SnapToGrid',true);
FGridSizeX:=XMLCfg.GetValue(Path+'FormEditor/GridSizeX',DefaultGridSize);
FGridSizeY:=XMLCfg.GetValue(Path+'FormEditor/GridSizeY',DefaultGridSize);
FShowGuideLines:=XMLCfg.GetValue(Path+'FormEditor/ShowGuideLines',true);
FSnapToGuideLines:=XMLCfg.GetValue(Path+'FormEditor/SnapToGuideLines',true);
FGuideLineColorLeftTop:=XMLCfg.GetValue(Path+'FormEditor/GuideLineColorLeftTop',
DefaultGuideLineColorLeftTop);
FGuideLineColorRightBottom:=XMLCfg.GetValue(Path+'FormEditor/GuideLineColorRightBottom',
DefaultGuideLineColorRightBottom);
FShowComponentCaptions:=XMLCfg.GetValue(Path+'FormEditor/ShowComponentCaptions',true);
FShowEditorHints:=XMLCfg.GetValue(Path+'FormEditor/ShowEditorHints',true);
FAutoCreateFormsOnOpen:=XMLCfg.GetValue(Path+'FormEditor/AutoCreateFormsOnOpen',true);
FCheckPackagesOnFormCreate:=XMLCfg.GetValue(Path+'FormEditor/CheckPackagesOnFormCreate',true);
FRightClickSelects:=XMLCfg.GetValue(Path+'FormEditor/RightClickSelects',true);
FGrabberColor:=XMLCfg.GetValue(Path+'FormEditor/GrabberColor/Value',FGrabberColor);
FMarkerColor:=XMLCfg.GetValue(Path+'FormEditor/MarkerColor/Value',FMarkerColor);
FNonFormBackgroundColor:=XMLCfg.GetValue(Path+'FormEditor/NonFormBackgroundColor/Value',FNonFormBackgroundColor);
FRubberbandSelectionColor:=XMLCfg.GetValue(Path+'FormEditor/Rubberband/SelectionColor/Value',
FRubberbandSelectionColor);
FRubberbandCreationColor:=XMLCfg.GetValue(Path+'FormEditor/Rubberband/CreationColor/Value',
FRubberbandCreationColor);
FRubberbandSelectsGrandChilds:=XMLCfg.GetValue(Path+'FormEditor/Rubberband/SelectsGrandChilds/Value',DefaultRubberbandSelectsGrandChilds);
FCreateComponentFocusNameProperty:=XMLCfg.GetValue(
Path+'FormEditor/CreateComponentFocusNameProperty/Value',false);
FSwitchToFavoritesOITab:=XMLCfg.GetValue(Path+'FormEditor/SwitchToFavoritesOITab/Value',false);
FFormTitleBarChangesObjectInspector:=XMLCfg.GetValue(Path+'FormEditor/FormTitleBarChangesObjectInspector/Value',false);
FForceDPIScalingInDesignTime:=XMLCfg.GetValue(Path+'FormEditor/ForceDPIScalingInDesignTime/Value',true);
// component list
FComponentListKeepOpen:=XMLCfg.GetValue(Path+'ComponentList/KeepOpen',false);
FComponentListPageIndex:=XMLCfg.GetValue(Path+'ComponentList/PageIndex',0);
// search result view
FSearchResultViewPathStyle:=StrToMsgWndFilenameStyle(XMLCfg.GetValue(
Path+'SearchResultView/PathStyle',MsgWndFileNameStyleNames[mwfsRelative]));
// object inspector
FObjectInspectorOptions.Load;
FObjectInspectorOptions.SaveBounds:=false;
// messages view
fMsgViewDblClickJumps:=XMLCfg.GetValue(Path+'MsgViewDblClickJumps/Value',false);
fMsgViewFocus:=XMLCfg.GetValue(Path+'MsgViewFocus/Value',DefaultMsgViewFocus);
FShowMessagesIcons:=XMLCfg.GetValue(Path+'MsgView/ShowMessagesIcons/Value',true);
FMsgViewStayOnTop:=XMLCfg.GetValue(Path+'MsgView/StayOnTop/Value',false);
FMsgViewShowTranslations:=XMLCfg.GetValue(Path+'MsgView/ShowTranslations/Value',false);
FMsgViewAlwaysDrawFocused:=XMLCfg.GetValue(Path+'MsgView/AlwaysDrawFocused/Value',false);
FMsgViewFilenameStyle:=StrToMsgWndFilenameStyle(XMLCfg.GetValue(
Path+'MsgView/Filename/Style',MsgWndFileNameStyleNames[mwfsShort]));
for mwc:=low(TMsgWndColor) to high(TMsgWndColor) do
fMsgViewColors[mwc]:=XMLCfg.GetValue(
Path+'MsgView/Colors/'+MsgWndColorNames[mwc],MsgWndDefaultColors[mwc]);
for u:=low(TMessageLineUrgency) to high(TMessageLineUrgency) do
fMsgColors[u] := XMLCfg.GetValue(
Path+'MsgView/MsgColors/'+dbgs(u),clDefault);
FMsgViewFilters.LoadFromXMLConfig(XMLCfg,'MsgView/Filters/');
// IDEEditorGroups
for i := 0 to IDEEditorGroups.Count-1 do
begin
Rec := IDEEditorGroups[i];
NodeName := Rec^.GroupClass.ClassName;
Rec^.Collapsed := XMLCfg.GetValue(Path+'OptionDialog/Tree/' + NodeName + '/Value',
Rec^.DefaultCollapsed);
if Rec^.Items <> nil then begin
for j := 0 to Rec^.Items.Count-1 do begin
Rec^.Items[j]^.Collapsed := XMLCfg.GetValue(Path+'OptionDialog/Tree/' + NodeName
+ '/' + Rec^.Items[j]^.EditorClass.ClassName + '/Value',
Rec^.Items[j]^.DefaultCollapsed);
end;
end;
end;
// auto save
FAutoSaveActiveDesktop:=XMLCfg.GetValue(Path+'AutoSave/ActiveDesktop',True);
// The user can define many desktops. They are saved under path Desktops/.
FDesktops.Clear;
FDesktops.SetConfig(XMLCfg, FConfigStorage);
FActiveDesktopName := '';
if Version<109 then begin
//load old default desktop - backwards compatibility - or create a new default desktop
CurPath := 'Desktop/'; // New place: Desktop/
if not XMLCfg.HasPath(CurPath, True) then
CurPath := Path+'Desktop/'; // Old place: EnvironmentOptions/Desktop/
if XMLCfg.HasPath(CurPath, True) or//default desktop exists in the settings
((ActiveDesktop.IDECoolBarOptions.ToolBars.Count = 0) and
(ActiveDesktop.FIDEDialogLayoutList.Count = 0))//desktop is empty, load it to recreate!
then
begin
ActiveDesktop.SetConfig(XMLCfg, FConfigStorage);
ActiveDesktop.Load(CurPath);
end;
end else begin
CurPath := 'Desktops/';
FDebugDesktopName := XMLCfg.GetValue(CurPath+'DebugDesktop', '');
FActiveDesktopName := XMLCfg.GetValue(CurPath+'ActiveDesktop', '');
j := XMLCfg.GetValue(CurPath+'Count', 1);
for i := 1 to j do
FDesktops.AddFromCfg(CurPath+'Desktop'+IntToStr(i)+'/');
end;
if Version<=109 then begin
XMLCfg.DeletePath('Desktop');
XMLCfg.DeletePath(CurPath+'Desktop');
end;
FDesktop.Assign(ActiveDesktop, False);
FDesktop.ExportSettingsToIDE(Self);
end;
procedure TEnvGuiOptions.WriteToXml(OnlyDesktop: boolean);
var
mwc: TMsgWndColor;
Rec: PIDEOptionsGroupRec;
Path, CurPath, NodeName: String;
u: TMessageLineUrgency;
i, j: Integer;
xSaveDesktop: TCustomDesktopOpt;
xActiveDesktopName: string;
begin
Path:='EnvironmentOptions/';
// hints
XMLCfg.SetDeleteValue(Path+'ShowHintsForComponentPalette/Value',FShowHintsForComponentPalette,true);
XMLCfg.SetDeleteValue(Path+'ShowHintsForMainSpeedButtons/Value',FShowHintsForMainSpeedButtons,true);
// glyphs
XMLCfg.SetDeleteValue(Path+'ShowButtonGlyphs/Value',Ord(FShowButtonGlyphs), Ord(sbgSystem));
XMLCfg.SetDeleteValue(Path+'ShowMenuGlyphs/Value',Ord(FShowMenuGlyphs), Ord(sbgSystem));
// form editor
XMLCfg.SetDeleteValue(Path+'FormEditor/ShowBorderSpacing',FShowBorderSpacing,false);
XMLCfg.SetDeleteValue(Path+'FormEditor/BorderSpacingColor',FBorderSpacingColor,DefaultBorderSpacingColor);
XMLCfg.SetDeleteValue(Path+'FormEditor/ShowGrid',FShowGrid,true);
XMLCfg.SetDeleteValue(Path+'FormEditor/GridColor',FGridColor,DefaultGridColor);
XMLCfg.SetDeleteValue(Path+'FormEditor/SnapToGrid',FSnapToGrid,true);
XMLCfg.SetDeleteValue(Path+'FormEditor/GridSizeX',FGridSizeX,DefaultGridSize);
XMLCfg.SetDeleteValue(Path+'FormEditor/GridSizeY',FGridSizeY,DefaultGridSize);
XMLCfg.SetDeleteValue(Path+'FormEditor/ShowGuideLines',FShowGuideLines,true);
XMLCfg.SetDeleteValue(Path+'FormEditor/SnapToGuideLines',FSnapToGuideLines,true);
XMLCfg.SetDeleteValue(Path+'FormEditor/GuideLineColorLeftTop',FGuideLineColorLeftTop,DefaultGuideLineColorLeftTop);
XMLCfg.SetDeleteValue(Path+'FormEditor/GuideLineColorRightBottom',FGuideLineColorRightBottom,DefaultGuideLineColorRightBottom);
XMLCfg.SetDeleteValue(Path+'FormEditor/ShowComponentCaptions',FShowComponentCaptions,true);
XMLCfg.SetDeleteValue(Path+'FormEditor/ShowEditorHints',FShowEditorHints,true);
XMLCfg.SetDeleteValue(Path+'FormEditor/AutoCreateFormsOnOpen',FAutoCreateFormsOnOpen,true);
XMLCfg.SetDeleteValue(Path+'FormEditor/CheckPackagesOnFormCreate',FCheckPackagesOnFormCreate,true);
XMLCfg.SetDeleteValue(Path+'FormEditor/RightClickSelects',FRightClickSelects,true);
XMLCfg.SetDeleteValue(Path+'FormEditor/GrabberColor/Value',FGrabberColor,clBlack);
XMLCfg.SetDeleteValue(Path+'FormEditor/MarkerColor/Value',FMarkerColor,clDkGray);
XMLCfg.SetDeleteValue(Path+'FormEditor/NonFormBackgroundColor/Value',FNonFormBackgroundColor,clWindow);
XMLCfg.SetDeleteValue(Path+'FormEditor/Rubberband/SelectionColor/Value',
FRubberbandSelectionColor,clBlack);
XMLCfg.SetDeleteValue(Path+'FormEditor/Rubberband/CreationColor/Value',
FRubberbandCreationColor,clRed);
XMLCfg.SetDeleteValue(Path+'FormEditor/Rubberband/SelectsGrandChilds/Value',
FRubberbandSelectsGrandChilds,DefaultRubberbandSelectsGrandChilds);
XMLCfg.SetDeleteValue(Path+'FormEditor/CreateComponentFocusNameProperty/Value',
FCreateComponentFocusNameProperty,false);
XMLCfg.SetDeleteValue(Path+'FormEditor/SwitchToFavoritesOITab/Value',FSwitchToFavoritesOITab,false);
XMLCfg.SetDeleteValue(Path+'FormEditor/FormTitleBarChangesObjectInspector/Value',FFormTitleBarChangesObjectInspector,false);
XMLCfg.SetDeleteValue(Path+'FormEditor/ForceDPIScalingInDesignTime/Value',FForceDPIScalingInDesignTime,true);
// component list
XMLCfg.SetDeleteValue(Path+'ComponentList/KeepOpen',FComponentListKeepOpen,false);
XMLCfg.SetDeleteValue(Path+'ComponentList/PageIndex',FComponentListPageIndex,0);
// search result view
XMLCfg.SetDeleteValue(Path+'SearchResultView/PathStyle',
MsgWndFileNameStyleNames[FSearchResultViewPathStyle],
MsgWndFileNameStyleNames[mwfsRelative]);
// object inspector
FObjectInspectorOptions.SaveBounds:=false;
FObjectInspectorOptions.Save;
// messages view
XMLCfg.SetDeleteValue(Path+'MsgViewDblClickJumps/Value',fMsgViewDblClickJumps,false);
XMLCfg.SetDeleteValue(Path+'MsgViewFocus/Value',fMsgViewFocus,DefaultMsgViewFocus);
XMLCfg.SetDeleteValue(Path+'MsgView/ShowMessagesIcons/Value',FShowMessagesIcons,true);
XMLCfg.SetDeleteValue(Path+'MsgView/StayOnTop/Value',FMsgViewStayOnTop,false);
XMLCfg.SetDeleteValue(Path+'MsgView/ShowTranslations/Value',FMsgViewShowTranslations,false);
XMLCfg.SetDeleteValue(Path+'MsgView/AlwaysDrawFocused/Value',FMsgViewAlwaysDrawFocused,false);
XMLCfg.SetDeleteValue(Path+'MsgView/Filename/Style',
MsgWndFileNameStyleNames[FMsgViewFilenameStyle],
MsgWndFileNameStyleNames[mwfsShort]);
for mwc:=low(TMsgWndColor) to high(TMsgWndColor) do
XMLCfg.SetDeleteValue(Path+'MsgView/Colors/'+MsgWndColorNames[mwc],
fMsgViewColors[mwc],MsgWndDefaultColors[mwc]);
for u:=low(TMessageLineUrgency) to high(TMessageLineUrgency) do
XMLCfg.SetDeleteValue(Path+'MsgView/MsgColors/'+dbgs(u),
fMsgColors[u],clDefault);
MsgViewFilters.SaveToXMLConfig(XMLCfg,'MsgView/Filters/');
// IDEEditorGroups
for i := 0 to IDEEditorGroups.Count-1 do
begin
Rec := IDEEditorGroups[i];
NodeName := Rec^.GroupClass.ClassName;
XMLCfg.SetDeleteValue(Path+'OptionDialog/Tree/' + NodeName + '/Value',
Rec^.Collapsed,
Rec^.DefaultCollapsed);
if Rec^.Items <> nil then begin
for j := 0 to Rec^.Items.Count-1 do begin
XMLCfg.SetDeleteValue(Path+'OptionDialog/Tree/' + NodeName
+ '/' + Rec^.Items[j]^.EditorClass.ClassName + '/Value',
Rec^.Items[j]^.Collapsed,
Rec^.Items[j]^.DefaultCollapsed);
end;
end;
end;
// auto save
XMLCfg.SetDeleteValue(Path+'AutoSave/ActiveDesktop', FAutoSaveActiveDesktop, True);
//automatically save active desktops
if AutoSaveActiveDesktop
and (Application.MainForm<>nil) and Application.MainForm.Visible then
begin
//save active desktop
FDesktop.ImportSettingsFromIDE(Self);
ActiveDesktop.Assign(FDesktop);
if Assigned(FLastDesktopBeforeDebug) then//are we in debug session?
begin
//save last desktop before the debug desktop
xSaveDesktop := FDesktops.Find(FLastDesktopBeforeDebug.Name);
if Assigned(xSaveDesktop) and xSaveDesktop.InheritsFrom(TDesktopOpt) then
TDesktopOpt(xSaveDesktop).Assign(FLastDesktopBeforeDebug, False);
end;
end;
if Assigned(FLastDesktopBeforeDebug) then
xActiveDesktopName := FLastDesktopBeforeDebug.Name
else
xActiveDesktopName := FActiveDesktopName;
// The user can define many desktops. They are saved under path Desktops/.
XMLCfg.DeletePath('Desktops/');
CurPath:='Desktops/';
XMLCfg.SetDeleteValue(CurPath+'Count', FDesktops.Count, 0);
XMLCfg.SetDeleteValue(CurPath+'DebugDesktop', FDebugDesktopName, '');
XMLCfg.SetDeleteValue(CurPath+'ActiveDesktop', xActiveDesktopName, '');
for i := 0 to FDesktops.Count-1 do
begin
FDesktops[i].SetConfig(XMLCfg, FConfigStorage);
FDesktops[i].Save(CurPath+'Desktop'+IntToStr(i+1)+'/');
end;
end;
procedure TEnvGuiOptions.InitConfig;
begin
FreeAndNil(FConfigStorage);
FConfigStorage:=TXMLOptionsStorage.Create(XMLCfg);
ObjectInspectorOptions.ConfigStore:=FConfigStorage;
end;
function _ContainsControl(const _Parent, _Control: TWinControl): Boolean;
var
I: Integer;
begin
for I := 0 to _Parent.ControlCount-1 do
if _Parent.Controls[I] is TWinControl then
if (_Parent.Controls[I] = _Control)
or _ContainsControl(TWinControl(_Parent.Controls[I]), _Control)
then
Exit(True);
Result := False;
end;
procedure TEnvGuiOptions.UseDesktop(ADesktop: TDesktopOpt);
var
xLastFocusControl: TWinControl;
xLastFocusForm: TCustomForm;
s: String;
begin
xLastFocusControl := Screen.ActiveControl;
xLastFocusForm := Screen.ActiveCustomForm;
// needed to get EditorToolBar refreshed! - needed only here in UseDesktop()
EnvironmentOptions.DoBeforeWrite(False);
Desktop.Assign(ADesktop);
ActiveDesktopName := ADesktop.Name;
s := ADesktop.AssociatedDebugDesktopName;
if (s<>'') and Assigned(Desktops.Find(s)) then
DebugDesktopName := s;
Desktop.ExportSettingsToIDE(Self);
EnvironmentOptions.DoAfterWrite(False); // needed to get EditorToolBar refreshed!
Desktop.RestoreDesktop;
//set focus back to the previously focused control
if Screen.CustomFormIndex(xLastFocusForm) >= 0 then
begin //check if form or control hasn't been destroyed
if ((xLastFocusForm = xLastFocusControl) or _ContainsControl(xLastFocusForm, xLastFocusControl))
and xLastFocusForm.CanFocus
and xLastFocusControl.CanFocus
then
xLastFocusControl.SetFocus;
end;
end;
procedure TEnvGuiOptions.EnableDebugDesktop;
begin
if not Assigned(LastDesktopBeforeDebug)
and Assigned(DebugDesktop)
and (DebugDesktop <> ActiveDesktop) then
begin
LastDesktopBeforeDebug := TDesktopOpt.Create(ActiveDesktopName);
if AutoSaveActiveDesktop then
Desktop.ImportSettingsFromIDE(Self);
LastDesktopBeforeDebug.Assign(Desktop, False);
UseDesktop(DebugDesktop);
end;
end;
procedure TEnvGuiOptions.DisableDebugDesktop;
begin
if (LastDesktopBeforeDebug=nil) or (Desktop=nil) then
Exit;
try
if AutoSaveActiveDesktop and Assigned(DebugDesktop) then
begin
Desktop.ImportSettingsFromIDE(Self);
DebugDesktop.Assign(Desktop);
end;
UseDesktop(LastDesktopBeforeDebug);
finally
LastDesktopBeforeDebug.Free;
LastDesktopBeforeDebug:=Nil
end;
end;
class function TEnvGuiOptions.DesktopCanBeLoaded(const aDockMaster: string): Boolean;
begin
Result := (aDockMaster = '') or (
Assigned(IDEDockMaster) and (IDEDockMaster.ClassName = aDockMaster));
end;
function TEnvGuiOptions.GetMsgColors(u: TMessageLineUrgency): TColor;
begin
Result:=fMsgColors[u];
end;
function TEnvGuiOptions.GetMsgViewColors(c: TMsgWndColor): TColor;
begin
Result:=fMsgViewColors[c];
end;
procedure TEnvGuiOptions.SetMsgColors(u: TMessageLineUrgency; AValue: TColor);
begin
fMsgColors[u] := AValue;
end;
procedure TEnvGuiOptions.SetMsgViewColors(c: TMsgWndColor; AValue: TColor);
begin
fMsgViewColors[c]:=AValue;
end;
function TEnvGuiOptions.GetActiveDesktop: TDesktopOpt;
procedure ChooseDefault;
begin
//use default desktop name
if Assigned(IDEDockMaster) then
FActiveDesktopName := 'default docked'//name for desktop with AnchorDocking
else
FActiveDesktopName := 'default';
end;
var
OldActiveDesktopName: string;
OldActiveDesktop, lDskTpOpt: TCustomDesktopOpt;
begin
Result := nil;
if FActiveDesktopName <> '' then
begin
lDskTpOpt := FDesktops.Find(FActiveDesktopName);
if Assigned(lDskTpOpt) and lDskTpOpt.InheritsFrom(TDesktopOpt) and lDskTpOpt.Compatible then
Exit(TDesktopOpt(lDskTpOpt));
end;
//the selected desktop is unsupported (docked/undocked)
// -> use default
OldActiveDesktopName := FActiveDesktopName;
ChooseDefault;
lDskTpOpt := FDesktops.Find(FActiveDesktopName);
if Assigned(lDskTpOpt) and lDskTpOpt.InheritsFrom(TDesktopOpt) then
if lDskTpOpt.Compatible then
Exit(TDesktopOpt(lDskTpOpt))
else
Result := TDesktopOpt(lDskTpOpt);
//recreate desktop with ActiveDesktopName
if Assigned(Result) then
FDesktops.Remove(Result);
Result := TDesktopOpt.Create(FActiveDesktopName);
FDesktops.Add(Result);
Result.Assign(FDesktop);
if Assigned(IDEDockMaster) then
Result.FDockedOpt.LoadDefaults;
OldActiveDesktop := FDesktops.Find(OldActiveDesktopName);
if not (OldActiveDesktop is TDesktopOpt) then
begin
lDskTpOpt := FDesktops.Find('default');
if Assigned(lDskTpOpt) and lDskTpOpt.InheritsFrom(TDesktopOpt) and lDskTpOpt.Compatible then
OldActiveDesktop := TDesktopOpt(lDskTpOpt)
else
OldActiveDesktop := nil;
end;
if Assigned(OldActiveDesktop) then
Result.Assign(TDesktopOpt(OldActiveDesktop), False, False);
end;
function TEnvGuiOptions.GetDebugDesktop: TDesktopOpt;
var
lDskTpOpt: TCustomDesktopOpt;
begin
Result := nil;
if FDebugDesktopName <> '' then
begin
lDskTpOpt := FDesktops.Find(FDebugDesktopName);
if Assigned(lDskTpOpt) //do not mix docked/undocked desktops
and lDskTpOpt.InheritsFrom(TDesktopOpt) and lDskTpOpt.Compatible then
Result := TDesktopOpt(lDskTpOpt);
end;
end;
end.
|