Ignore:
Timestamp:
May 7, 2015, 12:34:29 PM (9 years ago)
Author:
healthsevak
Message:

Updating the working copy to CPRS version 28

Location:
cprs/trunk/CPRS-Chart/Templates
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • cprs/trunk/CPRS-Chart/Templates/fTemplateDialog.dfm

    r829 r1679  
    1111  OnCreate = FormCreate
    1212  OnDestroy = FormDestroy
     13  OnMouseWheel = FormMouseWheel
    1314  OnPaint = FormPaint
    1415  OnShow = FormShow
  • cprs/trunk/CPRS-Chart/Templates/fTemplateDialog.pas

    r829 r1679  
    2828    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    2929    procedure FormShow(Sender: TObject);
     30    procedure FormMouseWheel(Sender: TObject; Shift: TShiftState;
     31      WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
    3032  private
    3133    FFirstBuild: boolean;
     
    7173procedure CheckBoilerplate4Fields(SL: TStrings; const CaptionText: string = ''; PreviewMode: boolean = FALSE); overload;
    7274procedure CheckBoilerplate4Fields(var AText: string; const CaptionText: string = ''; PreviewMode: boolean = FALSE); overload;
     75procedure ShutdownTemplateDialog;
    7376
    7477var
     
    8184
    8285{$R *.DFM}
     86
     87var
     88  uTemplateDialogRunning: boolean = false;
    8389
    8490const
     
    289295end;
    290296
     297procedure ShutdownTemplateDialog;
     298begin
     299  if uTemplateDialogRunning and assigned(frmTemplateDialog) then
     300  begin
     301    frmTemplateDialog.Silent := True;
     302    frmTemplateDialog.ModalResult := mrCancel;
     303  end;
     304end;
     305
    291306procedure CheckBoilerplate4Fields(SL: TStrings; const CaptionText: string = ''; PreviewMode: boolean = FALSE);
    292307begin
     
    689704procedure TfrmTemplateDialog.FormCreate(Sender: TObject);
    690705begin
     706  uTemplateDialogRunning := True;
    691707  FFirstBuild := TRUE;
    692708  BuildIdx := TStringList.Create;
     
    695711  FOldHintEvent := Application.OnShowHint;
    696712  Application.OnShowHint := AppShowHint;
    697   ResizeAnchoredFormToFont(Self);
     713  //ResizeAnchoredFormToFont(Self);
    698714  FMaxPnlWidth := FontWidthPixel(sbMain.Font.Handle) * MAX_ENTRY_WIDTH; //AGP change Template Dialog to wrap at 80 instead of 74
    699715  SetFormPosition(Self);
     716  ResizeAnchoredFormToFont(Self);
    700717  SizeFormToCancelBtn();
    701718end;
     
    720737  Entries.Free;
    721738  BuildIdx.Free;
     739  uTemplateDialogRunning := False; 
     740end;
     741
     742procedure TfrmTemplateDialog.FormMouseWheel(Sender: TObject; Shift: TShiftState;
     743  WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
     744begin
     745  If RectContains(sbMain.BoundsRect, SbMain.ScreenToClient(MousePos)) then
     746  begin
     747    ScrollControl(sbMain, (WheelDelta > 0));
     748    Handled := True;
     749  end;
    722750end;
    723751
  • cprs/trunk/CPRS-Chart/Templates/fTemplateEditor.dfm

    r829 r1679  
    66  BorderIcons = [biSystemMenu, biMaximize]
    77  Caption = 'Template Editor'
    8   ClientHeight = 450
     8  ClientHeight = 562
    99  ClientWidth = 740
    1010  Position = poScreenCenter
     
    1616  OnShow = FormShow
    1717  ExplicitWidth = 748
    18   ExplicitHeight = 477
     18  ExplicitHeight = 596
    1919  PixelsPerInch = 96
    2020  TextHeight = 13
     
    2929    Beveled = True
    3030    MinSize = 40
     31    OnCanResize = splMainCanResize
    3132    OnMoved = splMainMoved
    3233  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]
    28735    Left = 0
    28836    Top = 0
     
    1216964          Align = alLeft
    1217965          AutoSize = True
    1218           ButtonHeight = 21
    1219           ButtonWidth = 43
     966          ButtonHeight = 0
     967          ButtonWidth = 0
    1220968          Caption = 'mbMain'
    1221969          Menu = mnuMain
     
    1227975    end
    1228976  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]
    1273978    Left = 0
    1274979    Top = 263
     
    13351040    end
    13361041  end
    1337   object pnlLink: TPanel [7]
     1042  object pnlLink: TPanel [3]
    13381043    Left = 0
    13391044    Top = 242
     
    13421047    Align = alTop
    13431048    BevelOuter = bvNone
    1344     TabOrder = 5
     1049    TabOrder = 3
    13451050    Visible = False
    13461051    object lblLink: TLabel
     
    13791084      TabOrder = 0
    13801085      TabStop = True
    1381       OnChange = cbxLinkChange
     1086      OnExit = cbxLinkExit
    13821087      OnNeedData = cbxLinkNeedData
    13831088      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
    13841403    end
    13851404  end
     
    14081427        'Status = stsDefault')
    14091428      (
    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       (
    14331429        'Component = pnlTop'
    14341430        'Status = stsDefault')
     
    16021598        'Status = stsDefault')
    16031599      (
    1604         'Component = pnlNotes'
    1605         'Status = stsDefault')
    1606       (
    1607         'Component = reNotes'
    1608         'Label = lblNotes'
    1609         'Status = stsOK')
    1610       (
    16111600        'Component = pnlCOM'
    16121601        'Status = stsDefault')
     
    16281617      (
    16291618        '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'
    16301649        'Status = stsDefault'))
    16311650  end
  • cprs/trunk/CPRS-Chart/Templates/fTemplateEditor.pas

    r829 r1679  
    3131    btnCancel: TButton;
    3232    btnOK: TButton;
    33     pnlBoilerplate: TPanel;
    34     reBoil: TRichEdit;
    3533    pnlTop: TPanel;
    3634    pnlRightTop: TPanel;
     
    6664    mnuBPErrorCheck: TMenuItem;
    6765    mnuBPSpellCheck: TMenuItem;
    68     pnlGroupBP: TPanel;
    69     reGroupBP: TRichEdit;
    70     lblGroupBP: TLabel;
    71     splBoil: TSplitter;
    72     pnlGroupBPGap: TPanel;
    7366    tmrAutoScroll: TTimer;
    7467    popGroup: TPopupMenu;
     
    154147    mnuAutoGen: TMenuItem;
    155148    mnuNodeAutoGen: TMenuItem;
    156     pnlNotes: TPanel;
    157     reNotes: TRichEdit;
    158     splNotes: TSplitter;
    159     lblNotes: TLabel;
    160149    popNotes: TPopupMenu;
    161150    mnuNotesUndo: TMenuItem;
     
    193182    N17: TMenuItem;
    194183    mnuTemplateIconLegend: TMenuItem;
    195     pnlBP: TPanel;
    196     lblBoilerplate: TLabel;
    197     cbLongLines: TCheckBox;
    198184    cbLock: TORCheckBox;
    199185    mnuRefresh: TMenuItem;
    200     lblBoilRow: TLabel;
    201     lblGroupRow: TLabel;
    202     lblBoilCol: TLabel;
    203     lblGroupCol: TLabel;
    204186    pnlCOM: TPanel;
    205187    lblCOMParam: TLabel;
     
    211193    lblLink: TLabel;
    212194    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;
    213214    procedure btnNewClick(Sender: TObject);
    214215    procedure btnApplyClick(Sender: TObject);
    215216    procedure FormCreate(Sender: TObject);
    216     procedure cboOwnerNeedData(Sender: TObject; const StartFrom: String;
     217    procedure cboOwnerNeedData(Sender: TObject; const StartFrom: string;
    217218      Direction, InsertAt: Integer);
    218219    procedure cboOwnerChange(Sender: TObject);
     
    232233    procedure tvTreeEnter(Sender: TObject);
    233234    procedure tvTreeNodeEdited(Sender: TObject; Node: TTreeNode;
    234       var S: String);
     235      var S: string);
    235236    procedure cbShHideClick(Sender: TObject);
    236237    procedure cbPerHideClick(Sender: TObject);
     
    338339    procedure cbxCOMObjChange(Sender: TObject);
    339340    procedure edtCOMParamChange(Sender: TObject);
    340     procedure cbxLinkNeedData(Sender: TObject; const StartFrom: String;
     341    procedure cbxLinkNeedData(Sender: TObject; const StartFrom: string;
    341342      Direction, InsertAt: Integer);
    342     procedure cbxLinkChange(Sender: TObject);
     343    procedure cbxLinkExit(Sender: TObject);
    343344    procedure reBoilKeyUp(Sender: TObject; var Key: Word;
    344345      Shift: TShiftState);
     
    347348      Shift: TShiftState);
    348349    procedure FormClose(Sender: TObject; var Action: TCloseAction);
     350    procedure splMainCanResize(Sender: TObject; var NewSize: Integer;
     351      var Accept: Boolean);
    349352  private
    350353    FLastRect: TRect;
     
    366369    FCurTree: TTreeView;
    367370    FTreeControl: array[TTemplateTreeType, TTemplateTreeControl] of TControl;
    368     FInternalHiddenExpand :boolean;
     371    FInternalHiddenExpand: boolean;
    369372    FFindShOn: boolean;
    370373    FFindShNext: boolean;
     
    451454  PropText = ' Template Properties ';
    452455//  GroupTag = 5;
    453   BPDisplayOnlyFld  = 0;
    454   BPFirstLineFld    = 1;
    455   BPOneItemOnlyFld  = 2;
     456  BPDisplayOnlyFld = 0;
     457  BPFirstLineFld = 1;
     458  BPOneItemOnlyFld = 2;
    456459  BPHideDlgItemsFld = 3;
    457   BPHideItemsFld    = 4;
    458   BPIndentFld       = 5;
    459   BPLockFld         = 6;
     460  BPHideItemsFld = 4;
     461  BPIndentFld = 5;
     462  BPLockFld = 6;
    460463  NoIE5 = 'You must have Internet Explorer 5 or better installed to %s Templates';
    461464  NoIE5Header = 'Need Internet Explorer 5';
    462   VK_A              = Ord('A');
    463   VK_C              = Ord('C');
    464   VK_E              = Ord('E');
    465   VK_F              = Ord('F');
    466   VK_G              = Ord('G');
    467   VK_I              = Ord('I');
    468   VK_S              = Ord('S');
    469   VK_T              = Ord('T');
    470   VK_V              = Ord('V');
    471   VK_X              = Ord('X');
    472   VK_Z              = Ord('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');
    473476
    474477type
     
    481484
    482485  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));
    484487  IdxForced: array[boolean, 0..5] of TTypeIndex = ((tiTemplate, tiFolder, tiGroup, tiDialog, tiRemDlg, tiCOMObj),
    485                                                    (tiFolder, tiGroup, tiDialog, tiNone, tiNone, tiNone));
     488    (tiFolder, tiGroup, tiDialog, tiNone, tiNone, tiNone));
    486489  iMessage = 'This template has one or more new fields, and you are not authorized to create new fields.  ' +
    487              'If you continue, the program will import the new template without the new fields.  Do you wish ' +
    488              'to do this?';
     490    'If you continue, the program will import the new template without the new fields.  Do you wish ' +
     491    'to do this?';
    489492  iMessage2 = 'The imported template fields had XML errors.  ';
    490493  iMessage3 = 'No Fields were imported.';
     
    495498
    496499procedure EditTemplates(Form: TForm; NewTemplate: boolean = FALSE;
    497                         CopiedText: string = ''; Shared: boolean = FALSE);
     500  CopiedText: string = ''; Shared: boolean = FALSE);
    498501var
    499502  frmTemplateEditor: TfrmTemplateEditor;
     
    504507
    505508begin
    506   if(UserTemplateAccessLevel in [taReadOnly, taNone]) then exit;
     509  if (UserTemplateAccessLevel in [taReadOnly, taNone]) then exit;
    507510
    508511  ExpandStr := '';
    509512  SelectStr := '';
    510513  Drawers := nil;
    511   if(not NewTemplate) and (CopiedText = '') then
     514  if (not NewTemplate) and (CopiedText = '') then
    512515  begin
    513516    if Form is TfrmDrawers then
    514517      Drawers := TFrmDrawers(Form)
    515518    else
    516     if IsPublishedProp(Form, DrawersProperty) then
    517       Drawers := TFrmDrawers(GetOrdProp(Form, DrawersProperty));
     519      if IsPublishedProp(Form, DrawersProperty) then
     520        Drawers := TFrmDrawers(GetOrdProp(Form, DrawersProperty));
    518521  end;
    519522
     
    521524  begin
    522525    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, ';');
    524527  end;
    525528
     
    533536      reNotes.Font.Size := Form.Font.Size;
    534537      dmodShared.ExpandTree(tvShared, ExpandStr, FSharedEmptyNodeCount);
    535       SelNode := tvShared.FindPieceNode(SelectStr,1,';');
     538      SelNode := tvShared.FindPieceNode(SelectStr, 1, ';');
    536539      SelShared := assigned(SelNode);
    537540      dmodShared.ExpandTree(tvPersonal, ExpandStr, FPersonalEmptyNodeCount);
    538541      if not SelShared then
    539         SelNode := tvPersonal.FindPieceNode(SelectStr,1,';');
    540 
    541       if(SelShared and (not Shared)) then
     542        SelNode := tvPersonal.FindPieceNode(SelectStr, 1, ';');
     543
     544      if (SelShared and (not Shared)) then
    542545        Shared := TRUE;
    543546
    544       if(Shared and (UserTemplateAccessLevel = taEditor)) then
     547      if (Shared and (UserTemplateAccessLevel = taEditor)) then
    545548      begin
    546549        cbEditShared.Checked := TRUE;
     
    552555      end
    553556      else
    554       if(not SelShared) and (assigned(SelNode)) then
    555         tvPersonal.Selected := SelNode;
    556       if(NewTemplate) then
     557        if (not SelShared) and (assigned(SelNode)) then
     558          tvPersonal.Selected := SelNode;
     559      if (NewTemplate) then
    557560      begin
    558561        btnNewClick(frmTemplateEditor);
    559         if(CopiedText <> '') then
     562        if (CopiedText <> '') then
    560563        begin
    561564          TTemplate(FBtnNewNode.Data).Boilerplate := CopiedText;
     
    580583
    581584begin
    582   if((assigned(FCurTree)) and (assigned(FCurTree.Selected))) then
    583   begin
    584     if(FCurTree = tvShared) and (FCanEditShared) then
     585  if ((assigned(FCurTree)) and (assigned(FCurTree.Selected))) then
     586  begin
     587    if (FCurTree = tvShared) and (FCanEditShared) then
    585588      ok := TRUE
    586589    else
    587     if(FCurTree = tvPersonal) and (FCanEditPersonal) then
    588       ok := TRUE
    589     else
    590       ok := FALSE;
    591     if(ok) then
     590      if (FCurTree = tvPersonal) and (FCanEditPersonal) then
     591        ok := TRUE
     592      else
     593        ok := FALSE;
     594    if (ok) then
    592595    begin
    593596      Node := FCurTree.Selected;
    594597      PNode := Node;
    595       if(TTemplate(Node.Data).RealType = ttDoc) then
     598      if (TTemplate(Node.Data).RealType = ttDoc) then
    596599        PNode := Node.Parent;
    597600      if CanClone(PNode) then
     
    605608          else
    606609            idx := Owner.Items.IndexOf(Node.Data) + 1;
    607           if(FCurTree = tvShared) then
    608             begin
    609               ownr := '';
    610               ACheckBox := cbShHide;
    611             end
     610          if (FCurTree = tvShared) then
     611          begin
     612            ownr := '';
     613            ACheckBox := cbShHide;
     614          end
    612615          else
    613             begin
    614               ownr := IntToStr(User.DUZ);
    615               ACheckBox := cbPerHide;
    616             end;
     616          begin
     617            ownr := IntToStr(User.DUZ);
     618            ACheckBox := cbPerHide;
     619          end;
    617620          if FImportingFromXML then
    618621          begin
     
    622625          else
    623626          begin
    624             Tmp := TTemplate.Create('0^T^A^'+NewTemplateName+'^^^'+ownr);
     627            Tmp := TTemplate.Create('0^T^A^' + NewTemplateName + '^^^' + ownr);
    625628            Tmp.BackupItems;
    626629            Templates.AddObject(Tmp.ID, Tmp);
    627630          end;
    628631          btnApply.Enabled := TRUE;
    629           if(idx >= Owner.Items.Count) then
     632          if (idx >= Owner.Items.Count) then
    630633            Owner.Items.Add(Tmp)
    631634          else
     
    633636          Resync([Owner]);
    634637          Node := FCurTree.Selected;
    635           if(Node.Data <> Tmp) then
     638          if (Node.Data <> Tmp) then
    636639          begin
    637             if(TTemplate(Node.Data).RealType = ttDoc) then
     640            if (TTemplate(Node.Data).RealType = ttDoc) then
    638641              Node := Node.GetNextSibling
    639642            else
     
    645648          end;
    646649          FBtnNewNode := Node;
    647           if(FFirstShow) then
     650          if (FFirstShow) then
    648651            FFocusName := TRUE
    649652          else
     
    660663procedure TfrmTemplateEditor.btnApplyClick(Sender: TObject);
    661664begin
    662   if(ScanNames) then
     665  if (ScanNames) then
    663666  begin
    664667    SaveAllTemplates;
     
    671674procedure TfrmTemplateEditor.FormCreate(Sender: TObject);
    672675begin
     676  SetFormPosition(Self);
    673677  ResizeAnchoredFormToFont(self);
    674678  //Now fix everything the resize messed up
     
    681685
    682686  FSavePause := Application.HintHidePause;
    683   Application.HintHidePause := FSavePause*2;
     687  Application.HintHidePause := FSavePause * 2;
    684688  if InteractiveRemindersActive then
    685689  begin
     
    696700  FFirstShow := TRUE;
    697701
    698   FTreeControl[ttShared,   tcDel] := sbShDelete;
    699   FTreeControl[ttShared,   tcUp]  := sbShUp;
    700   FTreeControl[ttShared,   tcDown] := sbShDown;
    701   FTreeControl[ttShared,   tcLbl] := lblCopy;
    702   FTreeControl[ttShared,   tcCopy] := sbCopyRight;
    703   FTreeControl[ttPersonal, tcDel]  := sbPerDelete;
    704   FTreeControl[ttPersonal, tcUp]   := sbPerUp;
     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;
    705709  FTreeControl[ttPersonal, tcDown] := sbPerDown;
    706   FTreeControl[ttPersonal, tcLbl]  := lblCopy;
     710  FTreeControl[ttPersonal, tcLbl] := lblCopy;
    707711  FTreeControl[ttPersonal, tcCopy] := sbCopyLeft;
    708712  dmodShared.InEditor := TRUE;
     
    739743
    740744  BtnApply.Enabled := BackupDiffers;
    741   SetFormPosition(Self);
     745  //SetFormPosition(Self);
    742746end;
    743747
     
    745749begin
    746750  sbCopyRight.Visible := FCanEditPersonal;
    747   if(not FCanEditPersonal) then
     751  if (not FCanEditPersonal) then
    748752    cbPerHide.Checked := TRUE;
    749753  cbPerHide.Visible := FCanEditPersonal;
     
    756760
    757761procedure TfrmTemplateEditor.cboOwnerNeedData(Sender: TObject;
    758   const StartFrom: String; Direction, InsertAt: Integer);
     762  const StartFrom: string; Direction, InsertAt: Integer);
    759763begin
    760764//  cboOwner.ForDataUse(SubSetOfTemplateOwners(StartFrom, Direction));
     
    773777  FCurrentPersonalUser := UsrIEN;
    774778  NewEdit := (FCurrentPersonalUser = User.DUZ);
    775   if(FCanEditPersonal <> NewEdit) then
     779  if (FCanEditPersonal <> NewEdit) then
    776780  begin
    777781    FCanEditPersonal := NewEdit;
     
    784788begin
    785789  AllowExpansion := dmodShared.ExpandNode(tvPersonal, Node,
    786                     FPersonalEmptyNodeCount, not cbPerHide.Checked);
    787   if(AllowExpansion and FInternalHiddenExpand) then
     790    FPersonalEmptyNodeCount, not cbPerHide.Checked);
     791  if (AllowExpansion and FInternalHiddenExpand) then
    788792    AllowExpansion := FALSE;
    789793end;
     
    793797begin
    794798  AllowExpansion := dmodShared.ExpandNode(tvShared, Node,
    795                     FSharedEmptyNodeCount, not cbShHide.Checked);
    796   if(AllowExpansion and FInternalHiddenExpand) then
     799    FSharedEmptyNodeCount, not cbShHide.Checked);
     800  if (AllowExpansion and FInternalHiddenExpand) then
    797801    AllowExpansion := FALSE;
    798802end;
     
    813817var
    814818  Template: TTemplate;
    815  
     819
    816820begin
    817821  Result := FALSE;
     
    822826      Result := TRUE
    823827    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;
    834839      end;
    835     end;
    836840  end;
    837841end;
     
    852856    if Something then
    853857    begin
    854       if(Sender = tvPersonal) then
     858      if (Sender = tvPersonal) then
    855859      begin
    856860        ok := FCanEditPersonal;
     
    875879begin
    876880  cbLock.Enabled := ok and (FCurTree = tvShared);
    877   if(ok and Root) then
     881  if (ok and Root) then
    878882  begin
    879883    ok := FALSE;
     
    925929begin
    926930  tmpHeight := tvShared.Height;
    927   dec(tmpHeight,lblCopy.Height);
    928   if(sbCopyLeft.Visible) then
    929     dec(tmpHeight, sbCopyLeft.Height+5);
    930   if(sbCopyRight.Visible) then
    931     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);
    932936  tmpHeight := (tmpHeight div 2) + tvShared.Top;
    933937  lblCopy.Top := tmpHeight;
    934   inc(tmpHeight,lblCopy.height+5);
    935   if(sbCopyLeft.Visible) then
     938  inc(tmpHeight, lblCopy.height + 5);
     939  if (sbCopyLeft.Visible) then
    936940  begin
    937941    sbCopyLeft.Top := tmpHeight;
    938     inc(tmpHeight, sbCopyLeft.Height+5);
    939   end;
    940   if(sbCopyRight.Visible) then
     942    inc(tmpHeight, sbCopyLeft.Height + 5);
     943  end;
     944  if (sbCopyRight.Visible) then
    941945    sbCopyRight.Top := tmpHeight;
     946end;
     947
     948procedure TfrmTemplateEditor.splMainCanResize(Sender: TObject;
     949  var NewSize: Integer; var Accept: Boolean);
     950begin
     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
    942957end;
    943958
     
    962977    pnlGroupBP.Align := alBottom;
    963978    reBoil.Align := alClient;
     979    pnlNotes.Constraints.MaxHeight := 0;
    964980  end;
    965981end;
     
    977993  FUpdating := TRUE;
    978994  try
    979     if(assigned(Node)) then
     995    if (assigned(Node)) then
    980996    begin
    981997      FShowingTemplate := TTemplate(Node.Data);
     
    9871003        ShowTemplateType(TTemplate(Node.Data));
    9881004        lt := GetLinkType(Node);
    989         if(lt = ltNone) or (IsReminderDialog and (not (lt in [ltNone, ltTitle]))) then
     1005        if (lt = ltNone) or (IsReminderDialog and (not (lt in [ltNone, ltTitle]))) then
    9901006          pnlLink.Visible := FALSE
    9911007        else
     
    9941010          pnlLink.Tag := ord(lt);
    9951011          case lt of
    996             ltTitle:     lts := 'Title';
    997             ltConsult:   lts := 'Consult Service';
     1012            ltTitle: lts := 'Title';
     1013            ltConsult: lts := 'Consult Service';
    9981014            ltProcedure: lts := 'Procedure';
    999             else        lts := '';
     1015          else lts := '';
    10001016          end;
    10011017          cbxLink.Clear;
     
    10241040        edtName.Text := PrintName;
    10251041        reNotes.Lines.Text := Description;
    1026         if(PersonalOwner = 0) and (FCurTree = tvShared) and (cbEditShared.Checked) then
     1042        if (PersonalOwner = 0) and (FCurTree = tvShared) and (cbEditShared.Checked) then
    10271043        begin
    10281044          cbLock.Checked := IsLocked;
     
    10361052        end;
    10371053        CanDoCom := FCanDoCOMObjects and (PersonalOwner = 0);
    1038         if(RealType in AllTemplateRootTypes) then
     1054        if (RealType in AllTemplateRootTypes) then
    10391055        begin
    10401056          ClearRB := TRUE;
     
    10451061          case RealType of
    10461062            ttDoc: begin
    1047                      if IsReminderDialog then
    1048                        Idx := tiRemDlg
    1049                      else
    1050                      if IsCOMObject then
    1051                        Idx := tiCOMObj
    1052                      else
    1053                        Idx := tiTemplate;
    1054                    end;
     1063                if IsReminderDialog then
     1064                  Idx := tiRemDlg
     1065                else
     1066                  if IsCOMObject then
     1067                    Idx := tiCOMObj
     1068                  else
     1069                    Idx := tiTemplate;
     1070              end;
    10551071            ttGroup: begin
    1056                        if(Dialog) then
    1057                          Idx := tiDialog
    1058                        else
    1059                          Idx := tiGroup;
    1060                      end;
     1072                if (Dialog) then
     1073                  Idx := tiDialog
     1074                else
     1075                  Idx := tiGroup;
     1076              end;
    10611077            ttClass: Idx := tiFolder;
    1062             else Idx := tiNone;
     1078          else Idx := tiNone;
    10631079          end;
    10641080          FForceContainer := ((RealType in [ttGroup, ttClass]) and (Children <> tcNone));
     
    10711087          if (not FForceContainer) then
    10721088          begin
    1073             if(FCanDoReminders or CanDoCOM) then
     1089            if (FCanDoReminders or CanDoCOM) then
    10741090              cbxType.Items.Add('Reminder Dialog');
    1075             if(CanDoCOM) then
     1091            if (CanDoCOM) then
    10761092              cbxType.Items.Add('COM Object');
    10771093          end;
    10781094          cbxType.ItemIndex := ForcedIdx[FForceContainer, Idx];
    1079           if(Idx = tiRemDlg) and FCanDoReminders then
     1095          if (Idx = tiRemDlg) and FCanDoReminders then
    10801096            cbxRemDlgs.SelectByID(ReminderDialogIEN)
    10811097          else
     
    10981114          end;
    10991115          cbActive.Checked := Active;
    1100           if(RealType in [ttClass, ttGroup]) then
     1116          if (RealType in [ttClass, ttGroup]) then
    11011117            cbHideItems.Checked := HideItems
    11021118          else
     
    11051121            cbHideItems.Enabled := FALSE;
    11061122          end;
    1107           if((RealType in [ttDoc, ttGroup]) and (assigned(Node.Parent)) and
    1108              (TTemplate(Node.Parent.Data).RealType = ttGroup) and
    1109              (not IsReminderDialog) and (not IsCOMObject)) then
     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
    11101126            cbExclude.Checked := Exclude
    11111127          else
     
    11261142            cbFirstLine.Enabled := FALSE;
    11271143          end;
    1128           if(RealType in [ttGroup, ttClass]) and (Children <> tcNone) and
     1144          if (RealType in [ttGroup, ttClass]) and (Children <> tcNone) and
    11291145            (dmodShared.InDialog(Node)) then
    11301146          begin
    11311147            cbOneItemOnly.Checked := OneItemOnly;
    11321148            cbIndent.Checked := IndentItems;
    1133             if(RealType = ttGroup) and (Boilerplate <> '') then
     1149            if (RealType = ttGroup) and (Boilerplate <> '') then
    11341150            begin
    11351151              cbHideDlgItems.Checked := HideDlgItems;
     
    11501166            cbIndent.Enabled := FALSE;
    11511167          end;
    1152           if(RealType = ttGroup) then
     1168          if (RealType = ttGroup) then
    11531169            edtGap.Text := IntToStr(Gap)
    11541170          else
     
    11711187      gbProperties.Caption := PropText;
    11721188    end;
    1173     if(ClearName) then
     1189    if (ClearName) then
    11741190    begin
    11751191      edtName.Text := '';
    11761192      reNotes.Clear;
    11771193    end;
    1178     if(ClearRB) then
     1194    if (ClearRB) then
    11791195    begin
    11801196      cbxType.ItemIndex := Ord(tiNone);
    11811197    end;
    1182     if(ClearAll) then
     1198    if (ClearAll) then
    11831199    begin
    11841200      cbActive.Checked := FALSE;
     
    11971213      pnlLink.Visible := FALSE;
    11981214    end;
    1199     if cbDisplayOnly.Enabled  or
    1200        cbFirstLine.Enabled    or
    1201        cbIndent.Enabled      or
    1202        cbOneItemOnly.Enabled or
    1203        cbHideDlgItems.Enabled then
     1215    if cbDisplayOnly.Enabled or
     1216      cbFirstLine.Enabled or
     1217      cbIndent.Enabled or
     1218      cbOneItemOnly.Enabled or
     1219      cbHideDlgItems.Enabled then
    12041220      gbDialogProps.Font.Color := clWindowText
    12051221    else
     
    12151231
    12161232begin
    1217   if(pnlGroupBP.Visible) and (pnlGroupBP.Height > (pnlBoilerplate.Height-29)) then
    1218   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;
    12201236  end;
    12211237  if cbLongLines.checked then
    12221238    Max := 240
    12231239  else
    1224     Max := MAX_ENTRY_WIDTH;
     1240    Max := MAX_ENTRY_WIDTH - 1;
    12251241  LimitEditWidth(reBoil, Max);
    12261242  LimitEditWidth(reNotes, MAX_ENTRY_WIDTH);
     
    12341250
    12351251begin
    1236   if((not FUpdating) and (assigned(FCurTree)) and (assigned(FCurTree.Selected))) then
     1252  if ((not FUpdating) and (assigned(FCurTree)) and (assigned(FCurTree.Selected))) then
    12371253  begin
    12381254    if CanClone(FCurTree.Selected) then
     
    12441260        Template.PrintName := edtName.Text;
    12451261        UpdateApply(Template);
    1246         for i := 0 to Template.Nodes.Count-1 do
     1262        for i := 0 to Template.Nodes.Count - 1 do
    12471263          TTreeNode(Template.Nodes.Objects[i]).Text := Template.PrintName;
    1248         if(DoRefresh) then
     1264        if (DoRefresh) then
    12491265        begin
    12501266          tvShared.Invalidate;
     
    12631279
    12641280begin
    1265   if((not FUpdating) and (assigned(FCurTree)) and (assigned(FCurTree.Selected))) then
     1281  if ((not FUpdating) and (assigned(FCurTree)) and (assigned(FCurTree.Selected))) then
    12661282  begin
    12671283    if CanClone(FCurTree.Selected) then
     
    12731289        Template.Active := cbActive.Checked;
    12741290        UpdateApply(Template);
    1275         for i := 0 to Template.Nodes.Count-1 do
     1291        for i := 0 to Template.Nodes.Count - 1 do
    12761292        begin
    12771293          Node := TTreeNode(Template.Nodes.Objects[i]);
    12781294          Node.Cut := not Template.Active;
    12791295        end;
    1280         if(FCurTree = tvShared) then
     1296        if (FCurTree = tvShared) then
    12811297        begin
    12821298          cbPerHideClick(Sender);
     
    13041320
    13051321begin
    1306   if((not FUpdating) and (assigned(FCurTree)) and (assigned(FCurTree.Selected))) then
     1322  if ((not FUpdating) and (assigned(FCurTree)) and (assigned(FCurTree.Selected))) then
    13071323  begin
    13081324    if CanClone(FCurTree.Selected) then
     
    13141330        Template.Exclude := cbExclude.Checked;
    13151331        UpdateApply(Template);
    1316         for i := 0 to Template.Nodes.Count-1 do
     1332        for i := 0 to Template.Nodes.Count - 1 do
    13171333        begin
    13181334          Node := TTreeNode(Template.Nodes.Objects[i]);
     
    13331349
    13341350begin
    1335   if((not FUpdating) and (assigned(FCurTree)) and (assigned(FCurTree.Selected))) then
     1351  if ((not FUpdating) and (assigned(FCurTree)) and (assigned(FCurTree.Selected))) then
    13361352  begin
    13371353    if CanClone(FCurTree.Selected) then
     
    13441360        UpdateApply(Template);
    13451361        DisplayBoilerPlate(FCurTree.Selected);
    1346         if(DoRefresh) then
     1362        if (DoRefresh) then
    13471363        begin
    13481364          tvShared.Invalidate;
     
    13621378  tvShared.HideSelection := TRUE;
    13631379  tvPersonal.HideSelection := TRUE;
    1364   if(NewTree <> FCurTree) then
     1380  if (NewTree <> FCurTree) then
    13651381  begin
    13661382    Result := TRUE;
    1367     if(assigned(FCurTree)) then
     1383    if (assigned(FCurTree)) then
    13681384    begin
    13691385      for i := low(TTemplateTreeControl) to high(TTemplateTreeControl) do
     
    13721388    FCurTree := NewTree;
    13731389  end;
    1374   if(assigned(FCurTree)) then
     1390  if (assigned(FCurTree)) then
    13751391  begin
    13761392    FCurTree.HideSelection := FALSE;
    1377     if(FCurTree = tvPersonal) and (Screen.ActiveControl = tvShared) then
     1393    if (FCurTree = tvPersonal) and (Screen.ActiveControl = tvShared) then
    13781394      tvPersonal.SetFocus
    13791395    else
    1380     if(FCurTree = tvShared) and (Screen.ActiveControl = tvPersonal) then
    1381       tvShared.SetFocus;
     1396      if (FCurTree = tvShared) and (Screen.ActiveControl = tvPersonal) then
     1397        tvShared.SetFocus;
    13821398  end;
    13831399end;
     
    13851401procedure TfrmTemplateEditor.tvTreeEnter(Sender: TObject);
    13861402begin
    1387   if((Sender is TTreeView) and (ChangeTree(TTreeView(Sender)))) then
     1403  if ((Sender is TTreeView) and (ChangeTree(TTreeView(Sender)))) then
    13881404    tvTreeChange(Sender, TTreeView(Sender).Selected);
    13891405end;
    13901406
    13911407procedure TfrmTemplateEditor.tvTreeNodeEdited(Sender: TObject;
    1392   Node: TTreeNode; var S: String);
     1408  Node: TTreeNode; var S: string);
    13931409begin
    13941410  FUpdating := TRUE;
     
    14191435begin
    14201436  dmodShared.Resync(tvPersonal.Items.GetFirstNode, not cbPerHide.Checked,
    1421                                                           FPersonalEmptyNodeCount);
     1437    FPersonalEmptyNodeCount);
    14221438  tvTreeChange(tvPersonal, tvPersonal.Selected);
    14231439  EnableNavControls;
     
    14401456    with Node, TTemplate(Node.Data) do
    14411457    begin
    1442       if(RealType in [ttDoc, ttGroup]) then
     1458      if (RealType in [ttDoc, ttGroup]) then
    14431459      begin
    14441460        TmpSL := TStringList.Create;
    14451461        try
    1446           if(RealType = ttGroup) and (not reBoil.ReadOnly) then
     1462          if (RealType = ttGroup) and (not reBoil.ReadOnly) then
    14471463          begin
    14481464            ItemOK := TRUE;
     
    14541470            TmpSL.Text := FullBoilerplate;
    14551471          LongLines := FALSE;
    1456           for i := 0 to TmpSL.Count-1 do
     1472          for i := 0 to TmpSL.Count - 1 do
    14571473          begin
    14581474            if length(TmpSL[i]) > MAX_ENTRY_WIDTH then
     
    14751491      end;
    14761492      ShowGroupBoilerplate(ItemOK);
    1477       if(not ItemOK) and (IsReminderDialog or IsCOMObject) then
     1493      if (not ItemOK) and (IsReminderDialog or IsCOMObject) then
    14781494        BPOK := FALSE;
    14791495      pnlBoilerplateResize(Self);
     
    14911507  KillObj(@FConsultServices);
    14921508  Application.HintHidePause := FSavePause;
    1493   if(assigned(frmTemplateObjects)) then
     1509  if (assigned(frmTemplateObjects)) then
    14941510  begin
    14951511    frmTemplateObjects.Free;
    14961512    frmTemplateObjects := nil;
    14971513  end;
    1498   if(assigned(frmTemplateFields)) then
     1514  if (assigned(frmTemplateFields)) then
    14991515  begin
    15001516    frmTemplateFields.Free;
     
    15271543
    15281544begin
    1529   if((assigned(FCurTree)) and (assigned(FCurTree.Selected)) and
    1530                               (assigned(FCurTree.Selected.Parent))) then
     1545  if ((assigned(FCurTree)) and (assigned(FCurTree.Selected)) and
     1546    (assigned(FCurTree.Selected.Parent))) then
    15311547  begin
    15321548    Node := FCurTree.Selected;
     
    15361552    idx := Template.Items.IndexOf(NodeTemplate);
    15371553    ChangeLevel := (idx < 1);
    1538     if(not ChangeLevel) then
    1539     begin
    1540       if(TTemplateTreeType(TBitBtn(Sender).Tag) = ttShared) then
     1554    if (not ChangeLevel) then
     1555    begin
     1556      if (TTemplateTreeType(TBitBtn(Sender).Tag) = ttShared) then
    15411557        Hide := cbShHide.Checked
    15421558      else
    15431559        Hide := cbPerHide.Checked;
    15441560      First := TRUE;
    1545       while(idx > 0) do
     1561      while (idx > 0) do
    15461562      begin
    15471563        if First then
     
    15511567          if CanClone(ParentNode) then
    15521568          begin
    1553             if(Clone(ParentNode)) then
     1569            if (Clone(ParentNode)) then
    15541570              Template := TTemplate(ParentNode.Data);
    15551571            if Template.CanModify then
     
    15611577        if ok then
    15621578        begin
    1563           Template.Items.Exchange(idx-1, idx);
    1564           if(Hide and (not TTemplate(Template.Items[idx]).Active)) then
     1579          Template.Items.Exchange(idx - 1, idx);
     1580          if (Hide and (not TTemplate(Template.Items[idx]).Active)) then
    15651581          begin
    15661582            dec(idx);
     
    15741590      end;
    15751591    end;
    1576     if(ChangeLevel) then
     1592    if (ChangeLevel) then
    15771593    begin
    15781594      ParentsParent := ParentNode.Parent;
    1579       if(assigned(ParentsParent)) then
     1595      if (assigned(ParentsParent)) then
    15801596      begin
    15811597        ParentTemplate := TTemplate(ParentsParent.Data);
    1582         if(ParentTemplate.Items.IndexOf(NodeTemplate) >= 0) then
     1598        if (ParentTemplate.Items.IndexOf(NodeTemplate) >= 0) then
    15831599          InfoBox(ParentsParent.Text + ' already contains the ' +
    15841600            NodeTemplate.PrintName + ' template.',
     
    15881604          if CanClone(ParentNode) then
    15891605          begin
    1590             if(Clone(ParentNode)) then
     1606            if (Clone(ParentNode)) then
    15911607              Template := TTemplate(ParentNode.Data);
    15921608            if Template.CanModify and CanClone(ParentsParent) then
    15931609            begin
    1594               if(Clone(ParentsParent)) then
     1610              if (Clone(ParentsParent)) then
    15951611                ParentTemplate := TTemplate(ParentsParent.Data);
    15961612              if ParentTemplate.CanModify then
     
    15981614                Template.Items.Delete(idx);
    15991615                idx := ParentTemplate.Items.IndexOf(Template);
    1600                 if(idx >= 0) then
     1616                if (idx >= 0) then
    16011617                begin
    16021618                  ParentTemplate.Items.Insert(idx, NodeTemplate);
     
    16271643
    16281644begin
    1629   if((assigned(FCurTree)) and (assigned(FCurTree.Selected)) and
    1630                               (assigned(FCurTree.Selected.Parent))) then
     1645  if ((assigned(FCurTree)) and (assigned(FCurTree.Selected)) and
     1646    (assigned(FCurTree.Selected.Parent))) then
    16311647  begin
    16321648    Node := FCurTree.Selected;
     
    16351651    Template := TTemplate(ParentNode.Data);
    16361652    idx := Template.Items.IndexOf(NodeTemplate);
    1637     max := Template.Items.Count-1;
     1653    max := Template.Items.Count - 1;
    16381654    ChangeLevel := (idx >= max);
    1639     if(not ChangeLevel) then
    1640     begin
    1641       if(TTemplateTreeType(TBitBtn(Sender).Tag) = ttShared) then
     1655    if (not ChangeLevel) then
     1656    begin
     1657      if (TTemplateTreeType(TBitBtn(Sender).Tag) = ttShared) then
    16421658        Hide := cbShHide.Checked
    16431659      else
    16441660        Hide := cbPerHide.Checked;
    16451661      First := TRUE;
    1646       while(idx < max) do
     1662      while (idx < max) do
    16471663      begin
    16481664        if First then
     
    16521668          if CanClone(ParentNode) then
    16531669          begin
    1654             if(Clone(ParentNode)) then
     1670            if (Clone(ParentNode)) then
    16551671              Template := TTemplate(ParentNode.Data);
    16561672            if Template.CanModify then
     
    16621678        if ok then
    16631679        begin
    1664           Template.Items.Exchange(idx, idx+1);
    1665           if(Hide and (not TTemplate(Template.Items[idx]).Active)) then
     1680          Template.Items.Exchange(idx, idx + 1);
     1681          if (Hide and (not TTemplate(Template.Items[idx]).Active)) then
    16661682          begin
    16671683            inc(idx);
     
    16751691      end;
    16761692    end;
    1677     if(ChangeLevel) then
     1693    if (ChangeLevel) then
    16781694    begin
    16791695      ParentsParent := ParentNode.Parent;
    1680       if(assigned(ParentsParent)) then
     1696      if (assigned(ParentsParent)) then
    16811697      begin
    16821698        ParentTemplate := TTemplate(ParentsParent.Data);
    1683         if(ParentTemplate.Items.IndexOf(NodeTemplate) >= 0) then
     1699        if (ParentTemplate.Items.IndexOf(NodeTemplate) >= 0) then
    16841700          InfoBox(ParentsParent.Text + ' already contains the ' +
    16851701            NodeTemplate.PrintName + ' template.',
     
    16891705          if CanClone(ParentNode) then
    16901706          begin
    1691             if(Clone(ParentNode)) then
     1707            if (Clone(ParentNode)) then
    16921708              Template := TTemplate(ParentNode.Data);
    16931709            if Template.CanModify and CanClone(ParentsParent) then
    16941710            begin
    1695               if(Clone(ParentsParent)) then
     1711              if (Clone(ParentsParent)) then
    16961712                ParentTemplate := TTemplate(ParentsParent.Data);
    16971713              if ParentTemplate.CanModify then
     
    16991715                Template.Items.Delete(idx);
    17001716                idx := ParentTemplate.Items.IndexOf(Template);
    1701                 if(idx >= 0) then
     1717                if (idx >= 0) then
    17021718                begin
    1703                   if(idx = (ParentTemplate.Items.Count-1)) then
     1719                  if (idx = (ParentTemplate.Items.Count - 1)) then
    17041720                    ParentTemplate.Items.Add(NodeTemplate)
    17051721                  else
    1706                     ParentTemplate.Items.Insert(idx+1, NodeTemplate);
     1722                    ParentTemplate.Items.Insert(idx + 1, NodeTemplate);
    17071723                  Resync([ParentTemplate, Template]);
    17081724                  btnApply.Enabled := TRUE;
     
    17301746
    17311747begin
    1732   if((assigned(FCurTree)) and (assigned(FCurTree.Selected)) and
    1733                               (assigned(FCurTree.Selected.Parent))) then
     1748  if ((assigned(FCurTree)) and (assigned(FCurTree.Selected)) and
     1749    (assigned(FCurTree.Selected.Parent))) then
    17341750  begin
    17351751    Node := FCurTree.Selected;
     
    17371753    PNode := Node.Parent;
    17381754    Parent := TTemplate(PNode.Data);
    1739     if(AutoDel(Template)) then
     1755    if (AutoDel(Template)) then
    17401756      DoIt := TRUE
    17411757    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
    17521772      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
    17621778        Parent := TTemplate(PNode.Data);
    17631779      if assigned(Parent) and Parent.CanModify then
     
    17821798  OldActiveControl: TControl;
    17831799begin
    1784   if(Assigned(FCurTree)) then
     1800  if (Assigned(FCurTree)) then
    17851801  begin
    17861802    Tree := TTemplateTreeType(FCurTree.Tag);
    17871803    Node := FCurTree.Selected;
    1788     if(Assigned(Node)) then
     1804    if (Assigned(Node)) then
    17891805      Curok := (TTemplate(Node.Data).RealType in [ttDoc, ttGroup, ttClass])
    17901806    else
    17911807      Curok := FALSE;
    1792     if(Curok) then
     1808    if (Curok) then
    17931809    begin
    17941810      OldActiveControl := ActiveControl;
    17951811      FTreeControl[Tree, tcDel].Enabled := TRUE;
    17961812      AllowSet := FALSE;
    1797       if(Node.Index > 0) then
     1813      if (Node.Index > 0) then
    17981814        AllowUp := TRUE
    17991815      else
     
    18041820      FTreeControl[Tree, tcUp].Enabled := AllowUp;
    18051821      AllowDown := AllowUp;
    1806       if(Node.Index < (Node.Parent.Count-1)) then
     1822      if (Node.Index < (Node.Parent.Count - 1)) then
    18071823        AllowDown := TRUE
    18081824      else
    18091825      begin
    1810         if(not AllowSet) then
     1826        if (not AllowSet) then
    18111827          AllowDown := AllowMove(Node.Parent.Parent, Node);
    18121828      end;
     
    18161832      if not AllowDown and (OldActiveControl = FTreeControl[Tree, tcDown]) then
    18171833        (FTreeControl[Tree, tcUp] as TWinControl).SetFocus;
    1818       FTreeControl[Tree, tcCopy].Enabled := FTreeControl[TTemplateTreeType(1-ord(Tree)), tcDel].Visible;
    1819       if(FTreeControl[Tree, tcCopy].Enabled) then
    1820       begin
    1821         if(Tree = ttShared) then
     1834      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
    18221838          Node := tvPersonal.Selected
    18231839        else
    18241840          Node := tvShared.Selected;
    1825         if(assigned(Node)) then
     1841        if (assigned(Node)) then
    18261842        begin
    1827           if(TTemplate(Node.Data).RealType = ttDoc) then
     1843          if (TTemplate(Node.Data).RealType = ttDoc) then
    18281844            Node := Node.Parent;
    18291845          FTreeControl[Tree, tcCopy].Enabled := AllowMove(Node, FCurTree.Selected);
     
    18391855        FTreeControl[Tree, i].Enabled := FALSE;
    18401856    end;
    1841     if(FCurTree = tvShared) and (FCanEditShared) then
     1857    if (FCurTree = tvShared) and (FCanEditShared) then
    18421858      btnNew.Enabled := TRUE
    18431859    else
    1844     if(FCurTree = tvPersonal) and (FCanEditPersonal) then
    1845       btnNew.Enabled := TRUE
    1846     else
    1847       btnNew.Enabled := FALSE;
     1860      if (FCurTree = tvPersonal) and (FCanEditPersonal) then
     1861        btnNew.Enabled := TRUE
     1862      else
     1863        btnNew.Enabled := FALSE;
    18481864  end
    18491865  else
     
    18561872begin
    18571873  CanDrag := (TTemplate(Node.Data).RealType in [ttDoc, ttGroup, ttClass]);
    1858   if(CanDrag) then
     1874  if (CanDrag) then
    18591875    FDragNode := Node
    18601876  else
     
    18711887  FDropNode := nil;
    18721888  Accept := FALSE;
    1873   if(Source is TTreeView) and (assigned(FDragNode)) then
     1889  if (Source is TTreeView) and (assigned(FDragNode)) then
    18741890  begin
    18751891    Tree := TTreeView(Sender);
    1876     FDropNode := Tree.GetNodeAt(X,Y);
    1877     if(((Tree = tvShared)  and (FCanEditShared)) or
    1878        ((Tree = tvPersonal) and (FCanEditPersonal))) then
    1879     begin
    1880       if(assigned(FDropNode)) then
     1892    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
    18811897      begin
    18821898        FDropInto := (TTemplate(FDropNode.Data).RealType in AllTemplateFolderTypes);
    1883         if(FDropInto) then
     1899        if (FDropInto) then
    18841900          TmpNode := FDropNode
    18851901        else
     
    18991915
    19001916begin
    1901   if(assigned(FDragNode)) and (assigned(FDropNode)) and (FDragNode <> FDropNode) then
     1917  if (assigned(FDragNode)) and (assigned(FDropNode)) and (FDragNode <> FDropNode) then
    19021918  begin
    19031919    Item := TTemplate(FDragNode.Data);
    1904     if(FDropInto) then
     1920    if (FDropInto) then
    19051921    begin
    19061922      TmpNode := FDropNode;
     
    19121928      idx := TTemplate(FDropNode.Parent.Data).Items.IndexOf(FDropNode.Data);
    19131929    end;
    1914     if(AllowMove(TmpNode, FDragNode) and (idx >= 0)) then
     1930    if (AllowMove(TmpNode, FDragNode) and (idx >= 0)) then
    19151931    begin
    19161932      Template := TTemplate(TmpNode.Data);
    1917       if(Template <> FDragNode.Parent.Data) and
     1933      if (Template <> FDragNode.Parent.Data) and
    19181934        (Template.Items.IndexOf(Item) >= 0) then
    19191935        InfoBox(Template.PrintName + ' already contains the ' +
     
    19261942        if CanClone(TmpNode) then
    19271943        begin
    1928           if(Clone(TmpNode)) then
     1944          if (Clone(TmpNode)) then
    19291945            Template := TTemplate(TmpNode.Data);
    19301946          if assigned(Template) and Template.CanModify then
    19311947          begin
    1932             if(Sidx >= 0) and (FDragNode.TreeView = FDropNode.TreeView) and
     1948            if (Sidx >= 0) and (FDragNode.TreeView = FDropNode.TreeView) and
    19331949              (not FCopying) then // if same tree delete source
    19341950            begin
    19351951              if CanClone(FDragNode.Parent) then
    19361952              begin
    1937                 if(Clone(FDragNode.Parent)) then
     1953                if (Clone(FDragNode.Parent)) then
    19381954                  Src := TTemplate(FDragNode.Parent.Data);
    19391955                if assigned(Src) and Src.CanModify then
    19401956                begin
    19411957                  Src.Items.Delete(Sidx);
    1942                   if(Template = Src) then
     1958                  if (Template = Src) then
    19431959                    Src := nil;
    19441960                end
     
    19511967            else
    19521968              Src := nil;
    1953             if(idx > 0) then
     1969            if (idx > 0) then
    19541970              idx := TTemplate(FDropNode.Parent.Data).Items.IndexOf(FDropNode.Data);
    19551971            Template.Items.Insert(idx, Item);
    1956             if(TTreeView(FDropNode.TreeView) = tvShared) then
     1972            if (TTreeView(FDropNode.TreeView) = tvShared) then
    19571973            begin
    19581974              Item.PersonalOwner := 0;
     
    19872003      begin
    19882004        tmpl := Templates[i];
    1989         if(assigned(tmpl)) then
     2005        if (assigned(tmpl)) then
    19902006        begin
    1991           for j := 0 to tmpl.Nodes.Count-1 do
     2007          for j := 0 to tmpl.Nodes.Count - 1 do
    19922008          begin
    19932009            Node := TTreeNode(tmpl.Nodes.Objects[j]);
    1994             if(NodeList.IndexOfObject(Node) < 0) then
     2010            if (NodeList.IndexOfObject(Node) < 0) then
    19952011            begin
    19962012              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);
    20002016            end;
    20012017          end;
     
    20082024      NodeList.Sort;
    20092025
    2010       for i := 0 to NodeList.Count-1 do
     2026      for i := 0 to NodeList.Count - 1 do
    20112027      begin
    20122028        NodeID := NodeList[i];
    20132029        Node := TTreeNode(NodeList.Objects[i]);
    20142030        j := TemplateList.IndexOf(NodeID);
    2015         if(j >= 0) then
     2031        if (j >= 0) then
    20162032        begin
    20172033          tmpl := TTemplate(TemplateList.Objects[j]);
    2018           NodeID := Piece(NodeID,U,2);
    2019           if(tmpl.Nodes.IndexOf(NodeID) >= 0) then
     2034          NodeID := Piece(NodeID, U, 2);
     2035          if (tmpl.Nodes.IndexOf(NodeID) >= 0) then
    20202036          begin
    2021             if(Node.TreeView = tvShared) then
     2037            if (Node.TreeView = tvShared) then
    20222038              dmodShared.Resync(Node, not cbShHide.Checked, FSharedEmptyNodeCount)
    20232039            else
    2024             if(Node.TreeView = tvPersonal) then
    2025               dmodShared.Resync(Node, not cbPerHide.Checked, FPersonalEmptyNodeCount);
     2040              if (Node.TreeView = tvPersonal) then
     2041                dmodShared.Resync(Node, not cbPerHide.Checked, FPersonalEmptyNodeCount);
    20262042          end;
    20272043        end;
     
    20342050  end;
    20352051  EnableNavControls;
    2036   if((assigned(FCurTree)) and (assigned(FCurTree.Selected))) then
     2052  if ((assigned(FCurTree)) and (assigned(FCurTree.Selected))) then
    20372053    tvTreeChange(FCurTree, FCurTree.Selected)
    20382054  else
     
    20432059procedure TfrmTemplateEditor.sbCopyLeftClick(Sender: TObject);
    20442060begin
    2045   if(assigned(tvPersonal.Selected)) then
    2046   begin
    2047     if(not assigned(tvShared.Selected)) then
     2061  if (assigned(tvPersonal.Selected)) then
     2062  begin
     2063    if (not assigned(tvShared.Selected)) then
    20482064      tvShared.Selected := tvShared.Items.GetFirstNode;
    20492065    FDragNode := tvPersonal.Selected;
    20502066    FDropNode := tvShared.Selected;
    20512067    FDropInto := (TTemplate(FDropNode.Data).RealType in AllTemplateFolderTypes);
    2052     tvTreeDragDrop(tvPersonal, tvShared, 0,0);
     2068    tvTreeDragDrop(tvPersonal, tvShared, 0, 0);
    20532069  end;
    20542070end;
     
    20562072procedure TfrmTemplateEditor.sbCopyRightClick(Sender: TObject);
    20572073begin
    2058   if(assigned(tvShared.Selected)) then
    2059   begin
    2060     if(not assigned(tvPersonal.Selected)) then
     2074  if (assigned(tvShared.Selected)) then
     2075  begin
     2076    if (not assigned(tvPersonal.Selected)) then
    20612077      tvPersonal.Selected := tvPersonal.Items.GetFirstNode;
    20622078    FDragNode := tvShared.Selected;
    20632079    FDropNode := tvPersonal.Selected;
    20642080    FDropInto := (TTemplate(FDropNode.Data).RealType in AllTemplateFolderTypes);
    2065     tvTreeDragDrop(tvShared, tvPersonal, 0,0);
     2081    tvTreeDragDrop(tvShared, tvPersonal, 0, 0);
    20662082  end;
    20672083end;
     
    21022118
    21032119begin
    2104   if(assigned(ADropNode) and assigned(ADragNode)) then
     2120  if (assigned(ADropNode) and assigned(ADragNode)) then
    21052121  begin
    21062122    DropTemplate := TTemplate(ADropNode.Data);
     
    21102126    else
    21112127      Result := (DragTemplate.RealType in [ttDoc, ttGroup, ttClass]);
    2112     if(Result) then
    2113     begin
    2114       if(FCopying) then
    2115       begin
    2116         if(DropTemplate.Items.IndexOf(DragTemplate) >= 0) then
     2128    if (Result) then
     2129    begin
     2130      if (FCopying) then
     2131      begin
     2132        if (DropTemplate.Items.IndexOf(DragTemplate) >= 0) then
    21172133          Result := FALSE;
    21182134      end
    21192135      else
    2120       if((assigned(ADragNode.Parent)) and (ADropNode <> ADragNode.Parent) and
    2121          (DropTemplate.Items.IndexOf(DragTemplate) >= 0)) then
    2122         Result := FALSE;
    2123     end;
    2124     if(Result) then
    2125     begin
    2126       for i := 0 to DropTemplate.Nodes.Count-1 do
     2136        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
    21272143      begin
    21282144        TmpNode := TTreeNode(DropTemplate.Nodes.Objects[i]);
    21292145        while (Result and (assigned(TmpNode.Parent))) do
    21302146        begin
    2131           if(TmpNode.Data = DragTemplate) then
     2147          if (TmpNode.Data = DragTemplate) then
    21322148            Result := FALSE
    21332149          else
    21342150            TmpNode := TmpNode.Parent;
    21352151        end;
    2136         if(not Result) then break;
     2152        if (not Result) then break;
    21372153      end;
    21382154    end;
     
    21512167begin
    21522168  Result := FALSE;
    2153   if((assigned(Node)) and (TTreeView(Node.TreeView) = tvPersonal)) then
     2169  if ((assigned(Node)) and (TTreeView(Node.TreeView) = tvPersonal)) then
    21542170  begin
    21552171    OldT := TTemplate(Node.Data);
    2156     if(OldT.PersonalOwner <> User.DUZ) then
     2172    if (OldT.PersonalOwner <> User.DUZ) then
    21572173    begin
    21582174      PNode := Node.Parent;
     
    21792195        Node.Data := NewT;
    21802196        NewT.AddNode(Node);
    2181         if(assigned(Prnt)) then
     2197        if (assigned(Prnt)) then
    21822198        begin
    21832199          idx := Prnt.Items.IndexOf(OldT);
    2184           if(idx >= 0) then
     2200          if (idx >= 0) then
    21852201            Prnt.Items[idx] := NewT;
    21862202        end;
     
    22002216
    22012217begin
    2202   if((not FUpdating) and (assigned(FCurTree)) and (assigned(FCurTree.Selected))) then
     2218  if ((not FUpdating) and (assigned(FCurTree)) and (assigned(FCurTree.Selected))) then
    22032219  begin
    22042220    Template := TTemplate(FCurTree.Selected.Data);
    22052221    TmpBPlate := reBoil.Lines.Text;
    2206     if(Template.Boilerplate <> TmpBPlate) then
     2222    if (Template.Boilerplate <> TmpBPlate) then
    22072223    begin
    22082224      if CanClone(FCurTree.Selected) then
    22092225      begin
    22102226        DoRefresh := Clone(FCurTree.Selected);
    2211         if(DoRefresh) then
     2227        if (DoRefresh) then
    22122228          Template := TTemplate(FCurTree.Selected.Data);
    22132229        if assigned(Template) and Template.CanModify then
    22142230        begin
    22152231          DoInfo := FALSE;
    2216           if(Template.Boilerplate = '') or (TmpBPlate = '') then
     2232          if (Template.Boilerplate = '') or (TmpBPlate = '') then
    22172233            DoInfo := TRUE;
    22182234          Template.Boilerplate := TmpBPlate;
    22192235          TTemplate(FCurTree.Selected.Data).Gap := StrToIntDef(edtGap.Text, 0);
    2220           if(Template.RealType = ttGroup) then
     2236          if (Template.RealType = ttGroup) then
    22212237          begin
    22222238            reGroupBP.Text := Template.FullBoilerplate;
    22232239          end;
    2224           if(DoRefresh) then
     2240          if (DoRefresh) then
    22252241          begin
    22262242            tvShared.Invalidate;
    22272243            tvPersonal.Invalidate;
    22282244          end;
    2229           if(DoInfo) then
     2245          if (DoInfo) then
    22302246          begin
    22312247            x := reBoil.SelStart;
     
    22512267{$ENDIF}
    22522268  sbCopyLeft.Visible := FCanEditShared;
    2253   if(not FCanEditShared) then
     2269  if (not FCanEditShared) then
    22542270    cbShHide.Checked := TRUE;
    22552271  cbShHide.Visible := FCanEditShared;
     
    22832299  Tree.Selected := Node; // This line prevents selected from changing after menu closes
    22842300  mnuCollapseTree.Enabled := dmodShared.NeedsCollapsing(Tree);
    2285   if(Tree = tvShared) then
     2301  if (Tree = tvShared) then
    22862302  begin
    22872303    Txt := 'Shared';
     
    22962312  end;
    22972313  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)) then
     2314  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
    23022318  begin
    23032319    mnuNodeCopy.Enabled := (TTemplate(Tree.Selected.Data).RealType in [ttDoc, ttGroup, ttClass]);
    23042320    mnuNodeSort.Enabled := (TTemplate(Tree.Selected.Data).RealType in AllTemplateFolderTypes) and
    2305                            (Tree.Selected.HasChildren) and
    2306                            (Tree.Selected.GetFirstChild.GetNextSibling <> nil);
     2321      (Tree.Selected.HasChildren) and
     2322      (Tree.Selected.GetFirstChild.GetNextSibling <> nil);
    23072323  end
    23082324  else
     
    23192335procedure TfrmTemplateEditor.mnuCollapseTreeClick(Sender: TObject);
    23202336begin
    2321   if(GetTree = tvShared) then
     2337  if (GetTree = tvShared) then
    23222338  begin
    23232339    tvShared.Selected := tvShared.Items.GetFirstNode;
     
    23372353begin
    23382354  Tree := GetTree;
    2339   if(Tree = tvShared) then
     2355  if (Tree = tvShared) then
    23402356  begin
    23412357    FFindShOn := not FFindShOn;
    23422358    pnlShSearch.Visible := FFindShOn;
    2343     if(FFindShOn) then
     2359    if (FFindShOn) then
    23442360    begin
    23452361      edtShSearch.SetFocus;
     
    23512367    FFindPerOn := not FFindPerOn;
    23522368    pnlPerSearch.Visible := FFindPerOn;
    2353     if(FFindPerOn) then
     2369    if (FFindPerOn) then
    23542370    begin
    23552371      edtPerSearch.SetFocus;
     
    23622378procedure TfrmTemplateEditor.ShowTemplateType(Template: TTemplate);
    23632379begin
    2364   if(Template.PersonalOwner > 0) then
     2380  if (Template.PersonalOwner > 0) then
    23652381    gbProperties.Caption := 'Personal'
    23662382  else
     
    23712387function TfrmTemplateEditor.GetTree: TTreeView;
    23722388begin
    2373   if(FFromMainMenu) then
     2389  if (FFromMainMenu) then
    23742390    Result := FMainMenuTree
    23752391  else
    23762392  begin
    2377     if(TTemplateTreeType(PopupComponent(popTemplates, popTemplates).Tag) = ttShared) then
     2393    if (TTemplateTreeType(PopupComponent(popTemplates, popTemplates).Tag) = ttShared) then
    23782394      Result := tvShared
    23792395    else
     
    23952411
    23962412begin
    2397   if(TTemplateTreeType(TButton(Sender).Tag) = ttShared) then
     2413  if (TTemplateTreeType(TButton(Sender).Tag) = ttShared) then
    23982414  begin
    23992415    Tree := tvShared;
     
    24132429    LastFoundNode := FLastFoundPerNode;
    24142430  end;
    2415   if(edtSearch.text <> '') then
    2416   begin
    2417     IsNext := ((FindNext) and assigned (LastFoundNode));
     2431  if (edtSearch.text <> '') then
     2432  begin
     2433    IsNext := ((FindNext) and assigned(LastFoundNode));
    24182434    if IsNext then
    2419    
     2435
    24202436      TmpNode := LastFoundNode
    24212437    else
     
    24242440    try
    24252441      Found := FindTemplate(edtSearch.Text, Tree, Self, TmpNode,
    2426                             IsNext, not FindCase, FindWholeWords);
     2442        IsNext, not FindCase, FindWholeWords);
    24272443    finally
    24282444      FInternalHiddenExpand := FALSE;
     
    24312447    begin
    24322448      Tree.Selected := Found;
    2433       if(Tree = tvShared) then
     2449      if (Tree = tvShared) then
    24342450        FLastFoundShNode := Found
    24352451      else
     
    24432459procedure TfrmTemplateEditor.edtSearchChange(Sender: TObject);
    24442460begin
    2445   if(TTemplateTreeType(TEdit(Sender).Tag) = ttShared) then
     2461  if (TTemplateTreeType(TEdit(Sender).Tag) = ttShared) then
    24462462  begin
    24472463    btnShFind.Enabled := (edtShSearch.Text <> '');
     
    24572473procedure TfrmTemplateEditor.SetFindNext(const Tree: TTreeView; const Value: boolean);
    24582474begin
    2459   if(Tree = tvShared) then
    2460   begin
    2461     if(FFindShNext <> Value) then
     2475  if (Tree = tvShared) then
     2476  begin
     2477    if (FFindShNext <> Value) then
    24622478    begin
    24632479      FFindShNext := Value;
    2464       if(FFindShNext) then btnShFind.Caption := 'Find Next'
     2480      if (FFindShNext) then btnShFind.Caption := 'Find Next'
    24652481      else btnShFind.Caption := 'Find';
    24662482    end;
     
    24682484  else
    24692485  begin
    2470     if(FFindPerNext <> Value) then
     2486    if (FFindPerNext <> Value) then
    24712487    begin
    24722488      FFindPerNext := Value;
    2473       if(FFindPerNext) then btnPerFind.Caption := 'Find Next'
     2489      if (FFindPerNext) then btnPerFind.Caption := 'Find Next'
    24742490      else btnPerFind.Caption := 'Find';
    24752491    end;
     
    24992515procedure TfrmTemplateEditor.btnOKClick(Sender: TObject);
    25002516begin
    2501   if(ScanNames) then
    2502   begin
    2503     if(SaveAllTemplates) then
     2517  if (ScanNames) then
     2518  begin
     2519    if (SaveAllTemplates) then
    25042520    begin
    25052521      FOK2Close := TRUE;
     
    25132529procedure TfrmTemplateEditor.FormShow(Sender: TObject);
    25142530begin
    2515   if(FFirstShow) then
     2531  if (FFirstShow) then
    25162532  begin
    25172533    FUpdating := FALSE;
    25182534    FFirstShow := FALSE;
    2519     if(FFocusName) then
     2535    if (FFocusName) then
    25202536    begin
    25212537      edtName.SetFocus;
     
    25342550
    25352551begin
    2536   if(not assigned(frmTemplateObjects)) then
     2552  if (not assigned(frmTemplateObjects)) then
    25372553  begin
    25382554    dmodShared.LoadTIUObjects;
     
    25422558    begin
    25432559      UpdatePersonalObjects;
    2544       if uPersonalObjects.Count > 0 then                                                  // -------- CQ #8665 - RV ------------
     2560      if uPersonalObjects.Count > 0 then // -------- CQ #8665 - RV ------------
    25452561      begin
    25462562        DoIt := FALSE;
    2547         for i := 0 to dmodShared.TIUObjects.Count-1 do
    2548           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 ------------
    25492565            frmTemplateObjects.cboObjects.Items.Add(dmodShared.TIUObjects[i]);
    25502566      end;
     
    25622578begin
    25632579  FBPOK := FALSE;
    2564   if(reBoil.Lines.Count > 0) then
    2565   begin
    2566     if(dmodShared.TemplateOK(FCurTree.Selected.Data,'OK')) then
     2580  if (reBoil.Lines.Count > 0) then
     2581  begin
     2582    if (dmodShared.TemplateOK(FCurTree.Selected.Data, 'OK')) then
    25672583    begin
    25682584      TestBoilerplate(reBoil.Lines);
    2569       if(RPCBrokerV.Results.Count > 0) then
    2570         InfoBox('Boilerplate Contains Errors:'+CRLF+CRLF+
     2585      if (RPCBrokerV.Results.Count > 0) then
     2586        InfoBox('Boilerplate Contains Errors:' + CRLF + CRLF +
    25712587          RPCBrokerV.Results.Text, 'Error', MB_OK or MB_ICONERROR)
    25722588      else
    25732589      begin
    25742590        FBPOK := TRUE;
    2575         if(assigned(Sender)) then
     2591        if (assigned(Sender)) then
    25762592          InfoBox('No Errors Found in Boilerplate.', 'Information', MB_OK or MB_ICONINFORMATION);
    25772593      end;
     
    25902606
    25912607  mnuBPPaste.Enabled := (ok and Clipboard.HasFormat(CF_TEXT));
    2592   if(ok) then
     2608  if (ok) then
    25932609    ok := (reBoil.Lines.Count > 0);
    25942610  tryOK := (reBoil.Lines.Count > 0) or ((pnlGroupBP.Visible) and (reGroupBP.Lines.Count > 0));
     
    26162632    while (assigned(Node)) do
    26172633    begin
    2618       if(Node.Text <> EmptyNodeText) and (assigned(Node.Data)) then
    2619       begin
    2620         if(BadTemplateName(Node.Text)) then
     2634      if (Node.Text <> EmptyNodeText) and (assigned(Node.Data)) then
     2635      begin
     2636        if (BadTemplateName(Node.Text)) then
    26212637          Errors.Add(Node);
    26222638      end;
     
    26302646    ScanTree(tvShared);
    26312647    ScanTree(tvPersonal);
    2632     if(Errors.Count > 0) then
    2633     begin
    2634       if(Errors.Count > 1) then
     2648    if (Errors.Count > 0) then
     2649    begin
     2650      if (Errors.Count > 1) then
    26352651        msg := IntToStr(Errors.Count) + ' Templates have invalid names'
    26362652      else
    26372653        msg := 'Template has an invalid name';
    26382654      msg := msg + ': ';
    2639       for i := 0 to Errors.Count-1 do
    2640       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 + ', ';
    26422658        Node := TTreeNode(Errors[i]);
    26432659        msg := msg + Node.Text;
     
    26712687
    26722688begin
    2673   if(not FOK2Close) and (BackupDiffers) then
     2689  if (not FOK2Close) and (BackupDiffers) then
    26742690  begin
    26752691    ans := InfoBox('Save Changes?', 'Confirmation', MB_YESNOCANCEL or MB_ICONQUESTION);
    2676     if(ans = IDCANCEL) then
     2692    if (ans = IDCANCEL) then
    26772693      CanClose := FALSE
    26782694    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;
    26882705      end;
    2689     end;
    26902706  end;
    26912707end;
     
    27032719    tmplEditorSplitterNotes := pnlNotes.Height;
    27042720  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;
    27052725end;
    27062726
     
    27082728  var Key: Char);
    27092729begin
    2710   if(not (Key in ['0','1','2','3'])) then Key := #0;
     2730  if (not (Key in ['0', '1', '2', '3'])) then Key := #0;
    27112731end;
    27122732
     
    27172737begin
    27182738  Warn := (ActiveControl <> btnCancel) and (BadTemplateName(edtName.Text));
    2719   if(Warn and ((ActiveControl = sbShDelete) or (ActiveControl = sbPerDelete))) then
    2720   begin
    2721     if((assigned(FCurTree)) and (assigned(FCurTree.Selected))) then
     2739  if (Warn and ((ActiveControl = sbShDelete) or (ActiveControl = sbPerDelete))) then
     2740  begin
     2741    if ((assigned(FCurTree)) and (assigned(FCurTree.Selected))) then
    27222742      Warn := not AutoDel(TTemplate(FCurTree.Selected.Data));
    27232743  end;
    2724   if(Warn) then
     2744  if (Warn) then
    27252745  begin
    27262746    InfoBox('Template has an invalid name: ' + edtName.Text + '.' + BadNameText, 'Error', MB_OK or MB_ICONERROR);
     
    27412761
    27422762begin
    2743   if(assigned(FDropNode)) then
     2763  if (assigned(FDropNode)) then
    27442764  begin
    27452765    TopNode := FDropNode.TreeView.TopItem;
    27462766    Redraw := FALSE;
    27472767    TmpPt := FDropNode.TreeView.ScreenToClient(Mouse.CursorPos);
    2748     if(TopNode = FDropNode) and (TopNode <> TTreeView(FDropNode.TreeView).Items.GetFirstNode) then
     2768    if (TopNode = FDropNode) and (TopNode <> TTreeView(FDropNode.TreeView).Items.GetFirstNode) then
    27492769    begin
    27502770      FDropNode.TreeView.TopItem := TopNode.GetPrevVisible;
     
    27542774    begin
    27552775      RMax := FDropNode.TreeView.ClientHeight - EdgeScroll;
    2756       if((TmpPt.Y > RMax) and (FDropNode.GetNextVisible <> nil)) then
     2776      if ((TmpPt.Y > RMax) and (FDropNode.GetNextVisible <> nil)) then
    27572777      begin
    27582778        TORTreeView(FDropNode.TreeView).VertScrollPos :=
    2759         TORTreeView(FDropNode.TreeView).VertScrollPos + 1;
     2779          TORTreeView(FDropNode.TreeView).VertScrollPos + 1;
    27602780        Redraw := TRUE;
    27612781      end;
    27622782    end;
    2763     if(FLastDropNode <> FDropNode) then
    2764     begin
    2765       if((assigned(FDropNode)) and (FDropNode.GetNext = nil)) then
     2783    if (FLastDropNode <> FDropNode) then
     2784    begin
     2785      if ((assigned(FDropNode)) and (FDropNode.GetNext = nil)) then
    27662786        Redraw := TRUE
    27672787      else
    2768       if((assigned(FLastDropNode)) and (FLastDropNode.GetNext = nil)) then
    2769         Redraw := TRUE;
     2788        if ((assigned(FLastDropNode)) and (FLastDropNode.GetNext = nil)) then
     2789          Redraw := TRUE;
    27702790      FLastDropNode := FDropNode;
    27712791      FDragOverCount := 0;
     
    27732793    else
    27742794    begin
    2775       if(FDropNode.HasChildren) and (not FDropNode.Expanded) then
     2795      if (FDropNode.HasChildren) and (not FDropNode.Expanded) then
    27762796      begin
    27772797        ht := FDropNode.TreeView.GetHitTestInfoAt(TmpPt.X, TmpPt.Y);
    2778         if(htOnButton in ht) then
     2798        if (htOnButton in ht) then
    27792799        begin
    27802800          inc(FDragOverCount);
    2781           if(FDragOverCount > 4) then
     2801          if (FDragOverCount > 4) then
    27822802          begin
    27832803            TopNode := FDropNode.TreeView.TopItem;
     
    27912811          FDragOverCount := 0;
    27922812      end;
    2793       if(not Redraw) then
     2813      if (not Redraw) then
    27942814      begin
    27952815        HPos := TORTreeView(FDropNode.TreeView).HorzScrollPos;
    2796         if(HPos > 0) and (TmpPt.X < EdgeScroll) then
     2816        if (HPos > 0) and (TmpPt.X < EdgeScroll) then
    27972817        begin
    27982818          TORTreeView(FDropNode.TreeView).HorzScrollPos :=
    2799           TORTreeView(FDropNode.TreeView).HorzScrollPos - EdgeScroll;
     2819            TORTreeView(FDropNode.TreeView).HorzScrollPos - EdgeScroll;
    28002820          Redraw := TRUE;
    28012821        end
     
    28032823        begin
    28042824          RMax := FDropNode.TreeView.ClientWidth - EdgeScroll;
    2805           if(TmpPt.X > RMax) then
     2825          if (TmpPt.X > RMax) then
    28062826          begin
    28072827            TORTreeView(FDropNode.TreeView).HorzScrollPos :=
    2808             TORTreeView(FDropNode.TreeView).HorzScrollPos + EdgeScroll;
     2828              TORTreeView(FDropNode.TreeView).HorzScrollPos + EdgeScroll;
    28092829            Redraw := TRUE;
    28102830          end;
     
    28122832      end;
    28132833    end;
    2814     if(Redraw) then
     2834    if (Redraw) then
    28152835    begin
    28162836      TmpPt := Mouse.CursorPos; // Wiggling the mouse causes needed windows messages to fire
     
    28772897procedure TfrmTemplateEditor.mnuNodeDeleteClick(Sender: TObject);
    28782898begin
    2879   if(FCurTree = tvShared) and (sbShDelete.Visible) and (sbShDelete.Enabled) then
     2899  if (FCurTree = tvShared) and (sbShDelete.Visible) and (sbShDelete.Enabled) then
    28802900    sbDeleteClick(sbShDelete)
    28812901  else
    2882   if(FCurTree = tvPersonal) and (sbPerDelete.Visible) and (sbPerDelete.Enabled) then
    2883     sbDeleteClick(sbPerDelete);
     2902    if (FCurTree = tvPersonal) and (sbPerDelete.Visible) and (sbPerDelete.Enabled) then
     2903      sbDeleteClick(sbPerDelete);
    28842904end;
    28852905
    28862906procedure TfrmTemplateEditor.mnuNodeCopyClick(Sender: TObject);
    28872907begin
    2888   if(assigned(FCurTree)) then
     2908  if (assigned(FCurTree)) then
    28892909    FCopyNode := FCurTree.Selected
    28902910  else
     
    28942914procedure TfrmTemplateEditor.mnuNodePasteClick(Sender: TObject);
    28952915begin
    2896   if(PasteOK) then
     2916  if (PasteOK) then
    28972917  begin
    28982918    FDragNode := FCopyNode;
     
    29162936begin
    29172937  Result := assigned(FCopyNode) and assigned(FPasteNode);
    2918   if(Result) then
     2938  if (Result) then
    29192939    Result := (FTreeControl[TTemplateTreeType(FPasteNode.TreeView.Tag), tcDel].Visible);
    2920   if(Result) then
     2940  if (Result) then
    29212941  begin
    29222942    OldCopying := FCopying;
     
    29242944    try
    29252945      Node := FPasteNode;
    2926       if(TTemplate(Node.Data).RealType = ttDoc) then
     2946      if (TTemplate(Node.Data).RealType = ttDoc) then
    29272947        Node := Node.Parent;
    29282948      Result := AllowMove(Node, FCopyNode);
     
    29422962begin
    29432963
    2944   if(Key = VK_DELETE) then
    2945   begin
    2946     if(Sender = tvShared) then
    2947     begin
    2948       if(sbShDelete.Visible and sbShDelete.Enabled) then
     2964  if (Key = VK_DELETE) then
     2965  begin
     2966    if (Sender = tvShared) then
     2967    begin
     2968      if (sbShDelete.Visible and sbShDelete.Enabled) then
    29492969        sbDeleteClick(sbShDelete);
    29502970    end
    29512971    else
    29522972    begin
    2953       if(sbPerDelete.Visible and sbPerDelete.Enabled) then
     2973      if (sbPerDelete.Visible and sbPerDelete.Enabled) then
    29542974        sbDeleteClick(sbPerDelete);
    29552975    end;
     
    29572977   //Code Added to provide CTRL Key access for 508 compliance  GRE 3/03
    29582978  if (ssCtrl in Shift) and (Key = VK_A) then
    2959       reBoil.SelectAll
     2979    reBoil.SelectAll
    29602980  else
    2961   if (ssCtrl in Shift) and (Key = VK_C) then
     2981    if (ssCtrl in Shift) and (Key = VK_C) then
    29622982      reBoil.CopyToClipboard
    2963   else
    2964   if (ssCtrl in Shift) and (Key = VK_E) then
    2965       mnuBPErrorCheckClick(Self)
    2966   else
    2967   if (ssCtrl in Shift) and (Key = VK_F) then
    2968       mnuBPInsertFieldClick(Self)
    2969   else
    2970   if (ssCtrl in Shift) and (Key = VK_G) then
    2971       GrammarCheckForControl(reBoil)
    2972   else
    2973   if (ssCtrl in Shift) and (Key = VK_I) then
    2974       mnuBPInsertObjectClick(Self)
    2975   else
    2976   if (ssCtrl in Shift) and (Key = VK_S) then
    2977       SpellCheckForControl(reBoil)
    2978   else
    2979   if (ssCtrl in Shift) and (Key = VK_T) then
    2980       mnuBPTryClick(Self)
    2981   else
    2982   if (ssCtrl in Shift) and (Key = VK_V) then
    2983       reBoil.SelText := Clipboard.AsText
    2984   else
    2985   if (ssCtrl in Shift) and (Key = VK_X) then
    2986       reBoil.CutToClipboard
    2987   else
    2988   if (ssCtrl in Shift) and (Key = VK_Z) then
    2989       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);
    29903010  //End of ---- Code Added to provide CTRL Key access for 508 compliance  GRE 3/03
    29913011end;
     
    30023022    mnuInsertField.Enabled := ok;
    30033023    mnuPaste.Enabled := (ok and Clipboard.HasFormat(CF_TEXT));
    3004     if(ok) then
     3024    if (ok) then
    30053025      ok := (reBoil.Lines.Count > 0);
    30063026    tryOK := (reBoil.Lines.Count > 0) or ((pnlGroupBP.Visible) and (reGroupBP.Lines.Count > 0));
     
    30183038  else
    30193039  begin
    3020     mnuInsertObject.Enabled     := FALSE;
    3021     mnuInsertField.Enabled      := FALSE;
    3022     mnuPaste.Enabled            := FALSE;
    3023     mnuErrorCheck.Enabled       := FALSE;
    3024     mnuTry.Enabled              := FALSE;
    3025     mnuSpellCheck.Enabled       := FALSE;
    3026     mnuCheckGrammar.Enabled     := FALSE;
    3027     mnuCopy.Enabled             := FALSE;
    3028     mnuCut.Enabled              := FALSE;
    3029     mnuSelectAll.Enabled        := FALSE;
    3030     mnuUndo.Enabled             := FALSE;
     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;
    30313051    mnuGroupBoilerplate.Enabled := FALSE;
    30323052  end;
     
    30423062begin
    30433063  SetFindNext(tvShared, FALSE);
    3044   if(pnlShSearch.Visible) then edtShSearch.SetFocus;
     3064  if (pnlShSearch.Visible) then edtShSearch.SetFocus;
    30453065end;
    30463066
     
    30483068begin
    30493069  SetFindNext(tvPersonal, FALSE);
    3050   if(pnlPerSearch.Visible) then edtPerSearch.SetFocus;
     3070  if (pnlPerSearch.Visible) then edtPerSearch.SetFocus;
    30513071end;
    30523072
     
    30583078  FFromMainMenu := TRUE;
    30593079  Tree := FCurTree;
    3060   if(assigned(Tree) and assigned(Tree.Selected)) then
    3061   begin
    3062     if(Tree = tvShared) then
     3080  if (assigned(Tree) and assigned(Tree.Selected)) then
     3081  begin
     3082    if (Tree = tvShared) then
    30633083      mnuTDelete.Enabled := ((sbShDelete.Visible) and (sbShDelete.Enabled))
    30643084    else
    30653085      mnuTDelete.Enabled := ((sbPerDelete.Visible) and (sbPerDelete.Enabled));
    3066     if(assigned(Tree) and assigned(Tree.Selected) and assigned(Tree.Selected.Data)) then
     3086    if (assigned(Tree) and assigned(Tree.Selected) and assigned(Tree.Selected.Data)) then
    30673087    begin
    30683088      mnuTCopy.Enabled := (TTemplate(Tree.Selected.Data).RealType in [ttDoc, ttGroup, ttClass]);
    30693089      mnuSort.Enabled := (TTemplate(Tree.Selected.Data).RealType in AllTemplateFolderTypes) and
    3070                          (Tree.Selected.HasChildren) and
    3071                          (Tree.Selected.GetFirstChild.GetNextSibling <> nil);
     3090        (Tree.Selected.HasChildren) and
     3091        (Tree.Selected.GetFirstChild.GetNextSibling <> nil);
    30723092    end
    30733093    else
     
    31203140procedure TfrmTemplateEditor.pnlShSearchResize(Sender: TObject);
    31213141begin
    3122   if((cbShMatchCase.Width + cbShWholeWords.Width) > pnlShSearch.Width) then
     3142  if ((cbShMatchCase.Width + cbShWholeWords.Width) > pnlShSearch.Width) then
    31233143    cbShWholeWords.Left := cbShMatchCase.Width
    31243144  else
     
    31283148procedure TfrmTemplateEditor.pnlPerSearchResize(Sender: TObject);
    31293149begin
    3130   if((cbPerMatchCase.Width + cbPerWholeWords.Width) > pnlPerSearch.Width) then
     3150  if ((cbPerMatchCase.Width + cbPerWholeWords.Width) > pnlPerSearch.Width) then
    31313151    cbPerWholeWords.Left := cbPerMatchCase.Width
    31323152  else
     
    31563176begin
    31573177  Tree := FCurTree;
    3158   if(assigned(Tree) and assigned(Tree.Selected) and Tree.Selected.HasChildren) then
     3178  if (assigned(Tree) and assigned(Tree.Selected) and Tree.Selected.HasChildren) then
    31593179  begin
    31603180    TTemplate(Tree.Selected.Data).SortChildren;
     
    31673187  var NewWidth, NewHeight: Integer; var Resize: Boolean);
    31683188begin
    3169   if(NewHeight < 40) then Resize := FALSE;
     3189  if (NewHeight < 40) then Resize := FALSE;
    31703190end;
    31713191
    31723192function TfrmTemplateEditor.AutoDel(Template: TTemplate): boolean;
    31733193begin
    3174   if(assigned(Template)) then
     3194  if (assigned(Template)) then
    31753195    Result := (((Template.ID = '0') or (Template.ID = '')) and
    3176                 (Template.PrintName = NewTemplateName) and
    3177                 (Template.Boilerplate = ''))
     3196      (Template.PrintName = NewTemplateName) and
     3197      (Template.Boilerplate = ''))
    31783198  else
    3179     Result := FALSE;           
     3199    Result := FALSE;
    31803200end;
    31813201
     
    31853205  Move: boolean;
    31863206  tmpl: TTemplate;
    3187   txt: String;
     3207  txt: string;
    31883208
    31893209begin
    31903210  mnuBPErrorCheckClick(nil);
    3191   if(FBPOK) or (reBoil.Lines.Count = 0) then
     3211  if (FBPOK) or (reBoil.Lines.Count = 0) then
    31923212  begin
    31933213    Move := assigned(frmTemplateView);
    3194     if(Move) then
     3214    if (Move) then
    31953215    begin
    31963216      R := frmTemplateView.BoundsRect;
     
    32013221    tmpl.TemplatePreviewMode := TRUE; // Prevents "Are you sure?" dialog when canceling
    32023222    txt := tmpl.Text;
    3203     if(not tmpl.DialogAborted) then
    3204       ShowTemplateData(Self, tmpl.PrintName ,txt);
    3205     if(Move) then
     3223    if (not tmpl.DialogAborted) then
     3224      ShowTemplateData(Self, tmpl.PrintName, txt);
     3225    if (Move) then
    32063226      frmTemplateView.BoundsRect := R;
    32073227    tmpl.TemplatePreviewMode := FALSE;
     
    32163236  dmodShared.LoadTIUObjects;
    32173237  UpdatePersonalObjects;
    3218   GetAutoGenText(AName, AText, uPersonalObjects);   // -------- CQ #8665 - RV ------------
    3219   if(AName <> '') and (AText <> '') then
     3238  GetAutoGenText(AName, AText, uPersonalObjects); // -------- CQ #8665 - RV ------------
     3239  if (AName <> '') and (AText <> '') then
    32203240  begin
    32213241    btnNewClick(Self);
     
    32333253
    32343254begin
    3235   if((not FUpdating) and (assigned(FCurTree)) and (assigned(FCurTree.Selected))) then
     3255  if ((not FUpdating) and (assigned(FCurTree)) and (assigned(FCurTree.Selected))) then
    32363256  begin
    32373257    if CanClone(FCurTree.Selected) then
     
    32433263        Template.Description := reNotes.Lines.Text;
    32443264        UpdateApply(Template);
    3245         if(DoRefresh) then
     3265        if (DoRefresh) then
    32463266        begin
    32473267          tvShared.Invalidate;
     
    32973317  ok := not reNotes.ReadOnly;
    32983318  mnuNotesPaste.Enabled := (ok and Clipboard.HasFormat(CF_TEXT));
    3299   if(ok) then
     3319  if (ok) then
    33003320    ok := (reNotes.Lines.Count > 0);
    33013321  mnuNotesSpelling.Enabled := ok and SpellCheckAvailable;
     
    33083328
    33093329procedure TfrmTemplateEditor.cbNotesClick(Sender: TObject);
     3330var
     3331  ScreenPoint: TPoint;
     3332  NewHeight: Integer;
    33103333begin
    33113334  pnlNotes.Visible := cbNotes.Checked;
     
    33153338    pnlNotes.Height := tmplEditorSplitterNotes;
    33163339    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;
    33183360  end;
    33193361  pnlBoilerplateResize(Self);
     
    33483390var
    33493391  Template: TTemplate;
    3350  
    3351 begin
    3352   if((not FUpdating) and (assigned(FCurTree)) and (assigned(FCurTree.Selected))) then
     3392
     3393begin
     3394  if ((not FUpdating) and (assigned(FCurTree)) and (assigned(FCurTree.Selected))) then
    33533395  begin
    33543396    if CanClone(FCurTree.Selected) then
     
    33593401      begin
    33603402        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;
    33683410        end;
    33693411        UpdateApply(Template);
     
    33833425  mnuImportTemplate.Enabled := btnNew.Enabled;
    33843426  mnuExportTemplate.Enabled := (assigned(FCurTree) and assigned(FCurTree.Selected) and
    3385                                 assigned(FCurTree.Selected.Data));
     3427    assigned(FCurTree.Selected.Data));
    33863428end;
    33873429
     
    33983440procedure TfrmTemplateEditor.mnuBPInsertFieldClick(Sender: TObject);
    33993441begin
    3400   if(not assigned(frmTemplateFields)) then
     3442  if (not assigned(frmTemplateFields)) then
    34013443  begin
    34023444    frmTemplateFields := TfrmTemplateFields.Create(Self);
     
    34253467begin
    34263468  err := FALSE;
    3427   if(assigned(FCurTree) and assigned(FCurTree.Selected) and assigned(FCurTree.Selected.Data)) then
     3469  if (assigned(FCurTree) and assigned(FCurTree.Selected) and assigned(FCurTree.Selected.Data)) then
    34283470  begin
    34293471    dlgExport.FileName := ValidFileName(TTemplate(FCurTree.Selected.Data).PrintName);
     
    34343476        Flds := TStringList.Create;
    34353477        try
    3436           Tmpl.Add('<'+XMLHeader+'>');
     3478          Tmpl.Add('<' + XMLHeader + '>');
    34373479          if TTemplate(FCurTree.Selected.Data).CanExportXML(Tmpl, Flds, 2) then
    34383480          begin
     
    34403482              ExpandEmbeddedFields(Flds);
    34413483              FastAssign(ExportTemplateFields(Flds), Flds);
    3442               for i := 0 to Flds.Count-1 do
     3484              for i := 0 to Flds.Count - 1 do
    34433485                Flds[i] := '  ' + Flds[i];
    34443486              FastAddStrings(Flds, Tmpl);
    34453487            end; {if}
    3446             Tmpl.Add('</'+XMLHeader+'>');
     3488            Tmpl.Add('</' + XMLHeader + '>');
    34473489            try
    34483490              XMLDoc := CoDOMDocument.Create;
     
    34603502            if not err then
    34613503              InfoBox('Template ' + TTemplate(FCurTree.Selected.Data).PrintName +
    3462                       ' Exported.', 'Template Exported', MB_OK);
     3504                ' Exported.', 'Template Exported', MB_OK);
    34633505          end;
    34643506        finally
     
    34833525  ImportedTemplate: TTemplate;
    34843526  AppData, Flds, ResultSet: TStringList;
    3485   tmp,j,p3: string;
     3527  tmp, j, p3: string;
    34863528  err, ok, changes, xmlerr: boolean;
    34873529  i: integer;
     
    35043546  begin
    35053547    tmp := ExtractFileExt(dlgImport.FileName);
    3506     if(WordImportActive and ((CompareText(tmp,'.doc') = 0) or
    3507                              (CompareText(tmp,'.dot') = 0))) then
     3548    if (WordImportActive and ((CompareText(tmp, '.doc') = 0) or
     3549      (CompareText(tmp, '.dot') = 0))) then
    35083550      AppData := TStringList.Create
    35093551    else
     
    35393581            XMLImportError(0);
    35403582          try
    3541             if(RootElement.tagName <> XMLHeader)then
     3583            if (RootElement.tagName <> XMLHeader) then
    35423584              XMLImportError(0)
    35433585            else
     
    35483590              begin
    35493591                FXMLFieldElement := FindXMLElement(RootElement, XMLTemplateFieldsTag);
    3550                 if(assigned(FXMLFieldElement)) then
     3592                if (assigned(FXMLFieldElement)) then
    35513593                begin
    35523594                  Flds := TStringList.Create;
     
    35573599                    changes := FALSE;
    35583600                    Application.ProcessMessages;
    3559                     if not BuildTemplateFields(Flds) then  //Calls RPC to transfer all field XML
    3560                       choice := IDCANCEL;                  //for processing
     3601                    if not BuildTemplateFields(Flds) then //Calls RPC to transfer all field XML
     3602                      choice := IDCANCEL; //for processing
    35613603                    Flds.Text := '';
    35623604                    Application.ProcessMessages;
     
    35643606                      CheckTemplateFields(Flds);
    35653607                    if Flds.Count > 0 then
     3608                    begin
     3609                      for i := 1 to Flds.Count do
    35663610                      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
    35823622                          end;
    3583                       end
     3623                        end;
     3624                      end;
     3625                    end
    35843626                    else
    35853627                      choice := IDCANCEL;
    35863628                    if choice <> IDOK then
    3587                       InfoBox(iMessage2+iMessage3, 'Error', MB_OK or MB_ICONERROR)
     3629                      InfoBox(iMessage2 + iMessage3, 'Error', MB_OK or MB_ICONERROR)
    35883630                    else
    3589                       if (not CanEditTemplateFields) AND
    3590                          changes {(there is at least one new field)} then
    3591                         begin
    3592                           choice := InfoBox(iMessage, 'Warning', MB_OKCANCEL or MB_ICONWARNING);
    3593                           Flds.Text := '';
    3594                         end;
     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;
    35953637                    if choice <> IDCANCEL then
    3596                       begin
     3638                    begin
    35973639                      FImportingFromXML := TRUE;
    35983640                      try
     
    36053647                      if assigned(ImportedTemplate) and (Flds.Count > 0) then
    36063648                        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);
    36083650                          ClearFields;
    36093651                          choice := IDCANCEL;
    3610                         end;//if
     3652                        end; //if
    36113653                      if Flds.Count = 0 then
    36123654                        choice := IDCANCEL;
    3613                       end {if choice <> mrCancel}
     3655                    end {if choice <> mrCancel}
    36143656                    else
    36153657                      ClearFields;
     
    36173659                    xmlerr := FALSE;
    36183660                    if (Flds.Count > 0) and
    3619                        (ResultSet.Count > 0) and
    3620                        (Flds.Count = ResultSet.Count) then
    3621                       for i := 0 to Flds.Count-1 do begin
    3622                         if piece(ResultSet[i],U,2) = '0' then begin
    3623                           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);
    36243666                          Flds[i] := j;
    36253667                        end
     
    36393681                      else
    36403682                        inc(i);
    3641                     end;//while
    3642                     if(Flds.Count > 0) then
     3683                    end; //while
     3684                    if (Flds.Count > 0) then
    36433685                    begin
    36443686                      if assigned(frmTemplateFields) then
     
    36473689                      if not assigned(AppData) then
    36483690                      begin
    3649                         for i := 0 to Flds.Count-1 do
    3650                           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) + '"';
    36523694                        if Flds.Count = 1 then
    36533695                          tmp := 'A template field has'
    36543696                        else
    36553697                          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, '');
    36603702                        InfoBox(Flds.Text, 'Information', MB_OK or MB_ICONINFORMATION);
    36613703                      end;
     
    36923734        AppData.Free;
    36933735        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);
    36953737      end;
    36963738    end;
     
    37073749  case IdxForced[FForceContainer, Index] of
    37083750    tiTemplate: ImgIdx := 4;
    3709     tiFolder:   ImgIdx := 3;
    3710     tiGroup:    ImgIdx := 5;
    3711     tiDialog:   ImgIdx := 23;
    3712     tiRemDlg:   ImgIdx := 27;
    3713     tiCOMObj:   ImgIdx := 28;
    3714     else
    3715       ImgIdx := ord(tiNone);
     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);
    37163758  end;
    37173759  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);
    37193761  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]);
    37213763end;
    37223764
    37233765procedure TfrmTemplateEditor.cbxTypeChange(Sender: TObject);
    37243766var
    3725   i,tg: integer;
     3767  i, tg: integer;
    37263768  Template: TTemplate;
    37273769  ttyp: TTemplateType;
     
    37303772
    37313773begin
    3732   if((not FUpdating) and (assigned(FCurTree)) and (assigned(FCurTree.Selected))) then
     3774  if ((not FUpdating) and (assigned(FCurTree)) and (assigned(FCurTree.Selected))) then
    37333775  begin
    37343776    tg := cbxType.ItemIndex;
     
    37383780      begin
    37393781        idx := IdxForced[FForceContainer, tg];
    3740         if(idx = tiRemDlg) and (not (GetLinkType(FCurTree.Selected) in [ltNone, ltTitle])) then
     3782        if (idx = tiRemDlg) and (not (GetLinkType(FCurTree.Selected) in [ltNone, ltTitle])) then
    37413783        begin
    37423784          FUpdating := TRUE;
     
    37553797          begin
    37563798            ttyp := TypeTag[idx];
    3757             if(not FForceContainer) or (not (idx in [tiTemplate, tiRemDlg])) then
     3799            if (not FForceContainer) or (not (idx in [tiTemplate, tiRemDlg])) then
    37583800            begin
    3759               if(ttyp = ttDialog) then
     3801              if (ttyp = ttDialog) then
    37603802              begin
    37613803                Template.Dialog := TRUE;
     
    37653807                Template.Dialog := FALSE;
    37663808              Template.RealType := ttyp;
    3767               if(Template.RealType = ttDoc) and (idx = tiRemDlg) then
     3809              if (Template.RealType = ttDoc) and (idx = tiRemDlg) then
    37683810                Template.IsReminderDialog := TRUE
    37693811              else
    37703812                Template.IsReminderDialog := FALSE;
    3771               if(Template.RealType = ttDoc) and (idx = tiCOMObj) then
     3813              if (Template.RealType = ttDoc) and (idx = tiCOMObj) then
    37723814                Template.IsCOMObject := TRUE
    37733815              else
     
    37753817              UpdateApply(Template);
    37763818            end;
    3777             for i := 0 to Template.Nodes.Count-1 do
     3819            for i := 0 to Template.Nodes.Count - 1 do
    37783820            begin
    37793821              Node := TTreeNode(Template.Nodes.Objects[i]);
     
    37973839
    37983840begin
    3799   if((not FUpdating) and (assigned(FCurTree)) and (assigned(FCurTree.Selected)) and
    3800      FCanDoReminders) then
     3841  if ((not FUpdating) and (assigned(FCurTree)) and (assigned(FCurTree.Selected)) and
     3842    FCanDoReminders) then
    38013843  begin
    38023844    if CanClone(FCurTree.Selected) then
     
    38793921{ Returns TRUE if Cloning is not needed or if Cloning is needed and
    38803922  the top personal Node in the tree is locked. }
     3923
    38813924function TfrmTemplateEditor.CanClone(const Node: TTreeNode): boolean;
    38823925var
     
    38913934
    38923935begin
    3893   if(assigned(Node)) and assigned(Node.Data) then
     3936  if (assigned(Node)) and assigned(Node.Data) then
    38943937  begin
    38953938    if (TTreeView(Node.TreeView) = tvPersonal) then
     
    39103953procedure TfrmTemplateEditor.UpdateApply(Template: TTemplate);
    39113954begin
    3912   if(not btnApply.Enabled) then
     3955  if (not btnApply.Enabled) then
    39133956    btnApply.Enabled := Template.Changed;
    39143957end;
     
    39303973  begin
    39313974    if InfoBox('All changes must be saved before you can Refresh.  Save Changes?',
    3932         'Confirmation', MB_YESNO or MB_ICONQUESTION) <> IDYES then
     3975      'Confirmation', MB_YESNO or MB_ICONQUESTION) <> IDYES then
    39333976      exit;
    39343977  end;
     
    39493992  exp1 := tvShared.GetExpandedIDStr(1, ';');
    39503993  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, ';');
    39553998  tvPersonal.Items.BeginUpdate;
    39563999  try
     
    39624005      InitTrees;
    39634006      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, ';');
    39664009      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, ';');
    39694012    finally
    39704013      tvShared.Items.EndUpdate;
     
    39794022begin
    39804023  LoadTemplateData;
    3981   if(not assigned(RootTemplate)) then
    3982     SaveTemplate(AddTemplate('0^R^A^Shared Templates'),-1);
    3983   if(not assigned(MyTemplate)) then
    3984     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));
    39854028  dmodShared.AddTemplateNode(tvPersonal, FPersonalEmptyNodeCount, MyTemplate);
    39864029  dmodShared.AddTemplateNode(tvShared, FSharedEmptyNodeCount, RootTemplate);
     
    40044047  R := TRichEdit(Sender).ClientRect;
    40054048  if (FLastRect.Right <> R.Right) or
    4006      (FLastRect.Bottom <> R.Bottom) or
    4007      (FLastRect.Left <> R.Left) or
    4008      (FLastRect.Top <> R.Top) then
     4049    (FLastRect.Bottom <> R.Bottom) or
     4050    (FLastRect.Left <> R.Left) or
     4051    (FLastRect.Top <> R.Top) then
    40094052  begin
    40104053    FLastRect := R;
     
    40384081
    40394082begin
    4040   if((not FUpdating) and (assigned(FCurTree)) and (assigned(FCurTree.Selected)) and
    4041      FCanDoCOMObjects and (FCurTree = tvShared)) then
     4083  if ((not FUpdating) and (assigned(FCurTree)) and (assigned(FCurTree.Selected)) and
     4084    FCanDoCOMObjects and (FCurTree = tvShared)) then
    40424085  begin
    40434086    Template := TTemplate(FCurTree.Selected.Data);
     
    40584101
    40594102begin
    4060   if((not FUpdating) and (assigned(FCurTree)) and (assigned(FCurTree.Selected)) and
    4061      FCanDoCOMObjects and (FCurTree = tvShared)) then
     4103  if ((not FUpdating) and (assigned(FCurTree)) and (assigned(FCurTree.Selected)) and
     4104    FCanDoCOMObjects and (FCurTree = tvShared)) then
    40624105  begin
    40634106    Template := TTemplate(FCurTree.Selected.Data);
     
    40784121  if assigned(ANode) then
    40794122  begin
    4080     if(not assigned(ANode.Data)) or (TTemplate(ANode.Data).RealType <> ttClass) then
     4123    if (not assigned(ANode.Data)) or (TTemplate(ANode.Data).RealType <> ttClass) then
    40814124    begin
    40824125      Node := ANode.Parent;
     
    40874130            Node := nil
    40884131          else
    4089           if (TTemplate(Node.Data).RealType in AllTemplateLinkTypes) then
    4090           begin
    4091             case TTemplate(Node.Data).RealType of
    4092               ttTitles:    Result := ltTitle;
    4093               ttConsults:  Result := ltConsult;
    4094               ttProcedures: Result := ltProcedure;
    4095             end;
    4096           end
    4097           else
    4098             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;
    40994142        end
    41004143        else
    41014144          Node := nil;
    4102       until(Result <> ltNone) or (not assigned(Node));
     4145      until (Result <> ltNone) or (not assigned(Node));
    41034146    end;
    41044147  end;
     
    41064149
    41074150procedure TfrmTemplateEditor.cbxLinkNeedData(Sender: TObject;
    4108   const StartFrom: String; Direction, InsertAt: Integer);
     4151  const StartFrom: string; Direction, InsertAt: Integer);
    41094152var
    41104153  tmpSL: TStringList;
     
    41164159  try
    41174160    case TTemplateLinkType(pnlLink.Tag) of
    4118       ltTitle:     FastAssign(SubSetOfAllTitles(StartFrom, Direction), tmpSL);
     4161      ltTitle: FastAssign(SubSetOfAllTitles(StartFrom, Direction), tmpSL);
    41194162//      ltConsult:
    41204163      ltProcedure:
    41214164        begin
    41224165          FastAssign(SubSetOfProcedures(StartFrom, Direction), tmpSL);
    4123           for i := 0 to tmpSL.Count-1 do
     4166          for i := 0 to tmpSL.Count - 1 do
    41244167          begin
    41254168            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));
    41274170            tmpSL[i] := tmp;
    41284171          end;
     
    41354178end;
    41364179
    4137 procedure TfrmTemplateEditor.cbxLinkChange(Sender: TObject);
    4138 var
    4139   Template,LinkTemplate: TTemplate;
     4180procedure TfrmTemplateEditor.cbxLinkExit(Sender: TObject);
     4181var
     4182  Template, LinkTemplate: TTemplate;
    41404183  update: boolean;
    41414184
    41424185begin
    4143   if((not FUpdating) and (assigned(FCurTree)) and (assigned(FCurTree.Selected)) and
    4144      (FCurTree = tvShared)) then
     4186  if ((not FUpdating) and (assigned(FCurTree)) and (assigned(FCurTree.Selected)) and
     4187    (FCurTree = tvShared)) then
    41454188  begin
    41464189    Template := TTemplate(FCurTree.Selected.Data);
     
    41544197        begin
    41554198          ShowMsg(GetLinkName(cbxLink.ItemID, TTemplateLinkType(pnlLink.tag)) +
    4156                       ' is already assigned to another template.');
     4199            ' is already assigned to another template.');
     4200          cbxLink.SetFocus;
    41574201          cbxLink.SelectByID(Template.LinkIEN);
    41584202          update := False;
     
    41624206          Template.FileLink := ConvertFileLink(cbxLink.ItemID, TTemplateLinkType(pnlLink.tag));
    41634207          if Template.LinkName <> '' then
    4164             edtName.Text := copy(Template.LinkName,1,edtName.MaxLength);
     4208            edtName.Text := copy(Template.LinkName, 1, edtName.MaxLength);
    41654209        end;
    41664210      end
     
    41804224    if ssShift in Shift then
    41814225      FindNextControl(Sender as TWinControl, False, True, False).SetFocus //previous control
    4182     else if ssCtrl      in Shift then
     4226    else if ssCtrl in Shift then
    41834227      FindNextControl(Sender as TWinControl, True, True, False).SetFocus; //next control
    41844228    FNavigatingTab := False;
     
    41944238begin
    41954239  if FNavigatingTab then
    4196     Key := #0;  //Disable shift-tab processinend;
     4240    Key := #0; //Disable shift-tab processinend;
    41974241end;
    41984242
     
    42024246  //The navigating tab controls were inadvertantently adding tab characters
    42034247  //This should fix it
    4204   FNavigatingTab := (Key = VK_TAB) and ([ssShift,ssCtrl] * Shift <> []);
     4248  FNavigatingTab := (Key = VK_TAB) and ([ssShift, ssCtrl] * Shift <> []);
    42054249  if FNavigatingTab then
    42064250    Key := 0;
  • cprs/trunk/CPRS-Chart/Templates/fTemplateFieldEditor.dfm

    r829 r1679  
    832832    end
    833833    object btnNew: TButton
    834       Left = 711
     834      Left = 710
    835835      Top = 2
    836836      Width = 75
     
    842842    end
    843843    object btnCopy: TButton
    844       Left = 632
     844      Left = 631
    845845      Top = 2
    846846      Width = 75
     
    853853    end
    854854    object btnDelete: TButton
    855       Left = 553
     855      Left = 552
    856856      Top = 2
    857857      Width = 75
  • cprs/trunk/CPRS-Chart/Templates/uTemplateFields.pas

    r829 r1679  
    601601          begin
    602602            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}
    604604              Result := TRUE;
    605605          end;
     
    11601160          cbo.SelectByID(StripEmbedded(FItemDefault));
    11611161          cbo.Tag := CtrlID;
    1162           cbo.OnClick := Entry.DoChange;
     1162          cbo.OnChange := Entry.DoChange;
    11631163
    11641164          if cbo.Items.Count > 12 then
     
    12951295          pnl.Width := pnl.Edit.Width + pnl.UpDown.Width;
    12961296          UpdateColorsFor508Compliance(pnl, TRUE);
     1297          //CQ 17597 wat
     1298          pnl.Edit.Align := alLeft;
     1299          pnl.UpDown.Align := alLeft;
     1300          //end 17597
    12971301          ctrl := pnl;
    12981302        end;
     
    19321936      end
    19331937      else
     1938      //!!!!!! CODE ADDED BACK IN - VHAISPBELLC !!!!!!
    19341939      if(Ctrl is TEdit) then
    19351940        Result := TEdit(Ctrl).Text
     
    19451950        Result := TORDateCombo(Ctrl).Text + ':' + FloatToStr(TORDateCombo(Ctrl).FMDate)
    19461951      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 !!!!!!
    19471961      if(Ctrl is TORDateBox) then
    19481962        Result := TORDateBox(Ctrl).Text
     
    19731987      end
    19741988      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 }
    19751993      if(Ctrl is TORCheckBox) then
    19761994      begin
Note: See TracChangeset for help on using the changeset viewer.