~ubuntu-branches/ubuntu/saucy/lazarus/saucy

« back to all changes in this revision

Viewing changes to ide/customformeditor.pp

  • Committer: Package Import Robot
  • Author(s): Paul Gevers, Abou Al Montacir, Bart Martens, Paul Gevers
  • Date: 2013-06-08 14:12:17 UTC
  • mfrom: (1.1.9)
  • Revision ID: package-import@ubuntu.com-20130608141217-7k0cy9id8ifcnutc
Tags: 1.0.8+dfsg-1
[ Abou Al Montacir ]
* New upstream major release and multiple maintenace release offering many
  fixes and new features marking a new milestone for the Lazarus development
  and its stability level.
  - The detailed list of changes can be found here:
    http://wiki.lazarus.freepascal.org/Lazarus_1.0_release_notes
    http://wiki.lazarus.freepascal.org/Lazarus_1.0_fixes_branch
* LCL changes:
  - LCL is now a normal package.
      + Platform independent parts of the LCL are now in the package LCLBase
      + LCL is automatically recompiled when switching the target platform,
        unless pre-compiled binaries for this target are already installed.
      + No impact on existing projects.
      + Linker options needed by LCL are no more added to projects that do
        not use the LCL package.
  - Minor changes in LCL basic classes behaviour
      + TCustomForm.Create raises an exception if a form resource is not
        found.
      + TNotebook and TPage: a new implementation of these classes was added.
      + TDBNavigator: It is now possible to have focusable buttons by setting
        Options = [navFocusableButtons] and TabStop = True, useful for
        accessibility and for devices with neither mouse nor touch screen.
      + Names of TControlBorderSpacing.GetSideSpace and GetSpace were swapped
        and are now consistent. GetSideSpace = Around + GetSpace.
      + TForm.WindowState=wsFullscreen was added
      + TCanvas.TextFitInfo was added to calculate how many characters will
        fit into a specified Width. Useful for word-wrapping calculations.
      + TControl.GetColorResolvingParent and
        TControl.GetRGBColorResolvingParent were added, simplifying the work
        to obtain the final color of the control while resolving clDefault
        and the ParentColor.
      + LCLIntf.GetTextExtentExPoint now has a good default implementation
        which works in any platform not providing a specific implementation.
        However, Widgetset specific implementation is better, when available.
      + TTabControl was reorganized. Now it has the correct class hierarchy
        and inherits from TCustomTabControl as it should.
  - New unit in the LCL:
      + lazdialogs.pas: adds non-native versions of various native dialogs,
        for example TLazOpenDialog, TLazSaveDialog, TLazSelectDirectoryDialog.
        It is used by widgetsets which either do not have a native dialog, or
        do not wish to use it because it is limited. These dialogs can also be
        used by user applications directly.
      + lazdeviceapis.pas: offers an interface to more hardware devices such
        as the accelerometer, GPS, etc. See LazDeviceAPIs
      + lazcanvas.pas: provides a TFPImageCanvas descendent implementing
        drawing in a LCL-compatible way, but 100% in Pascal.
      + lazregions.pas. LazRegions is a wholly Pascal implementation of
        regions for canvas clipping, event clipping, finding in which control
        of a region tree one an event should reach, for drawing polygons, etc.
      + customdrawncontrols.pas, customdrawndrawers.pas,
        customdrawn_common.pas, customdrawn_android.pas and
        customdrawn_winxp.pas: are the Lazarus Custom Drawn Controls -controls
        which imitate the standard LCL ones, but with the difference that they
        are non-native and support skinning.
  - New APIs added to the LCL to improve support of accessibility software
    such as screen readers.
* IDE changes:
  - Many improvments.
  - The detailed list of changes can be found here:
    http://wiki.lazarus.freepascal.org/New_IDE_features_since#v1.0_.282012-08-29.29
    http://wiki.lazarus.freepascal.org/Lazarus_1.0_release_notes#IDE_Changes
* Debugger / Editor changes:
  - Added pascal sources and breakpoints to the disassembler
  - Added threads dialog.
* Components changes:
  - TAChart: many fixes and new features
  - CodeTool: support Delphi style generics and new syntax extensions.
  - AggPas: removed to honor free licencing. (Closes: Bug#708695)
[Bart Martens]
* New debian/watch file fixing issues with upstream RC release.
[Abou Al Montacir]
* Avoid changing files in .pc hidden directory, these are used by quilt for
  internal purpose and could lead to surprises during build.
[Paul Gevers]
* Updated get-orig-source target and it compinion script orig-tar.sh so that they
  repack the source file, allowing bug 708695 to be fixed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
{$ENDIF}
41
41
  // LCL+FCL
42
42
  Classes, SysUtils, TypInfo, Math, LCLIntf, LCLType, LResources,
43
 
  AVL_Tree, LCLMemManager,
 
43
  AVL_Tree, LCLMemManager, FileUtil,
44
44
  LCLProc, Graphics, Controls, Forms, Menus, Dialogs,
45
45
  // IDEIntf
46
46
  PropEdits, PropEditUtils, ObjectInspector, IDECommands, FormEditingIntf,
47
47
  // IDE
48
 
  LazarusIDEStrConsts, Project, JITForms, MainIntf,
49
 
  CustomNonFormDesigner, NonControlDesigner, FrameDesigner,
50
 
  ComponentReg, IDEProcs, ComponentEditors, KeyMapping, EditorOptions,
51
 
  EnvironmentOpts, DesignerProcs;
 
48
  LazarusIDEStrConsts, ControlSelection, Project, JITForms, MainIntf,
 
49
  CustomNonFormDesigner, NonControlDesigner, FrameDesigner, ComponentReg,
 
50
  IDEProcs, ComponentEditors, IDEOptionsIntf, IDEDialogs, KeyMapping,
 
51
  EditorOptions, EnvironmentOpts, DesignerProcs;
52
52
 
53
53
const
54
54
  OrdinalTypes = [tkInteger,tkChar,tkEnumeration,tkbool];
120
120
    function CutSelectionToClipboard: Boolean; override;
121
121
    function PasteSelectionFromClipboard(Flags: TComponentPasteSelectionFlags
122
122
                                         ): Boolean; override;
 
123
    function GetCurrentObjectInspector: TObjectInspectorDlg; override;
123
124
 
124
125
    // JIT components
125
126
    function IsJITComponent(AComponent: TComponent): boolean;
212
213
                      Visible: boolean = true;
213
214
                      DisableAutoSize: boolean = false;
214
215
                      ContextObj: TObject = nil): TComponent;
215
 
    function CreateChildComponentFromStream(BinStream: TStream;
 
216
    procedure CreateChildComponentsFromStream(BinStream: TStream;
216
217
                       ComponentClass: TComponentClass; Root: TComponent;
217
 
                       ParentControl: TWinControl): TComponent; override;
 
218
                       ParentControl: TWinControl; NewComponents: TFPList); override;
218
219
    function FixupReferences(AComponent: TComponent): TModalResult;
219
220
    procedure WriterFindAncestor(Writer: TWriter; Component: TComponent;
220
221
                                 const Name: string;
349
350
      DebugLn('TryFreeComponent ERROR:',
350
351
        ' "'+OldName+':'+OldClassName+'" ',E.Message);
351
352
      DumpExceptionBackTrace;
352
 
      MessageDlg('Error',
353
 
        'An exception occured during deletion of'#13
354
 
        +'"'+OldName+':'+OldClassName+'"'#13
355
 
        +E.Message,
 
353
      MessageDlg(lisCCOErrorCaption,
 
354
        Format(lisCFEAnExceptionOccuredDuringDeletionOf, [#13, OldName,
 
355
          OldClassName, #13, E.Message]),
356
356
        mtError,[mbOk],0);
357
357
    end;
358
358
  end;
407
407
  DesignerMenuItemClick:=@OnDesignerMenuItemClick;
408
408
  OnGetDesignerForm:=@GetDesignerForm;
409
409
  FormEditingHook:=Self;
 
410
 
 
411
  RegisterDesignerBaseClass(TAbstractIDEOptionsEditor);
410
412
end;
411
413
 
412
414
destructor TCustomFormEditor.Destroy;
439
441
  const ASelection: TPersistentSelectionList);
440
442
begin
441
443
  FSelection.Assign(ASelection);
 
444
  if Obj_Inspector=nil then exit;
442
445
  if FSelection.Count>0 then begin
443
 
    Obj_Inspector.PropertyEditorHook.LookupRoot:=
444
 
      GetLookupRootForComponent(FSelection[0]);
 
446
      Obj_Inspector.PropertyEditorHook.LookupRoot:=
 
447
        GetLookupRootForComponent(FSelection[0]);
445
448
  end;
446
449
  Obj_Inspector.Selection := FSelection;
447
450
end;
449
452
Function TCustomFormEditor.AddSelected(Value : TComponent) : Integer;
450
453
Begin
451
454
  Result := FSelection.Add(Value) + 1;
452
 
  Obj_Inspector.Selection := FSelection;
 
455
  if Obj_Inspector<>nil then
 
456
    Obj_Inspector.Selection := FSelection;
453
457
end;
454
458
 
455
459
Procedure TCustomFormEditor.DeleteComponent(AComponent: TComponent;
458
462
  AForm: TCustomForm;
459
463
  AWinControl: TWinControl;
460
464
  IsJIT: Boolean;
 
465
  i: Integer;
 
466
  aDesigner: TIDesigner;
461
467
Begin
 
468
  IsJIT:=IsJITComponent(AComponent);
462
469
  {$IFDEF IDE_DEBUG}
463
 
  DebugLn(['TCustomFormEditor.DeleteComponent ',DbgSName(AComponent),' IsJITComponent=',IsJITComponent(AComponent),' FreeComponent=',FreeComponent]);
 
470
  DebugLn(['TCustomFormEditor.DeleteComponent ',DbgSName(AComponent),' IsJITComponent=',IsJIT,' FreeComponent=',FreeComponent]);
464
471
  {$ENDIF}
 
472
  if TheControlSelection.LookupRoot = AComponent then
 
473
  begin
 
474
    TheControlSelection.BeginUpdate;
 
475
    try
 
476
      TheControlSelection.Clear;
 
477
    finally
 
478
      TheControlSelection.EndUpdate;
 
479
    end;
 
480
  end;
465
481
  if PropertyEditorHook.LookupRoot=AComponent then
466
482
    PropertyEditorHook.LookupRoot:=nil;
467
 
  IsJIT:=IsJITComponent(AComponent);
 
483
 
468
484
  if IsJIT then begin
469
 
    // value is a top level component
 
485
    // AComponent is a top level component
 
486
    if FreeComponent then
 
487
    begin
 
488
      // tell hooks about deleting
 
489
      for i := AComponent.ComponentCount - 1 downto 0 do
 
490
        PropertyEditorHook.PersistentDeleting(AComponent.Components[i]);
 
491
      PropertyEditorHook.PersistentDeleting(AComponent);
 
492
    end;
 
493
    // disconnect designer
 
494
    aDesigner:=GetDesignerByComponent(AComponent);
 
495
    if aDesigner is TComponentEditorDesigner then
 
496
      TComponentEditorDesigner(aDesigner).DisconnectComponent;
 
497
 
470
498
    if JITFormList.IsJITForm(AComponent) then begin
471
499
      // free/unbind a form component
472
500
      if FreeComponent then
473
501
        JITFormList.DestroyJITComponent(AComponent);
474
502
    end else if JITNonFormList.IsJITNonForm(AComponent) then begin
475
503
      // free/unbind a non form component and its designer form
476
 
      AForm:=GetDesignerForm(AComponent);
 
504
      aForm:=GetDesignerForm(AComponent);
477
505
      if (AForm<>nil) and (not (AForm is TCustomNonFormDesignerForm)) then
478
 
        RaiseException('TCustomFormEditor.DeleteComponent  Where is the TCustomNonFormDesignerForm? '+AComponent.ClassName);
 
506
        RaiseException(Format(
 
507
          lisCFETCustomFormEditorDeleteComponentWhereIsTheTCustomN, [AComponent.
 
508
          ClassName]));
479
509
 
480
 
      if (AForm <> nil) and (AForm is TCustomNonFormDesignerForm) then
 
510
      if (AForm <> nil) then
481
511
      begin
482
512
        FNonFormForms.Remove(AForm);
483
513
        TCustomNonFormDesignerForm(AForm).LookupRoot := nil;
559
589
    Selection:=ASelection;
560
590
  except
561
591
    on E: Exception do begin
562
 
      MessageDlg('Error',
563
 
        'Unable to clear the form editing selection'#13
564
 
        +E.Message,mtError,[mbCancel],0);
 
592
      MessageDlg(lisCCOErrorCaption,
 
593
        Format(lisCFEUnableToClearTheFormEditingSelection, [#13, E.Message]),
 
594
          mtError, [mbCancel], 0);
565
595
    end;
566
596
  end;
567
597
  ASelection.Free;
584
614
  end;
585
615
  Result:=Selection.Count=0;
586
616
  if Selection.Count>0 then begin
587
 
    MessageDlg('Error',
588
 
      'Do not know how to delete this form editing selection',
 
617
    MessageDlg(lisCCOErrorCaption,
 
618
      lisCFEDoNotKnowHowToDeleteThisFormEditingSelection,
589
619
      mtError,[mbCancel],0);
590
620
  end;
591
621
end;
606
636
  end;
607
637
  Result:=Selection.Count=0;
608
638
  if Selection.Count>0 then begin
609
 
    MessageDlg('Error',
610
 
      'Do not know how to copy this form editing selection',
 
639
    MessageDlg(lisCCOErrorCaption,
 
640
      lisCFEDoNotKnowHowToCopyThisFormEditingSelection,
611
641
      mtError,[mbCancel],0);
612
642
  end;
613
643
end;
628
658
  end;
629
659
  Result:=Selection.Count=0;
630
660
  if Selection.Count>0 then begin
631
 
    MessageDlg('Error',
632
 
      'Do not know how to cut this form editing selection',
 
661
    MessageDlg(lisCCOErrorCaption,
 
662
      lisCFEDoNotKnowHowToCutThisFormEditingSelection,
633
663
      mtError,[mbCancel],0);
634
664
  end;
635
665
end;
646
676
    Result:=false;
647
677
end;
648
678
 
 
679
function TCustomFormEditor.GetCurrentObjectInspector: TObjectInspectorDlg;
 
680
begin
 
681
  Result:=FObj_Inspector;
 
682
end;
 
683
 
649
684
function TCustomFormEditor.IsJITComponent(AComponent: TComponent): boolean;
650
685
begin
651
686
  Result:=JITFormList.IsJITForm(AComponent)
728
763
  MediatorClass: TDesignerMediatorClass;
729
764
begin
730
765
  if FindNonFormFormNode(LookupRoot) <> nil then
731
 
    RaiseException('TCustomFormEditor.CreateNonFormForm already exists');
 
766
    RaiseException(lisCFETCustomFormEditorCreateNonFormFormAlreadyExists);
732
767
  if LookupRoot is TComponent then
733
768
  begin
734
769
    if LookupRoot is TCustomFrame then
746
781
        TNonControlDesignerForm(Result).Mediator:=MediatorClass.CreateMediator(nil,LookupRoot);
747
782
    end;
748
783
  end else
749
 
    RaiseException('TCustomFormEditor.CreateNonFormForm Unknown type '
750
 
      +LookupRoot.ClassName);
 
784
    RaiseException(Format(lisCFETCustomFormEditorCreateNonFormFormUnknownType, [
 
785
      LookupRoot.ClassName]));
751
786
end;
752
787
 
753
788
procedure TCustomFormEditor.RenameJITComponent(AComponent: TComponent;
1037
1072
  MediatorClass: TDesignerMediatorClass);
1038
1073
begin
1039
1074
  if FDesignerMediatorClasses.IndexOf(MediatorClass)>=0 then
1040
 
    raise Exception.Create('TCustomFormEditor.RegisterDesignerMediator already registered: '+DbgSName(MediatorClass));
 
1075
    raise Exception.Create(Format(
 
1076
      lisCFETCustomFormEditorRegisterDesignerMediatorAlreadyRe, [DbgSName(
 
1077
      MediatorClass)]));
1041
1078
  FDesignerMediatorClasses.Add(MediatorClass);
1042
1079
  RegisterDesignerBaseClass(MediatorClass.FormClass);
1043
1080
end;
1150
1187
      except
1151
1188
        on e: Exception do begin
1152
1189
          DumpExceptionBackTrace;
1153
 
          MessageDlg('Error creating component',
1154
 
            'Error creating component: '+TypeClass.ClassName+#13+E.Message,
 
1190
          MessageDlg(lisCFEErrorCreatingComponent,
 
1191
            Format(lisCFEErrorCreatingComponent2, [TypeClass.ClassName, #13, E.
 
1192
              Message]),
1155
1193
            mtError,[mbCancel],0);
1156
1194
          exit;
1157
1195
        end;
1158
1196
      end;
1159
1197
      // check if Owner was properly set
1160
1198
      if NewComponent.Owner <> OwnerComponent then begin
1161
 
        MessageDlg('Invalid component owner',
1162
 
          'The component of type '+NewComponent.ClassName
1163
 
          +' failed to set its owner to '
1164
 
          +OwnerComponent.Name+':'+OwnerComponent.ClassName,
 
1199
        MessageDlg(lisCFEInvalidComponentOwner,
 
1200
          Format(lisCFETheComponentOfTypeFailedToSetItsOwnerTo, [NewComponent.
 
1201
            ClassName, OwnerComponent.Name, OwnerComponent.ClassName]),
1165
1202
          mtError,[mbCancel],0);
1166
1203
        exit;
1167
1204
      end;
1261
1298
          // no parent and not a form
1262
1299
          AControl.SetBounds(0,0,CompWidth,CompHeight);
1263
1300
          AControl.DesignInfo := LeftTopToDesignInfo(CompLeft, CompTop);
1264
 
          //DebugLn(['TCustomFormEditor.CreateComponent ',dbgsName(AControl),' ',LongRec(AControl.DesignInfo).Lo,',',LongRec(AControl.DesignInfo).Hi]);
 
1301
          //DebugLn(['TCustomFormEditor.CreateComponent ',dbgsName(AControl),' ',LazLongRec(AControl.DesignInfo).Lo,',',LongRec(AControl.DesignInfo).Hi]);
1265
1302
        end;
1266
1303
      end
1267
1304
      else
1335
1372
        FreeAndNil(Mediator);
1336
1373
      except
1337
1374
        on E: Exception do begin
1338
 
          s:='Error destroying mediator '+Mediator.ClassName
1339
 
            +' of unit '+AUnitName+':'#13
1340
 
            +E.Message;
1341
 
          DebugLn(['TCustomFormEditor.CreateComponent ',s]);
 
1375
          s:=Format(lisCFEErrorDestroyingMediatorOfUnit, [Mediator.ClassName,
 
1376
            AUnitName, #13, E.Message]);
 
1377
          DebugLn(['TCustomFormEditor.CreateComponent ',UTF8ToConsole(s)]);
1342
1378
          DumpExceptionBackTrace;
1343
 
          MessageDlg('Error destroying mediator',s,mtError,[mbCancel],0);
 
1379
          MessageDlg(lisCFEErrorDestroyingMediator, s, mtError, [mbCancel], 0);
1344
1380
        end;
1345
1381
      end;
1346
1382
    end;
1351
1387
          NewComponent:=nil;
1352
1388
        except
1353
1389
          on E: Exception do begin
1354
 
            s:='Error destroying component of type '+TypeClass.ClassName
1355
 
              +' of unit '+AUnitName+':'#13
1356
 
              +E.Message;
1357
 
            DebugLn(['TCustomFormEditor.CreateComponent ',s]);
 
1390
            s:=Format(lisCFEErrorDestroyingComponentOfTypeOfUnit, [TypeClass.
 
1391
              ClassName, AUnitName, #13, E.Message]);
 
1392
            DebugLn(['TCustomFormEditor.CreateComponent ',UTF8ToConsole(s)]);
1358
1393
            DumpExceptionBackTrace;
1359
 
            MessageDlg('Error destroying component',s,mtError,[mbCancel],0);
 
1394
            MessageDlg(lisCFEErrorDestroyingComponent, s, mtError, [mbCancel], 0
 
1395
              );
1360
1396
          end;
1361
1397
        end;
1362
1398
      end;
1399
1435
  Result:=JITList[NewJITIndex];
1400
1436
end;
1401
1437
 
1402
 
function TCustomFormEditor.CreateChildComponentFromStream(BinStream: TStream;
 
1438
procedure TCustomFormEditor.CreateChildComponentsFromStream(BinStream: TStream;
1403
1439
  ComponentClass: TComponentClass; Root: TComponent;
1404
 
  ParentControl: TWinControl): TComponent;
 
1440
  ParentControl: TWinControl; NewComponents: TFPList);
1405
1441
var
1406
1442
  JITList: TJITComponentList;
1407
1443
begin
1408
 
  Result:=nil;
1409
 
  
1410
1444
  JITList:=FindJITList(Root);
1411
1445
  if JITList=nil then
1412
1446
    RaiseException('TCustomFormEditor.CreateChildComponentFromStream ClassName='+
1413
1447
                   Root.ClassName);
1414
1448
 
1415
 
  Result:=JITList.AddJITChildComponentFromStream(
1416
 
                                   Root,BinStream,ComponentClass,ParentControl);
 
1449
  JITList.AddJITChildComponentsFromStream(
 
1450
                     Root,BinStream,ComponentClass,ParentControl,NewComponents);
1417
1451
end;
1418
1452
 
1419
1453
function TCustomFormEditor.FixupReferences(AComponent: TComponent): TModalResult;
1550
1584
  Result:=FDesignerBaseClasses.Count;
1551
1585
end;
1552
1586
 
1553
 
procedure TCustomFormEditor.UnregisterDesignerBaseClass(AClass: TComponentClass
1554
 
  );
 
1587
procedure TCustomFormEditor.UnregisterDesignerBaseClass(AClass: TComponentClass);
1555
1588
var
1556
1589
  l: Integer;
1557
1590
begin
1797
1830
  aCaption, aMsg: string;
1798
1831
  DlgType: TMsgDlgType;
1799
1832
  Buttons: TMsgDlgButtons;
1800
 
  HelpCtx: Longint;
1801
1833
  JITComponentList: TJITComponentList;
1802
1834
  StreamClass: TComponentClass;
1803
1835
  AnUnitInfo: TUnitInfo;
1809
1841
  aMsg:='';
1810
1842
  DlgType:=mtError;
1811
1843
  Buttons:=[mbCancel];
1812
 
  HelpCtx:=0;
1813
 
  
 
1844
 
1814
1845
  // get current lfm filename
1815
1846
  LFMFilename:='';
1816
1847
  if (JITComponentList.CurReadStreamClass<>nil)
1822
1853
    end;
1823
1854
  end;
1824
1855
  if LFMFilename<>'' then
1825
 
    aCaption:='Error reading '+ExtractFilename(LFMFilename);
 
1856
    aCaption:=Format(lisCFEErrorReading, [ExtractFilename(LFMFilename)]);
1826
1857
  
1827
1858
  with JITComponentList do begin
1828
1859
    if LFMFilename<>'' then
1829
1860
      aMsg:=aMsg+LFMFilename
1830
1861
    else if CurReadStreamClass<>nil then
1831
 
      aMsg:=aMsg+'Stream='+CurReadStreamClass.ClassName
 
1862
      aMsg:=Format(lisCFEStream, [aMsg, CurReadStreamClass.ClassName])
1832
1863
    else
1833
1864
      aMsg:=aMsg+'JITList='+ClassName;
1834
1865
    aMsg:=aMsg+': ';
1835
1866
    if CurReadJITComponent<>nil then
1836
 
      aMsg:=aMsg+'Root='+CurReadJITComponent.Name+':'+CurReadJITComponent.ClassName;
 
1867
      aMsg:=Format(lisCFERoot, [aMsg, CurReadJITComponent.Name,
 
1868
        CurReadJITComponent.ClassName]);
1837
1869
    if CurReadChild<>nil then
1838
 
      aMsg:=aMsg+#13'Component: '
1839
 
        +CurReadChild.Name+':'+CurReadChild.ClassName
 
1870
      aMsg:=Format(lisCFEComponent, [aMsg, #13, CurReadChild.Name, CurReadChild.
 
1871
        ClassName])
1840
1872
    else if CurReadChildClass<>nil then
1841
 
      aMsg:=aMsg+#13'Component Class: '+CurReadChildClass.ClassName;
 
1873
      aMsg:=Format(lisCFEComponentClass, [aMsg, #13, CurReadChildClass.ClassName
 
1874
        ]);
1842
1875
    aMsg:=aMsg+#13+CurReadErrorMsg;
1843
1876
  end;
1844
1877
  if (Reader<>nil) and (Reader.Driver is TLRSObjectReader) then begin
1845
1878
    ErrorBinPos:=TLRSObjectReader(Reader.Driver).Stream.Position;
1846
 
    aMsg:=aMsg+#13+'Stream position: '+dbgs(ErrorBinPos);
 
1879
    aMsg:=Format(lisCFEStreamPosition, [aMsg, #13, dbgs(ErrorBinPos)]);
1847
1880
  end;
1848
1881
 
1849
1882
  case ErrorType of
1853
1886
      end;
1854
1887
    jfeUnknownComponentClass:
1855
1888
      begin
1856
 
        aMsg:=aMsg+#13+'Class "'+JITComponentList.CurUnknownClass+'" not found.';
 
1889
        aMsg:=Format(lisCFEClassNotFound, [aMsg, #13, JITComponentList.
 
1890
          CurUnknownClass]);
1857
1891
      end;
1858
1892
  end;
1859
1893
  if Buttons=[mbIgnore,mbCancel] then begin
1860
 
    Action:=QuestionDlg(aCaption,aMsg,DlgType,
1861
 
      [mrIgnore,'Continue loading',
1862
 
       mrCancel,'Cancel loading this resource',
1863
 
       mrAbort,'Stop all loading'],HelpCtx);
 
1894
    Action:=IDEQuestionDialog(aCaption,aMsg,DlgType,
 
1895
      [mrIgnore, lisCFEContinueLoading,
 
1896
       mrCancel, lisCFECancelLoadingThisResource,
 
1897
       mrAbort, lisCFEStopAllLoading]);
1864
1898
  end else begin
1865
 
    Action:=QuestionDlg(aCaption,aMsg,DlgType,
1866
 
      [mrCancel,'Cancel loading this resource',
1867
 
       mrAbort,'Stop all loading'],HelpCtx);
 
1899
    Action:=IDEQuestionDialog(aCaption,aMsg,DlgType,
 
1900
      [mrCancel, lisCFECancelLoadingThisResource,
 
1901
       mrAbort, lisCFEStopAllLoading]);
1868
1902
  end;
1869
1903
end;
1870
1904
 
1903
1937
    LFMFilename:=ChangeFileExt(TUnitInfo(List.ContextObject).Filename,'.lfm');
1904
1938
  end;
1905
1939
  if LFMFilename<>'' then
1906
 
    Msg:=Msg+'In file '+LFMFilename+#13;
 
1940
    Msg:=Format(lisCFEInFile, [Msg, LFMFilename, #13]);
1907
1941
 
1908
1942
  if List.CurReadErrorMsg<>'' then
1909
1943
    Msg:=Msg+List.CurReadErrorMsg+#13;
1910
1944
  if E is EReadError then;
1911
 
  MessageDlg('Read error',Msg,mtError,[mbCancel],0);
 
1945
  MessageDlg(lisCodeToolsDefsReadError, Msg, mtError, [mbCancel], 0);
1912
1946
end;
1913
1947
 
1914
1948
procedure TCustomFormEditor.OnDesignerMenuItemClick(Sender: TObject);
1915
1949
var
1916
1950
  CompEditor: TBaseComponentEditor;
1917
1951
  MenuItem: TMenuItem;
 
1952
  CompClassName: String;
1918
1953
begin
1919
1954
  if (Sender=nil) or (not (Sender is TMenuItem)) then exit;
1920
1955
  MenuItem:=TMenuItem(Sender);
1922
1957
 
1923
1958
  CompEditor:=GetComponentEditor(TComponent(Sender));
1924
1959
  if CompEditor=nil then exit;
 
1960
  CompClassName:=CompEditor.ClassName;
1925
1961
  try
1926
1962
    CompEditor.Edit;
1927
1963
  except
1928
1964
    on E: Exception do begin
1929
 
      DebugLn('TCustomFormEditor.OnDesignerMenuItemClick ERROR: ',E.Message);
1930
 
      MessageDlg('Error in '+CompEditor.ClassName,
1931
 
        'The component editor of class "'+CompEditor.ClassName+'"'
1932
 
        +'has created the error:'#13
1933
 
        +'"'+E.Message+'"',
 
1965
      DebugLn('TCustomFormEditor.OnDesignerMenuItemClick ERROR on CompEditor.Edit: ',E.Message);
 
1966
      MessageDlg(Format(lisErrorIn, [CompClassName]),
 
1967
        Format(lisCFETheComponentEditorOfClassHasCreatedTheError, [CompClassName, #13, E.Message]),
 
1968
        mtError,[mbOk],0);
 
1969
    end;
 
1970
  end;
 
1971
  try
 
1972
    CompEditor.Free;
 
1973
  except
 
1974
    on E: Exception do begin
 
1975
      DebugLn('TCustomFormEditor.OnDesignerMenuItemClick ERROR on CompEditor.Free: ',E.Message);
 
1976
      MessageDlg(Format(lisErrorIn, [CompClassName]),
 
1977
        Format(lisCFETheComponentEditorOfClassHasCreatedTheError, [CompClassName, #13, E.Message]),
1934
1978
        mtError,[mbOk],0);
1935
1979
    end;
1936
1980
  end;
2047
2091
 
2048
2092
function TCustomFormEditor.GetPropertyEditorHook: TPropertyEditorHook;
2049
2093
begin
2050
 
  Result:=Obj_Inspector.PropertyEditorHook;
 
2094
  Result:=GlobalDesignHook;
 
2095
  if Obj_Inspector<>nil then
 
2096
    Result:=Obj_Inspector.PropertyEditorHook;
2051
2097
end;
2052
2098
 
2053
2099
function TCustomFormEditor.FindDefinePropertyNode(
2080
2126
  i:=1;
2081
2127
  while true do begin
2082
2128
    j:=OwnerComponent.ComponentCount-1;
2083
 
    Result:=AClassName;
2084
 
    if (length(Result)>1) and (Result[1]='T') then
2085
 
      Result:=RightStr(Result,length(Result)-1);
 
2129
    Result:=ClassNameToComponentName(AClassName);
2086
2130
    if Result[length(Result)] in ['0'..'9'] then
2087
2131
      Result:=Result+'_';
2088
2132
    Result:=Result+IntToStr(i);