Changeset 1679 for cprs/trunk/CPRS-Chart/Templates
- Timestamp:
- May 7, 2015, 12:34:29 PM (10 years ago)
- Location:
- cprs/trunk/CPRS-Chart/Templates
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
cprs/trunk/CPRS-Chart/Templates/fTemplateDialog.dfm
r829 r1679 11 11 OnCreate = FormCreate 12 12 OnDestroy = FormDestroy 13 OnMouseWheel = FormMouseWheel 13 14 OnPaint = FormPaint 14 15 OnShow = FormShow -
cprs/trunk/CPRS-Chart/Templates/fTemplateDialog.pas
r829 r1679 28 28 procedure FormClose(Sender: TObject; var Action: TCloseAction); 29 29 procedure FormShow(Sender: TObject); 30 procedure FormMouseWheel(Sender: TObject; Shift: TShiftState; 31 WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean); 30 32 private 31 33 FFirstBuild: boolean; … … 71 73 procedure CheckBoilerplate4Fields(SL: TStrings; const CaptionText: string = ''; PreviewMode: boolean = FALSE); overload; 72 74 procedure CheckBoilerplate4Fields(var AText: string; const CaptionText: string = ''; PreviewMode: boolean = FALSE); overload; 75 procedure ShutdownTemplateDialog; 73 76 74 77 var … … 81 84 82 85 {$R *.DFM} 86 87 var 88 uTemplateDialogRunning: boolean = false; 83 89 84 90 const … … 289 295 end; 290 296 297 procedure ShutdownTemplateDialog; 298 begin 299 if uTemplateDialogRunning and assigned(frmTemplateDialog) then 300 begin 301 frmTemplateDialog.Silent := True; 302 frmTemplateDialog.ModalResult := mrCancel; 303 end; 304 end; 305 291 306 procedure CheckBoilerplate4Fields(SL: TStrings; const CaptionText: string = ''; PreviewMode: boolean = FALSE); 292 307 begin … … 689 704 procedure TfrmTemplateDialog.FormCreate(Sender: TObject); 690 705 begin 706 uTemplateDialogRunning := True; 691 707 FFirstBuild := TRUE; 692 708 BuildIdx := TStringList.Create; … … 695 711 FOldHintEvent := Application.OnShowHint; 696 712 Application.OnShowHint := AppShowHint; 697 ResizeAnchoredFormToFont(Self);713 //ResizeAnchoredFormToFont(Self); 698 714 FMaxPnlWidth := FontWidthPixel(sbMain.Font.Handle) * MAX_ENTRY_WIDTH; //AGP change Template Dialog to wrap at 80 instead of 74 699 715 SetFormPosition(Self); 716 ResizeAnchoredFormToFont(Self); 700 717 SizeFormToCancelBtn(); 701 718 end; … … 720 737 Entries.Free; 721 738 BuildIdx.Free; 739 uTemplateDialogRunning := False; 740 end; 741 742 procedure TfrmTemplateDialog.FormMouseWheel(Sender: TObject; Shift: TShiftState; 743 WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean); 744 begin 745 If RectContains(sbMain.BoundsRect, SbMain.ScreenToClient(MousePos)) then 746 begin 747 ScrollControl(sbMain, (WheelDelta > 0)); 748 Handled := True; 749 end; 722 750 end; 723 751 -
cprs/trunk/CPRS-Chart/Templates/fTemplateEditor.dfm
r829 r1679 6 6 BorderIcons = [biSystemMenu, biMaximize] 7 7 Caption = 'Template Editor' 8 ClientHeight = 4508 ClientHeight = 562 9 9 ClientWidth = 740 10 10 Position = poScreenCenter … … 16 16 OnShow = FormShow 17 17 ExplicitWidth = 748 18 ExplicitHeight = 47718 ExplicitHeight = 596 19 19 PixelsPerInch = 96 20 20 TextHeight = 13 … … 29 29 Beveled = True 30 30 MinSize = 40 31 OnCanResize = splMainCanResize 31 32 OnMoved = splMainMoved 32 33 end 33 object splNotes: TSplitter [1] 34 Left = 0 35 Top = 377 36 Width = 740 37 Height = 3 38 Cursor = crVSplit 39 Align = alBottom 40 AutoSnap = False 41 Beveled = True 42 Visible = False 43 OnMoved = splBoilMoved 44 ExplicitTop = 371 45 end 46 object pnlBottom: TPanel [2] 47 Left = 0 48 Top = 423 49 Width = 740 50 Height = 27 51 Align = alBottom 52 BevelOuter = bvNone 53 TabOrder = 4 54 ExplicitTop = 416 55 DesignSize = ( 56 740 57 27) 58 object btnApply: TButton 59 Left = 664 60 Top = 4 61 Width = 75 62 Height = 22 63 Anchors = [akTop, akRight] 64 Caption = 'Apply' 65 ParentShowHint = False 66 ShowHint = False 67 TabOrder = 5 68 OnClick = btnApplyClick 69 end 70 object btnCancel: TButton 71 Left = 584 72 Top = 4 73 Width = 75 74 Height = 22 75 Anchors = [akTop, akRight] 76 Cancel = True 77 Caption = 'Cancel' 78 ModalResult = 2 79 ParentShowHint = False 80 ShowHint = False 81 TabOrder = 4 82 OnClick = btnCancelClick 83 end 84 object btnOK: TButton 85 Left = 504 86 Top = 4 87 Width = 75 88 Height = 22 89 Anchors = [akTop, akRight] 90 Caption = 'OK' 91 ParentShowHint = False 92 ShowHint = False 93 TabOrder = 3 94 OnClick = btnOKClick 95 end 96 object cbEditShared: TCheckBox 97 Left = 0 98 Top = 6 99 Width = 129 100 Height = 17 101 Caption = 'E&dit Shared Templates' 102 TabOrder = 0 103 OnClick = cbEditSharedClick 104 end 105 object cbNotes: TCheckBox 106 Left = 259 107 Top = 6 108 Width = 128 109 Height = 17 110 Hint = 111 'Keep notes about a template that can be seen from the templates ' + 112 'drawer' 113 Caption = 'Sh&ow Template Notes' 114 ParentShowHint = False 115 ShowHint = True 116 TabOrder = 2 117 OnClick = cbNotesClick 118 end 119 object cbEditUser: TCheckBox 120 Left = 132 121 Top = 6 122 Width = 123 123 Height = 17 124 Caption = 'E&dit User'#39's Templates' 125 TabOrder = 1 126 Visible = False 127 OnClick = cbEditSharedClick 128 end 129 end 130 object pnlBoilerplate: TPanel [3] 131 Left = 0 132 Top = 284 133 Width = 740 134 Height = 93 135 Align = alClient 136 BevelOuter = bvNone 137 TabOrder = 2 138 OnCanResize = pnlBoilerplateCanResize 139 OnResize = pnlBoilerplateResize 140 object splBoil: TSplitter 141 Left = 0 142 Top = 14 143 Width = 740 144 Height = 3 145 Cursor = crVSplit 146 Align = alTop 147 AutoSnap = False 148 Beveled = True 149 Visible = False 150 OnMoved = splBoilMoved 151 ExplicitTop = 43 152 end 153 object reBoil: TRichEdit 154 Left = 0 155 Top = 17 156 Width = 740 157 Height = 30 158 Align = alClient 159 Font.Charset = ANSI_CHARSET 160 Font.Color = clWindowText 161 Font.Height = -11 162 Font.Name = 'Courier New' 163 Font.Style = [] 164 Constraints.MinHeight = 30 165 ParentFont = False 166 PlainText = True 167 PopupMenu = popBoilerplate 168 ScrollBars = ssBoth 169 TabOrder = 1 170 WantTabs = True 171 OnChange = reBoilChange 172 OnKeyDown = reBoilKeyDown 173 OnKeyPress = reBoilKeyPress 174 OnKeyUp = reBoilKeyUp 175 OnResizeRequest = reResizeRequest 176 OnSelectionChange = reBoilSelectionChange 177 ExplicitTop = 14 178 end 179 object pnlGroupBP: TPanel 180 Left = 0 181 Top = 47 182 Width = 740 183 Height = 46 184 Align = alBottom 185 BevelOuter = bvNone 186 TabOrder = 2 187 Visible = False 188 object lblGroupBP: TLabel 189 Left = 0 190 Top = 0 191 Width = 740 192 Height = 13 193 Align = alTop 194 Caption = 'Group Boilerplate' 195 ExplicitWidth = 81 196 end 197 object lblGroupRow: TLabel 198 Left = 264 199 Top = 0 200 Width = 23 201 Height = 13 202 Caption = 'Line:' 203 end 204 object lblGroupCol: TLabel 205 Left = 336 206 Top = 0 207 Width = 38 208 Height = 13 209 Caption = 'Column:' 210 end 211 object reGroupBP: TRichEdit 212 Left = 0 213 Top = 16 214 Width = 740 215 Height = 30 216 Align = alClient 217 Color = clCream 218 Font.Charset = ANSI_CHARSET 219 Font.Color = clWindowText 220 Font.Height = -11 221 Font.Name = 'Courier New' 222 Font.Style = [] 223 Constraints.MinHeight = 30 224 ParentFont = False 225 PlainText = True 226 PopupMenu = popGroup 227 ReadOnly = True 228 ScrollBars = ssBoth 229 TabOrder = 0 230 WantReturns = False 231 OnSelectionChange = reGroupBPSelectionChange 232 end 233 object pnlGroupBPGap: TPanel 234 Left = 0 235 Top = 13 236 Width = 740 237 Height = 3 238 Align = alTop 239 BevelOuter = bvNone 240 TabOrder = 1 241 end 242 end 243 object pnlBP: TPanel 244 Left = 0 245 Top = 0 246 Width = 740 247 Height = 14 248 Align = alTop 249 BevelOuter = bvNone 250 TabOrder = 0 251 object lblBoilerplate: TLabel 252 Left = 0 253 Top = 0 254 Width = 96 255 Height = 13 256 Caption = 'Template &Boilerplate' 257 FocusControl = reBoil 258 end 259 object lblBoilRow: TLabel 260 Left = 264 261 Top = 0 262 Width = 23 263 Height = 13 264 Caption = 'Line:' 265 end 266 object lblBoilCol: TLabel 267 Left = 336 268 Top = 0 269 Width = 38 270 Height = 13 271 Caption = 'Column:' 272 Color = clBtnFace 273 ParentColor = False 274 end 275 object cbLongLines: TCheckBox 276 Left = 120 277 Top = -2 278 Width = 105 279 Height = 17 280 Caption = 'Allow Lon&g Lines' 281 TabOrder = 0 282 OnClick = cbLongLinesClick 283 end 284 end 285 end 286 object pnlTop: TPanel [4] 34 object pnlTop: TPanel [1] 287 35 Left = 0 288 36 Top = 0 … … 1216 964 Align = alLeft 1217 965 AutoSize = True 1218 ButtonHeight = 211219 ButtonWidth = 43966 ButtonHeight = 0 967 ButtonWidth = 0 1220 968 Caption = 'mbMain' 1221 969 Menu = mnuMain … … 1227 975 end 1228 976 end 1229 object pnlNotes: TPanel [5] 1230 Left = 0 1231 Top = 380 1232 Width = 740 1233 Height = 43 1234 Align = alBottom 1235 BevelOuter = bvNone 1236 TabOrder = 3 1237 Visible = False 1238 object lblNotes: TLabel 1239 Left = 0 1240 Top = 0 1241 Width = 740 1242 Height = 13 1243 Align = alTop 1244 Caption = 'Template Notes:' 1245 ExplicitWidth = 78 1246 end 1247 object reNotes: TRichEdit 1248 Left = 0 1249 Top = 13 1250 Width = 740 1251 Height = 30 1252 Align = alClient 1253 Font.Charset = ANSI_CHARSET 1254 Font.Color = clWindowText 1255 Font.Height = -11 1256 Font.Name = 'Courier New' 1257 Font.Style = [] 1258 Constraints.MinHeight = 30 1259 ParentFont = False 1260 PlainText = True 1261 PopupMenu = popNotes 1262 ScrollBars = ssBoth 1263 TabOrder = 0 1264 WantTabs = True 1265 OnChange = reNotesChange 1266 OnKeyDown = reBoilKeyDown 1267 OnKeyPress = reBoilKeyPress 1268 OnKeyUp = reBoilKeyUp 1269 OnResizeRequest = reResizeRequest 1270 end 1271 end 1272 object pnlCOM: TPanel [6] 977 object pnlCOM: TPanel [2] 1273 978 Left = 0 1274 979 Top = 263 … … 1335 1040 end 1336 1041 end 1337 object pnlLink: TPanel [ 7]1042 object pnlLink: TPanel [3] 1338 1043 Left = 0 1339 1044 Top = 242 … … 1342 1047 Align = alTop 1343 1048 BevelOuter = bvNone 1344 TabOrder = 51049 TabOrder = 3 1345 1050 Visible = False 1346 1051 object lblLink: TLabel … … 1379 1084 TabOrder = 0 1380 1085 TabStop = True 1381 On Change = cbxLinkChange1086 OnExit = cbxLinkExit 1382 1087 OnNeedData = cbxLinkNeedData 1383 1088 CharsNeedMatch = 1 1089 end 1090 end 1091 object Panel1: TPanel [4] 1092 Left = 0 1093 Top = 284 1094 Width = 740 1095 Height = 251 1096 Align = alClient 1097 TabOrder = 4 1098 ExplicitLeft = 138 1099 ExplicitTop = 221 1100 object pnlBoilerplate: TPanel 1101 Left = 1 1102 Top = 1 1103 Width = 738 1104 Height = 249 1105 Align = alClient 1106 BevelOuter = bvNone 1107 TabOrder = 0 1108 OnCanResize = pnlBoilerplateCanResize 1109 OnResize = pnlBoilerplateResize 1110 ExplicitLeft = 17 1111 ExplicitTop = 2 1112 object splBoil: TSplitter 1113 Left = 0 1114 Top = 14 1115 Width = 738 1116 Height = 3 1117 Cursor = crVSplit 1118 Align = alTop 1119 AutoSnap = False 1120 Beveled = True 1121 Visible = False 1122 OnMoved = splBoilMoved 1123 ExplicitTop = 43 1124 ExplicitWidth = 740 1125 end 1126 object splNotes: TSplitter 1127 Left = 0 1128 Top = 203 1129 Width = 738 1130 Height = 3 1131 Cursor = crVSplit 1132 Align = alBottom 1133 AutoSnap = False 1134 Beveled = True 1135 Visible = False 1136 OnMoved = splBoilMoved 1137 ExplicitTop = 132 1138 ExplicitWidth = 740 1139 end 1140 object reBoil: TRichEdit 1141 Left = 0 1142 Top = 17 1143 Width = 738 1144 Height = 140 1145 Align = alClient 1146 Font.Charset = ANSI_CHARSET 1147 Font.Color = clWindowText 1148 Font.Height = -11 1149 Font.Name = 'Courier New' 1150 Font.Style = [] 1151 Constraints.MinHeight = 30 1152 ParentFont = False 1153 PlainText = True 1154 PopupMenu = popBoilerplate 1155 ScrollBars = ssBoth 1156 TabOrder = 1 1157 WantTabs = True 1158 OnChange = reBoilChange 1159 OnKeyDown = reBoilKeyDown 1160 OnKeyPress = reBoilKeyPress 1161 OnKeyUp = reBoilKeyUp 1162 OnResizeRequest = reResizeRequest 1163 OnSelectionChange = reBoilSelectionChange 1164 end 1165 object pnlGroupBP: TPanel 1166 Left = 0 1167 Top = 157 1168 Width = 738 1169 Height = 46 1170 Align = alBottom 1171 BevelOuter = bvNone 1172 Constraints.MinHeight = 30 1173 TabOrder = 2 1174 Visible = False 1175 ExplicitLeft = -1 1176 ExplicitTop = 154 1177 object lblGroupBP: TLabel 1178 Left = 0 1179 Top = 0 1180 Width = 738 1181 Height = 13 1182 Align = alTop 1183 Caption = 'Group Boilerplate' 1184 ExplicitWidth = 81 1185 end 1186 object lblGroupRow: TLabel 1187 Left = 264 1188 Top = 0 1189 Width = 23 1190 Height = 13 1191 Caption = 'Line:' 1192 end 1193 object lblGroupCol: TLabel 1194 Left = 336 1195 Top = 0 1196 Width = 38 1197 Height = 13 1198 Caption = 'Column:' 1199 end 1200 object reGroupBP: TRichEdit 1201 Left = 0 1202 Top = 16 1203 Width = 738 1204 Height = 30 1205 Align = alClient 1206 Color = clCream 1207 Font.Charset = ANSI_CHARSET 1208 Font.Color = clWindowText 1209 Font.Height = -11 1210 Font.Name = 'Courier New' 1211 Font.Style = [] 1212 Constraints.MinHeight = 30 1213 ParentFont = False 1214 PlainText = True 1215 PopupMenu = popGroup 1216 ReadOnly = True 1217 ScrollBars = ssBoth 1218 TabOrder = 0 1219 WantReturns = False 1220 OnSelectionChange = reGroupBPSelectionChange 1221 end 1222 object pnlGroupBPGap: TPanel 1223 Left = 0 1224 Top = 13 1225 Width = 738 1226 Height = 3 1227 Align = alTop 1228 BevelOuter = bvNone 1229 TabOrder = 1 1230 end 1231 end 1232 object pnlBP: TPanel 1233 Left = 0 1234 Top = 0 1235 Width = 738 1236 Height = 14 1237 Align = alTop 1238 BevelOuter = bvNone 1239 TabOrder = 0 1240 object lblBoilerplate: TLabel 1241 Left = 0 1242 Top = 0 1243 Width = 96 1244 Height = 13 1245 Caption = 'Template &Boilerplate' 1246 FocusControl = reBoil 1247 end 1248 object lblBoilRow: TLabel 1249 Left = 264 1250 Top = 0 1251 Width = 23 1252 Height = 13 1253 Caption = 'Line:' 1254 end 1255 object lblBoilCol: TLabel 1256 Left = 336 1257 Top = 0 1258 Width = 38 1259 Height = 13 1260 Caption = 'Column:' 1261 Color = clBtnFace 1262 ParentColor = False 1263 end 1264 object cbLongLines: TCheckBox 1265 Left = 120 1266 Top = -2 1267 Width = 105 1268 Height = 17 1269 Caption = 'Allow Lon&g Lines' 1270 TabOrder = 0 1271 OnClick = cbLongLinesClick 1272 end 1273 end 1274 object pnlNotes: TPanel 1275 Left = 0 1276 Top = 206 1277 Width = 738 1278 Height = 43 1279 Align = alBottom 1280 BevelOuter = bvNone 1281 Constraints.MinHeight = 30 1282 TabOrder = 3 1283 Visible = False 1284 ExplicitTop = 158 1285 object lblNotes: TLabel 1286 Left = 0 1287 Top = 0 1288 Width = 78 1289 Height = 13 1290 Align = alTop 1291 Caption = 'Template Notes:' 1292 end 1293 object reNotes: TRichEdit 1294 Left = 0 1295 Top = 13 1296 Width = 738 1297 Height = 30 1298 Align = alClient 1299 Font.Charset = ANSI_CHARSET 1300 Font.Color = clWindowText 1301 Font.Height = -11 1302 Font.Name = 'Courier New' 1303 Font.Style = [] 1304 Constraints.MinHeight = 30 1305 ParentFont = False 1306 PlainText = True 1307 PopupMenu = popNotes 1308 ScrollBars = ssBoth 1309 TabOrder = 0 1310 WantTabs = True 1311 OnChange = reNotesChange 1312 OnKeyDown = reBoilKeyDown 1313 OnKeyPress = reBoilKeyPress 1314 OnKeyUp = reBoilKeyUp 1315 OnResizeRequest = reResizeRequest 1316 end 1317 end 1318 end 1319 end 1320 object pnlBottom: TPanel [5] 1321 Left = 0 1322 Top = 535 1323 Width = 740 1324 Height = 27 1325 Align = alBottom 1326 BevelOuter = bvNone 1327 TabOrder = 2 1328 ExplicitLeft = 40 1329 ExplicitTop = 498 1330 DesignSize = ( 1331 740 1332 27) 1333 object btnApply: TButton 1334 Left = 664 1335 Top = 4 1336 Width = 75 1337 Height = 22 1338 Anchors = [akTop, akRight] 1339 Caption = 'Apply' 1340 ParentShowHint = False 1341 ShowHint = False 1342 TabOrder = 5 1343 OnClick = btnApplyClick 1344 end 1345 object btnCancel: TButton 1346 Left = 584 1347 Top = 4 1348 Width = 75 1349 Height = 22 1350 Anchors = [akTop, akRight] 1351 Cancel = True 1352 Caption = 'Cancel' 1353 ModalResult = 2 1354 ParentShowHint = False 1355 ShowHint = False 1356 TabOrder = 4 1357 OnClick = btnCancelClick 1358 end 1359 object btnOK: TButton 1360 Left = 504 1361 Top = 4 1362 Width = 75 1363 Height = 22 1364 Anchors = [akTop, akRight] 1365 Caption = 'OK' 1366 ParentShowHint = False 1367 ShowHint = False 1368 TabOrder = 3 1369 OnClick = btnOKClick 1370 end 1371 object cbEditShared: TCheckBox 1372 Left = 0 1373 Top = 6 1374 Width = 129 1375 Height = 17 1376 Caption = 'E&dit Shared Templates' 1377 TabOrder = 0 1378 OnClick = cbEditSharedClick 1379 end 1380 object cbNotes: TCheckBox 1381 Left = 259 1382 Top = 6 1383 Width = 128 1384 Height = 17 1385 Hint = 1386 'Keep notes about a template that can be seen from the templates ' + 1387 'drawer' 1388 Caption = 'Sh&ow Template Notes' 1389 ParentShowHint = False 1390 ShowHint = True 1391 TabOrder = 2 1392 OnClick = cbNotesClick 1393 end 1394 object cbEditUser: TCheckBox 1395 Left = 132 1396 Top = 6 1397 Width = 123 1398 Height = 17 1399 Caption = 'E&dit User'#39's Templates' 1400 TabOrder = 1 1401 Visible = False 1402 OnClick = cbEditSharedClick 1384 1403 end 1385 1404 end … … 1408 1427 'Status = stsDefault') 1409 1428 ( 1410 'Component = pnlBoilerplate'1411 'Status = stsDefault')1412 (1413 'Component = reBoil'1414 'Label = lblBoilerplate'1415 'Status = stsOK')1416 (1417 'Component = pnlGroupBP'1418 'Status = stsDefault')1419 (1420 'Component = reGroupBP'1421 'Label = lblGroupBP'1422 'Status = stsOK')1423 (1424 'Component = pnlGroupBPGap'1425 'Status = stsDefault')1426 (1427 'Component = pnlBP'1428 'Status = stsDefault')1429 (1430 'Component = cbLongLines'1431 'Status = stsDefault')1432 (1433 1429 'Component = pnlTop' 1434 1430 'Status = stsDefault') … … 1602 1598 'Status = stsDefault') 1603 1599 ( 1604 'Component = pnlNotes'1605 'Status = stsDefault')1606 (1607 'Component = reNotes'1608 'Label = lblNotes'1609 'Status = stsOK')1610 (1611 1600 'Component = pnlCOM' 1612 1601 'Status = stsDefault') … … 1628 1617 ( 1629 1618 'Component = frmTemplateEditor' 1619 'Status = stsDefault') 1620 ( 1621 'Component = Panel1' 1622 'Status = stsDefault') 1623 ( 1624 'Component = pnlBoilerplate' 1625 'Status = stsDefault') 1626 ( 1627 'Component = reBoil' 1628 'Status = stsDefault') 1629 ( 1630 'Component = pnlGroupBP' 1631 'Status = stsDefault') 1632 ( 1633 'Component = reGroupBP' 1634 'Status = stsDefault') 1635 ( 1636 'Component = pnlGroupBPGap' 1637 'Status = stsDefault') 1638 ( 1639 'Component = pnlBP' 1640 'Status = stsDefault') 1641 ( 1642 'Component = cbLongLines' 1643 'Status = stsDefault') 1644 ( 1645 'Component = pnlNotes' 1646 'Status = stsDefault') 1647 ( 1648 'Component = reNotes' 1630 1649 'Status = stsDefault')) 1631 1650 end -
cprs/trunk/CPRS-Chart/Templates/fTemplateEditor.pas
r829 r1679 31 31 btnCancel: TButton; 32 32 btnOK: TButton; 33 pnlBoilerplate: TPanel;34 reBoil: TRichEdit;35 33 pnlTop: TPanel; 36 34 pnlRightTop: TPanel; … … 66 64 mnuBPErrorCheck: TMenuItem; 67 65 mnuBPSpellCheck: TMenuItem; 68 pnlGroupBP: TPanel;69 reGroupBP: TRichEdit;70 lblGroupBP: TLabel;71 splBoil: TSplitter;72 pnlGroupBPGap: TPanel;73 66 tmrAutoScroll: TTimer; 74 67 popGroup: TPopupMenu; … … 154 147 mnuAutoGen: TMenuItem; 155 148 mnuNodeAutoGen: TMenuItem; 156 pnlNotes: TPanel;157 reNotes: TRichEdit;158 splNotes: TSplitter;159 lblNotes: TLabel;160 149 popNotes: TPopupMenu; 161 150 mnuNotesUndo: TMenuItem; … … 193 182 N17: TMenuItem; 194 183 mnuTemplateIconLegend: TMenuItem; 195 pnlBP: TPanel;196 lblBoilerplate: TLabel;197 cbLongLines: TCheckBox;198 184 cbLock: TORCheckBox; 199 185 mnuRefresh: TMenuItem; 200 lblBoilRow: TLabel;201 lblGroupRow: TLabel;202 lblBoilCol: TLabel;203 lblGroupCol: TLabel;204 186 pnlCOM: TPanel; 205 187 lblCOMParam: TLabel; … … 211 193 lblLink: TLabel; 212 194 imgLblTemplates: TVA508ImageListLabeler; 195 Panel1: TPanel; 196 pnlBoilerplate: TPanel; 197 splBoil: TSplitter; 198 splNotes: TSplitter; 199 reBoil: TRichEdit; 200 pnlGroupBP: TPanel; 201 lblGroupBP: TLabel; 202 lblGroupRow: TLabel; 203 lblGroupCol: TLabel; 204 reGroupBP: TRichEdit; 205 pnlGroupBPGap: TPanel; 206 pnlBP: TPanel; 207 lblBoilerplate: TLabel; 208 lblBoilRow: TLabel; 209 lblBoilCol: TLabel; 210 cbLongLines: TCheckBox; 211 pnlNotes: TPanel; 212 lblNotes: TLabel; 213 reNotes: TRichEdit; 213 214 procedure btnNewClick(Sender: TObject); 214 215 procedure btnApplyClick(Sender: TObject); 215 216 procedure FormCreate(Sender: TObject); 216 procedure cboOwnerNeedData(Sender: TObject; const StartFrom: String;217 procedure cboOwnerNeedData(Sender: TObject; const StartFrom: string; 217 218 Direction, InsertAt: Integer); 218 219 procedure cboOwnerChange(Sender: TObject); … … 232 233 procedure tvTreeEnter(Sender: TObject); 233 234 procedure tvTreeNodeEdited(Sender: TObject; Node: TTreeNode; 234 var S: String);235 var S: string); 235 236 procedure cbShHideClick(Sender: TObject); 236 237 procedure cbPerHideClick(Sender: TObject); … … 338 339 procedure cbxCOMObjChange(Sender: TObject); 339 340 procedure edtCOMParamChange(Sender: TObject); 340 procedure cbxLinkNeedData(Sender: TObject; const StartFrom: String;341 procedure cbxLinkNeedData(Sender: TObject; const StartFrom: string; 341 342 Direction, InsertAt: Integer); 342 procedure cbxLink Change(Sender: TObject);343 procedure cbxLinkExit(Sender: TObject); 343 344 procedure reBoilKeyUp(Sender: TObject; var Key: Word; 344 345 Shift: TShiftState); … … 347 348 Shift: TShiftState); 348 349 procedure FormClose(Sender: TObject; var Action: TCloseAction); 350 procedure splMainCanResize(Sender: TObject; var NewSize: Integer; 351 var Accept: Boolean); 349 352 private 350 353 FLastRect: TRect; … … 366 369 FCurTree: TTreeView; 367 370 FTreeControl: array[TTemplateTreeType, TTemplateTreeControl] of TControl; 368 FInternalHiddenExpand :boolean;371 FInternalHiddenExpand: boolean; 369 372 FFindShOn: boolean; 370 373 FFindShNext: boolean; … … 451 454 PropText = ' Template Properties '; 452 455 // GroupTag = 5; 453 BPDisplayOnlyFld 454 BPFirstLineFld 455 BPOneItemOnlyFld 456 BPDisplayOnlyFld = 0; 457 BPFirstLineFld = 1; 458 BPOneItemOnlyFld = 2; 456 459 BPHideDlgItemsFld = 3; 457 BPHideItemsFld 458 BPIndentFld 459 BPLockFld 460 BPHideItemsFld = 4; 461 BPIndentFld = 5; 462 BPLockFld = 6; 460 463 NoIE5 = 'You must have Internet Explorer 5 or better installed to %s Templates'; 461 464 NoIE5Header = 'Need Internet Explorer 5'; 462 VK_A 463 VK_C 464 VK_E 465 VK_F 466 VK_G 467 VK_I 468 VK_S 469 VK_T 470 VK_V 471 VK_X 472 VK_Z 465 VK_A = Ord('A'); 466 VK_C = Ord('C'); 467 VK_E = Ord('E'); 468 VK_F = Ord('F'); 469 VK_G = Ord('G'); 470 VK_I = Ord('I'); 471 VK_S = Ord('S'); 472 VK_T = Ord('T'); 473 VK_V = Ord('V'); 474 VK_X = Ord('X'); 475 VK_Z = Ord('Z'); 473 476 474 477 type … … 481 484 482 485 TypeTag: array[TTypeIndex] of TTemplateType = (ttDoc, ttClass, ttGroup, ttDialog, ttDoc, ttDoc); 483 ForcedIdx: array[boolean, TTypeIndex] of integer = ((0, 1,2,3,4,5),(-1,0,1,2,-1,-1));486 ForcedIdx: array[boolean, TTypeIndex] of integer = ((0, 1, 2, 3, 4, 5), (-1, 0, 1, 2, -1, -1)); 484 487 IdxForced: array[boolean, 0..5] of TTypeIndex = ((tiTemplate, tiFolder, tiGroup, tiDialog, tiRemDlg, tiCOMObj), 485 488 (tiFolder, tiGroup, tiDialog, tiNone, tiNone, tiNone)); 486 489 iMessage = 'This template has one or more new fields, and you are not authorized to create new fields. ' + 487 488 490 'If you continue, the program will import the new template without the new fields. Do you wish ' + 491 'to do this?'; 489 492 iMessage2 = 'The imported template fields had XML errors. '; 490 493 iMessage3 = 'No Fields were imported.'; … … 495 498 496 499 procedure EditTemplates(Form: TForm; NewTemplate: boolean = FALSE; 497 500 CopiedText: string = ''; Shared: boolean = FALSE); 498 501 var 499 502 frmTemplateEditor: TfrmTemplateEditor; … … 504 507 505 508 begin 506 if (UserTemplateAccessLevel in [taReadOnly, taNone]) then exit;509 if (UserTemplateAccessLevel in [taReadOnly, taNone]) then exit; 507 510 508 511 ExpandStr := ''; 509 512 SelectStr := ''; 510 513 Drawers := nil; 511 if (not NewTemplate) and (CopiedText = '') then514 if (not NewTemplate) and (CopiedText = '') then 512 515 begin 513 516 if Form is TfrmDrawers then 514 517 Drawers := TFrmDrawers(Form) 515 518 else 516 if IsPublishedProp(Form, DrawersProperty) then517 Drawers := TFrmDrawers(GetOrdProp(Form, DrawersProperty));519 if IsPublishedProp(Form, DrawersProperty) then 520 Drawers := TFrmDrawers(GetOrdProp(Form, DrawersProperty)); 518 521 end; 519 522 … … 521 524 begin 522 525 ExpandStr := Drawers.tvTemplates.GetExpandedIDStr(1, ';'); 523 SelectStr := Drawers.tvTemplates.GetNodeID(TORTreeNode(Drawers.tvTemplates.Selected), 1,';');526 SelectStr := Drawers.tvTemplates.GetNodeID(TORTreeNode(Drawers.tvTemplates.Selected), 1, ';'); 524 527 end; 525 528 … … 533 536 reNotes.Font.Size := Form.Font.Size; 534 537 dmodShared.ExpandTree(tvShared, ExpandStr, FSharedEmptyNodeCount); 535 SelNode := tvShared.FindPieceNode(SelectStr, 1,';');538 SelNode := tvShared.FindPieceNode(SelectStr, 1, ';'); 536 539 SelShared := assigned(SelNode); 537 540 dmodShared.ExpandTree(tvPersonal, ExpandStr, FPersonalEmptyNodeCount); 538 541 if not SelShared then 539 SelNode := tvPersonal.FindPieceNode(SelectStr, 1,';');540 541 if (SelShared and (not Shared)) then542 SelNode := tvPersonal.FindPieceNode(SelectStr, 1, ';'); 543 544 if (SelShared and (not Shared)) then 542 545 Shared := TRUE; 543 546 544 if (Shared and (UserTemplateAccessLevel = taEditor)) then547 if (Shared and (UserTemplateAccessLevel = taEditor)) then 545 548 begin 546 549 cbEditShared.Checked := TRUE; … … 552 555 end 553 556 else 554 if(not SelShared) and (assigned(SelNode)) then555 tvPersonal.Selected := SelNode;556 if (NewTemplate) then557 if (not SelShared) and (assigned(SelNode)) then 558 tvPersonal.Selected := SelNode; 559 if (NewTemplate) then 557 560 begin 558 561 btnNewClick(frmTemplateEditor); 559 if (CopiedText <> '') then562 if (CopiedText <> '') then 560 563 begin 561 564 TTemplate(FBtnNewNode.Data).Boilerplate := CopiedText; … … 580 583 581 584 begin 582 if ((assigned(FCurTree)) and (assigned(FCurTree.Selected))) then583 begin 584 if (FCurTree = tvShared) and (FCanEditShared) then585 if ((assigned(FCurTree)) and (assigned(FCurTree.Selected))) then 586 begin 587 if (FCurTree = tvShared) and (FCanEditShared) then 585 588 ok := TRUE 586 589 else 587 if(FCurTree = tvPersonal) and (FCanEditPersonal) then588 ok := TRUE589 else590 ok := FALSE;591 if (ok) then590 if (FCurTree = tvPersonal) and (FCanEditPersonal) then 591 ok := TRUE 592 else 593 ok := FALSE; 594 if (ok) then 592 595 begin 593 596 Node := FCurTree.Selected; 594 597 PNode := Node; 595 if (TTemplate(Node.Data).RealType = ttDoc) then598 if (TTemplate(Node.Data).RealType = ttDoc) then 596 599 PNode := Node.Parent; 597 600 if CanClone(PNode) then … … 605 608 else 606 609 idx := Owner.Items.IndexOf(Node.Data) + 1; 607 if (FCurTree = tvShared) then608 609 610 611 610 if (FCurTree = tvShared) then 611 begin 612 ownr := ''; 613 ACheckBox := cbShHide; 614 end 612 615 else 613 614 615 616 616 begin 617 ownr := IntToStr(User.DUZ); 618 ACheckBox := cbPerHide; 619 end; 617 620 if FImportingFromXML then 618 621 begin … … 622 625 else 623 626 begin 624 Tmp := TTemplate.Create('0^T^A^' +NewTemplateName+'^^^'+ownr);627 Tmp := TTemplate.Create('0^T^A^' + NewTemplateName + '^^^' + ownr); 625 628 Tmp.BackupItems; 626 629 Templates.AddObject(Tmp.ID, Tmp); 627 630 end; 628 631 btnApply.Enabled := TRUE; 629 if (idx >= Owner.Items.Count) then632 if (idx >= Owner.Items.Count) then 630 633 Owner.Items.Add(Tmp) 631 634 else … … 633 636 Resync([Owner]); 634 637 Node := FCurTree.Selected; 635 if (Node.Data <> Tmp) then638 if (Node.Data <> Tmp) then 636 639 begin 637 if (TTemplate(Node.Data).RealType = ttDoc) then640 if (TTemplate(Node.Data).RealType = ttDoc) then 638 641 Node := Node.GetNextSibling 639 642 else … … 645 648 end; 646 649 FBtnNewNode := Node; 647 if (FFirstShow) then650 if (FFirstShow) then 648 651 FFocusName := TRUE 649 652 else … … 660 663 procedure TfrmTemplateEditor.btnApplyClick(Sender: TObject); 661 664 begin 662 if (ScanNames) then665 if (ScanNames) then 663 666 begin 664 667 SaveAllTemplates; … … 671 674 procedure TfrmTemplateEditor.FormCreate(Sender: TObject); 672 675 begin 676 SetFormPosition(Self); 673 677 ResizeAnchoredFormToFont(self); 674 678 //Now fix everything the resize messed up … … 681 685 682 686 FSavePause := Application.HintHidePause; 683 Application.HintHidePause := FSavePause *2;687 Application.HintHidePause := FSavePause * 2; 684 688 if InteractiveRemindersActive then 685 689 begin … … 696 700 FFirstShow := TRUE; 697 701 698 FTreeControl[ttShared, tcDel]:= sbShDelete;699 FTreeControl[ttShared, tcUp]:= sbShUp;700 FTreeControl[ttShared, 701 FTreeControl[ttShared, tcLbl]:= lblCopy;702 FTreeControl[ttShared, 703 FTreeControl[ttPersonal, tcDel] 704 FTreeControl[ttPersonal, tcUp] 702 FTreeControl[ttShared, tcDel] := sbShDelete; 703 FTreeControl[ttShared, tcUp] := sbShUp; 704 FTreeControl[ttShared, tcDown] := sbShDown; 705 FTreeControl[ttShared, tcLbl] := lblCopy; 706 FTreeControl[ttShared, tcCopy] := sbCopyRight; 707 FTreeControl[ttPersonal, tcDel] := sbPerDelete; 708 FTreeControl[ttPersonal, tcUp] := sbPerUp; 705 709 FTreeControl[ttPersonal, tcDown] := sbPerDown; 706 FTreeControl[ttPersonal, tcLbl] 710 FTreeControl[ttPersonal, tcLbl] := lblCopy; 707 711 FTreeControl[ttPersonal, tcCopy] := sbCopyLeft; 708 712 dmodShared.InEditor := TRUE; … … 739 743 740 744 BtnApply.Enabled := BackupDiffers; 741 SetFormPosition(Self);745 //SetFormPosition(Self); 742 746 end; 743 747 … … 745 749 begin 746 750 sbCopyRight.Visible := FCanEditPersonal; 747 if (not FCanEditPersonal) then751 if (not FCanEditPersonal) then 748 752 cbPerHide.Checked := TRUE; 749 753 cbPerHide.Visible := FCanEditPersonal; … … 756 760 757 761 procedure TfrmTemplateEditor.cboOwnerNeedData(Sender: TObject; 758 const StartFrom: String; Direction, InsertAt: Integer);762 const StartFrom: string; Direction, InsertAt: Integer); 759 763 begin 760 764 // cboOwner.ForDataUse(SubSetOfTemplateOwners(StartFrom, Direction)); … … 773 777 FCurrentPersonalUser := UsrIEN; 774 778 NewEdit := (FCurrentPersonalUser = User.DUZ); 775 if (FCanEditPersonal <> NewEdit) then779 if (FCanEditPersonal <> NewEdit) then 776 780 begin 777 781 FCanEditPersonal := NewEdit; … … 784 788 begin 785 789 AllowExpansion := dmodShared.ExpandNode(tvPersonal, Node, 786 787 if (AllowExpansion and FInternalHiddenExpand) then790 FPersonalEmptyNodeCount, not cbPerHide.Checked); 791 if (AllowExpansion and FInternalHiddenExpand) then 788 792 AllowExpansion := FALSE; 789 793 end; … … 793 797 begin 794 798 AllowExpansion := dmodShared.ExpandNode(tvShared, Node, 795 796 if (AllowExpansion and FInternalHiddenExpand) then799 FSharedEmptyNodeCount, not cbShHide.Checked); 800 if (AllowExpansion and FInternalHiddenExpand) then 797 801 AllowExpansion := FALSE; 798 802 end; … … 813 817 var 814 818 Template: TTemplate; 815 819 816 820 begin 817 821 Result := FALSE; … … 822 826 Result := TRUE 823 827 else 824 if (Template.PersonalOwner = 0) then 825 begin 826 if RootTemplate.IsLocked then 827 Result := TRUE 828 else 829 begin 830 Result := TTemplate(Node.Data).IsLocked; 831 if (not Result) and assigned(Node.Parent) and 832 (TTemplate(Node.Parent).PersonalOwner = 0) then 833 Result := IsTemplateLocked(Node.Parent); 828 if (Template.PersonalOwner = 0) then 829 begin 830 if RootTemplate.IsLocked then 831 Result := TRUE 832 else 833 begin 834 Result := TTemplate(Node.Data).IsLocked; 835 if (not Result) and assigned(Node.Parent) and 836 (TTemplate(Node.Parent).PersonalOwner = 0) then 837 Result := IsTemplateLocked(Node.Parent); 838 end; 834 839 end; 835 end;836 840 end; 837 841 end; … … 852 856 if Something then 853 857 begin 854 if (Sender = tvPersonal) then858 if (Sender = tvPersonal) then 855 859 begin 856 860 ok := FCanEditPersonal; … … 875 879 begin 876 880 cbLock.Enabled := ok and (FCurTree = tvShared); 877 if (ok and Root) then881 if (ok and Root) then 878 882 begin 879 883 ok := FALSE; … … 925 929 begin 926 930 tmpHeight := tvShared.Height; 927 dec(tmpHeight, lblCopy.Height);928 if (sbCopyLeft.Visible) then929 dec(tmpHeight, sbCopyLeft.Height +5);930 if (sbCopyRight.Visible) then931 dec(tmpHeight, sbCopyRight.Height +5);931 dec(tmpHeight, lblCopy.Height); 932 if (sbCopyLeft.Visible) then 933 dec(tmpHeight, sbCopyLeft.Height + 5); 934 if (sbCopyRight.Visible) then 935 dec(tmpHeight, sbCopyRight.Height + 5); 932 936 tmpHeight := (tmpHeight div 2) + tvShared.Top; 933 937 lblCopy.Top := tmpHeight; 934 inc(tmpHeight, lblCopy.height+5);935 if (sbCopyLeft.Visible) then938 inc(tmpHeight, lblCopy.height + 5); 939 if (sbCopyLeft.Visible) then 936 940 begin 937 941 sbCopyLeft.Top := tmpHeight; 938 inc(tmpHeight, sbCopyLeft.Height +5);939 end; 940 if (sbCopyRight.Visible) then942 inc(tmpHeight, sbCopyLeft.Height + 5); 943 end; 944 if (sbCopyRight.Visible) then 941 945 sbCopyRight.Top := tmpHeight; 946 end; 947 948 procedure TfrmTemplateEditor.splMainCanResize(Sender: TObject; 949 var NewSize: Integer; var Accept: Boolean); 950 begin 951 inherited; 952 if (pnlGroupBP.Height - (NewSize - splMain.Top) <= pnlGroupBP.Constraints.MinHeight) and (NewSize > splMain.Top) then begin 953 //Moving Down 954 Accept := False; 955 NewSize := splMain.Top; 956 end else Accept := True; //Moving Up 942 957 end; 943 958 … … 962 977 pnlGroupBP.Align := alBottom; 963 978 reBoil.Align := alClient; 979 pnlNotes.Constraints.MaxHeight := 0; 964 980 end; 965 981 end; … … 977 993 FUpdating := TRUE; 978 994 try 979 if (assigned(Node)) then995 if (assigned(Node)) then 980 996 begin 981 997 FShowingTemplate := TTemplate(Node.Data); … … 987 1003 ShowTemplateType(TTemplate(Node.Data)); 988 1004 lt := GetLinkType(Node); 989 if (lt = ltNone) or (IsReminderDialog and (not (lt in [ltNone, ltTitle]))) then1005 if (lt = ltNone) or (IsReminderDialog and (not (lt in [ltNone, ltTitle]))) then 990 1006 pnlLink.Visible := FALSE 991 1007 else … … 994 1010 pnlLink.Tag := ord(lt); 995 1011 case lt of 996 ltTitle: 997 ltConsult: 1012 ltTitle: lts := 'Title'; 1013 ltConsult: lts := 'Consult Service'; 998 1014 ltProcedure: lts := 'Procedure'; 999 elselts := '';1015 else lts := ''; 1000 1016 end; 1001 1017 cbxLink.Clear; … … 1024 1040 edtName.Text := PrintName; 1025 1041 reNotes.Lines.Text := Description; 1026 if (PersonalOwner = 0) and (FCurTree = tvShared) and (cbEditShared.Checked) then1042 if (PersonalOwner = 0) and (FCurTree = tvShared) and (cbEditShared.Checked) then 1027 1043 begin 1028 1044 cbLock.Checked := IsLocked; … … 1036 1052 end; 1037 1053 CanDoCom := FCanDoCOMObjects and (PersonalOwner = 0); 1038 if (RealType in AllTemplateRootTypes) then1054 if (RealType in AllTemplateRootTypes) then 1039 1055 begin 1040 1056 ClearRB := TRUE; … … 1045 1061 case RealType of 1046 1062 ttDoc: begin 1047 1048 1049 1050 1051 1052 1053 1054 1063 if IsReminderDialog then 1064 Idx := tiRemDlg 1065 else 1066 if IsCOMObject then 1067 Idx := tiCOMObj 1068 else 1069 Idx := tiTemplate; 1070 end; 1055 1071 ttGroup: begin 1056 if(Dialog) then1057 1058 1059 1060 1072 if (Dialog) then 1073 Idx := tiDialog 1074 else 1075 Idx := tiGroup; 1076 end; 1061 1077 ttClass: Idx := tiFolder; 1062 1078 else Idx := tiNone; 1063 1079 end; 1064 1080 FForceContainer := ((RealType in [ttGroup, ttClass]) and (Children <> tcNone)); … … 1071 1087 if (not FForceContainer) then 1072 1088 begin 1073 if (FCanDoReminders or CanDoCOM) then1089 if (FCanDoReminders or CanDoCOM) then 1074 1090 cbxType.Items.Add('Reminder Dialog'); 1075 if (CanDoCOM) then1091 if (CanDoCOM) then 1076 1092 cbxType.Items.Add('COM Object'); 1077 1093 end; 1078 1094 cbxType.ItemIndex := ForcedIdx[FForceContainer, Idx]; 1079 if (Idx = tiRemDlg) and FCanDoReminders then1095 if (Idx = tiRemDlg) and FCanDoReminders then 1080 1096 cbxRemDlgs.SelectByID(ReminderDialogIEN) 1081 1097 else … … 1098 1114 end; 1099 1115 cbActive.Checked := Active; 1100 if (RealType in [ttClass, ttGroup]) then1116 if (RealType in [ttClass, ttGroup]) then 1101 1117 cbHideItems.Checked := HideItems 1102 1118 else … … 1105 1121 cbHideItems.Enabled := FALSE; 1106 1122 end; 1107 if ((RealType in [ttDoc, ttGroup]) and (assigned(Node.Parent)) and1108 1109 1123 if ((RealType in [ttDoc, ttGroup]) and (assigned(Node.Parent)) and 1124 (TTemplate(Node.Parent.Data).RealType = ttGroup) and 1125 (not IsReminderDialog) and (not IsCOMObject)) then 1110 1126 cbExclude.Checked := Exclude 1111 1127 else … … 1126 1142 cbFirstLine.Enabled := FALSE; 1127 1143 end; 1128 if (RealType in [ttGroup, ttClass]) and (Children <> tcNone) and1144 if (RealType in [ttGroup, ttClass]) and (Children <> tcNone) and 1129 1145 (dmodShared.InDialog(Node)) then 1130 1146 begin 1131 1147 cbOneItemOnly.Checked := OneItemOnly; 1132 1148 cbIndent.Checked := IndentItems; 1133 if (RealType = ttGroup) and (Boilerplate <> '') then1149 if (RealType = ttGroup) and (Boilerplate <> '') then 1134 1150 begin 1135 1151 cbHideDlgItems.Checked := HideDlgItems; … … 1150 1166 cbIndent.Enabled := FALSE; 1151 1167 end; 1152 if (RealType = ttGroup) then1168 if (RealType = ttGroup) then 1153 1169 edtGap.Text := IntToStr(Gap) 1154 1170 else … … 1171 1187 gbProperties.Caption := PropText; 1172 1188 end; 1173 if (ClearName) then1189 if (ClearName) then 1174 1190 begin 1175 1191 edtName.Text := ''; 1176 1192 reNotes.Clear; 1177 1193 end; 1178 if (ClearRB) then1194 if (ClearRB) then 1179 1195 begin 1180 1196 cbxType.ItemIndex := Ord(tiNone); 1181 1197 end; 1182 if (ClearAll) then1198 if (ClearAll) then 1183 1199 begin 1184 1200 cbActive.Checked := FALSE; … … 1197 1213 pnlLink.Visible := FALSE; 1198 1214 end; 1199 if cbDisplayOnly.Enabled 1200 cbFirstLine.Enabledor1201 cbIndent.Enabledor1202 cbOneItemOnly.Enabledor1203 1215 if cbDisplayOnly.Enabled or 1216 cbFirstLine.Enabled or 1217 cbIndent.Enabled or 1218 cbOneItemOnly.Enabled or 1219 cbHideDlgItems.Enabled then 1204 1220 gbDialogProps.Font.Color := clWindowText 1205 1221 else … … 1215 1231 1216 1232 begin 1217 if (pnlGroupBP.Visible) and (pnlGroupBP.Height > (pnlBoilerplate.Height-29)) then1218 begin 1219 pnlGroupBP.Height := pnlBoilerplate.Height -29;1233 if (pnlGroupBP.Visible) and (pnlGroupBP.Height > (pnlBoilerplate.Height - 29)) then 1234 begin 1235 pnlGroupBP.Height := pnlBoilerplate.Height - 29; 1220 1236 end; 1221 1237 if cbLongLines.checked then 1222 1238 Max := 240 1223 1239 else 1224 Max := MAX_ENTRY_WIDTH ;1240 Max := MAX_ENTRY_WIDTH - 1; 1225 1241 LimitEditWidth(reBoil, Max); 1226 1242 LimitEditWidth(reNotes, MAX_ENTRY_WIDTH); … … 1234 1250 1235 1251 begin 1236 if ((not FUpdating) and (assigned(FCurTree)) and (assigned(FCurTree.Selected))) then1252 if ((not FUpdating) and (assigned(FCurTree)) and (assigned(FCurTree.Selected))) then 1237 1253 begin 1238 1254 if CanClone(FCurTree.Selected) then … … 1244 1260 Template.PrintName := edtName.Text; 1245 1261 UpdateApply(Template); 1246 for i := 0 to Template.Nodes.Count -1 do1262 for i := 0 to Template.Nodes.Count - 1 do 1247 1263 TTreeNode(Template.Nodes.Objects[i]).Text := Template.PrintName; 1248 if (DoRefresh) then1264 if (DoRefresh) then 1249 1265 begin 1250 1266 tvShared.Invalidate; … … 1263 1279 1264 1280 begin 1265 if ((not FUpdating) and (assigned(FCurTree)) and (assigned(FCurTree.Selected))) then1281 if ((not FUpdating) and (assigned(FCurTree)) and (assigned(FCurTree.Selected))) then 1266 1282 begin 1267 1283 if CanClone(FCurTree.Selected) then … … 1273 1289 Template.Active := cbActive.Checked; 1274 1290 UpdateApply(Template); 1275 for i := 0 to Template.Nodes.Count -1 do1291 for i := 0 to Template.Nodes.Count - 1 do 1276 1292 begin 1277 1293 Node := TTreeNode(Template.Nodes.Objects[i]); 1278 1294 Node.Cut := not Template.Active; 1279 1295 end; 1280 if (FCurTree = tvShared) then1296 if (FCurTree = tvShared) then 1281 1297 begin 1282 1298 cbPerHideClick(Sender); … … 1304 1320 1305 1321 begin 1306 if ((not FUpdating) and (assigned(FCurTree)) and (assigned(FCurTree.Selected))) then1322 if ((not FUpdating) and (assigned(FCurTree)) and (assigned(FCurTree.Selected))) then 1307 1323 begin 1308 1324 if CanClone(FCurTree.Selected) then … … 1314 1330 Template.Exclude := cbExclude.Checked; 1315 1331 UpdateApply(Template); 1316 for i := 0 to Template.Nodes.Count -1 do1332 for i := 0 to Template.Nodes.Count - 1 do 1317 1333 begin 1318 1334 Node := TTreeNode(Template.Nodes.Objects[i]); … … 1333 1349 1334 1350 begin 1335 if ((not FUpdating) and (assigned(FCurTree)) and (assigned(FCurTree.Selected))) then1351 if ((not FUpdating) and (assigned(FCurTree)) and (assigned(FCurTree.Selected))) then 1336 1352 begin 1337 1353 if CanClone(FCurTree.Selected) then … … 1344 1360 UpdateApply(Template); 1345 1361 DisplayBoilerPlate(FCurTree.Selected); 1346 if (DoRefresh) then1362 if (DoRefresh) then 1347 1363 begin 1348 1364 tvShared.Invalidate; … … 1362 1378 tvShared.HideSelection := TRUE; 1363 1379 tvPersonal.HideSelection := TRUE; 1364 if (NewTree <> FCurTree) then1380 if (NewTree <> FCurTree) then 1365 1381 begin 1366 1382 Result := TRUE; 1367 if (assigned(FCurTree)) then1383 if (assigned(FCurTree)) then 1368 1384 begin 1369 1385 for i := low(TTemplateTreeControl) to high(TTemplateTreeControl) do … … 1372 1388 FCurTree := NewTree; 1373 1389 end; 1374 if (assigned(FCurTree)) then1390 if (assigned(FCurTree)) then 1375 1391 begin 1376 1392 FCurTree.HideSelection := FALSE; 1377 if (FCurTree = tvPersonal) and (Screen.ActiveControl = tvShared) then1393 if (FCurTree = tvPersonal) and (Screen.ActiveControl = tvShared) then 1378 1394 tvPersonal.SetFocus 1379 1395 else 1380 if(FCurTree = tvShared) and (Screen.ActiveControl = tvPersonal) then1381 tvShared.SetFocus;1396 if (FCurTree = tvShared) and (Screen.ActiveControl = tvPersonal) then 1397 tvShared.SetFocus; 1382 1398 end; 1383 1399 end; … … 1385 1401 procedure TfrmTemplateEditor.tvTreeEnter(Sender: TObject); 1386 1402 begin 1387 if ((Sender is TTreeView) and (ChangeTree(TTreeView(Sender)))) then1403 if ((Sender is TTreeView) and (ChangeTree(TTreeView(Sender)))) then 1388 1404 tvTreeChange(Sender, TTreeView(Sender).Selected); 1389 1405 end; 1390 1406 1391 1407 procedure TfrmTemplateEditor.tvTreeNodeEdited(Sender: TObject; 1392 Node: TTreeNode; var S: String);1408 Node: TTreeNode; var S: string); 1393 1409 begin 1394 1410 FUpdating := TRUE; … … 1419 1435 begin 1420 1436 dmodShared.Resync(tvPersonal.Items.GetFirstNode, not cbPerHide.Checked, 1421 1437 FPersonalEmptyNodeCount); 1422 1438 tvTreeChange(tvPersonal, tvPersonal.Selected); 1423 1439 EnableNavControls; … … 1440 1456 with Node, TTemplate(Node.Data) do 1441 1457 begin 1442 if (RealType in [ttDoc, ttGroup]) then1458 if (RealType in [ttDoc, ttGroup]) then 1443 1459 begin 1444 1460 TmpSL := TStringList.Create; 1445 1461 try 1446 if (RealType = ttGroup) and (not reBoil.ReadOnly) then1462 if (RealType = ttGroup) and (not reBoil.ReadOnly) then 1447 1463 begin 1448 1464 ItemOK := TRUE; … … 1454 1470 TmpSL.Text := FullBoilerplate; 1455 1471 LongLines := FALSE; 1456 for i := 0 to TmpSL.Count -1 do1472 for i := 0 to TmpSL.Count - 1 do 1457 1473 begin 1458 1474 if length(TmpSL[i]) > MAX_ENTRY_WIDTH then … … 1475 1491 end; 1476 1492 ShowGroupBoilerplate(ItemOK); 1477 if (not ItemOK) and (IsReminderDialog or IsCOMObject) then1493 if (not ItemOK) and (IsReminderDialog or IsCOMObject) then 1478 1494 BPOK := FALSE; 1479 1495 pnlBoilerplateResize(Self); … … 1491 1507 KillObj(@FConsultServices); 1492 1508 Application.HintHidePause := FSavePause; 1493 if (assigned(frmTemplateObjects)) then1509 if (assigned(frmTemplateObjects)) then 1494 1510 begin 1495 1511 frmTemplateObjects.Free; 1496 1512 frmTemplateObjects := nil; 1497 1513 end; 1498 if (assigned(frmTemplateFields)) then1514 if (assigned(frmTemplateFields)) then 1499 1515 begin 1500 1516 frmTemplateFields.Free; … … 1527 1543 1528 1544 begin 1529 if ((assigned(FCurTree)) and (assigned(FCurTree.Selected)) and1530 1545 if ((assigned(FCurTree)) and (assigned(FCurTree.Selected)) and 1546 (assigned(FCurTree.Selected.Parent))) then 1531 1547 begin 1532 1548 Node := FCurTree.Selected; … … 1536 1552 idx := Template.Items.IndexOf(NodeTemplate); 1537 1553 ChangeLevel := (idx < 1); 1538 if (not ChangeLevel) then1539 begin 1540 if (TTemplateTreeType(TBitBtn(Sender).Tag) = ttShared) then1554 if (not ChangeLevel) then 1555 begin 1556 if (TTemplateTreeType(TBitBtn(Sender).Tag) = ttShared) then 1541 1557 Hide := cbShHide.Checked 1542 1558 else 1543 1559 Hide := cbPerHide.Checked; 1544 1560 First := TRUE; 1545 while (idx > 0) do1561 while (idx > 0) do 1546 1562 begin 1547 1563 if First then … … 1551 1567 if CanClone(ParentNode) then 1552 1568 begin 1553 if (Clone(ParentNode)) then1569 if (Clone(ParentNode)) then 1554 1570 Template := TTemplate(ParentNode.Data); 1555 1571 if Template.CanModify then … … 1561 1577 if ok then 1562 1578 begin 1563 Template.Items.Exchange(idx -1, idx);1564 if (Hide and (not TTemplate(Template.Items[idx]).Active)) then1579 Template.Items.Exchange(idx - 1, idx); 1580 if (Hide and (not TTemplate(Template.Items[idx]).Active)) then 1565 1581 begin 1566 1582 dec(idx); … … 1574 1590 end; 1575 1591 end; 1576 if (ChangeLevel) then1592 if (ChangeLevel) then 1577 1593 begin 1578 1594 ParentsParent := ParentNode.Parent; 1579 if (assigned(ParentsParent)) then1595 if (assigned(ParentsParent)) then 1580 1596 begin 1581 1597 ParentTemplate := TTemplate(ParentsParent.Data); 1582 if (ParentTemplate.Items.IndexOf(NodeTemplate) >= 0) then1598 if (ParentTemplate.Items.IndexOf(NodeTemplate) >= 0) then 1583 1599 InfoBox(ParentsParent.Text + ' already contains the ' + 1584 1600 NodeTemplate.PrintName + ' template.', … … 1588 1604 if CanClone(ParentNode) then 1589 1605 begin 1590 if (Clone(ParentNode)) then1606 if (Clone(ParentNode)) then 1591 1607 Template := TTemplate(ParentNode.Data); 1592 1608 if Template.CanModify and CanClone(ParentsParent) then 1593 1609 begin 1594 if (Clone(ParentsParent)) then1610 if (Clone(ParentsParent)) then 1595 1611 ParentTemplate := TTemplate(ParentsParent.Data); 1596 1612 if ParentTemplate.CanModify then … … 1598 1614 Template.Items.Delete(idx); 1599 1615 idx := ParentTemplate.Items.IndexOf(Template); 1600 if (idx >= 0) then1616 if (idx >= 0) then 1601 1617 begin 1602 1618 ParentTemplate.Items.Insert(idx, NodeTemplate); … … 1627 1643 1628 1644 begin 1629 if ((assigned(FCurTree)) and (assigned(FCurTree.Selected)) and1630 1645 if ((assigned(FCurTree)) and (assigned(FCurTree.Selected)) and 1646 (assigned(FCurTree.Selected.Parent))) then 1631 1647 begin 1632 1648 Node := FCurTree.Selected; … … 1635 1651 Template := TTemplate(ParentNode.Data); 1636 1652 idx := Template.Items.IndexOf(NodeTemplate); 1637 max := Template.Items.Count -1;1653 max := Template.Items.Count - 1; 1638 1654 ChangeLevel := (idx >= max); 1639 if (not ChangeLevel) then1640 begin 1641 if (TTemplateTreeType(TBitBtn(Sender).Tag) = ttShared) then1655 if (not ChangeLevel) then 1656 begin 1657 if (TTemplateTreeType(TBitBtn(Sender).Tag) = ttShared) then 1642 1658 Hide := cbShHide.Checked 1643 1659 else 1644 1660 Hide := cbPerHide.Checked; 1645 1661 First := TRUE; 1646 while (idx < max) do1662 while (idx < max) do 1647 1663 begin 1648 1664 if First then … … 1652 1668 if CanClone(ParentNode) then 1653 1669 begin 1654 if (Clone(ParentNode)) then1670 if (Clone(ParentNode)) then 1655 1671 Template := TTemplate(ParentNode.Data); 1656 1672 if Template.CanModify then … … 1662 1678 if ok then 1663 1679 begin 1664 Template.Items.Exchange(idx, idx +1);1665 if (Hide and (not TTemplate(Template.Items[idx]).Active)) then1680 Template.Items.Exchange(idx, idx + 1); 1681 if (Hide and (not TTemplate(Template.Items[idx]).Active)) then 1666 1682 begin 1667 1683 inc(idx); … … 1675 1691 end; 1676 1692 end; 1677 if (ChangeLevel) then1693 if (ChangeLevel) then 1678 1694 begin 1679 1695 ParentsParent := ParentNode.Parent; 1680 if (assigned(ParentsParent)) then1696 if (assigned(ParentsParent)) then 1681 1697 begin 1682 1698 ParentTemplate := TTemplate(ParentsParent.Data); 1683 if (ParentTemplate.Items.IndexOf(NodeTemplate) >= 0) then1699 if (ParentTemplate.Items.IndexOf(NodeTemplate) >= 0) then 1684 1700 InfoBox(ParentsParent.Text + ' already contains the ' + 1685 1701 NodeTemplate.PrintName + ' template.', … … 1689 1705 if CanClone(ParentNode) then 1690 1706 begin 1691 if (Clone(ParentNode)) then1707 if (Clone(ParentNode)) then 1692 1708 Template := TTemplate(ParentNode.Data); 1693 1709 if Template.CanModify and CanClone(ParentsParent) then 1694 1710 begin 1695 if (Clone(ParentsParent)) then1711 if (Clone(ParentsParent)) then 1696 1712 ParentTemplate := TTemplate(ParentsParent.Data); 1697 1713 if ParentTemplate.CanModify then … … 1699 1715 Template.Items.Delete(idx); 1700 1716 idx := ParentTemplate.Items.IndexOf(Template); 1701 if (idx >= 0) then1717 if (idx >= 0) then 1702 1718 begin 1703 if (idx = (ParentTemplate.Items.Count-1)) then1719 if (idx = (ParentTemplate.Items.Count - 1)) then 1704 1720 ParentTemplate.Items.Add(NodeTemplate) 1705 1721 else 1706 ParentTemplate.Items.Insert(idx +1, NodeTemplate);1722 ParentTemplate.Items.Insert(idx + 1, NodeTemplate); 1707 1723 Resync([ParentTemplate, Template]); 1708 1724 btnApply.Enabled := TRUE; … … 1730 1746 1731 1747 begin 1732 if ((assigned(FCurTree)) and (assigned(FCurTree.Selected)) and1733 1748 if ((assigned(FCurTree)) and (assigned(FCurTree.Selected)) and 1749 (assigned(FCurTree.Selected.Parent))) then 1734 1750 begin 1735 1751 Node := FCurTree.Selected; … … 1737 1753 PNode := Node.Parent; 1738 1754 Parent := TTemplate(PNode.Data); 1739 if (AutoDel(Template)) then1755 if (AutoDel(Template)) then 1740 1756 DoIt := TRUE 1741 1757 else 1742 if(Template.Active) and (cbActive.Checked) then 1743 begin 1744 DoIt := FALSE; 1745 Answer := MessageDlg('Once you delete a template you may not be able to retrieve it.' + CRLF + 1746 'Rather than deleting, you may want to inactivate a template instead.' + CRLF + 1747 'You may inactivate this template by pressing the Ignore button now.' + CRLF + 1748 'Are you sure you want to delete the "' + Node.Text + 1749 '" Template?', mtConfirmation, [mbYes, mbNo, mbIgnore], 0); 1750 if(Answer = mrYes) then 1751 DoIt := TRUE 1758 if (Template.Active) and (cbActive.Checked) then 1759 begin 1760 DoIt := FALSE; 1761 Answer := MessageDlg('Once you delete a template you may not be able to retrieve it.' + CRLF + 1762 'Rather than deleting, you may want to inactivate a template instead.' + CRLF + 1763 'You may inactivate this template by pressing the Ignore button now.' + CRLF + 1764 'Are you sure you want to delete the "' + Node.Text + 1765 '" Template?', mtConfirmation, [mbYes, mbNo, mbIgnore], 0); 1766 if (Answer = mrYes) then 1767 DoIt := TRUE 1768 else 1769 if (Answer = mrIgnore) then 1770 cbActive.Checked := FALSE; 1771 end 1752 1772 else 1753 if(Answer = mrIgnore) then 1754 cbActive.Checked := FALSE; 1755 end 1756 else 1757 DoIt := InfoBox('Are you sure you want to delete the "' + Node.Text + 1758 '" Template?', 'Confirmation', MB_YESNO or MB_ICONQUESTION) = IDYES; 1759 if(DoIt and CanClone(PNode)) then 1760 begin 1761 if(Clone(PNode)) then 1773 DoIt := InfoBox('Are you sure you want to delete the "' + Node.Text + 1774 '" Template?', 'Confirmation', MB_YESNO or MB_ICONQUESTION) = IDYES; 1775 if (DoIt and CanClone(PNode)) then 1776 begin 1777 if (Clone(PNode)) then 1762 1778 Parent := TTemplate(PNode.Data); 1763 1779 if assigned(Parent) and Parent.CanModify then … … 1782 1798 OldActiveControl: TControl; 1783 1799 begin 1784 if (Assigned(FCurTree)) then1800 if (Assigned(FCurTree)) then 1785 1801 begin 1786 1802 Tree := TTemplateTreeType(FCurTree.Tag); 1787 1803 Node := FCurTree.Selected; 1788 if (Assigned(Node)) then1804 if (Assigned(Node)) then 1789 1805 Curok := (TTemplate(Node.Data).RealType in [ttDoc, ttGroup, ttClass]) 1790 1806 else 1791 1807 Curok := FALSE; 1792 if (Curok) then1808 if (Curok) then 1793 1809 begin 1794 1810 OldActiveControl := ActiveControl; 1795 1811 FTreeControl[Tree, tcDel].Enabled := TRUE; 1796 1812 AllowSet := FALSE; 1797 if (Node.Index > 0) then1813 if (Node.Index > 0) then 1798 1814 AllowUp := TRUE 1799 1815 else … … 1804 1820 FTreeControl[Tree, tcUp].Enabled := AllowUp; 1805 1821 AllowDown := AllowUp; 1806 if (Node.Index < (Node.Parent.Count-1)) then1822 if (Node.Index < (Node.Parent.Count - 1)) then 1807 1823 AllowDown := TRUE 1808 1824 else 1809 1825 begin 1810 if (not AllowSet) then1826 if (not AllowSet) then 1811 1827 AllowDown := AllowMove(Node.Parent.Parent, Node); 1812 1828 end; … … 1816 1832 if not AllowDown and (OldActiveControl = FTreeControl[Tree, tcDown]) then 1817 1833 (FTreeControl[Tree, tcUp] as TWinControl).SetFocus; 1818 FTreeControl[Tree, tcCopy].Enabled := FTreeControl[TTemplateTreeType(1 -ord(Tree)), tcDel].Visible;1819 if (FTreeControl[Tree, tcCopy].Enabled) then1820 begin 1821 if (Tree = ttShared) then1834 FTreeControl[Tree, tcCopy].Enabled := FTreeControl[TTemplateTreeType(1 - ord(Tree)), tcDel].Visible; 1835 if (FTreeControl[Tree, tcCopy].Enabled) then 1836 begin 1837 if (Tree = ttShared) then 1822 1838 Node := tvPersonal.Selected 1823 1839 else 1824 1840 Node := tvShared.Selected; 1825 if (assigned(Node)) then1841 if (assigned(Node)) then 1826 1842 begin 1827 if (TTemplate(Node.Data).RealType = ttDoc) then1843 if (TTemplate(Node.Data).RealType = ttDoc) then 1828 1844 Node := Node.Parent; 1829 1845 FTreeControl[Tree, tcCopy].Enabled := AllowMove(Node, FCurTree.Selected); … … 1839 1855 FTreeControl[Tree, i].Enabled := FALSE; 1840 1856 end; 1841 if (FCurTree = tvShared) and (FCanEditShared) then1857 if (FCurTree = tvShared) and (FCanEditShared) then 1842 1858 btnNew.Enabled := TRUE 1843 1859 else 1844 if(FCurTree = tvPersonal) and (FCanEditPersonal) then1845 btnNew.Enabled := TRUE1846 else1847 btnNew.Enabled := FALSE;1860 if (FCurTree = tvPersonal) and (FCanEditPersonal) then 1861 btnNew.Enabled := TRUE 1862 else 1863 btnNew.Enabled := FALSE; 1848 1864 end 1849 1865 else … … 1856 1872 begin 1857 1873 CanDrag := (TTemplate(Node.Data).RealType in [ttDoc, ttGroup, ttClass]); 1858 if (CanDrag) then1874 if (CanDrag) then 1859 1875 FDragNode := Node 1860 1876 else … … 1871 1887 FDropNode := nil; 1872 1888 Accept := FALSE; 1873 if (Source is TTreeView) and (assigned(FDragNode)) then1889 if (Source is TTreeView) and (assigned(FDragNode)) then 1874 1890 begin 1875 1891 Tree := TTreeView(Sender); 1876 FDropNode := Tree.GetNodeAt(X, Y);1877 if (((Tree = tvShared)and (FCanEditShared)) or1878 1879 begin 1880 if (assigned(FDropNode)) then1892 FDropNode := Tree.GetNodeAt(X, Y); 1893 if (((Tree = tvShared) and (FCanEditShared)) or 1894 ((Tree = tvPersonal) and (FCanEditPersonal))) then 1895 begin 1896 if (assigned(FDropNode)) then 1881 1897 begin 1882 1898 FDropInto := (TTemplate(FDropNode.Data).RealType in AllTemplateFolderTypes); 1883 if (FDropInto) then1899 if (FDropInto) then 1884 1900 TmpNode := FDropNode 1885 1901 else … … 1899 1915 1900 1916 begin 1901 if (assigned(FDragNode)) and (assigned(FDropNode)) and (FDragNode <> FDropNode) then1917 if (assigned(FDragNode)) and (assigned(FDropNode)) and (FDragNode <> FDropNode) then 1902 1918 begin 1903 1919 Item := TTemplate(FDragNode.Data); 1904 if (FDropInto) then1920 if (FDropInto) then 1905 1921 begin 1906 1922 TmpNode := FDropNode; … … 1912 1928 idx := TTemplate(FDropNode.Parent.Data).Items.IndexOf(FDropNode.Data); 1913 1929 end; 1914 if (AllowMove(TmpNode, FDragNode) and (idx >= 0)) then1930 if (AllowMove(TmpNode, FDragNode) and (idx >= 0)) then 1915 1931 begin 1916 1932 Template := TTemplate(TmpNode.Data); 1917 if (Template <> FDragNode.Parent.Data) and1933 if (Template <> FDragNode.Parent.Data) and 1918 1934 (Template.Items.IndexOf(Item) >= 0) then 1919 1935 InfoBox(Template.PrintName + ' already contains the ' + … … 1926 1942 if CanClone(TmpNode) then 1927 1943 begin 1928 if (Clone(TmpNode)) then1944 if (Clone(TmpNode)) then 1929 1945 Template := TTemplate(TmpNode.Data); 1930 1946 if assigned(Template) and Template.CanModify then 1931 1947 begin 1932 if (Sidx >= 0) and (FDragNode.TreeView = FDropNode.TreeView) and1948 if (Sidx >= 0) and (FDragNode.TreeView = FDropNode.TreeView) and 1933 1949 (not FCopying) then // if same tree delete source 1934 1950 begin 1935 1951 if CanClone(FDragNode.Parent) then 1936 1952 begin 1937 if (Clone(FDragNode.Parent)) then1953 if (Clone(FDragNode.Parent)) then 1938 1954 Src := TTemplate(FDragNode.Parent.Data); 1939 1955 if assigned(Src) and Src.CanModify then 1940 1956 begin 1941 1957 Src.Items.Delete(Sidx); 1942 if (Template = Src) then1958 if (Template = Src) then 1943 1959 Src := nil; 1944 1960 end … … 1951 1967 else 1952 1968 Src := nil; 1953 if (idx > 0) then1969 if (idx > 0) then 1954 1970 idx := TTemplate(FDropNode.Parent.Data).Items.IndexOf(FDropNode.Data); 1955 1971 Template.Items.Insert(idx, Item); 1956 if (TTreeView(FDropNode.TreeView) = tvShared) then1972 if (TTreeView(FDropNode.TreeView) = tvShared) then 1957 1973 begin 1958 1974 Item.PersonalOwner := 0; … … 1987 2003 begin 1988 2004 tmpl := Templates[i]; 1989 if (assigned(tmpl)) then2005 if (assigned(tmpl)) then 1990 2006 begin 1991 for j := 0 to tmpl.Nodes.Count -1 do2007 for j := 0 to tmpl.Nodes.Count - 1 do 1992 2008 begin 1993 2009 Node := TTreeNode(tmpl.Nodes.Objects[j]); 1994 if (NodeList.IndexOfObject(Node) < 0) then2010 if (NodeList.IndexOfObject(Node) < 0) then 1995 2011 begin 1996 2012 NodeID := IntToStr(Node.Level); 1997 NodeID := copy('000', 1,4-length(NodeID))+NodeID+U+tmpl.Nodes[j];1998 TemplateList.AddObject(NodeID, tmpl);1999 NodeList.AddObject(NodeId, Node);2013 NodeID := copy('000', 1, 4 - length(NodeID)) + NodeID + U + tmpl.Nodes[j]; 2014 TemplateList.AddObject(NodeID, tmpl); 2015 NodeList.AddObject(NodeId, Node); 2000 2016 end; 2001 2017 end; … … 2008 2024 NodeList.Sort; 2009 2025 2010 for i := 0 to NodeList.Count -1 do2026 for i := 0 to NodeList.Count - 1 do 2011 2027 begin 2012 2028 NodeID := NodeList[i]; 2013 2029 Node := TTreeNode(NodeList.Objects[i]); 2014 2030 j := TemplateList.IndexOf(NodeID); 2015 if (j >= 0) then2031 if (j >= 0) then 2016 2032 begin 2017 2033 tmpl := TTemplate(TemplateList.Objects[j]); 2018 NodeID := Piece(NodeID, U,2);2019 if (tmpl.Nodes.IndexOf(NodeID) >= 0) then2034 NodeID := Piece(NodeID, U, 2); 2035 if (tmpl.Nodes.IndexOf(NodeID) >= 0) then 2020 2036 begin 2021 if (Node.TreeView = tvShared) then2037 if (Node.TreeView = tvShared) then 2022 2038 dmodShared.Resync(Node, not cbShHide.Checked, FSharedEmptyNodeCount) 2023 2039 else 2024 if(Node.TreeView = tvPersonal) then2025 dmodShared.Resync(Node, not cbPerHide.Checked, FPersonalEmptyNodeCount);2040 if (Node.TreeView = tvPersonal) then 2041 dmodShared.Resync(Node, not cbPerHide.Checked, FPersonalEmptyNodeCount); 2026 2042 end; 2027 2043 end; … … 2034 2050 end; 2035 2051 EnableNavControls; 2036 if ((assigned(FCurTree)) and (assigned(FCurTree.Selected))) then2052 if ((assigned(FCurTree)) and (assigned(FCurTree.Selected))) then 2037 2053 tvTreeChange(FCurTree, FCurTree.Selected) 2038 2054 else … … 2043 2059 procedure TfrmTemplateEditor.sbCopyLeftClick(Sender: TObject); 2044 2060 begin 2045 if (assigned(tvPersonal.Selected)) then2046 begin 2047 if (not assigned(tvShared.Selected)) then2061 if (assigned(tvPersonal.Selected)) then 2062 begin 2063 if (not assigned(tvShared.Selected)) then 2048 2064 tvShared.Selected := tvShared.Items.GetFirstNode; 2049 2065 FDragNode := tvPersonal.Selected; 2050 2066 FDropNode := tvShared.Selected; 2051 2067 FDropInto := (TTemplate(FDropNode.Data).RealType in AllTemplateFolderTypes); 2052 tvTreeDragDrop(tvPersonal, tvShared, 0, 0);2068 tvTreeDragDrop(tvPersonal, tvShared, 0, 0); 2053 2069 end; 2054 2070 end; … … 2056 2072 procedure TfrmTemplateEditor.sbCopyRightClick(Sender: TObject); 2057 2073 begin 2058 if (assigned(tvShared.Selected)) then2059 begin 2060 if (not assigned(tvPersonal.Selected)) then2074 if (assigned(tvShared.Selected)) then 2075 begin 2076 if (not assigned(tvPersonal.Selected)) then 2061 2077 tvPersonal.Selected := tvPersonal.Items.GetFirstNode; 2062 2078 FDragNode := tvShared.Selected; 2063 2079 FDropNode := tvPersonal.Selected; 2064 2080 FDropInto := (TTemplate(FDropNode.Data).RealType in AllTemplateFolderTypes); 2065 tvTreeDragDrop(tvShared, tvPersonal, 0, 0);2081 tvTreeDragDrop(tvShared, tvPersonal, 0, 0); 2066 2082 end; 2067 2083 end; … … 2102 2118 2103 2119 begin 2104 if (assigned(ADropNode) and assigned(ADragNode)) then2120 if (assigned(ADropNode) and assigned(ADragNode)) then 2105 2121 begin 2106 2122 DropTemplate := TTemplate(ADropNode.Data); … … 2110 2126 else 2111 2127 Result := (DragTemplate.RealType in [ttDoc, ttGroup, ttClass]); 2112 if (Result) then2113 begin 2114 if (FCopying) then2115 begin 2116 if (DropTemplate.Items.IndexOf(DragTemplate) >= 0) then2128 if (Result) then 2129 begin 2130 if (FCopying) then 2131 begin 2132 if (DropTemplate.Items.IndexOf(DragTemplate) >= 0) then 2117 2133 Result := FALSE; 2118 2134 end 2119 2135 else 2120 if((assigned(ADragNode.Parent)) and (ADropNode <> ADragNode.Parent) and2121 (DropTemplate.Items.IndexOf(DragTemplate) >= 0)) then2122 Result := FALSE;2123 end; 2124 if (Result) then2125 begin 2126 for i := 0 to DropTemplate.Nodes.Count -1 do2136 if ((assigned(ADragNode.Parent)) and (ADropNode <> ADragNode.Parent) and 2137 (DropTemplate.Items.IndexOf(DragTemplate) >= 0)) then 2138 Result := FALSE; 2139 end; 2140 if (Result) then 2141 begin 2142 for i := 0 to DropTemplate.Nodes.Count - 1 do 2127 2143 begin 2128 2144 TmpNode := TTreeNode(DropTemplate.Nodes.Objects[i]); 2129 2145 while (Result and (assigned(TmpNode.Parent))) do 2130 2146 begin 2131 if (TmpNode.Data = DragTemplate) then2147 if (TmpNode.Data = DragTemplate) then 2132 2148 Result := FALSE 2133 2149 else 2134 2150 TmpNode := TmpNode.Parent; 2135 2151 end; 2136 if (not Result) then break;2152 if (not Result) then break; 2137 2153 end; 2138 2154 end; … … 2151 2167 begin 2152 2168 Result := FALSE; 2153 if ((assigned(Node)) and (TTreeView(Node.TreeView) = tvPersonal)) then2169 if ((assigned(Node)) and (TTreeView(Node.TreeView) = tvPersonal)) then 2154 2170 begin 2155 2171 OldT := TTemplate(Node.Data); 2156 if (OldT.PersonalOwner <> User.DUZ) then2172 if (OldT.PersonalOwner <> User.DUZ) then 2157 2173 begin 2158 2174 PNode := Node.Parent; … … 2179 2195 Node.Data := NewT; 2180 2196 NewT.AddNode(Node); 2181 if (assigned(Prnt)) then2197 if (assigned(Prnt)) then 2182 2198 begin 2183 2199 idx := Prnt.Items.IndexOf(OldT); 2184 if (idx >= 0) then2200 if (idx >= 0) then 2185 2201 Prnt.Items[idx] := NewT; 2186 2202 end; … … 2200 2216 2201 2217 begin 2202 if ((not FUpdating) and (assigned(FCurTree)) and (assigned(FCurTree.Selected))) then2218 if ((not FUpdating) and (assigned(FCurTree)) and (assigned(FCurTree.Selected))) then 2203 2219 begin 2204 2220 Template := TTemplate(FCurTree.Selected.Data); 2205 2221 TmpBPlate := reBoil.Lines.Text; 2206 if (Template.Boilerplate <> TmpBPlate) then2222 if (Template.Boilerplate <> TmpBPlate) then 2207 2223 begin 2208 2224 if CanClone(FCurTree.Selected) then 2209 2225 begin 2210 2226 DoRefresh := Clone(FCurTree.Selected); 2211 if (DoRefresh) then2227 if (DoRefresh) then 2212 2228 Template := TTemplate(FCurTree.Selected.Data); 2213 2229 if assigned(Template) and Template.CanModify then 2214 2230 begin 2215 2231 DoInfo := FALSE; 2216 if (Template.Boilerplate = '') or (TmpBPlate = '') then2232 if (Template.Boilerplate = '') or (TmpBPlate = '') then 2217 2233 DoInfo := TRUE; 2218 2234 Template.Boilerplate := TmpBPlate; 2219 2235 TTemplate(FCurTree.Selected.Data).Gap := StrToIntDef(edtGap.Text, 0); 2220 if (Template.RealType = ttGroup) then2236 if (Template.RealType = ttGroup) then 2221 2237 begin 2222 2238 reGroupBP.Text := Template.FullBoilerplate; 2223 2239 end; 2224 if (DoRefresh) then2240 if (DoRefresh) then 2225 2241 begin 2226 2242 tvShared.Invalidate; 2227 2243 tvPersonal.Invalidate; 2228 2244 end; 2229 if (DoInfo) then2245 if (DoInfo) then 2230 2246 begin 2231 2247 x := reBoil.SelStart; … … 2251 2267 {$ENDIF} 2252 2268 sbCopyLeft.Visible := FCanEditShared; 2253 if (not FCanEditShared) then2269 if (not FCanEditShared) then 2254 2270 cbShHide.Checked := TRUE; 2255 2271 cbShHide.Visible := FCanEditShared; … … 2283 2299 Tree.Selected := Node; // This line prevents selected from changing after menu closes 2284 2300 mnuCollapseTree.Enabled := dmodShared.NeedsCollapsing(Tree); 2285 if (Tree = tvShared) then2301 if (Tree = tvShared) then 2286 2302 begin 2287 2303 Txt := 'Shared'; … … 2296 2312 end; 2297 2313 mnuFindTemplates.Checked := FindOn; 2298 mnuCollapseTree.Caption := 'Collapse ' +Txt+' &Tree';2299 mnuFindTemplates.Caption := '&Find ' +Txt+' Templates';2300 2301 if (assigned(Tree) and assigned(Tree.Selected) and assigned(Tree.Selected.Data)) then2314 mnuCollapseTree.Caption := 'Collapse ' + Txt + ' &Tree'; 2315 mnuFindTemplates.Caption := '&Find ' + Txt + ' Templates'; 2316 2317 if (assigned(Tree) and assigned(Tree.Selected) and assigned(Tree.Selected.Data)) then 2302 2318 begin 2303 2319 mnuNodeCopy.Enabled := (TTemplate(Tree.Selected.Data).RealType in [ttDoc, ttGroup, ttClass]); 2304 2320 mnuNodeSort.Enabled := (TTemplate(Tree.Selected.Data).RealType in AllTemplateFolderTypes) and 2305 2306 2321 (Tree.Selected.HasChildren) and 2322 (Tree.Selected.GetFirstChild.GetNextSibling <> nil); 2307 2323 end 2308 2324 else … … 2319 2335 procedure TfrmTemplateEditor.mnuCollapseTreeClick(Sender: TObject); 2320 2336 begin 2321 if (GetTree = tvShared) then2337 if (GetTree = tvShared) then 2322 2338 begin 2323 2339 tvShared.Selected := tvShared.Items.GetFirstNode; … … 2337 2353 begin 2338 2354 Tree := GetTree; 2339 if (Tree = tvShared) then2355 if (Tree = tvShared) then 2340 2356 begin 2341 2357 FFindShOn := not FFindShOn; 2342 2358 pnlShSearch.Visible := FFindShOn; 2343 if (FFindShOn) then2359 if (FFindShOn) then 2344 2360 begin 2345 2361 edtShSearch.SetFocus; … … 2351 2367 FFindPerOn := not FFindPerOn; 2352 2368 pnlPerSearch.Visible := FFindPerOn; 2353 if (FFindPerOn) then2369 if (FFindPerOn) then 2354 2370 begin 2355 2371 edtPerSearch.SetFocus; … … 2362 2378 procedure TfrmTemplateEditor.ShowTemplateType(Template: TTemplate); 2363 2379 begin 2364 if (Template.PersonalOwner > 0) then2380 if (Template.PersonalOwner > 0) then 2365 2381 gbProperties.Caption := 'Personal' 2366 2382 else … … 2371 2387 function TfrmTemplateEditor.GetTree: TTreeView; 2372 2388 begin 2373 if (FFromMainMenu) then2389 if (FFromMainMenu) then 2374 2390 Result := FMainMenuTree 2375 2391 else 2376 2392 begin 2377 if (TTemplateTreeType(PopupComponent(popTemplates, popTemplates).Tag) = ttShared) then2393 if (TTemplateTreeType(PopupComponent(popTemplates, popTemplates).Tag) = ttShared) then 2378 2394 Result := tvShared 2379 2395 else … … 2395 2411 2396 2412 begin 2397 if (TTemplateTreeType(TButton(Sender).Tag) = ttShared) then2413 if (TTemplateTreeType(TButton(Sender).Tag) = ttShared) then 2398 2414 begin 2399 2415 Tree := tvShared; … … 2413 2429 LastFoundNode := FLastFoundPerNode; 2414 2430 end; 2415 if (edtSearch.text <> '') then2416 begin 2417 IsNext := ((FindNext) and assigned 2431 if (edtSearch.text <> '') then 2432 begin 2433 IsNext := ((FindNext) and assigned(LastFoundNode)); 2418 2434 if IsNext then 2419 2435 2420 2436 TmpNode := LastFoundNode 2421 2437 else … … 2424 2440 try 2425 2441 Found := FindTemplate(edtSearch.Text, Tree, Self, TmpNode, 2426 2442 IsNext, not FindCase, FindWholeWords); 2427 2443 finally 2428 2444 FInternalHiddenExpand := FALSE; … … 2431 2447 begin 2432 2448 Tree.Selected := Found; 2433 if (Tree = tvShared) then2449 if (Tree = tvShared) then 2434 2450 FLastFoundShNode := Found 2435 2451 else … … 2443 2459 procedure TfrmTemplateEditor.edtSearchChange(Sender: TObject); 2444 2460 begin 2445 if (TTemplateTreeType(TEdit(Sender).Tag) = ttShared) then2461 if (TTemplateTreeType(TEdit(Sender).Tag) = ttShared) then 2446 2462 begin 2447 2463 btnShFind.Enabled := (edtShSearch.Text <> ''); … … 2457 2473 procedure TfrmTemplateEditor.SetFindNext(const Tree: TTreeView; const Value: boolean); 2458 2474 begin 2459 if (Tree = tvShared) then2460 begin 2461 if (FFindShNext <> Value) then2475 if (Tree = tvShared) then 2476 begin 2477 if (FFindShNext <> Value) then 2462 2478 begin 2463 2479 FFindShNext := Value; 2464 if (FFindShNext) then btnShFind.Caption := 'Find Next'2480 if (FFindShNext) then btnShFind.Caption := 'Find Next' 2465 2481 else btnShFind.Caption := 'Find'; 2466 2482 end; … … 2468 2484 else 2469 2485 begin 2470 if (FFindPerNext <> Value) then2486 if (FFindPerNext <> Value) then 2471 2487 begin 2472 2488 FFindPerNext := Value; 2473 if (FFindPerNext) then btnPerFind.Caption := 'Find Next'2489 if (FFindPerNext) then btnPerFind.Caption := 'Find Next' 2474 2490 else btnPerFind.Caption := 'Find'; 2475 2491 end; … … 2499 2515 procedure TfrmTemplateEditor.btnOKClick(Sender: TObject); 2500 2516 begin 2501 if (ScanNames) then2502 begin 2503 if (SaveAllTemplates) then2517 if (ScanNames) then 2518 begin 2519 if (SaveAllTemplates) then 2504 2520 begin 2505 2521 FOK2Close := TRUE; … … 2513 2529 procedure TfrmTemplateEditor.FormShow(Sender: TObject); 2514 2530 begin 2515 if (FFirstShow) then2531 if (FFirstShow) then 2516 2532 begin 2517 2533 FUpdating := FALSE; 2518 2534 FFirstShow := FALSE; 2519 if (FFocusName) then2535 if (FFocusName) then 2520 2536 begin 2521 2537 edtName.SetFocus; … … 2534 2550 2535 2551 begin 2536 if (not assigned(frmTemplateObjects)) then2552 if (not assigned(frmTemplateObjects)) then 2537 2553 begin 2538 2554 dmodShared.LoadTIUObjects; … … 2542 2558 begin 2543 2559 UpdatePersonalObjects; 2544 if uPersonalObjects.Count > 0 then 2560 if uPersonalObjects.Count > 0 then // -------- CQ #8665 - RV ------------ 2545 2561 begin 2546 2562 DoIt := FALSE; 2547 for i := 0 to dmodShared.TIUObjects.Count -1 do2548 if uPersonalObjects.IndexOf(Piece(dmodShared.TIUObjects[i], U,2)) >= 0 then// -------- CQ #8665 - RV ------------2563 for i := 0 to dmodShared.TIUObjects.Count - 1 do 2564 if uPersonalObjects.IndexOf(Piece(dmodShared.TIUObjects[i], U, 2)) >= 0 then // -------- CQ #8665 - RV ------------ 2549 2565 frmTemplateObjects.cboObjects.Items.Add(dmodShared.TIUObjects[i]); 2550 2566 end; … … 2562 2578 begin 2563 2579 FBPOK := FALSE; 2564 if (reBoil.Lines.Count > 0) then2565 begin 2566 if (dmodShared.TemplateOK(FCurTree.Selected.Data,'OK')) then2580 if (reBoil.Lines.Count > 0) then 2581 begin 2582 if (dmodShared.TemplateOK(FCurTree.Selected.Data, 'OK')) then 2567 2583 begin 2568 2584 TestBoilerplate(reBoil.Lines); 2569 if (RPCBrokerV.Results.Count > 0) then2570 InfoBox('Boilerplate Contains Errors:' +CRLF+CRLF+2585 if (RPCBrokerV.Results.Count > 0) then 2586 InfoBox('Boilerplate Contains Errors:' + CRLF + CRLF + 2571 2587 RPCBrokerV.Results.Text, 'Error', MB_OK or MB_ICONERROR) 2572 2588 else 2573 2589 begin 2574 2590 FBPOK := TRUE; 2575 if (assigned(Sender)) then2591 if (assigned(Sender)) then 2576 2592 InfoBox('No Errors Found in Boilerplate.', 'Information', MB_OK or MB_ICONINFORMATION); 2577 2593 end; … … 2590 2606 2591 2607 mnuBPPaste.Enabled := (ok and Clipboard.HasFormat(CF_TEXT)); 2592 if (ok) then2608 if (ok) then 2593 2609 ok := (reBoil.Lines.Count > 0); 2594 2610 tryOK := (reBoil.Lines.Count > 0) or ((pnlGroupBP.Visible) and (reGroupBP.Lines.Count > 0)); … … 2616 2632 while (assigned(Node)) do 2617 2633 begin 2618 if (Node.Text <> EmptyNodeText) and (assigned(Node.Data)) then2619 begin 2620 if (BadTemplateName(Node.Text)) then2634 if (Node.Text <> EmptyNodeText) and (assigned(Node.Data)) then 2635 begin 2636 if (BadTemplateName(Node.Text)) then 2621 2637 Errors.Add(Node); 2622 2638 end; … … 2630 2646 ScanTree(tvShared); 2631 2647 ScanTree(tvPersonal); 2632 if (Errors.Count > 0) then2633 begin 2634 if (Errors.Count > 1) then2648 if (Errors.Count > 0) then 2649 begin 2650 if (Errors.Count > 1) then 2635 2651 msg := IntToStr(Errors.Count) + ' Templates have invalid names' 2636 2652 else 2637 2653 msg := 'Template has an invalid name'; 2638 2654 msg := msg + ': '; 2639 for i := 0 to Errors.Count -1 do2640 begin 2641 if (i > 0) then msg := msg + ', ';2655 for i := 0 to Errors.Count - 1 do 2656 begin 2657 if (i > 0) then msg := msg + ', '; 2642 2658 Node := TTreeNode(Errors[i]); 2643 2659 msg := msg + Node.Text; … … 2671 2687 2672 2688 begin 2673 if (not FOK2Close) and (BackupDiffers) then2689 if (not FOK2Close) and (BackupDiffers) then 2674 2690 begin 2675 2691 ans := InfoBox('Save Changes?', 'Confirmation', MB_YESNOCANCEL or MB_ICONQUESTION); 2676 if (ans = IDCANCEL) then2692 if (ans = IDCANCEL) then 2677 2693 CanClose := FALSE 2678 2694 else 2679 if(ans = IDYES) then 2680 begin 2681 CanClose := FALSE; 2682 if(ScanNames) then 2683 begin 2684 if(SaveAllTemplates) then 2685 CanClose := TRUE 2686 else 2687 BtnApply.Enabled := BackupDiffers; 2695 if (ans = IDYES) then 2696 begin 2697 CanClose := FALSE; 2698 if (ScanNames) then 2699 begin 2700 if (SaveAllTemplates) then 2701 CanClose := TRUE 2702 else 2703 BtnApply.Enabled := BackupDiffers; 2704 end; 2688 2705 end; 2689 end;2690 2706 end; 2691 2707 end; … … 2703 2719 tmplEditorSplitterNotes := pnlNotes.Height; 2704 2720 pnlBoilerplateResize(Self); 2721 if not PnlNotes.visible and (PnlNotes.Top <= pnlGroupBP.Top - pnlGroupBP.Constraints.MinHeight) then 2722 tmplEditorSplitterNotes := (pnlGroupBP.Height - pnlGroupBP.Constraints.MinHeight) - splNotes.Height - 10; 2723 if not pnlGroupBP.visible and (pnlGroupBP.Top >= pnlNotes.Top + pnlGroupBP.Constraints.MinHeight) then 2724 tmplEditorSplitterBoil := reBoil.Height - pnlGroupBP.Constraints.MinHeight - 10; 2705 2725 end; 2706 2726 … … 2708 2728 var Key: Char); 2709 2729 begin 2710 if (not (Key in ['0','1','2','3'])) then Key := #0;2730 if (not (Key in ['0', '1', '2', '3'])) then Key := #0; 2711 2731 end; 2712 2732 … … 2717 2737 begin 2718 2738 Warn := (ActiveControl <> btnCancel) and (BadTemplateName(edtName.Text)); 2719 if (Warn and ((ActiveControl = sbShDelete) or (ActiveControl = sbPerDelete))) then2720 begin 2721 if ((assigned(FCurTree)) and (assigned(FCurTree.Selected))) then2739 if (Warn and ((ActiveControl = sbShDelete) or (ActiveControl = sbPerDelete))) then 2740 begin 2741 if ((assigned(FCurTree)) and (assigned(FCurTree.Selected))) then 2722 2742 Warn := not AutoDel(TTemplate(FCurTree.Selected.Data)); 2723 2743 end; 2724 if (Warn) then2744 if (Warn) then 2725 2745 begin 2726 2746 InfoBox('Template has an invalid name: ' + edtName.Text + '.' + BadNameText, 'Error', MB_OK or MB_ICONERROR); … … 2741 2761 2742 2762 begin 2743 if (assigned(FDropNode)) then2763 if (assigned(FDropNode)) then 2744 2764 begin 2745 2765 TopNode := FDropNode.TreeView.TopItem; 2746 2766 Redraw := FALSE; 2747 2767 TmpPt := FDropNode.TreeView.ScreenToClient(Mouse.CursorPos); 2748 if (TopNode = FDropNode) and (TopNode <> TTreeView(FDropNode.TreeView).Items.GetFirstNode) then2768 if (TopNode = FDropNode) and (TopNode <> TTreeView(FDropNode.TreeView).Items.GetFirstNode) then 2749 2769 begin 2750 2770 FDropNode.TreeView.TopItem := TopNode.GetPrevVisible; … … 2754 2774 begin 2755 2775 RMax := FDropNode.TreeView.ClientHeight - EdgeScroll; 2756 if ((TmpPt.Y > RMax) and (FDropNode.GetNextVisible <> nil)) then2776 if ((TmpPt.Y > RMax) and (FDropNode.GetNextVisible <> nil)) then 2757 2777 begin 2758 2778 TORTreeView(FDropNode.TreeView).VertScrollPos := 2759 TORTreeView(FDropNode.TreeView).VertScrollPos + 1;2779 TORTreeView(FDropNode.TreeView).VertScrollPos + 1; 2760 2780 Redraw := TRUE; 2761 2781 end; 2762 2782 end; 2763 if (FLastDropNode <> FDropNode) then2764 begin 2765 if ((assigned(FDropNode)) and (FDropNode.GetNext = nil)) then2783 if (FLastDropNode <> FDropNode) then 2784 begin 2785 if ((assigned(FDropNode)) and (FDropNode.GetNext = nil)) then 2766 2786 Redraw := TRUE 2767 2787 else 2768 if((assigned(FLastDropNode)) and (FLastDropNode.GetNext = nil)) then2769 Redraw := TRUE;2788 if ((assigned(FLastDropNode)) and (FLastDropNode.GetNext = nil)) then 2789 Redraw := TRUE; 2770 2790 FLastDropNode := FDropNode; 2771 2791 FDragOverCount := 0; … … 2773 2793 else 2774 2794 begin 2775 if (FDropNode.HasChildren) and (not FDropNode.Expanded) then2795 if (FDropNode.HasChildren) and (not FDropNode.Expanded) then 2776 2796 begin 2777 2797 ht := FDropNode.TreeView.GetHitTestInfoAt(TmpPt.X, TmpPt.Y); 2778 if (htOnButton in ht) then2798 if (htOnButton in ht) then 2779 2799 begin 2780 2800 inc(FDragOverCount); 2781 if (FDragOverCount > 4) then2801 if (FDragOverCount > 4) then 2782 2802 begin 2783 2803 TopNode := FDropNode.TreeView.TopItem; … … 2791 2811 FDragOverCount := 0; 2792 2812 end; 2793 if (not Redraw) then2813 if (not Redraw) then 2794 2814 begin 2795 2815 HPos := TORTreeView(FDropNode.TreeView).HorzScrollPos; 2796 if (HPos > 0) and (TmpPt.X < EdgeScroll) then2816 if (HPos > 0) and (TmpPt.X < EdgeScroll) then 2797 2817 begin 2798 2818 TORTreeView(FDropNode.TreeView).HorzScrollPos := 2799 TORTreeView(FDropNode.TreeView).HorzScrollPos - EdgeScroll;2819 TORTreeView(FDropNode.TreeView).HorzScrollPos - EdgeScroll; 2800 2820 Redraw := TRUE; 2801 2821 end … … 2803 2823 begin 2804 2824 RMax := FDropNode.TreeView.ClientWidth - EdgeScroll; 2805 if (TmpPt.X > RMax) then2825 if (TmpPt.X > RMax) then 2806 2826 begin 2807 2827 TORTreeView(FDropNode.TreeView).HorzScrollPos := 2808 TORTreeView(FDropNode.TreeView).HorzScrollPos + EdgeScroll;2828 TORTreeView(FDropNode.TreeView).HorzScrollPos + EdgeScroll; 2809 2829 Redraw := TRUE; 2810 2830 end; … … 2812 2832 end; 2813 2833 end; 2814 if (Redraw) then2834 if (Redraw) then 2815 2835 begin 2816 2836 TmpPt := Mouse.CursorPos; // Wiggling the mouse causes needed windows messages to fire … … 2877 2897 procedure TfrmTemplateEditor.mnuNodeDeleteClick(Sender: TObject); 2878 2898 begin 2879 if (FCurTree = tvShared) and (sbShDelete.Visible) and (sbShDelete.Enabled) then2899 if (FCurTree = tvShared) and (sbShDelete.Visible) and (sbShDelete.Enabled) then 2880 2900 sbDeleteClick(sbShDelete) 2881 2901 else 2882 if(FCurTree = tvPersonal) and (sbPerDelete.Visible) and (sbPerDelete.Enabled) then2883 sbDeleteClick(sbPerDelete);2902 if (FCurTree = tvPersonal) and (sbPerDelete.Visible) and (sbPerDelete.Enabled) then 2903 sbDeleteClick(sbPerDelete); 2884 2904 end; 2885 2905 2886 2906 procedure TfrmTemplateEditor.mnuNodeCopyClick(Sender: TObject); 2887 2907 begin 2888 if (assigned(FCurTree)) then2908 if (assigned(FCurTree)) then 2889 2909 FCopyNode := FCurTree.Selected 2890 2910 else … … 2894 2914 procedure TfrmTemplateEditor.mnuNodePasteClick(Sender: TObject); 2895 2915 begin 2896 if (PasteOK) then2916 if (PasteOK) then 2897 2917 begin 2898 2918 FDragNode := FCopyNode; … … 2916 2936 begin 2917 2937 Result := assigned(FCopyNode) and assigned(FPasteNode); 2918 if (Result) then2938 if (Result) then 2919 2939 Result := (FTreeControl[TTemplateTreeType(FPasteNode.TreeView.Tag), tcDel].Visible); 2920 if (Result) then2940 if (Result) then 2921 2941 begin 2922 2942 OldCopying := FCopying; … … 2924 2944 try 2925 2945 Node := FPasteNode; 2926 if (TTemplate(Node.Data).RealType = ttDoc) then2946 if (TTemplate(Node.Data).RealType = ttDoc) then 2927 2947 Node := Node.Parent; 2928 2948 Result := AllowMove(Node, FCopyNode); … … 2942 2962 begin 2943 2963 2944 if (Key = VK_DELETE) then2945 begin 2946 if (Sender = tvShared) then2947 begin 2948 if (sbShDelete.Visible and sbShDelete.Enabled) then2964 if (Key = VK_DELETE) then 2965 begin 2966 if (Sender = tvShared) then 2967 begin 2968 if (sbShDelete.Visible and sbShDelete.Enabled) then 2949 2969 sbDeleteClick(sbShDelete); 2950 2970 end 2951 2971 else 2952 2972 begin 2953 if (sbPerDelete.Visible and sbPerDelete.Enabled) then2973 if (sbPerDelete.Visible and sbPerDelete.Enabled) then 2954 2974 sbDeleteClick(sbPerDelete); 2955 2975 end; … … 2957 2977 //Code Added to provide CTRL Key access for 508 compliance GRE 3/03 2958 2978 if (ssCtrl in Shift) and (Key = VK_A) then 2959 2979 reBoil.SelectAll 2960 2980 else 2961 if (ssCtrl in Shift) and (Key = VK_C) then2981 if (ssCtrl in Shift) and (Key = VK_C) then 2962 2982 reBoil.CopyToClipboard 2963 else2964 if (ssCtrl in Shift) and (Key = VK_E) then2965 mnuBPErrorCheckClick(Self)2966 else2967 if (ssCtrl in Shift) and (Key = VK_F) then2968 mnuBPInsertFieldClick(Self)2969 else2970 if (ssCtrl in Shift) and (Key = VK_G) then2971 GrammarCheckForControl(reBoil)2972 else2973 if (ssCtrl in Shift) and (Key = VK_I) then2974 mnuBPInsertObjectClick(Self)2975 else2976 if (ssCtrl in Shift) and (Key = VK_S) then2977 SpellCheckForControl(reBoil)2978 else2979 if (ssCtrl in Shift) and (Key = VK_T) then2980 mnuBPTryClick(Self)2981 else2982 if (ssCtrl in Shift) and (Key = VK_V) then2983 reBoil.SelText := Clipboard.AsText2984 else2985 if (ssCtrl in Shift) and (Key = VK_X) then2986 reBoil.CutToClipboard2987 else2988 if (ssCtrl in Shift) and (Key = VK_Z) then2989 reBoil.Perform(EM_UNDO, 0, 0);2983 else 2984 if (ssCtrl in Shift) and (Key = VK_E) then 2985 mnuBPErrorCheckClick(Self) 2986 else 2987 if (ssCtrl in Shift) and (Key = VK_F) then 2988 mnuBPInsertFieldClick(Self) 2989 else 2990 if (ssCtrl in Shift) and (Key = VK_G) then 2991 GrammarCheckForControl(reBoil) 2992 else 2993 if (ssCtrl in Shift) and (Key = VK_I) then 2994 mnuBPInsertObjectClick(Self) 2995 else 2996 if (ssCtrl in Shift) and (Key = VK_S) then 2997 SpellCheckForControl(reBoil) 2998 else 2999 if (ssCtrl in Shift) and (Key = VK_T) then 3000 mnuBPTryClick(Self) 3001 else 3002 if (ssCtrl in Shift) and (Key = VK_V) then 3003 reBoil.SelText := Clipboard.AsText 3004 else 3005 if (ssCtrl in Shift) and (Key = VK_X) then 3006 reBoil.CutToClipboard 3007 else 3008 if (ssCtrl in Shift) and (Key = VK_Z) then 3009 reBoil.Perform(EM_UNDO, 0, 0); 2990 3010 //End of ---- Code Added to provide CTRL Key access for 508 compliance GRE 3/03 2991 3011 end; … … 3002 3022 mnuInsertField.Enabled := ok; 3003 3023 mnuPaste.Enabled := (ok and Clipboard.HasFormat(CF_TEXT)); 3004 if (ok) then3024 if (ok) then 3005 3025 ok := (reBoil.Lines.Count > 0); 3006 3026 tryOK := (reBoil.Lines.Count > 0) or ((pnlGroupBP.Visible) and (reGroupBP.Lines.Count > 0)); … … 3018 3038 else 3019 3039 begin 3020 mnuInsertObject.Enabled := FALSE;3021 mnuInsertField.Enabled 3022 mnuPaste.Enabled 3023 mnuErrorCheck.Enabled 3024 mnuTry.Enabled 3025 mnuSpellCheck.Enabled 3026 mnuCheckGrammar.Enabled 3027 mnuCopy.Enabled 3028 mnuCut.Enabled 3029 mnuSelectAll.Enabled 3030 mnuUndo.Enabled 3040 mnuInsertObject.Enabled := FALSE; 3041 mnuInsertField.Enabled := FALSE; 3042 mnuPaste.Enabled := FALSE; 3043 mnuErrorCheck.Enabled := FALSE; 3044 mnuTry.Enabled := FALSE; 3045 mnuSpellCheck.Enabled := FALSE; 3046 mnuCheckGrammar.Enabled := FALSE; 3047 mnuCopy.Enabled := FALSE; 3048 mnuCut.Enabled := FALSE; 3049 mnuSelectAll.Enabled := FALSE; 3050 mnuUndo.Enabled := FALSE; 3031 3051 mnuGroupBoilerplate.Enabled := FALSE; 3032 3052 end; … … 3042 3062 begin 3043 3063 SetFindNext(tvShared, FALSE); 3044 if (pnlShSearch.Visible) then edtShSearch.SetFocus;3064 if (pnlShSearch.Visible) then edtShSearch.SetFocus; 3045 3065 end; 3046 3066 … … 3048 3068 begin 3049 3069 SetFindNext(tvPersonal, FALSE); 3050 if (pnlPerSearch.Visible) then edtPerSearch.SetFocus;3070 if (pnlPerSearch.Visible) then edtPerSearch.SetFocus; 3051 3071 end; 3052 3072 … … 3058 3078 FFromMainMenu := TRUE; 3059 3079 Tree := FCurTree; 3060 if (assigned(Tree) and assigned(Tree.Selected)) then3061 begin 3062 if (Tree = tvShared) then3080 if (assigned(Tree) and assigned(Tree.Selected)) then 3081 begin 3082 if (Tree = tvShared) then 3063 3083 mnuTDelete.Enabled := ((sbShDelete.Visible) and (sbShDelete.Enabled)) 3064 3084 else 3065 3085 mnuTDelete.Enabled := ((sbPerDelete.Visible) and (sbPerDelete.Enabled)); 3066 if (assigned(Tree) and assigned(Tree.Selected) and assigned(Tree.Selected.Data)) then3086 if (assigned(Tree) and assigned(Tree.Selected) and assigned(Tree.Selected.Data)) then 3067 3087 begin 3068 3088 mnuTCopy.Enabled := (TTemplate(Tree.Selected.Data).RealType in [ttDoc, ttGroup, ttClass]); 3069 3089 mnuSort.Enabled := (TTemplate(Tree.Selected.Data).RealType in AllTemplateFolderTypes) and 3070 3071 3090 (Tree.Selected.HasChildren) and 3091 (Tree.Selected.GetFirstChild.GetNextSibling <> nil); 3072 3092 end 3073 3093 else … … 3120 3140 procedure TfrmTemplateEditor.pnlShSearchResize(Sender: TObject); 3121 3141 begin 3122 if ((cbShMatchCase.Width + cbShWholeWords.Width) > pnlShSearch.Width) then3142 if ((cbShMatchCase.Width + cbShWholeWords.Width) > pnlShSearch.Width) then 3123 3143 cbShWholeWords.Left := cbShMatchCase.Width 3124 3144 else … … 3128 3148 procedure TfrmTemplateEditor.pnlPerSearchResize(Sender: TObject); 3129 3149 begin 3130 if ((cbPerMatchCase.Width + cbPerWholeWords.Width) > pnlPerSearch.Width) then3150 if ((cbPerMatchCase.Width + cbPerWholeWords.Width) > pnlPerSearch.Width) then 3131 3151 cbPerWholeWords.Left := cbPerMatchCase.Width 3132 3152 else … … 3156 3176 begin 3157 3177 Tree := FCurTree; 3158 if (assigned(Tree) and assigned(Tree.Selected) and Tree.Selected.HasChildren) then3178 if (assigned(Tree) and assigned(Tree.Selected) and Tree.Selected.HasChildren) then 3159 3179 begin 3160 3180 TTemplate(Tree.Selected.Data).SortChildren; … … 3167 3187 var NewWidth, NewHeight: Integer; var Resize: Boolean); 3168 3188 begin 3169 if (NewHeight < 40) then Resize := FALSE;3189 if (NewHeight < 40) then Resize := FALSE; 3170 3190 end; 3171 3191 3172 3192 function TfrmTemplateEditor.AutoDel(Template: TTemplate): boolean; 3173 3193 begin 3174 if (assigned(Template)) then3194 if (assigned(Template)) then 3175 3195 Result := (((Template.ID = '0') or (Template.ID = '')) and 3176 3177 3196 (Template.PrintName = NewTemplateName) and 3197 (Template.Boilerplate = '')) 3178 3198 else 3179 Result := FALSE; 3199 Result := FALSE; 3180 3200 end; 3181 3201 … … 3185 3205 Move: boolean; 3186 3206 tmpl: TTemplate; 3187 txt: String;3207 txt: string; 3188 3208 3189 3209 begin 3190 3210 mnuBPErrorCheckClick(nil); 3191 if (FBPOK) or (reBoil.Lines.Count = 0) then3211 if (FBPOK) or (reBoil.Lines.Count = 0) then 3192 3212 begin 3193 3213 Move := assigned(frmTemplateView); 3194 if (Move) then3214 if (Move) then 3195 3215 begin 3196 3216 R := frmTemplateView.BoundsRect; … … 3201 3221 tmpl.TemplatePreviewMode := TRUE; // Prevents "Are you sure?" dialog when canceling 3202 3222 txt := tmpl.Text; 3203 if (not tmpl.DialogAborted) then3204 ShowTemplateData(Self, tmpl.PrintName ,txt);3205 if (Move) then3223 if (not tmpl.DialogAborted) then 3224 ShowTemplateData(Self, tmpl.PrintName, txt); 3225 if (Move) then 3206 3226 frmTemplateView.BoundsRect := R; 3207 3227 tmpl.TemplatePreviewMode := FALSE; … … 3216 3236 dmodShared.LoadTIUObjects; 3217 3237 UpdatePersonalObjects; 3218 GetAutoGenText(AName, AText, uPersonalObjects); 3219 if (AName <> '') and (AText <> '') then3238 GetAutoGenText(AName, AText, uPersonalObjects); // -------- CQ #8665 - RV ------------ 3239 if (AName <> '') and (AText <> '') then 3220 3240 begin 3221 3241 btnNewClick(Self); … … 3233 3253 3234 3254 begin 3235 if ((not FUpdating) and (assigned(FCurTree)) and (assigned(FCurTree.Selected))) then3255 if ((not FUpdating) and (assigned(FCurTree)) and (assigned(FCurTree.Selected))) then 3236 3256 begin 3237 3257 if CanClone(FCurTree.Selected) then … … 3243 3263 Template.Description := reNotes.Lines.Text; 3244 3264 UpdateApply(Template); 3245 if (DoRefresh) then3265 if (DoRefresh) then 3246 3266 begin 3247 3267 tvShared.Invalidate; … … 3297 3317 ok := not reNotes.ReadOnly; 3298 3318 mnuNotesPaste.Enabled := (ok and Clipboard.HasFormat(CF_TEXT)); 3299 if (ok) then3319 if (ok) then 3300 3320 ok := (reNotes.Lines.Count > 0); 3301 3321 mnuNotesSpelling.Enabled := ok and SpellCheckAvailable; … … 3308 3328 3309 3329 procedure TfrmTemplateEditor.cbNotesClick(Sender: TObject); 3330 var 3331 ScreenPoint: TPoint; 3332 NewHeight: Integer; 3310 3333 begin 3311 3334 pnlNotes.Visible := cbNotes.Checked; … … 3315 3338 pnlNotes.Height := tmplEditorSplitterNotes; 3316 3339 pnlNotes.Top := pnlBottom.Top - pnlNotes.Height; 3317 splNotes.Top := pnlNotes.Top-3; 3340 splNotes.Top := pnlNotes.Top - 3; 3341 if pnlGroupBP.Height <= pnlGroupBP.Constraints.MinHeight then begin 3342 //Clear the points 3343 ScreenPoint.Y := 0; 3344 ScreenPoint.X := 0; 3345 if pnlNotes.ClientToScreen(ScreenPoint).Y + 30 > pnlBottom.Top then begin 3346 if pnlNotes.ClientToScreen(ScreenPoint).Y > pnlBottom.Top then 3347 NewHeight := pnlNotes.Height + (pnlNotes.ClientToScreen(ScreenPoint).Y - pnlBottom.Top) 3348 else 3349 NewHeight := pnlNotes.Height - (pnlNotes.ClientToScreen(ScreenPoint).Y - pnlBottom.Top); 3350 Reboil.Height := Reboil.Height - (NewHeight + 10); 3351 PnlNotes.Constraints.MinHeight := 30; 3352 pnlNotes.Height := PnlNotes.Constraints.MinHeight; 3353 if reboil.Height = reboil.Constraints.MinHeight then 3354 PnlTop.height := PnlTop.height - 100; 3355 end; 3356 end; 3357 end else begin 3358 pnlNotes.Constraints.MinHeight := 1; 3359 pnlNotes.Height := 1; 3318 3360 end; 3319 3361 pnlBoilerplateResize(Self); … … 3348 3390 var 3349 3391 Template: TTemplate; 3350 3351 begin 3352 if ((not FUpdating) and (assigned(FCurTree)) and (assigned(FCurTree.Selected))) then3392 3393 begin 3394 if ((not FUpdating) and (assigned(FCurTree)) and (assigned(FCurTree.Selected))) then 3353 3395 begin 3354 3396 if CanClone(FCurTree.Selected) then … … 3359 3401 begin 3360 3402 case Index of 3361 BPDisplayOnlyFld: Template.DisplayOnly:= Sender.Checked;3362 BPFirstLineFld: Template.FirstLine:= Sender.Checked;3363 BPOneItemOnlyFld: Template.OneItemOnly:= Sender.Checked;3364 BPHideDlgItemsFld: Template.HideDlgItems:= Sender.Checked;3365 BPHideItemsFld: Template.HideItems:= Sender.Checked;3366 BPIndentFld: Template.IndentItems:= Sender.Checked;3367 BPLockFld: Template.Lock:= Sender.Checked;3403 BPDisplayOnlyFld: Template.DisplayOnly := Sender.Checked; 3404 BPFirstLineFld: Template.FirstLine := Sender.Checked; 3405 BPOneItemOnlyFld: Template.OneItemOnly := Sender.Checked; 3406 BPHideDlgItemsFld: Template.HideDlgItems := Sender.Checked; 3407 BPHideItemsFld: Template.HideItems := Sender.Checked; 3408 BPIndentFld: Template.IndentItems := Sender.Checked; 3409 BPLockFld: Template.Lock := Sender.Checked; 3368 3410 end; 3369 3411 UpdateApply(Template); … … 3383 3425 mnuImportTemplate.Enabled := btnNew.Enabled; 3384 3426 mnuExportTemplate.Enabled := (assigned(FCurTree) and assigned(FCurTree.Selected) and 3385 3427 assigned(FCurTree.Selected.Data)); 3386 3428 end; 3387 3429 … … 3398 3440 procedure TfrmTemplateEditor.mnuBPInsertFieldClick(Sender: TObject); 3399 3441 begin 3400 if (not assigned(frmTemplateFields)) then3442 if (not assigned(frmTemplateFields)) then 3401 3443 begin 3402 3444 frmTemplateFields := TfrmTemplateFields.Create(Self); … … 3425 3467 begin 3426 3468 err := FALSE; 3427 if (assigned(FCurTree) and assigned(FCurTree.Selected) and assigned(FCurTree.Selected.Data)) then3469 if (assigned(FCurTree) and assigned(FCurTree.Selected) and assigned(FCurTree.Selected.Data)) then 3428 3470 begin 3429 3471 dlgExport.FileName := ValidFileName(TTemplate(FCurTree.Selected.Data).PrintName); … … 3434 3476 Flds := TStringList.Create; 3435 3477 try 3436 Tmpl.Add('<' +XMLHeader+'>');3478 Tmpl.Add('<' + XMLHeader + '>'); 3437 3479 if TTemplate(FCurTree.Selected.Data).CanExportXML(Tmpl, Flds, 2) then 3438 3480 begin … … 3440 3482 ExpandEmbeddedFields(Flds); 3441 3483 FastAssign(ExportTemplateFields(Flds), Flds); 3442 for i := 0 to Flds.Count -1 do3484 for i := 0 to Flds.Count - 1 do 3443 3485 Flds[i] := ' ' + Flds[i]; 3444 3486 FastAddStrings(Flds, Tmpl); 3445 3487 end; {if} 3446 Tmpl.Add('</' +XMLHeader+'>');3488 Tmpl.Add('</' + XMLHeader + '>'); 3447 3489 try 3448 3490 XMLDoc := CoDOMDocument.Create; … … 3460 3502 if not err then 3461 3503 InfoBox('Template ' + TTemplate(FCurTree.Selected.Data).PrintName + 3462 3504 ' Exported.', 'Template Exported', MB_OK); 3463 3505 end; 3464 3506 finally … … 3483 3525 ImportedTemplate: TTemplate; 3484 3526 AppData, Flds, ResultSet: TStringList; 3485 tmp, j,p3: string;3527 tmp, j, p3: string; 3486 3528 err, ok, changes, xmlerr: boolean; 3487 3529 i: integer; … … 3504 3546 begin 3505 3547 tmp := ExtractFileExt(dlgImport.FileName); 3506 if (WordImportActive and ((CompareText(tmp,'.doc') = 0) or3507 (CompareText(tmp,'.dot') = 0))) then3548 if (WordImportActive and ((CompareText(tmp, '.doc') = 0) or 3549 (CompareText(tmp, '.dot') = 0))) then 3508 3550 AppData := TStringList.Create 3509 3551 else … … 3539 3581 XMLImportError(0); 3540 3582 try 3541 if (RootElement.tagName <> XMLHeader)then3583 if (RootElement.tagName <> XMLHeader) then 3542 3584 XMLImportError(0) 3543 3585 else … … 3548 3590 begin 3549 3591 FXMLFieldElement := FindXMLElement(RootElement, XMLTemplateFieldsTag); 3550 if (assigned(FXMLFieldElement)) then3592 if (assigned(FXMLFieldElement)) then 3551 3593 begin 3552 3594 Flds := TStringList.Create; … … 3557 3599 changes := FALSE; 3558 3600 Application.ProcessMessages; 3559 if not BuildTemplateFields(Flds) then 3560 choice := IDCANCEL; 3601 if not BuildTemplateFields(Flds) then //Calls RPC to transfer all field XML 3602 choice := IDCANCEL; //for processing 3561 3603 Flds.Text := ''; 3562 3604 Application.ProcessMessages; … … 3564 3606 CheckTemplateFields(Flds); 3565 3607 if Flds.Count > 0 then 3608 begin 3609 for i := 1 to Flds.Count do 3566 3610 begin 3567 for i := 1 to Flds.Count do 3568 begin 3569 j := piece(Flds[i-1],U,2); 3570 if (j = '0') or (j = '2') then 3571 begin 3572 p3 := piece(Flds[i-1],U,3); 3573 if p3 = 'XML FORMAT ERROR' then 3574 choice := IDCANCEL; 3575 changes := TRUE; 3576 if j = '2' then begin 3577 j := Flds[i-1]; 3578 SetPiece(j,U,2,'1'); 3579 Flds[i-1] := j 3580 end; 3581 end; 3611 j := piece(Flds[i - 1], U, 2); 3612 if (j = '0') or (j = '2') then 3613 begin 3614 p3 := piece(Flds[i - 1], U, 3); 3615 if p3 = 'XML FORMAT ERROR' then 3616 choice := IDCANCEL; 3617 changes := TRUE; 3618 if j = '2' then begin 3619 j := Flds[i - 1]; 3620 SetPiece(j, U, 2, '1'); 3621 Flds[i - 1] := j 3582 3622 end; 3583 end 3623 end; 3624 end; 3625 end 3584 3626 else 3585 3627 choice := IDCANCEL; 3586 3628 if choice <> IDOK then 3587 InfoBox(iMessage2 +iMessage3, 'Error', MB_OK or MB_ICONERROR)3629 InfoBox(iMessage2 + iMessage3, 'Error', MB_OK or MB_ICONERROR) 3588 3630 else 3589 if (not CanEditTemplateFields) AND3590 3591 3592 3593 3594 3631 if (not CanEditTemplateFields) and 3632 changes {(there is at least one new field)} then 3633 begin 3634 choice := InfoBox(iMessage, 'Warning', MB_OKCANCEL or MB_ICONWARNING); 3635 Flds.Text := ''; 3636 end; 3595 3637 if choice <> IDCANCEL then 3596 3638 begin 3597 3639 FImportingFromXML := TRUE; 3598 3640 try … … 3605 3647 if assigned(ImportedTemplate) and (Flds.Count > 0) then 3606 3648 if not ImportLoadedFields(ResultSet) then begin 3607 InfoBox(iMessage2 +iMessage3, 'Error', MB_OK or MB_ICONERROR);3649 InfoBox(iMessage2 + iMessage3, 'Error', MB_OK or MB_ICONERROR); 3608 3650 ClearFields; 3609 3651 choice := IDCANCEL; 3610 end; //if3652 end; //if 3611 3653 if Flds.Count = 0 then 3612 3654 choice := IDCANCEL; 3613 3655 end {if choice <> mrCancel} 3614 3656 else 3615 3657 ClearFields; … … 3617 3659 xmlerr := FALSE; 3618 3660 if (Flds.Count > 0) and 3619 3620 3621 for i := 0 to Flds.Count -1 do begin3622 if piece(ResultSet[i], U,2) = '0' then begin3623 j := piece(Flds[i], U,1) + U + '0' + U + piece(ResultSet[i],U,3);3661 (ResultSet.Count > 0) and 3662 (Flds.Count = ResultSet.Count) then 3663 for i := 0 to Flds.Count - 1 do begin 3664 if piece(ResultSet[i], U, 2) = '0' then begin 3665 j := piece(Flds[i], U, 1) + U + '0' + U + piece(ResultSet[i], U, 3); 3624 3666 Flds[i] := j; 3625 3667 end … … 3639 3681 else 3640 3682 inc(i); 3641 end; //while3642 if (Flds.Count > 0) then3683 end; //while 3684 if (Flds.Count > 0) then 3643 3685 begin 3644 3686 if assigned(frmTemplateFields) then … … 3647 3689 if not assigned(AppData) then 3648 3690 begin 3649 for i := 0 to Flds.Count -1 do3650 Flds[i] := ' Field "' + Piece(Flds[i], U,1) + '" has been renamed to "'+3651 Piece(Flds[i],U,3) + '"';3691 for i := 0 to Flds.Count - 1 do 3692 Flds[i] := ' Field "' + Piece(Flds[i], U, 1) + '" has been renamed to "' + 3693 Piece(Flds[i], U, 3) + '"'; 3652 3694 if Flds.Count = 1 then 3653 3695 tmp := 'A template field has' 3654 3696 else 3655 3697 tmp := IntToStr(Flds.Count) + ' template fields have'; 3656 Flds.Insert(0, tmp + ' been imported with the same name as');3657 Flds.Insert(1, 'existing template fields, but with different field definitions.');3658 Flds.Insert(2, 'These imported template fields have been renamed as follows:');3659 Flds.Insert(3, '');3698 Flds.Insert(0, tmp + ' been imported with the same name as'); 3699 Flds.Insert(1, 'existing template fields, but with different field definitions.'); 3700 Flds.Insert(2, 'These imported template fields have been renamed as follows:'); 3701 Flds.Insert(3, ''); 3660 3702 InfoBox(Flds.Text, 'Information', MB_OK or MB_ICONINFORMATION); 3661 3703 end; … … 3692 3734 AppData.Free; 3693 3735 if err then 3694 InfoBox('An error occured while Importing Word Document. Make sure Word is closed and try again.', 'Import Error', MB_OK);3736 InfoBox('An error occured while Importing Word Document. Make sure Word is closed and try again.', 'Import Error', MB_OK); 3695 3737 end; 3696 3738 end; … … 3707 3749 case IdxForced[FForceContainer, Index] of 3708 3750 tiTemplate: ImgIdx := 4; 3709 tiFolder: 3710 tiGroup: 3711 tiDialog: 3712 tiRemDlg: 3713 tiCOMObj: 3714 3715 3751 tiFolder: ImgIdx := 3; 3752 tiGroup: ImgIdx := 5; 3753 tiDialog: ImgIdx := 23; 3754 tiRemDlg: ImgIdx := 27; 3755 tiCOMObj: ImgIdx := 28; 3756 else 3757 ImgIdx := ord(tiNone); 3716 3758 end; 3717 3759 if ImgIdx >= 0 then 3718 dmodShared.imgTemplates.Draw(cbxType.Canvas, Rect.Left +1, Rect.Top+1, ImgIdx);3760 dmodShared.imgTemplates.Draw(cbxType.Canvas, Rect.Left + 1, Rect.Top + 1, ImgIdx); 3719 3761 if Index >= 0 then 3720 cbxType.Canvas.TextOut(Rect.Left +21, Rect.Top+2, cbxType.Items[Index]);3762 cbxType.Canvas.TextOut(Rect.Left + 21, Rect.Top + 2, cbxType.Items[Index]); 3721 3763 end; 3722 3764 3723 3765 procedure TfrmTemplateEditor.cbxTypeChange(Sender: TObject); 3724 3766 var 3725 i, tg: integer;3767 i, tg: integer; 3726 3768 Template: TTemplate; 3727 3769 ttyp: TTemplateType; … … 3730 3772 3731 3773 begin 3732 if ((not FUpdating) and (assigned(FCurTree)) and (assigned(FCurTree.Selected))) then3774 if ((not FUpdating) and (assigned(FCurTree)) and (assigned(FCurTree.Selected))) then 3733 3775 begin 3734 3776 tg := cbxType.ItemIndex; … … 3738 3780 begin 3739 3781 idx := IdxForced[FForceContainer, tg]; 3740 if (idx = tiRemDlg) and (not (GetLinkType(FCurTree.Selected) in [ltNone, ltTitle])) then3782 if (idx = tiRemDlg) and (not (GetLinkType(FCurTree.Selected) in [ltNone, ltTitle])) then 3741 3783 begin 3742 3784 FUpdating := TRUE; … … 3755 3797 begin 3756 3798 ttyp := TypeTag[idx]; 3757 if (not FForceContainer) or (not (idx in [tiTemplate, tiRemDlg])) then3799 if (not FForceContainer) or (not (idx in [tiTemplate, tiRemDlg])) then 3758 3800 begin 3759 if (ttyp = ttDialog) then3801 if (ttyp = ttDialog) then 3760 3802 begin 3761 3803 Template.Dialog := TRUE; … … 3765 3807 Template.Dialog := FALSE; 3766 3808 Template.RealType := ttyp; 3767 if (Template.RealType = ttDoc) and (idx = tiRemDlg) then3809 if (Template.RealType = ttDoc) and (idx = tiRemDlg) then 3768 3810 Template.IsReminderDialog := TRUE 3769 3811 else 3770 3812 Template.IsReminderDialog := FALSE; 3771 if (Template.RealType = ttDoc) and (idx = tiCOMObj) then3813 if (Template.RealType = ttDoc) and (idx = tiCOMObj) then 3772 3814 Template.IsCOMObject := TRUE 3773 3815 else … … 3775 3817 UpdateApply(Template); 3776 3818 end; 3777 for i := 0 to Template.Nodes.Count -1 do3819 for i := 0 to Template.Nodes.Count - 1 do 3778 3820 begin 3779 3821 Node := TTreeNode(Template.Nodes.Objects[i]); … … 3797 3839 3798 3840 begin 3799 if ((not FUpdating) and (assigned(FCurTree)) and (assigned(FCurTree.Selected)) and3800 3841 if ((not FUpdating) and (assigned(FCurTree)) and (assigned(FCurTree.Selected)) and 3842 FCanDoReminders) then 3801 3843 begin 3802 3844 if CanClone(FCurTree.Selected) then … … 3879 3921 { Returns TRUE if Cloning is not needed or if Cloning is needed and 3880 3922 the top personal Node in the tree is locked. } 3923 3881 3924 function TfrmTemplateEditor.CanClone(const Node: TTreeNode): boolean; 3882 3925 var … … 3891 3934 3892 3935 begin 3893 if (assigned(Node)) and assigned(Node.Data) then3936 if (assigned(Node)) and assigned(Node.Data) then 3894 3937 begin 3895 3938 if (TTreeView(Node.TreeView) = tvPersonal) then … … 3910 3953 procedure TfrmTemplateEditor.UpdateApply(Template: TTemplate); 3911 3954 begin 3912 if (not btnApply.Enabled) then3955 if (not btnApply.Enabled) then 3913 3956 btnApply.Enabled := Template.Changed; 3914 3957 end; … … 3930 3973 begin 3931 3974 if InfoBox('All changes must be saved before you can Refresh. Save Changes?', 3932 3975 'Confirmation', MB_YESNO or MB_ICONQUESTION) <> IDYES then 3933 3976 exit; 3934 3977 end; … … 3949 3992 exp1 := tvShared.GetExpandedIDStr(1, ';'); 3950 3993 exp2 := tvPersonal.GetExpandedIDStr(1, ';'); 3951 s1 := tvShared.GetNodeID(TORTreeNode(tvShared.Selected), 1,';');3952 s2 := tvPersonal.GetNodeID(TORTreeNode(tvPersonal.Selected), 1,';');3953 t1 := tvShared.GetNodeID(TORTreeNode(tvShared.TopItem), 1,';');3954 t2 := tvPersonal.GetNodeID(TORTreeNode(tvPersonal.TopItem), 1,';');3994 s1 := tvShared.GetNodeID(TORTreeNode(tvShared.Selected), 1, ';'); 3995 s2 := tvPersonal.GetNodeID(TORTreeNode(tvPersonal.Selected), 1, ';'); 3996 t1 := tvShared.GetNodeID(TORTreeNode(tvShared.TopItem), 1, ';'); 3997 t2 := tvPersonal.GetNodeID(TORTreeNode(tvPersonal.TopItem), 1, ';'); 3955 3998 tvPersonal.Items.BeginUpdate; 3956 3999 try … … 3962 4005 InitTrees; 3963 4006 tvShared.SetExpandedIDStr(1, ';', exp1); 3964 tvShared.TopItem := tvShared.FindPieceNode(t1, 1,';');3965 tvShared.Selected := tvShared.FindPieceNode(s1, 1,';');4007 tvShared.TopItem := tvShared.FindPieceNode(t1, 1, ';'); 4008 tvShared.Selected := tvShared.FindPieceNode(s1, 1, ';'); 3966 4009 tvPersonal.SetExpandedIDStr(1, ';', exp2); 3967 tvPersonal.TopItem := tvPersonal.FindPieceNode(t2, 1,';');3968 tvPersonal.Selected := tvPersonal.FindPieceNode(s2, 1,';');4010 tvPersonal.TopItem := tvPersonal.FindPieceNode(t2, 1, ';'); 4011 tvPersonal.Selected := tvPersonal.FindPieceNode(s2, 1, ';'); 3969 4012 finally 3970 4013 tvShared.Items.EndUpdate; … … 3979 4022 begin 3980 4023 LoadTemplateData; 3981 if (not assigned(RootTemplate)) then3982 SaveTemplate(AddTemplate('0^R^A^Shared Templates'), -1);3983 if (not assigned(MyTemplate)) then3984 AddTemplate('0^P^A^My Templates^^^' +IntToStr(User.DUZ));4024 if (not assigned(RootTemplate)) then 4025 SaveTemplate(AddTemplate('0^R^A^Shared Templates'), -1); 4026 if (not assigned(MyTemplate)) then 4027 AddTemplate('0^P^A^My Templates^^^' + IntToStr(User.DUZ)); 3985 4028 dmodShared.AddTemplateNode(tvPersonal, FPersonalEmptyNodeCount, MyTemplate); 3986 4029 dmodShared.AddTemplateNode(tvShared, FSharedEmptyNodeCount, RootTemplate); … … 4004 4047 R := TRichEdit(Sender).ClientRect; 4005 4048 if (FLastRect.Right <> R.Right) or 4006 4007 4008 4049 (FLastRect.Bottom <> R.Bottom) or 4050 (FLastRect.Left <> R.Left) or 4051 (FLastRect.Top <> R.Top) then 4009 4052 begin 4010 4053 FLastRect := R; … … 4038 4081 4039 4082 begin 4040 if ((not FUpdating) and (assigned(FCurTree)) and (assigned(FCurTree.Selected)) and4041 4083 if ((not FUpdating) and (assigned(FCurTree)) and (assigned(FCurTree.Selected)) and 4084 FCanDoCOMObjects and (FCurTree = tvShared)) then 4042 4085 begin 4043 4086 Template := TTemplate(FCurTree.Selected.Data); … … 4058 4101 4059 4102 begin 4060 if ((not FUpdating) and (assigned(FCurTree)) and (assigned(FCurTree.Selected)) and4061 4103 if ((not FUpdating) and (assigned(FCurTree)) and (assigned(FCurTree.Selected)) and 4104 FCanDoCOMObjects and (FCurTree = tvShared)) then 4062 4105 begin 4063 4106 Template := TTemplate(FCurTree.Selected.Data); … … 4078 4121 if assigned(ANode) then 4079 4122 begin 4080 if (not assigned(ANode.Data)) or (TTemplate(ANode.Data).RealType <> ttClass) then4123 if (not assigned(ANode.Data)) or (TTemplate(ANode.Data).RealType <> ttClass) then 4081 4124 begin 4082 4125 Node := ANode.Parent; … … 4087 4130 Node := nil 4088 4131 else 4089 if (TTemplate(Node.Data).RealType in AllTemplateLinkTypes) then4090 begin4091 case TTemplate(Node.Data).RealType of4092 ttTitles:Result := ltTitle;4093 ttConsults:Result := ltConsult;4094 ttProcedures: Result := ltProcedure;4095 end;4096 end4097 else4098 Node := Node.Parent;4132 if (TTemplate(Node.Data).RealType in AllTemplateLinkTypes) then 4133 begin 4134 case TTemplate(Node.Data).RealType of 4135 ttTitles: Result := ltTitle; 4136 ttConsults: Result := ltConsult; 4137 ttProcedures: Result := ltProcedure; 4138 end; 4139 end 4140 else 4141 Node := Node.Parent; 4099 4142 end 4100 4143 else 4101 4144 Node := nil; 4102 until (Result <> ltNone) or (not assigned(Node));4145 until (Result <> ltNone) or (not assigned(Node)); 4103 4146 end; 4104 4147 end; … … 4106 4149 4107 4150 procedure TfrmTemplateEditor.cbxLinkNeedData(Sender: TObject; 4108 const StartFrom: String; Direction, InsertAt: Integer);4151 const StartFrom: string; Direction, InsertAt: Integer); 4109 4152 var 4110 4153 tmpSL: TStringList; … … 4116 4159 try 4117 4160 case TTemplateLinkType(pnlLink.Tag) of 4118 ltTitle: 4161 ltTitle: FastAssign(SubSetOfAllTitles(StartFrom, Direction), tmpSL); 4119 4162 // ltConsult: 4120 4163 ltProcedure: 4121 4164 begin 4122 4165 FastAssign(SubSetOfProcedures(StartFrom, Direction), tmpSL); 4123 for i := 0 to tmpSL.Count -1 do4166 for i := 0 to tmpSL.Count - 1 do 4124 4167 begin 4125 4168 tmp := tmpSL[i]; 4126 setpiece(tmp, U,1,piece(piece(tmp,U,4),';',1));4169 setpiece(tmp, U, 1, piece(piece(tmp, U, 4), ';', 1)); 4127 4170 tmpSL[i] := tmp; 4128 4171 end; … … 4135 4178 end; 4136 4179 4137 procedure TfrmTemplateEditor.cbxLink Change(Sender: TObject);4138 var 4139 Template, LinkTemplate: TTemplate;4180 procedure TfrmTemplateEditor.cbxLinkExit(Sender: TObject); 4181 var 4182 Template, LinkTemplate: TTemplate; 4140 4183 update: boolean; 4141 4184 4142 4185 begin 4143 if ((not FUpdating) and (assigned(FCurTree)) and (assigned(FCurTree.Selected)) and4144 4186 if ((not FUpdating) and (assigned(FCurTree)) and (assigned(FCurTree.Selected)) and 4187 (FCurTree = tvShared)) then 4145 4188 begin 4146 4189 Template := TTemplate(FCurTree.Selected.Data); … … 4154 4197 begin 4155 4198 ShowMsg(GetLinkName(cbxLink.ItemID, TTemplateLinkType(pnlLink.tag)) + 4156 ' is already assigned to another template.'); 4199 ' is already assigned to another template.'); 4200 cbxLink.SetFocus; 4157 4201 cbxLink.SelectByID(Template.LinkIEN); 4158 4202 update := False; … … 4162 4206 Template.FileLink := ConvertFileLink(cbxLink.ItemID, TTemplateLinkType(pnlLink.tag)); 4163 4207 if Template.LinkName <> '' then 4164 edtName.Text := copy(Template.LinkName, 1,edtName.MaxLength);4208 edtName.Text := copy(Template.LinkName, 1, edtName.MaxLength); 4165 4209 end; 4166 4210 end … … 4180 4224 if ssShift in Shift then 4181 4225 FindNextControl(Sender as TWinControl, False, True, False).SetFocus //previous control 4182 else if ssCtrl 4226 else if ssCtrl in Shift then 4183 4227 FindNextControl(Sender as TWinControl, True, True, False).SetFocus; //next control 4184 4228 FNavigatingTab := False; … … 4194 4238 begin 4195 4239 if FNavigatingTab then 4196 Key := #0; 4240 Key := #0; //Disable shift-tab processinend; 4197 4241 end; 4198 4242 … … 4202 4246 //The navigating tab controls were inadvertantently adding tab characters 4203 4247 //This should fix it 4204 FNavigatingTab := (Key = VK_TAB) and ([ssShift, ssCtrl] * Shift <> []);4248 FNavigatingTab := (Key = VK_TAB) and ([ssShift, ssCtrl] * Shift <> []); 4205 4249 if FNavigatingTab then 4206 4250 Key := 0; -
cprs/trunk/CPRS-Chart/Templates/fTemplateFieldEditor.dfm
r829 r1679 832 832 end 833 833 object btnNew: TButton 834 Left = 71 1834 Left = 710 835 835 Top = 2 836 836 Width = 75 … … 842 842 end 843 843 object btnCopy: TButton 844 Left = 63 2844 Left = 631 845 845 Top = 2 846 846 Width = 75 … … 853 853 end 854 854 object btnDelete: TButton 855 Left = 55 3855 Left = 552 856 856 Top = 2 857 857 Width = 75 -
cprs/trunk/CPRS-Chart/Templates/uTemplateFields.pas
r829 r1679 601 601 begin 602 602 NewTxt := Entry.GetControlText(CtrlID, TRUE, FoundEntry, FALSE); 603 if FoundEntry and (NewTxt = '') then 603 if FoundEntry and (NewTxt = '') then{(Trim(NewTxt) = '') then //CODE ADDED BACK IN - VHAISPBELLC} 604 604 Result := TRUE; 605 605 end; … … 1160 1160 cbo.SelectByID(StripEmbedded(FItemDefault)); 1161 1161 cbo.Tag := CtrlID; 1162 cbo.OnC lick:= Entry.DoChange;1162 cbo.OnChange := Entry.DoChange; 1163 1163 1164 1164 if cbo.Items.Count > 12 then … … 1295 1295 pnl.Width := pnl.Edit.Width + pnl.UpDown.Width; 1296 1296 UpdateColorsFor508Compliance(pnl, TRUE); 1297 //CQ 17597 wat 1298 pnl.Edit.Align := alLeft; 1299 pnl.UpDown.Align := alLeft; 1300 //end 17597 1297 1301 ctrl := pnl; 1298 1302 end; … … 1932 1936 end 1933 1937 else 1938 //!!!!!! CODE ADDED BACK IN - VHAISPBELLC !!!!!! 1934 1939 if(Ctrl is TEdit) then 1935 1940 Result := TEdit(Ctrl).Text … … 1945 1950 Result := TORDateCombo(Ctrl).Text + ':' + FloatToStr(TORDateCombo(Ctrl).FMDate) 1946 1951 else 1952 {!!!!!! THIS HAS BEEN REMOVED AS IT CAUSED PROBLEMS WITH REMINDER DIALOGS - VHAISPBELLC !!!!!! 1953 if(Ctrl is TORDateBox) then begin 1954 if TORDateBox(Ctrl).IsValid then 1955 Result := TORDateBox(Ctrl).Text 1956 else 1957 Result := ''; 1958 end else 1959 } 1960 //!!!!!! CODE ADDED BACK IN - VHAISPBELLC !!!!!! 1947 1961 if(Ctrl is TORDateBox) then 1948 1962 Result := TORDateBox(Ctrl).Text … … 1973 1987 end 1974 1988 else 1989 {!!!!!! THIS HAS BEEN REMOVED AS IT CAUSED PROBLEMS WITH REMINDER DIALOGS - VHAISPBELLC !!!!!! 1990 if(Ctrl is TEdit) then 1991 Result := TEdit(Ctrl).Text 1992 else } 1975 1993 if(Ctrl is TORCheckBox) then 1976 1994 begin
Note:
See TracChangeset
for help on using the changeset viewer.