home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 1997 May / VPR9705A.ISO / VPR_DATA / PROGRAM / CBTRIAL / SETUP / DATA.Z / CLSSDLPH.PAS < prev    next >
Pascal/Delphi Source File  |  1997-02-14  |  103KB  |  2,603 lines

  1. //---------------------------------------------------------------------------
  2. // Borland C++Builder
  3. // Copyright (c) 1987, 1997 Borland International Inc.  All Rights Reserved.
  4. //---------------------------------------------------------------------------
  5. // Clssdlph.pas
  6. //
  7. // VCL Class Browser
  8. //---------------------------------------------------------------------------
  9. unit clssdlph;
  10.  
  11. interface
  12.  
  13. uses
  14.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  15.   DB, DBTables, Grids, DBGrids, ExtCtrls, DBCtrls, Menus, ComCtrls,RichEdit,
  16.   StdCtrls,CodePage, Buttons, BDE,about, BtsClass,Registry;
  17.  
  18. type
  19.   TExtractObjects=class
  20.      public
  21.         procedure ExtractObjectNameAndType(StartPosition:Integer; EndPosition:Integer;
  22.                   LineString:string;Phase:string);
  23.      protected
  24.         ObjectName:string;
  25.         ObjectType:string;
  26.         LastCommaPosition:Integer;
  27.   end;
  28.  
  29.  
  30.   TSearchEngine=class
  31.      public
  32.         procedure SearchForString(Word:string;Occurance:Integer;StartPosition:Integer;Page:string);
  33.      protected
  34.         PositionFound:longint;
  35.         LineNumberFound:longint;
  36.         LineFoundPositionOne:longint;
  37.         NewSearchPosition:longint;
  38.   end;
  39.  
  40.   TMainDlg = class(TForm)
  41.     VCLTable: TTable;
  42.     DataSource1: TDataSource;
  43.     MainMenu1: TMainMenu;
  44.     File1: TMenuItem;
  45.     DisplayTblLabel: TLabel;
  46.     New1: TMenuItem;
  47.     Open1: TMenuItem;
  48.     Save1: TMenuItem;
  49.     SaveAs1: TMenuItem;
  50.     DestTblQuery: TQuery;
  51.     DestTable: TTable;
  52.     Search1: TMenuItem;
  53.     Windows1: TMenuItem;
  54.     Help1: TMenuItem;
  55.     FileOPenDlg: TOpenDialog;
  56.     DisplayTblQuery: TQuery;
  57.     SaveAll1: TMenuItem;
  58.     Project1: TMenuItem;
  59.     Project2: TMenuItem;
  60.     HeaderParser: TTable;
  61.     WIN32Table1: TMenuItem;
  62.     PopupMenu5: TPopupMenu;
  63.     ViewHeader2: TMenuItem;
  64.     EditHeader2: TMenuItem;
  65.     ViewSource1: TMenuItem;
  66.     About1: TMenuItem;
  67.     HeaderParserHeaderName: TStringField;
  68.     HeaderParserParse: TBooleanField;
  69.     BatchMove1: TBatchMove;
  70.     ParseVclTable: TTable;
  71.     Errorlogging: TTable;
  72.     ErrorloggingUser: TStringField;
  73.     ErrorloggingClassName: TStringField;
  74.     ErrorloggingListBoxText: TStringField;
  75.     ErrorloggingMemberName: TStringField;
  76.     ClassListTab: TTable;
  77.     ClassListTabClassName: TStringField;
  78.     Panel4: TPanel;
  79.     DeclarationRichEdit: TRichEdit;
  80.     Panel5: TPanel;
  81.     SourceEntryPage: TRichEdit;
  82.     DBGrid1: TDBGrid;
  83.     Panel6: TPanel;
  84.     Panel7: TPanel;
  85.     PageControl1: TPageControl;
  86.     Panel8: TPanel;
  87.     QuickClassListbox: TListBox;
  88.     Panel1: TPanel;
  89.     Panel2: TPanel;
  90.     DBNavigator1: TDBNavigator;
  91.     Print1: TMenuItem;
  92.     PrintDefinition1: TMenuItem;
  93.     PrintDialog1: TPrintDialog;
  94.     ParseallHeaders1: TMenuItem;
  95.     Timer2: TTimer;
  96.     ClassOrgDB: TDatabase;
  97.     Grid: TMenuItem;
  98.     Declaration: TMenuItem;
  99.     Definition: TMenuItem;
  100.     QuickClassBox: TMenuItem;
  101.     MemberList: TMenuItem;
  102.     ChangeFonts: TMenuItem;
  103.     FontDialog1: TFontDialog;
  104.     ChangeBkGround: TMenuItem;
  105.     HeaderPage1: TMenuItem;
  106.     Declaration1: TMenuItem;
  107.     Definition1: TMenuItem;
  108.     QuickClassBox1: TMenuItem;
  109.     MemberList1: TMenuItem;
  110.     ColorDialog1: TColorDialog;
  111.     Label1: TLabel;
  112.     Label2: TLabel;
  113.     Label3: TLabel;
  114.     Label4: TLabel;
  115.     MainListBox: TListView;
  116.     ImageList1: TImageList;
  117.     DestTableClassName: TStringField;
  118.     DestTableMember: TStringField;
  119.     DestTableMemberName: TStringField;
  120.     DestTableRecNum: TAutoIncField;
  121.     DestTableScope: TStringField;
  122.     DestTableReturnType: TStringField;
  123.     DestTableHeader: TStringField;
  124.     DestTablePs: TSmallintField;
  125.     DestTablePType1: TStringField;
  126.     DestTablePObject1: TStringField;
  127.     DestTablePType2: TStringField;
  128.     DestTablePObject2: TStringField;
  129.     DestTablePType3: TStringField;
  130.     DestTablePObject3: TStringField;
  131.     DestTablePType4: TStringField;
  132.     DestTablePObject4: TStringField;
  133.     DestTablePType5: TStringField;
  134.     DestTablePObject5: TStringField;
  135.     DestTablePType6: TStringField;
  136.     DestTablePObject6: TStringField;
  137.     DestTablePType7: TStringField;
  138.     DestTablePObject7: TStringField;
  139.     DestTablePType8: TStringField;
  140.     DestTablePObject8: TStringField;
  141.     DestTableSecondClass: TStringField;
  142.     DestTableMisc: TStringField;
  143.     VCLTableClassName: TStringField;
  144.     VCLTableMember: TStringField;
  145.     VCLTableMemberName: TStringField;
  146.     VCLTableRecNum: TAutoIncField;
  147.     VCLTableScope: TStringField;
  148.     VCLTableReturnType: TStringField;
  149.     VCLTableHeader: TStringField;
  150.     VCLTablePs: TSmallintField;
  151.     VCLTablePType1: TStringField;
  152.     VCLTablePObject1: TStringField;
  153.     VCLTablePType2: TStringField;
  154.     VCLTablePObject2: TStringField;
  155.     VCLTablePType3: TStringField;
  156.     VCLTablePObject3: TStringField;
  157.     VCLTablePType4: TStringField;
  158.     VCLTablePObject4: TStringField;
  159.     VCLTablePType5: TStringField;
  160.     VCLTablePObject5: TStringField;
  161.     VCLTablePType6: TStringField;
  162.     VCLTablePObject6: TStringField;
  163.     VCLTablePType7: TStringField;
  164.     VCLTablePObject7: TStringField;
  165.     VCLTablePType8: TStringField;
  166.     VCLTablePObject8: TStringField;
  167.     VCLTableSecondClass: TStringField;
  168.     VCLTableMisc: TStringField;
  169.     CloseActivePage1: TMenuItem;
  170.     CloseAllPages2: TMenuItem;
  171.     ShowNextDerivation2: TMenuItem;
  172.     SearchByMemberName1: TMenuItem;
  173.     SearchByClassName1: TMenuItem;
  174.     N1: TMenuItem;
  175.     N3: TMenuItem;
  176.     N4: TMenuItem;
  177.     N5: TMenuItem;
  178.     ClassName1: TMenuItem;
  179.     LoadVCLHeader1: TMenuItem;
  180.     PrintHeaderhpp1: TMenuItem;
  181.     PrintSourcepas1: TMenuItem;
  182.     Grid1: TMenuItem;
  183.     HeaderPage: TMenuItem;
  184.     Exit1: TMenuItem;
  185.  
  186.     {Events}
  187.     procedure SelectaTab(Sender: TObject);
  188.     procedure MainSetupWindow(Sender: TObject);
  189.     procedure RebuildVCLTable(Sender: TObject);
  190.     procedure MainDlgOnShow(Sender: TObject);
  191.     procedure MoveToClass(Sender: TObject);
  192.     procedure SearchMemberName1Click(Sender: TObject);
  193.     procedure ViewHeader1Click(Sender: TObject);
  194.     procedure ShowRecordClass1Click(Sender: TObject);
  195.     procedure About1Click(Sender: TObject);
  196.     procedure SearchClassName1Click(Sender: TObject);
  197.     procedure ViewSource1Click(Sender: TObject);
  198.     procedure FormResize(Sender: TObject);
  199.     procedure Print1Click(Sender: TObject);
  200.     procedure PrintDefinition1Click(Sender: TObject);
  201.     procedure HeaderSource1Click(Sender: TObject);
  202.     procedure ParseaNewHeader1Click(Sender: TObject);
  203.     procedure ClosePageClick(Sender: TObject);
  204.     procedure CloseAllPages1Click(Sender: TObject);
  205.     procedure FormActivate(Sender: TObject);
  206.     procedure ChangeFontsClick(Sender: TObject);
  207.     procedure ChangeBkGroundClick(Sender: TObject);
  208.     procedure MainListBoxClick(Sender: TObject);
  209.     procedure ShowNextDerivation1Click(Sender: TObject);
  210.     procedure PrintHeaderhpp1Click(Sender: TObject);
  211.     procedure PrintSourcepas1Click(Sender: TObject);
  212.     procedure Project1Click(Sender: TObject);
  213.     procedure FormClose(Sender: TObject; var Action: TCloseAction);
  214.     procedure Exit1Click(Sender: TObject);
  215.     procedure MainListBoxKeyUp(Sender: TObject; var Key: Word;
  216.       Shift: TShiftState);
  217.  
  218.   private
  219.     InitializedTable:Boolean;
  220.     DoesFileExist:Boolean;
  221.     MemberSearch:Boolean;
  222.     CurrentSecondClass:string;
  223.     LocalVclSource:string;
  224.     LocalTablesDir:string;
  225.     LocalVclHeaders:string;
  226.     DefinitionLength:Integer;
  227.     PasSourceFileName:string;
  228.     LocateSuccess:Boolean;
  229.     RawVCLTable:TCloneTable;
  230.     UserName:string;
  231.     CurrentHeaderFileName:string;
  232.     CurrentSourceFileName:string;
  233.     MySearchOptions:TLocateOptions;
  234.     EndLineNum:longint;
  235.     DefinitionEditMode:Boolean;
  236.     DeclarationEditMode:Boolean;
  237.     CurrentSelectedMemberName:string[40];
  238.     FileOpenActive:Boolean;
  239.     ClassFinderSelectedItem:string[40];
  240.     CurrentTabClassName:string[40];
  241.     procedure WriteRegistryKeys;
  242.     procedure ProcessSelectedClass;
  243.     procedure LoadSourcePage;
  244.     procedure GetRegistryInfo;
  245.     procedure LoadDefinitionSource(MemberType:string);
  246.     procedure LoadDeclarationSource(ListBoxString:string);
  247.     function DetermineImageIndex(Scope:string;Member:string):Integer;
  248.     function IsItABadLine(Line:string;DefinedLineNumber:Integer):Boolean;
  249.     procedure ExtractClassMembers(ClassPosition:Integer;ClassName:string);
  250.     procedure ConvertCppToDestTable;
  251.     procedure QueryDispTbl_LoadQuickList;
  252.     procedure StringToTablePos(SelectedText:string;ClassName:string);
  253.     procedure ConvertTableToTabs;
  254.     procedure TableToListStrings(ClassName:string);
  255.     procedure MemberToTable(MemberDeclaration:string;MyScope:string;CppClassName:string;MemberLineNumber:Integer);
  256.   public
  257.  
  258.   end;
  259.  
  260. var
  261.   MainDlg: TMainDlg = nil;
  262. implementation
  263.  
  264. uses Rebuild, ParsHead;
  265.  
  266.  
  267.  
  268. //uses NewMemDG;
  269.  
  270. {$R *.DFM}
  271.  
  272.  
  273. { Source Code}
  274.  
  275. procedure TMainDlg.ConvertTableToTabs; 
  276.    begin
  277.    MainListBox.Items.Clear;
  278.    DestTblQuery.Close();
  279.    DestTblQuery.SQL.Clear();
  280.    DestTblQuery.SQL.Add('SELECT DISTINCT ClassName FROM');
  281.    DestTblQuery.SQL.Add('"main2.db"');
  282.    DestTblQuery.SQL.Add('ORDER BY ClassName');
  283.    DestTblQuery.Open();
  284.  
  285.    { Clear all tabs}
  286.    if PageControl1.PageCount > 0 then
  287.       with PageControl1 do
  288.          begin
  289.          ActivePage := Pages[0];
  290.          while (ActivePage <> nil) do
  291.             begin
  292.             ActivePage.Free;
  293.             SelectNextPage(TRUE);
  294.             end;
  295.          end; 
  296.       
  297.    {Create tabs from query}
  298.    while not DestTblQuery.EOF do
  299.       begin
  300.       with TTabSheet.Create(Self) do
  301.          begin
  302.          Caption := DestTblQuery.FieldByName('ClassName').AsString;
  303.          PageControl := PageControl1;
  304.          end;
  305.       DestTblQuery.Next();
  306.       end;
  307.    end;
  308.  
  309. procedure TMainDlg.SelectaTab(Sender: TObject);
  310.    begin
  311.    Screen.Cursor:=crHourGlass;
  312.    CurrentTabClassName:=PageControl1.ActivePage.Caption;
  313.    RawVCLTable.DisableControls();
  314.    RawVCLTable.Filtered:=false;
  315.    RawVCLTable.SetRange([CurrentTabClassName], [CurrentTabClassName]);
  316.    CurrentHeaderFileName:=RawVCLTable.FieldByName('Header').AsString;
  317.    CurrentSourceFileName:=RawVCLTable.FieldByName('Misc').AsString;
  318.    DeclarationRichEdit.Clear;
  319.    SourceEntryPage.Clear;
  320.    CodePageForm.CodePage.Clear();
  321.    try
  322.       CodePageForm.CodePage.Lines.LoadFromFile(LocalVclHeaders + CurrentHeaderFileName);
  323.          except on EFOpenError do
  324.             begin
  325.             MessageDlg('Header File Not Found!' ,mtError, [mbOk], 0);
  326.             Screen.Cursor:=crDefault;
  327.             Exit;
  328.             end;
  329.       end;
  330.    CodePageForm.SourceRichEdit1.Clear();
  331.    LoadSourcePage;
  332.  
  333.    TableToListStrings(CurrentTabClassName);
  334.    RawVCLTable.EnableControls();
  335.    Screen.Cursor:=crDefault;
  336. end;
  337.  
  338. procedure TMainDlg.TableToListStrings(ClassName:string); 
  339.    var
  340.    ParamNum:Longint;
  341.    FinalString:string[255];
  342.    RecordClassName:string[40];
  343.    MemberName:string[40];
  344.    MemberType:string[40];
  345.    ReturnType:string[40];
  346.    ScopeColor:string[40];
  347.    PType1:string[40];
  348.    PType2:string[40];
  349.    PType3:string[40];
  350.    PType4:string[40];
  351.    PType5:string[40];
  352.    PType6:string[40];
  353.    PType7:string[40];
  354.    PType8:string[40];
  355.    PObject1:string[40];
  356.    PObject2:string[40];
  357.    PObject3:string[40];
  358.    PObject4:string[40];
  359.    PObject5:string[40];
  360.    PObject6:string[40];
  361.    PObject7:string[40];
  362.    PObject8:string[40];
  363.    Break:Boolean;
  364.    NewItem:TListItem;
  365.    DataProperty:Boolean;
  366.    begin
  367.    if FileOpenActive=true then
  368.       begin
  369.       VCLTable.Close();
  370.       VCLTable.TableName:=DestTable.TableName;
  371.       VCLTable.Open();
  372.       end;
  373.    DataProperty:=false;
  374.    Break:=false;
  375.    MainListBox.Items.Clear();
  376.    while (Break<>true) and (not RawVCLTable.EOF) do
  377.       begin
  378.       FinalString:='';
  379.       RecordClassName:=RawVCLTable.FieldByName('ClassName').AsString;
  380.       if ClassName=RecordClassName then
  381.          begin
  382.          ReturnType:=RawVCLTable.FieldByName('ReturnType').AsString;
  383.          MemberName:=RawVCLTable.FieldByName('MemberName').AsString;
  384.          MemberType:=RawVCLTable.FieldByName('Member').AsString;
  385.          ParamNum:=RawVCLTable.FieldByName('Ps').AsInteger;
  386.          ScopeColor:=RawVCLTable.FieldByName('Scope').AsString;
  387.          {Is it a data property}
  388.          if ((MemberType='property')and(ParamNum=0)) then
  389.             begin
  390.             DataProperty:=true;
  391.             end;
  392.  
  393.          {Start building string}
  394.          FinalString:='';
  395.             if (MemberType='data') or (DataProperty=true) then { if data member }
  396.                begin
  397.                FinalString:=concat(FinalString,MemberName);
  398.                NewItem := MainListBox.Items.Add;
  399.                NewItem.Caption := FinalString;
  400.                NewItem.ImageIndex:=DetermineImageIndex(ScopeColor,MemberType);
  401.                end else
  402.                   begin
  403.                   if ParamNum=0 then   { Ps=0 }
  404.                      begin
  405.                      FinalString:=concat(FinalString,MemberName);
  406.                      if MemberType='property' then FinalString:=concat(FinalString,' ={')
  407.                         else FinalString:=concat(FinalString,' (');
  408.                      end;
  409.                   if ParamNum>0 then   { Ps=1 }
  410.                      begin
  411.                      PType1:=RawVCLTable.FieldByName('PType1').AsString;
  412.                      PObject1:=RawVCLTable.FieldByName('PObject1').AsString;
  413.                      FinalString:=concat(FinalString,MemberName);
  414.                      if MemberType='property' then FinalString:=concat(FinalString,' ={')
  415.                         else FinalString:=concat(FinalString,' (');
  416.                      FinalString:=concat(FinalString,PType1);
  417.                      FinalString:=concat(FinalString,' ');
  418.                      FinalString:=concat(FinalString,PObject1);
  419.                      end;
  420.                   if ParamNum>1 then   { Ps=2 }
  421.                      begin
  422.                      PType2:=RawVCLTable.FieldByName('PType2').AsString;
  423.                      PObject2:=RawVCLTable.FieldByName('PObject2').AsString;
  424.                      FinalString:=concat(FinalString,',');
  425.                      FinalString:=concat(FinalString,PType2);
  426.                      FinalString:=concat(FinalString,' ');
  427.                      FinalString:=concat(FinalString,PObject2);
  428.                      end;
  429.                   if ParamNum>2 then   { Ps=3 }
  430.                      begin
  431.                      PType3:=RawVCLTable.FieldByName('PType3').AsString;
  432.                      PObject3:=RawVCLTable.FieldByName('PObject3').AsString;
  433.                      FinalString:=concat(FinalString,',');
  434.                      FinalString:=concat(FinalString,PType3);
  435.                      FinalString:=concat(FinalString,' ');
  436.                      FinalString:=concat(FinalString,PObject3);
  437.                      end;
  438.                   if ParamNum>3 then   { Ps=4 }
  439.                      begin
  440.                      PType4:=RawVCLTable.FieldByName('PType4').AsString;
  441.                      PObject4:=RawVCLTable.FieldByName('PObject4').AsString;
  442.                      FinalString:=concat(FinalString,',');
  443.                      FinalString:=concat(FinalString,PType4);
  444.                      FinalString:=concat(FinalString,' ');
  445.                      FinalString:=concat(FinalString,PObject4);
  446.                      end;
  447.                   if ParamNum>4 then   { Ps=5 }
  448.                      begin
  449.                      PType5:=RawVCLTable.FieldByName('PType5').AsString;
  450.                      PObject5:=RawVCLTable.FieldByName('PObject5').AsString;
  451.                      FinalString:=concat(FinalString,',');
  452.                      FinalString:=concat(FinalString,PType5);
  453.                      FinalString:=concat(FinalString,' ');
  454.                      FinalString:=concat(FinalString,PObject5);
  455.                      end;
  456.                   if ParamNum>5 then   { Ps=6 }
  457.                      begin
  458.                      PType6:=RawVCLTable.FieldByName('PType6').AsString;
  459.                      PObject6:=RawVCLTable.FieldByName('PObject6').AsString;
  460.                      FinalString:=concat(FinalString,',');
  461.                      FinalString:=concat(FinalString,PType6);
  462.                      FinalString:=concat(FinalString,' ');
  463.                      FinalString:=concat(FinalString,PObject6);
  464.                      end;
  465.                   if ParamNum>6 then   { Ps=7 }
  466.                      begin
  467.                      PType7:=RawVCLTable.FieldByName('PType7').AsString;
  468.                      PObject7:=RawVCLTable.FieldByName('PObject7').AsString;
  469.                      FinalString:=concat(FinalString,',');
  470.                      FinalString:=concat(FinalString,PType7);
  471.                      FinalString:=concat(FinalString,' ');
  472.                      FinalString:=concat(FinalString,PObject7);
  473.                      end;
  474.                   if ParamNum>7 then   { Ps=8 }
  475.                      begin
  476.                      PType8:=RawVCLTable.FieldByName('PType8').AsString;
  477.                      PObject8:=RawVCLTable.FieldByName('PObject8').AsString;
  478.                      FinalString:=concat(FinalString,',');
  479.                      FinalString:=concat(FinalString,PType8);
  480.                      FinalString:=concat(FinalString,' ');
  481.                      FinalString:=concat(FinalString,PObject8);
  482.                      end;
  483.                if MemberType='property' then FinalString:=concat(FinalString,' }')
  484.                   else
  485.                      begin
  486.                      FinalString:=concat(FinalString,' )');
  487.                      end;               
  488.                NewItem := MainListBox.Items.Add;
  489.                NewItem.Caption := FinalString;
  490.                NewItem.ImageIndex:=DetermineImageIndex(ScopeColor,MemberType);
  491.                end;
  492.                RawVCLTable.Next();
  493.          end
  494.            else Break:=true;
  495.       end;
  496.    end;
  497.  
  498. procedure TMainDlg.MainListBoxClick(Sender: TObject);
  499.    var
  500.    MemberType:string;
  501.    CurrentSelectedReturnType:string;
  502.    begin
  503.    CurrentSelectedReturnType:='';
  504.    if (FileOpenActive=true) or (MainListBox.ItemFocused=nil) or
  505.       (MainListBox.ItemFocused.Caption='Class Member List') then Exit;
  506.    MemberType:='';
  507.    CurrentTabClassName:=PageControl1.ActivePage.Caption;
  508.    RawVCLTable.DisableControls;
  509.    RawVCLTable.First;
  510.    StringToTablePos(MainListBox.ItemFocused.Caption,CurrentTabClassName);
  511.    CurrentSelectedMemberName:=RawVCLTable.FieldByName('MemberName').AsString;
  512.    CurrentSelectedReturnType:=RawVCLTable.FieldByName('ReturnType').AsString;
  513.    LoadDeclarationSource(CurrentSelectedReturnType+MainListBox.ItemFocused.Caption);
  514.    MemberType:=RawVCLTable.FieldByName('Member').AsString;
  515.  
  516.    LoadDefinitionSource(MemberType);
  517.  
  518.    Screen.Cursor:=crDefault;
  519.    RawVCLTable.EnableControls;
  520.    MainListBox.SetFocus();
  521.    end;
  522.  
  523. procedure TMainDlg.MainSetupWindow(Sender: TObject);
  524.    begin
  525.    {Initialize Database}
  526.    GetRegistryInfo;
  527.    WriteRegistryKeys;
  528.    ClassOrgDB.Params.Values['Path'] := LocalTablesDir;
  529.  
  530.    {Open Tables}
  531.    try
  532.       VCLTable.Open;
  533.       except on EDatabaseError do
  534.          begin
  535.          MessageDlg('Table is corrupt! Recopy all vcltable.* files from CD!' ,mtError, [mbOk], 0);
  536.          Exit;
  537.          end;
  538.    end;
  539.  
  540.  
  541.  
  542.    DestTable.Open;
  543.    ClassListTab.Open;
  544.    HeaderParser.Open;
  545.    ErrorLogging.Open;
  546.    ParseVclTable.Open;
  547.    RawVCLTable := TCloneTable.CreateFromTable(VCLTable, True);
  548.    RawVCLTable.Open;
  549.                     
  550.    {Initialize Variables}
  551.    FileOpenActive:=false;
  552.    DefinitionEditMode:=false;
  553.    MemberSearch:=false;
  554.    WindowState:=wsMaximized;
  555.    InitializedTable:=false;
  556.    end;
  557.  
  558. procedure TMainDlg.RebuildVCLTable(Sender: TObject);
  559.    var
  560.    SelectOK:Boolean;
  561.    Password:string;
  562.    HeaderName:string;
  563.    ParseIt:Boolean;
  564.    PasFileSearch:TSearchEngine;
  565.    OneCharacter:string;
  566.    GotPasName:Boolean;
  567.    CharCount:Integer;
  568.    Line:string;
  569.    ValidHeader:Boolean;
  570.    begin
  571.    TabRebuildStats:=TTabRebuildStats.Create(nil);
  572.    if VCLTable.RecordCount<>0 then
  573.       begin
  574.       Password:='Rebuild';
  575.       SelectOK:=InputQuery('Enter Password','Warning you are about to rebuild your VCL table!!',Password);
  576.       if not SelectOK then Exit;
  577.       if SelectOK then
  578.          begin
  579.          if Password <>'Rebuild' then Exit
  580.          end;
  581.       end;
  582.    TabRebuildStats.Left:=Trunc((ClientWidth/2)-(TabRebuildStats.Width/2));
  583.    TabRebuildStats.Top:=Trunc((ClientHeight/2)-(TabRebuildStats.Height/2));
  584.    TabRebuildStats.Show;
  585.    Enabled:=false;
  586.    TabRebuildStats.RebuildBar.Position:=1;
  587.    TabRebuildStats.HeaderNameLabel.Caption:='emptying table';
  588.    Application.ProcessMessages;
  589.    VCLTable.Close;
  590.    try
  591.       VCLTable.EmptyTable;
  592.       except on EDatabaseError do
  593.          begin
  594.          MessageDlg('Table is corrupt! Recopy all vcltable.* files from CD!' ,mtError, [mbOk], 0);
  595.          Screen.Cursor:=crDefault;
  596.          TabRebuildStats.Free;
  597.          Exit;
  598.          end;
  599.    end;
  600.  
  601.    VCLTable.Open;
  602.    FileOpenActive:=true;
  603.    Screen.Cursor:=crHourglass;
  604.    HeaderParser.First;
  605.    DestTable.DisableControls;
  606.    PasFileSearch:=TSearchEngine.Create;
  607.    while not HeaderParser.EOF do
  608.       begin
  609.       HeaderName:=HeaderParserHeaderName.AsString;
  610.       ParseIt:=HeaderParserParse.AsBoolean;
  611.       if ParseIt=true then
  612.          begin
  613.          TabRebuildStats.HeaderNameLabel.Caption:=HeaderName;
  614.          {Take care of status bar}
  615.          if HeaderName='dataform.hpp' then TabRebuildStats.RebuildBar.Position:=1;
  616.          if HeaderName='dbinpreq.hpp' then TabRebuildStats.RebuildBar.Position:=2;
  617.          if HeaderName='dialogs.hpp' then TabRebuildStats.RebuildBar.Position:=3;
  618.          if HeaderName='dsgnwnds.hpp' then TabRebuildStats.RebuildBar.Position:=4;
  619.          if HeaderName='frmexprt.hpp' then TabRebuildStats.RebuildBar.Position:=5;
  620.          if HeaderName='inifiles.hpp' then TabRebuildStats.RebuildBar.Position:=6;
  621.          if HeaderName='masktext.hpp' then TabRebuildStats.RebuildBar.Position:=7;
  622.          if HeaderName='nodeedit.hpp' then TabRebuildStats.RebuildBar.Position:=8;
  623.          if HeaderName='pageedit.hpp' then TabRebuildStats.RebuildBar.Position:=9;
  624.          if HeaderName='sbaredit.hpp' then TabRebuildStats.RebuildBar.Position:=10;
  625.          if HeaderName='updsqled.hpp' then TabRebuildStats.RebuildBar.Position:=11;
  626.          if HeaderName='zvcl.hpp' then TabRebuildStats.RebuildBar.Position:=12;
  627.          Application.ProcessMessages;
  628.  
  629.          CharCount:=0;
  630.          GotPasName:=false;
  631.          PasSourceFileName:='';
  632.          OneCharacter:='';
  633.          Screen.Cursor:=crHourglass;
  634.          CurrentHeaderFileName:=HeaderName;
  635.          CodePageForm.CodePage.Clear();
  636.          ValidHeader:=true;
  637.          try
  638.             CodePageForm.CodePage.Lines.LoadFromFile(LocalVclHeaders + CurrentHeaderFileName);
  639.             except on EFOpenError do
  640.                begin
  641.                ValidHeader:=false
  642.                end;
  643.             end;
  644.  
  645.          if ValidHeader=true then
  646.             begin
  647.             CodePageForm.SourceRichEdit1.Clear();
  648.             PasFileSearch.SearchForString('.pas',1,0,'Include');
  649.             if PasFileSearch.PositionFound=-1 then MessageDlg('Could not find .pas for '+HeaderName ,mtError, [mbOk], 0);
  650.             Line:=CodePageForm.CodePage.Lines[PasFileSearch.LineNumberFound];
  651.  
  652.             while not GotPasName do
  653.                begin
  654.                OneCharacter:=Copy(Line,(PasFileSearch.PositionFound-PasFileSearch.LineFoundPositionOne)-CharCount,1);
  655.                if (OneCharacter=' ') or (OneCharacter='/')then GotPasName:=true;
  656.                if GotPasName=false then
  657.                   begin
  658.                   AppendStr(OneCharacter,PasSourceFileName);
  659.                   PasSourceFileName:=OneCharacter;
  660.                   Inc(CharCount);
  661.                   end;
  662.                end;
  663.             AppendStr(PasSourceFileName,'.pas');
  664.             DestTable.Close();
  665.             DestTable.TableName:='main2.db';
  666.             DestTable.Open();
  667.             DestTable.Close();
  668.             DestTable.EmptyTable;
  669.             DestTable.Open();
  670.             ConvertCppToDestTable;
  671.             Screen.Cursor:=crDefault;
  672.             BatchMove1.Execute;
  673.             end;
  674.          end;
  675.          HeaderParser.Next;
  676.       end;
  677.    DestTable.Close;
  678.    HeaderParser.Close;
  679.    DestTable.EnableControls;
  680.    Screen.Cursor:=crDefault;
  681.    TabRebuildStats.Close;
  682.    TabRebuildStats.Free;
  683.    VCLTable.Close;
  684.    VCLTable.TableName:='vcltable.db';
  685.    VCLTable.Open;
  686.    VCLTable.Refresh;
  687.    RawVCLTable.Refresh;
  688.    DBGrid1.Refresh;
  689.    RawVCLTable.First;
  690.    MessageDlg('Successful Build',mtConfirmation, [mbOk], 0);
  691.    FileOpenActive:=false;
  692.    Enabled:=true;
  693.    end;
  694.  
  695. procedure TMainDlg.StringToTablePos(SelectedText:string;ClassName:string); 
  696.    var
  697.    Match:Boolean;
  698.    ParamNum:Longint;
  699.    FinalString:string[255];
  700.    RecordClassName:string[40];
  701.    MemberName:string[40];
  702.    MemberType:string[40];
  703.    ReturnType:string[40];
  704.    PType1:string[40];
  705.    PType2:string[40];
  706.    PType3:string[40];
  707.    PType4:string[40];
  708.    PType5:string[40];
  709.    PType6:string[40];
  710.    PType7:string[40];
  711.    PType8:string[40];
  712.    PObject1:string[40];
  713.    PObject2:string[40];
  714.    PObject3:string[40];
  715.    PObject4:string[40];
  716.    PObject5:string[40];
  717.    PObject6:string[40];
  718.    PObject7:string[40];
  719.    PObject8:string[40];
  720.    DataProperty:Boolean;
  721.    begin
  722.    Match:=false;
  723.    DataProperty:=false;
  724.    while (not RawVCLTable.EOF) and (not Match) do
  725.       begin
  726.       FinalString:='';
  727.       ReturnType:=RawVCLTable.FieldByName('ReturnType').AsString;
  728.       MemberName:=RawVCLTable.FieldByName('MemberName').AsString;
  729.       MemberType:=RawVCLTable.FieldByName('Member').AsString;
  730.       RecordClassName:=RawVCLTable.FieldByName('ClassName').AsString;
  731.       ParamNum:=RawVCLTable.FieldByName('Ps').AsInteger;
  732.       {Is it a data property}
  733.          if ((MemberType='property')and(ParamNum=0)) then
  734.             begin
  735.             DataProperty:=true;
  736.             end;
  737.       if ClassName=RecordClassName then
  738.          begin
  739.          FinalString:='';
  740.          if (MemberType='data') or (DataProperty=true) then  { if data member }
  741.             begin
  742.             FinalString:=concat(FinalString,MemberName);
  743.             end else  { all other member types }
  744.             begin
  745.             if ParamNum=0 then   { Ps=0 }
  746.                begin
  747.                FinalString:=concat(FinalString,MemberName);
  748.                if MemberType='property' then FinalString:=concat(FinalString,' ={')
  749.                   else FinalString:=concat(FinalString,' (');
  750.                end;
  751.             if ParamNum>0 then   { Ps=1 }
  752.                begin
  753.                PType1:=RawVCLTable.FieldByName('PType1').AsString;
  754.                PObject1:=RawVCLTable.FieldByName('PObject1').AsString;
  755.                FinalString:=concat(FinalString,MemberName);
  756.                if MemberType='property' then FinalString:=concat(FinalString,' ={')
  757.                   else
  758.                      FinalString:=concat(FinalString,' (');
  759.                      FinalString:=concat(FinalString,PType1);
  760.                      FinalString:=concat(FinalString,' ');
  761.                      FinalString:=concat(FinalString,PObject1);
  762.                end;
  763.             if ParamNum>1 then   { Ps=2 }
  764.                begin
  765.                PType2:=RawVCLTable.FieldByName('PType2').AsString;
  766.                PObject2:=RawVCLTable.FieldByName('PObject2').AsString;
  767.                FinalString:=concat(FinalString,',');
  768.                FinalString:=concat(FinalString,PType2);
  769.                FinalString:=concat(FinalString,' ');
  770.                FinalString:=concat(FinalString,PObject2);
  771.                end;
  772.             if ParamNum>2 then   { Ps=3 }
  773.                begin
  774.                PType3:=RawVCLTable.FieldByName('PType3').AsString;
  775.                PObject3:=RawVCLTable.FieldByName('PObject3').AsString;
  776.                FinalString:=concat(FinalString,',');
  777.                FinalString:=concat(FinalString,PType3);
  778.                FinalString:=concat(FinalString,' ');
  779.                FinalString:=concat(FinalString,PObject3);
  780.                end;
  781.             if ParamNum>3 then   { Ps=4 }
  782.                begin
  783.                PType4:=RawVCLTable.FieldByName('PType4').AsString;
  784.                PObject4:=RawVCLTable.FieldByName('PObject4').AsString;
  785.                FinalString:=concat(FinalString,',');
  786.                FinalString:=concat(FinalString,PType4);
  787.                FinalString:=concat(FinalString,' ');
  788.                FinalString:=concat(FinalString,PObject4);
  789.                end;
  790.             if ParamNum>4 then   { Ps=5 }
  791.                begin
  792.                PType5:=RawVCLTable.FieldByName('PType5').AsString;
  793.                PObject5:=RawVCLTable.FieldByName('PObject5').AsString;
  794.                FinalString:=concat(FinalString,',');
  795.                FinalString:=concat(FinalString,PType5);
  796.                FinalString:=concat(FinalString,' ');
  797.                FinalString:=concat(FinalString,PObject5);
  798.                end;
  799.             if ParamNum>5 then   { Ps=6 }
  800.                begin
  801.                PType6:=RawVCLTable.FieldByName('PType6').AsString;
  802.                PObject6:=RawVCLTable.FieldByName('PObject6').AsString;
  803.                FinalString:=concat(FinalString,',');
  804.                FinalString:=concat(FinalString,PType6);
  805.                FinalString:=concat(FinalString,' ');
  806.                FinalString:=concat(FinalString,PObject6);
  807.                end;
  808.             if ParamNum>6 then   { Ps=7 }
  809.                begin
  810.                PType7:=RawVCLTable.FieldByName('PType7').AsString;
  811.                PObject7:=RawVCLTable.FieldByName('PObject7').AsString;
  812.                FinalString:=concat(FinalString,',');
  813.                FinalString:=concat(FinalString,PType7);
  814.                FinalString:=concat(FinalString,' ');
  815.                FinalString:=concat(FinalString,PObject7);
  816.                end;
  817.             if ParamNum>7 then   { Ps=8 }
  818.                begin
  819.                PType8:=RawVCLTable.FieldByName('PType8').AsString;
  820.                PObject8:=RawVCLTable.FieldByName('PObject8').AsString;
  821.                FinalString:=concat(FinalString,',');
  822.                FinalString:=concat(FinalString,PType8);
  823.                FinalString:=concat(FinalString,' ');
  824.                FinalString:=concat(FinalString,PObject8);
  825.                end;
  826.             if MemberType='property' then FinalString:=concat(FinalString,' }')
  827.                else
  828.                   begin
  829.                   FinalString:=concat(FinalString,' )');
  830.                   end;
  831.             if Selectedtext=FinalString then Match:=true;
  832.             end;
  833.          end;
  834.       if Selectedtext=FinalString then Match:=true;
  835.       if Match<>true then RawVCLTable.Next();
  836.       end;
  837.       RawVCLTable.EnableControls;
  838.    end;
  839.  
  840.  
  841.  
  842. procedure TMainDlg.MainDlgOnShow(Sender: TObject);
  843.    begin
  844.    {Set Resizing}
  845.    DeclarationRichEdit.Height:=Trunc(ClientHeight * 0.18);
  846.    Panel4.Width:=ClientWidth div 2;
  847.    PageControl1.Height:=Trunc(ClientHeight * 0.6);
  848.    QuickClassListbox.Height:=Trunc(ClientHeight* 0.4)-30;
  849.    SourceEntryPage.Height:=(PageControl1.Height-15)-(DeclarationRichEdit.Height);
  850.    MainListBox.Height:=PageControl1.Height -40;
  851.    MainListBox.Width:=PageControl1.Width -5;
  852.    Label1.Left:=Trunc(Panel2.Width * 0.174);
  853.    Label2.Left:=Trunc(Panel2.Width * 0.300);
  854.    Label3.Left:=Trunc(Panel2.Width * 0.532);
  855.    Label4.Left:=Trunc(Panel2.Width * 0.725);
  856.    CodePageForm:=TCodePageForm.Create(Self);
  857.  
  858.    with TRegistry.Create do
  859.       begin
  860.       {Load background colors from registry}
  861.       RootKey := HKEY_LOCAL_MACHINE;
  862.       OpenKey('\software\borland\VCL Class Organizer\colors', false);
  863.       DeclarationRichEdit.Color:=TColor(StrToInt(ReadString('Declaration')));
  864.       SourceEntryPage.Color:=TColor(StrToInt(ReadString('Definition')));
  865.       QuickClassListbox.Color:=TColor(StrToInt(ReadString('QuickClass')));
  866.       MainListBox.Color:=TColor(StrToInt(ReadString('MemberList')));
  867.       DBGrid1.Color:=TColor(StrToInt(ReadString('Grid')));
  868.       CodePageForm.CodePage.Color:=TColor(StrToInt(ReadString('HeaderPage')));
  869.       CodePageForm.SourceRichEdit1.Color:=TColor(StrToInt(ReadString('DefinitionPage')));
  870.  
  871.       {Load fonts from registry}
  872.       RootKey := HKEY_LOCAL_MACHINE;
  873.       OpenKey('\software\borland\VCL Class Organizer\fonts', false);
  874.       DeclarationRichEdit.Font.Color:=TColor(StrToInt(ReadString('Declaration')));
  875.       SourceEntryPage.Font.Color:=TColor(StrToInt(ReadString('Definition')));
  876.       QuickClassListbox.Font.Color:=TColor(StrToInt(ReadString('QuickClass')));
  877.       MainListBox.Font.Color:=TColor(StrToInt(ReadString('MemberList')));
  878.       CodePageForm.CodePage.Font.Color:=TColor(StrToInt(ReadString('HeaderPage')));
  879.       CodePageForm.SourceRichEdit1.Font.Color:=TColor(StrToInt(ReadString('DefinitionPage')));
  880.       DBGrid1.Columns[1].Font.Color:=TColor(StrToInt(ReadString('Grid')));
  881.       DBGrid1.Columns[2].Font.Color:=TColor(StrToInt(ReadString('Grid')));
  882.       DBGrid1.Columns[3].Font.Color:=TColor(StrToInt(ReadString('Grid')));
  883.       DBGrid1.Columns[4].Font.Color:=TColor(StrToInt(ReadString('Grid')));
  884.       Free;
  885.       end;
  886.    QueryDispTbl_LoadQuickList;
  887.    end;
  888.  
  889.  
  890. procedure TMainDlg.QueryDispTbl_LoadQuickList; 
  891.    begin
  892.    QuickClassListbox.Clear;
  893.    ClassListTab.Open;
  894.    ClassListTab.First;
  895.    while not ClassListTab.EOF do
  896.       begin
  897.       QuickClassListbox.Items.Add(ClassListTabClassName.AsString);
  898.       ClassListTab.Next;
  899.       end;
  900.    SendMessage(QuickClassListbox.Handle,LB_SETSEL,WPARAM(TRUE),LPARAM(280));
  901.    SendMessage(QuickClassListbox.Handle,LB_SETSEL,WPARAM(TRUE),LPARAM(188));
  902.    SendMessage(QuickClassListbox.Handle,LB_SETSEL,WPARAM(FALSE),LPARAM(280));
  903.    end;
  904.    
  905. procedure TMainDlg.ConvertCppToDestTable; 
  906.    var
  907.    OneLinerClass:Boolean;
  908.    ThisIsDerivedClass:Boolean;
  909.    ClassCommentLine:Boolean;
  910.    Break:Boolean;
  911.    x:Integer;
  912.    p:Integer;
  913.    StrLength:Integer;
  914.    CopyLength:Integer;
  915.    CompensateFirstSearch:Integer;
  916.    EndOfSearch:Integer;
  917.    CommentPagePosToLinePos:longint;
  918.    OneLineOfCode:string[200];
  919.    ExtractedClassName:string[40];
  920.    OneChar:string;
  921.    ClassSearch:TSearchEngine;
  922.    CommentSearch:TSearchEngine;
  923.    Sender:TObject;
  924.    TempString:string;
  925.    Done:Boolean;
  926.    begin
  927.    CurrentSecondClass:='';
  928.    EndOfSearch:=0;  
  929.    CompensateFirstSearch:=0;
  930.    ClassSearch:=TSearchEngine.Create;
  931.    CommentSearch:=TSearchEngine.Create;
  932.    ClassSearch.LineNumberFound:=0;
  933.    CommentSearch.LineNumberFound:=0;
  934.    ClassSearch.PositionFound:=0;
  935.    CommentSearch.PositionFound:=0;
  936.  
  937.    {Clear all tabs}
  938.    if FileOpenActive<>true then
  939.       begin
  940.       if PageControl1.PageCount > 0 then
  941.          with PageControl1 do
  942.             begin
  943.             ActivePage := Pages[0];
  944.             while (ActivePage <> nil) do
  945.                begin
  946.                ActivePage.Free;
  947.                SelectNextPage(TRUE);
  948.                end;
  949.             end;
  950.       end;
  951.  
  952.    {start page search for 'class' and start extracting Class names}
  953.    while EndOfSearch<>-1 do
  954.       begin
  955.       OneLinerClass:=false;
  956.       ThisIsDerivedClass:=false;
  957.       Break:=false;
  958.       ClassCommentLine:=false;
  959.       ExtractedClassName:='';
  960.       ClassSearch.SearchForString('class ',1,CompensateFirstSearch,'Include'); { Find 'class' from pos 0 }
  961.       CommentSearch.SearchForString('//',1,ClassSearch.LineFoundPositionOne,'Include');{ is class line a comment line }
  962.       if ClassSearch.LineNumberFound=CommentSearch.LineNumberFound then ClassCommentLine:=true;
  963.       if CommentSearch.PositionFound=-1 then CommentSearch.PositionFound:= 999999;
  964.       if ((ClassCommentLine=true) and (ClassSearch.PositionFound<CommentSearch.PositionFound)
  965.            and (ClassSearch.PositionFound<>-1))
  966.            or ((ClassCommentLine=false) and (ClassSearch.PositionFound<>-1)) then
  967.  
  968.          begin
  969.          OneLineOfCode:=CodePageForm.CodePage.Lines[ClassSearch.LineNumberFound];
  970.          StrLength:=Length(OneLineOfCode);
  971.          while StrLength=0 do {skip blank lines}
  972.             begin
  973.             OneLineOfCode:=CodePageForm.CodePage.Lines[ClassSearch.LineNumberFound+1];
  974.             StrLength:=Length(OneLineOfCode);
  975.             end;
  976.         {found valid class line}
  977.  
  978.          if ClassCommentLine=true then {strip off comments}
  979.             begin
  980.             CommentPagePosToLinePos:=CommentSearch.PositionFound-CommentSearch.LineFoundPositionOne;
  981.             OneLineOfCode:=CodePageForm.CodePage.Lines[ClassSearch.LineNumberFound];
  982.             OneLineOfCode:=Copy(OneLineOfCode,0,CommentPagePosToLinePos);
  983.             StrLength:=Length(OneLineOfCode);
  984.             end;
  985.          for p:=1 to (StrLength+1) do  {check for forward declaration}
  986.                   begin
  987.                   OneChar:=Copy(OneLineOfCode,p,1);
  988.                   if OneChar=';' then Break:=true;
  989.                   if OneChar=':' then ThisIsDerivedClass:=true;
  990.                   if OneChar='{' then OneLinerClass:=true;
  991.                   end;
  992.          {extract derived class}
  993.          if ThisIsDerivedClass=true then
  994.             begin
  995.  
  996.             { Get the 2nd derivation class name}
  997.             CopyLength:=StrLength;
  998.             TempString:='';
  999.             Done:=false;
  1000.             CurrentSecondClass:='';
  1001.             while Done=false do
  1002.                begin
  1003.                TempString:=Copy(OneLineOfCode,CopyLength,1);
  1004.                if (TempString=':') or (TempString=' ') then Done:=true;
  1005.  
  1006.                if (TempString<>'{') and (Done=false) then
  1007.                   begin
  1008.                   AppendStr(TempString,CurrentSecondClass);
  1009.                   CurrentSecondClass:=TempString;
  1010.                   end;
  1011.                Dec(CopyLength);
  1012.                end;
  1013.  
  1014.             {Get Class Name}
  1015.             x:=1;
  1016.             while (x<>StrLength+1) and (Break<>true) do {read 1 char at a time of string}
  1017.                begin
  1018.                OneChar:=''; {clear it}
  1019.                OneChar:=Copy(OneLineOfCode,x,1);
  1020.                if OneChar=':' then  { Search for derived classes, find scope operator}
  1021.                   begin
  1022.                   OneChar:=' '; {clear it}
  1023.                   x:=x-1; {move off of : }
  1024.                   OneChar:=Copy(OneLineOfCode,x,1);
  1025.                   while OneChar=' ' do  {backup until found last class letter}
  1026.                      begin
  1027.                      Dec(x);
  1028.                      OneChar:=Copy(OneLineOfCode,x,1);
  1029.                      end;
  1030.                   while OneChar<>' ' do  {backup until found first class letter}
  1031.                      begin
  1032.                      OneChar:=Copy(OneLineOfCode,x,1);
  1033.                      Dec(x);
  1034.                      end;
  1035.                   x:=x+2;
  1036.                   OneChar:=Copy(OneLineOfCode,x,1);
  1037.                   while (OneChar<>' ') and (OneChar<>':') do
  1038.                      begin
  1039.                      ExtractedClassName:=ExtractedClassName+OneChar;
  1040.                      Inc(x);
  1041.                      OneChar:=Copy(OneLineOfCode,x,1);
  1042.                      end;
  1043.                   Break:=true; {stop loading chars- one at a time}
  1044.                   ExtractClassMembers(ClassSearch.PositionFound,ExtractedClassName);  {derived class}
  1045.                   end;
  1046.                Inc(x);
  1047.                end;            
  1048.             CurrentSecondClass:='';
  1049.             end;{end of extract derived class}
  1050.  
  1051.         {extract base classes}
  1052.         if (ThisIsDerivedClass=false) and (OneLinerClass=true) then
  1053.            begin
  1054.            x:=1;
  1055.            while (x<>StrLength+1) and (Break<>true) do {read 1 char at a time of string}
  1056.                begin
  1057.                OneChar:=''; {clear it}
  1058.                OneChar:=Copy(OneLineOfCode,x,1);
  1059.                if OneChar='{' then
  1060.                   begin
  1061.                   x:=x-1; { move off of : }
  1062.                   OneChar:=Copy(OneLineOfCode,x,1);
  1063.                   while OneChar=' ' do  {backup until found last class letter}
  1064.                      begin
  1065.                      Dec(x);
  1066.                      OneChar:=Copy(OneLineOfCode,x,1);
  1067.                      end;
  1068.                   while OneChar<>' ' do  {backup until found first class letter}
  1069.                      begin
  1070.                      OneChar:=Copy(OneLineOfCode,x,1);
  1071.                      Dec(x);
  1072.                      end;
  1073.                   x:=x+2;
  1074.                   OneChar:=Copy(OneLineOfCode,x,1);
  1075.                   while (OneChar<>' ') and (OneChar<>'{') do
  1076.                      begin
  1077.                      ExtractedClassName:=ExtractedClassName+OneChar;
  1078.                      Inc(x);
  1079.                      OneChar:=Copy(OneLineOfCode,x,1);
  1080.                      end;
  1081.                   Break:=true; {stop loading chars- one at a time}
  1082.                   ExtractClassMembers(ClassSearch.PositionFound,ExtractedClassName);  {Base class}
  1083.                   end;
  1084.                Inc(x);
  1085.                end;
  1086.            end;{end of base class extraction}
  1087.  
  1088.  
  1089.         {start of two line class declaration}
  1090.         if (OneLinerClass=false) and (ThisIsDerivedClass=false) and (Break<>true) then
  1091.            begin
  1092.            x:=StrLength;
  1093.            OneChar:=Copy(OneLineOfCode,x,1);
  1094.            while OneChar=' ' do  {backup until found last class letter}
  1095.               begin
  1096.               Dec(x);
  1097.               OneChar:=Copy(OneLineOfCode,x,1);
  1098.               end;
  1099.            while OneChar<>' ' do  {backup until found first class letter}
  1100.               begin
  1101.               OneChar:=Copy(OneLineOfCode,x,1);
  1102.               Dec(x);
  1103.               end;
  1104.            x:=x+2;
  1105.            OneChar:=Copy(OneLineOfCode,x,1);
  1106.            while x<>StrLength+1 do
  1107.               begin
  1108.               ExtractedClassName:=ExtractedClassName+OneChar;
  1109.               Inc(x);
  1110.               OneChar:=Copy(OneLineOfCode,x,1);
  1111.               end; {stop loading chars- one at a time}
  1112.            ExtractClassMembers(ClassSearch.PositionFound,ExtractedClassName);  { 2 line class }
  1113.            end;
  1114.          end;
  1115.          {end of two line class declaration}
  1116.       EndOfSearch:=ClassSearch.PositionFound;
  1117.       CompensateFirstSearch:=ClassSearch.NewSearchPosition;
  1118.       end;
  1119.  
  1120.    {Dont do tabs if table rebuild}
  1121.    if FileOpenActive<>true then
  1122.       begin
  1123.       ConvertTableToTabs;
  1124.       SelectaTab(Sender);
  1125.       end;
  1126.    end;
  1127.  
  1128.  
  1129. procedure TMainDlg.ExtractClassMembers(ClassPosition:Integer;ClassName:string); 
  1130.    var
  1131.    PublishedMember:string;
  1132.    HasPublishedMembers:Boolean;
  1133.    PublishedMembers:TSearchEngine;
  1134.    PublishedMemberLineNumber:Integer;
  1135.    AllMembersDone:Boolean;
  1136.    PublicMembersDone:Boolean;
  1137.    ProtectedMembersDone:Boolean;
  1138.    PrivateMembersDone:Boolean;
  1139.    PublishedMembersDone:Boolean;
  1140.    PublicMember:string;
  1141.    PrivateMember:string;
  1142.    ProtectedMember:string;
  1143.    HasPublicMembers:Boolean;
  1144.    HasProtectedMembers:Boolean;
  1145.    HasPrivateMembers:Boolean;
  1146.    BeginClassBracket:TSearchEngine;
  1147.    PublicMembers:TSearchEngine;
  1148.    PrivateMembers:TSearchEngine;
  1149.    ProtectedMembers:TSearchEngine;
  1150.    MemberCommentSearch:TSearchEngine;
  1151.    n:Integer;
  1152.    StrLength:Integer;
  1153.    j:Integer;
  1154.    ClassMember:string;
  1155.    PublicMemberLineNumber:Integer;
  1156.    ProtectedMemberLineNumber:Integer;
  1157.    PrivateMemberLineNumber:Integer;
  1158.    FoundEnd:Boolean;
  1159.    LineLength:Integer;
  1160.    CompleteMemberLinesCount:Integer;
  1161.    r:Integer;
  1162.    OneChar:string;
  1163.    b:Integer;
  1164.    Break:Boolean;
  1165.    x:Integer;
  1166.    FoundAnOpenBracket:Boolean;
  1167.    MyCount:Integer;
  1168.    MemberFoundPositionOne:uint;
  1169.    EndBracket:uint;
  1170.    FoundEqual:Boolean;
  1171.    MorePublisheds:Integer;
  1172.    MorePublics:Integer;
  1173.    MoreProtecteds:Integer;
  1174.    MorePrivates:Integer;
  1175.    begin
  1176.    HasPublishedMembers:=false;
  1177.    PublishedMember:='';
  1178.    PublishedMembers:=TSearchEngine.Create;
  1179.    PublishedMembers.SearchForString('__published:',1,ClassPosition,'Include');
  1180.    Break:=false;
  1181.    MyCount:=0;
  1182.    FoundAnOpenBracket:=false;
  1183.    AllMembersDone:=false;
  1184.    HasPublicMembers:=false;
  1185.    HasProtectedMembers:=false;
  1186.    HasPrivateMembers:=false;
  1187.    PublicMember:='';
  1188.    PrivateMember:='';
  1189.    ProtectedMember:='';
  1190.    MemberCommentSearch:=TSearchEngine.Create;
  1191.    BeginClassBracket:=TSearchEngine.Create;
  1192.    PublicMembers:=TSearchEngine.Create;
  1193.    ProtectedMembers:=TSearchEngine.Create;
  1194.    PrivateMembers:=TSearchEngine.Create;
  1195.    BeginClassBracket.SearchForString('{',1,ClassPosition,'Include');
  1196.    PublicMembers.SearchForString('public:',1,ClassPosition,'Include');
  1197.    ProtectedMembers.SearchForString('protected:',1,ClassPosition,'Include');
  1198.    PrivateMembers.SearchForString('private:',1,ClassPosition,'Include');
  1199.    b:= BeginClassBracket.LineNumberFound;
  1200.    MorePublisheds:=2;
  1201.    MorePublics:=2;
  1202.    MoreProtecteds:=2;
  1203.    MorePrivates:=2;
  1204.    DestTable.Close();
  1205.    DestTable.TableName:='main2.db';
  1206.    DestTable.Open();
  1207.  
  1208.    while Break<>true do
  1209.       begin
  1210.       x:=1;
  1211.       StrLength:=Length(CodePageForm.CodePage.Lines[b]);  {actual void Calls() line}
  1212.       while (x<>StrLength+1) and (Break<>True) do
  1213.          begin
  1214.          OneChar:=Copy(CodePageForm.CodePage.Lines[b],x,1);
  1215.          if OneChar='{' then
  1216.             begin
  1217.             FoundAnOpenBracket:=true;
  1218.             MyCount:=MyCount+1;
  1219.             end;
  1220.          if OneChar='}' then MyCount:=MyCount-1;
  1221.          Inc(x);
  1222.          if (MyCount=0) and (FoundAnOpenBracket=true) then Break:=true;
  1223.          end;
  1224.       Inc(b);
  1225.       end;
  1226.       b:=b-1;
  1227.    { line position that last ; is on }
  1228.    MemberFoundPositionOne:=SendMessage(CodePageForm.CodePage.Handle,EM_LINEINDEX,b,0);
  1229.    EndBracket:=MemberFoundPositionOne+(x-1);
  1230.  
  1231.    if (PublishedMembers.PositionFound<EndBracket) and (PublishedMembers.PositionFound<>-1) then HasPublishedMembers:=true;
  1232.    if (PublicMembers.PositionFound<EndBracket) and (PublicMembers.PositionFound<>-1) then HasPublicMembers:=true;
  1233.    if (ProtectedMembers.PositionFound<EndBracket) and (ProtectedMembers.PositionFound<>-1) then HasProtectedMembers:=true;
  1234.    if (PrivateMembers.PositionFound<EndBracket) and (PrivateMembers.PositionFound<>-1) then HasPrivateMembers:=true;
  1235.  
  1236.  
  1237.    while HasPublishedMembers do {begin Published members}
  1238.       begin
  1239.       n:=1;
  1240.       PublishedMembersDone:=false;
  1241.       while PublishedMembersDone<>true do
  1242.          begin
  1243.          if ((PublishedMembers.LineNumberFound+n)=(PublicMembers.LineNumberFound)) or
  1244.             ((PublishedMembers.LineNumberFound+n)=(ProtectedMembers.LineNumberFound)) or
  1245.             ((PublishedMembers.LineNumberFound+n)=(PrivateMembers.LineNumberFound)) or
  1246.             ((PublishedMembers.LineNumberFound+n)=(b))  then PublishedMembersDone:=true;
  1247.  
  1248.          ClassMember:='';
  1249.          ClassMember:=CodePageForm.CodePage.Lines[PublishedMembers.LineNumberFound+n];  {line where Published is}
  1250.          if (Pos('public:',ClassMember)<>0) then PublishedMembersDone:=true;
  1251.          if (Pos('private:',ClassMember)<>0) then PublishedMembersDone:=true;
  1252.          if (Pos('__published:',ClassMember)<>0) then PublishedMembersDone:=true;
  1253.          if (Pos('protected:',ClassMember)<>0) then PublishedMembersDone:=true;
  1254.          PublishedMemberLineNumber:=PublishedMembers.LineNumberFound+n;
  1255.  
  1256.  
  1257.          while IsItABadLine(ClassMember,PublishedMemberLineNumber)=true do {check for bad line}
  1258.             begin
  1259.             ClassMember:=CodePageForm.CodePage.Lines[PublishedMembers.LineNumberFound+n+1];
  1260.             if (Pos('public:',ClassMember)<>0) then PublishedMembersDone:=true;
  1261.             if (Pos('private:',ClassMember)<>0) then PublishedMembersDone:=true;
  1262.             if (Pos('__published:',ClassMember)<>0) then PublishedMembersDone:=true;
  1263.             if (Pos('protected:',ClassMember)<>0) then PublishedMembersDone:=true;
  1264.             if ((PublishedMembers.LineNumberFound+n+1)=(PublicMembers.LineNumberFound)) or
  1265.                ((PublishedMembers.LineNumberFound+n+1)=(ProtectedMembers.LineNumberFound)) or
  1266.                ((PublishedMembers.LineNumberFound+n+1)=(PrivateMembers.LineNumberFound)) or
  1267.                ((PublishedMembers.LineNumberFound+n+1)=(b))  then PublishedMembersDone:=true;
  1268.                PublishedMemberLineNumber:=PublishedMembers.LineNumberFound+n+1;
  1269.                Inc(n);
  1270.             end;{end of bad line adjustment}
  1271.  
  1272.          if PublishedMembersDone=false then
  1273.             begin
  1274.             FoundEqual:=false;
  1275.             FoundEnd:=false;
  1276.             CompleteMemberLinesCount:=1;
  1277.             while FoundEnd<>true do   {Append multiple line functions}
  1278.                begin
  1279.                   LineLength:=Length(ClassMember);
  1280.                   for r:=1 to LineLength+1 do {check first line}
  1281.                      begin
  1282.                      OneChar:=Copy(ClassMember,r,1);
  1283.                      if OneChar='=' then FoundEqual:=true;
  1284.                      if OneChar=';' then FoundEnd:=true;
  1285.                      if (OneChar='}') and (FoundEqual=false) then FoundEnd:=true;
  1286.                      end;
  1287.                 if FoundEnd=false then
  1288.                      ClassMember:=ClassMember+CodePageForm.CodePage.Lines[PublishedMembers.LineNumberFound+n+CompleteMemberLinesCount];
  1289.                 Inc(CompleteMemberLinesCount);
  1290.                 end;
  1291.             MemberToTable(ClassMember,'__published',ClassName,PublishedMemberLineNumber);
  1292.             end;
  1293.  
  1294.          n:=n+CompleteMemberLinesCount-2;
  1295.          Inc(n);
  1296.          end;
  1297.       HasPublishedMembers:=false;
  1298.       PublishedMembers.SearchForString('__published:',MorePublisheds,ClassPosition,'Include');
  1299.       if (PublishedMembers.PositionFound<EndBracket) and (PublishedMembers.PositionFound<>-1) then
  1300.          begin
  1301.          HasPublishedMembers:=true;
  1302.          Inc(MorePublisheds);
  1303.          end;
  1304.       end;
  1305.  
  1306.    while HasPublicMembers do {begin public members}
  1307.       begin
  1308.       n:=1;
  1309.       PublicMembersDone:=false;
  1310.       while PublicMembersDone<>true do
  1311.          begin
  1312.          if ((PublicMembers.LineNumberFound+n)=(PublishedMembers.LineNumberFound)) or
  1313.             ((PublicMembers.LineNumberFound+n)=(ProtectedMembers.LineNumberFound)) or
  1314.             ((PublicMembers.LineNumberFound+n)=(PrivateMembers.LineNumberFound)) or
  1315.             ((PublicMembers.LineNumberFound+n)=(b))  then PublicMembersDone:=true;
  1316.          ClassMember:='';
  1317.          ClassMember:=CodePageForm.CodePage.Lines[PublicMembers.LineNumberFound+n];  { line where public is }
  1318.          if (Pos('public:',ClassMember)<>0) then PublicMembersDone:=true;
  1319.          if (Pos('private:',ClassMember)<>0) then PublicMembersDone:=true;
  1320.          if (Pos('__published:',ClassMember)<>0) then PublicMembersDone:=true;
  1321.          if (Pos('protected:',ClassMember)<>0) then PublicMembersDone:=true;
  1322.          PublicMemberLineNumber:=PublicMembers.LineNumberFound+n;
  1323.  
  1324.  
  1325.          while IsItABadLine(ClassMember,PublicMemberLineNumber)=true do { check for bad line }
  1326.             begin
  1327.             ClassMember:=CodePageForm.CodePage.Lines[PublicMembers.LineNumberFound+n+1];
  1328.             if (Pos('public:',ClassMember)<>0) then PublicMembersDone:=true;
  1329.             if (Pos('private:',ClassMember)<>0) then PublicMembersDone:=true;
  1330.             if (Pos('__published:',ClassMember)<>0) then PublicMembersDone:=true;
  1331.             if (Pos('protected:',ClassMember)<>0) then PublicMembersDone:=true;
  1332.             if ((PublicMembers.LineNumberFound+n+1)=(PublishedMembers.LineNumberFound)) or
  1333.                ((PublicMembers.LineNumberFound+n+1)=(ProtectedMembers.LineNumberFound)) or
  1334.                ((PublicMembers.LineNumberFound+n+1)=(PrivateMembers.LineNumberFound)) or
  1335.                ((PublicMembers.LineNumberFound+n+1)=(b))  then PublicMembersDone:=true;
  1336.                PublicMemberLineNumber:=PublicMembers.LineNumberFound+n+1;
  1337.                Inc(n);
  1338.             end;{ end of bad line adjustment }
  1339.  
  1340.          if PublicMembersDone=false then
  1341.             begin
  1342.             FoundEqual:=false;
  1343.             FoundEnd:=false;
  1344.             CompleteMemberLinesCount:=1;
  1345.             while FoundEnd<>true do   {Append multiple line functions }
  1346.                begin
  1347.                   LineLength:=Length(ClassMember);
  1348.                   for r:=1 to LineLength+1 do { check first line }
  1349.                      begin
  1350.                      OneChar:=Copy(ClassMember,r,1);
  1351.                      if OneChar='=' then FoundEqual:=true;
  1352.                      if OneChar=';' then FoundEnd:=true;
  1353.                      if (OneChar='}') and (FoundEqual=false) then FoundEnd:=true;
  1354.                      end;
  1355.                 if FoundEnd=false then
  1356.                      ClassMember:=ClassMember+CodePageForm.CodePage.Lines[PublicMembers.LineNumberFound+n+CompleteMemberLinesCount];
  1357.                 Inc(CompleteMemberLinesCount);
  1358.                 end;
  1359.             MemberToTable(ClassMember,'public',ClassName,PublicMemberLineNumber);
  1360.             end;
  1361.  
  1362.          n:=n+CompleteMemberLinesCount-2;
  1363.          Inc(n);
  1364.          end;
  1365.       HasPublicMembers:=false;
  1366.       PublicMembers.SearchForString('public:',MorePublics,ClassPosition,'Include');
  1367.       if (PublicMembers.PositionFound<EndBracket) and (PublicMembers.PositionFound<>-1) then
  1368.          begin
  1369.          HasPublicMembers:=true;
  1370.          Inc(MorePublics);
  1371.          end;
  1372.       end;
  1373.  
  1374.  
  1375.    while HasProtectedMembers do {  begin protected members  }
  1376.       begin
  1377.       n:=1;
  1378.       ProtectedMembersDone:=false;
  1379.       while ProtectedMembersDone<>true do
  1380.          begin
  1381.          if ((ProtectedMembers.LineNumberFound+n)=(PublishedMembers.LineNumberFound)) or
  1382.             ((ProtectedMembers.LineNumberFound+n)=(PublicMembers.LineNumberFound)) or
  1383.             ((ProtectedMembers.LineNumberFound+n)=(PrivateMembers.LineNumberFound)) or
  1384.             ((ProtectedMembers.LineNumberFound+n)=(b))  then ProtectedMembersDone:=true;
  1385.          
  1386.          ClassMember:='';
  1387.           {skip blank lines and load a new line }
  1388.          ClassMember:=CodePageForm.CodePage.Lines[ProtectedMembers.LineNumberFound+n];  { line where protected is }
  1389.          if (Pos('public:',ClassMember)<>0) then ProtectedMembersDone:=true;
  1390.          if (Pos('private:',ClassMember)<>0) then ProtectedMembersDone:=true;
  1391.          if (Pos('__published:',ClassMember)<>0) then ProtectedMembersDone:=true;
  1392.          if (Pos('protected:',ClassMember)<>0) then ProtectedMembersDone:=true;
  1393.  
  1394.  
  1395.          ProtectedMemberLineNumber:=ProtectedMembers.LineNumberFound+n;
  1396.           while IsItABadLine(ClassMember,ProtectedMemberLineNumber)=true do
  1397.             begin
  1398.             ClassMember:=CodePageForm.CodePage.Lines[ProtectedMembers.LineNumberFound+n+1];
  1399.             if (Pos('public:',ClassMember)<>0) then ProtectedMembersDone:=true;
  1400.             if (Pos('private:',ClassMember)<>0) then ProtectedMembersDone:=true;
  1401.             if (Pos('__published:',ClassMember)<>0) then ProtectedMembersDone:=true;
  1402.             if (Pos('protected:',ClassMember)<>0) then ProtectedMembersDone:=true;
  1403.             if ((ProtectedMembers.LineNumberFound+n+1)=(PublishedMembers.LineNumberFound)) or
  1404.                ((ProtectedMembers.LineNumberFound+n+1)=(PublicMembers.LineNumberFound)) or
  1405.                ((ProtectedMembers.LineNumberFound+n+1)=(PrivateMembers.LineNumberFound)) or
  1406.                ((ProtectedMembers.LineNumberFound+n+1)=(b)) then ProtectedMembersDone:=true;
  1407.             ProtectedMemberLineNumber:=ProtectedMembers.LineNumberFound+n+1;
  1408.             Inc(n)
  1409.             end;{ end of blank line adjustment }
  1410.  
  1411.          if ProtectedMembersDone=false then
  1412.            begin
  1413.            FoundEqual:=false;
  1414.            FoundEnd:=false;
  1415.            CompleteMemberLinesCount:=1;
  1416.            while FoundEnd<>true do   {Append multiple line functions }
  1417.               begin
  1418.                  LineLength:=Length(ClassMember);
  1419.                  for r:=1 to LineLength+1 do { check first line }
  1420.                     begin
  1421.                     OneChar:=Copy(ClassMember,r,1);
  1422.                     if OneChar='=' then FoundEqual:=true;
  1423.                     if OneChar=';' then FoundEnd:=true;
  1424.                     if (OneChar='}') and (FoundEqual=false) then FoundEnd:=true;
  1425.                     end;
  1426.                if FoundEnd=false then
  1427.                     ClassMember:=ClassMember+CodePageForm.CodePage.Lines[ProtectedMembers.LineNumberFound+n+CompleteMemberLinesCount];
  1428.                Inc(CompleteMemberLinesCount);
  1429.                end;
  1430.             MemberToTable(ClassMember,'protected',ClassName,ProtectedMemberLineNumber);
  1431.             end;
  1432.          n:=n+CompleteMemberLinesCount-2;
  1433.  
  1434.          Inc(n);
  1435.          end;
  1436.       HasProtectedMembers:=false;
  1437.       ProtectedMembers.SearchForString('protected:',MoreProtecteds,ClassPosition,'Include');
  1438.       if (ProtectedMembers.PositionFound<EndBracket) and (ProtectedMembers.PositionFound<>-1) then
  1439.          begin
  1440.          HasProtectedMembers:=true;
  1441.          Inc(MoreProtecteds);
  1442.          end;
  1443.       end;
  1444.  
  1445.    while HasPrivateMembers do {  begin public members  }
  1446.       begin
  1447.       n:=1;
  1448.       PrivateMembersDone:=false;
  1449.       while PrivateMembersDone<>true do
  1450.          begin
  1451.          if ((PrivateMembers.LineNumberFound+n)=(PublishedMembers.LineNumberFound)) or
  1452.             ((PrivateMembers.LineNumberFound+n)=(ProtectedMembers.LineNumberFound)) or
  1453.             ((PrivateMembers.LineNumberFound+n)=(PublicMembers.LineNumberFound)) or
  1454.             ((PrivateMembers.LineNumberFound+n)=(b))  then PrivateMembersDone:=true;
  1455.          
  1456.          ClassMember:='';
  1457.           {skip blank lines and load a new line }
  1458.          ClassMember:=CodePageForm.CodePage.Lines[PrivateMembers.LineNumberFound+n];  { line where public is }
  1459.          if (Pos('public:',ClassMember)<>0) then PrivateMembersDone:=true;
  1460.          if (Pos('private:',ClassMember)<>0) then PrivateMembersDone:=true;
  1461.          if (Pos('__published:',ClassMember)<>0) then PrivateMembersDone:=true;
  1462.          if (Pos('protected:',ClassMember)<>0) then PrivateMembersDone:=true;
  1463.          PrivateMemberLineNumber:=PrivateMembers.LineNumberFound+n;
  1464.  
  1465.           while IsItABadLine(ClassMember,PrivateMemberLineNumber)=true do
  1466.             begin
  1467.             ClassMember:=CodePageForm.CodePage.Lines[PrivateMembers.LineNumberFound+n+1];
  1468.             if (Pos('public:',ClassMember)<>0) then PrivateMembersDone:=true;
  1469.             if (Pos('private:',ClassMember)<>0) then PrivateMembersDone:=true;
  1470.             if (Pos('__published:',ClassMember)<>0) then PrivateMembersDone:=true;
  1471.             if (Pos('protected:',ClassMember)<>0) then PrivateMembersDone:=true;
  1472.             if ((PrivateMembers.LineNumberFound+n+1)=(PublishedMembers.LineNumberFound)) or
  1473.                ((PrivateMembers.LineNumberFound+n+1)=(ProtectedMembers.LineNumberFound)) or
  1474.                ((PrivateMembers.LineNumberFound+n+1)=(PublicMembers.LineNumberFound)) or
  1475.                ((PrivateMembers.LineNumberFound+n+1)=(b)) then PrivateMembersDone:=true;
  1476.             PrivateMemberLineNumber:=PrivateMembers.LineNumberFound+n+1;
  1477.             Inc(n)
  1478.             end;{ end of blank line adjustment }
  1479.  
  1480.          if PrivateMembersDone=false then
  1481.             begin
  1482.             FoundEqual:=false;
  1483.             FoundEnd:=false;
  1484.             CompleteMemberLinesCount:=1;
  1485.             while FoundEnd<>true do   {Append multiple line functions }
  1486.                begin
  1487.                   LineLength:=Length(ClassMember);
  1488.                   for r:=1 to LineLength+1 do { check first line }
  1489.                      begin
  1490.                      OneChar:=Copy(ClassMember,r,1);
  1491.                      if OneChar='=' then FoundEqual:=true;
  1492.                      if OneChar=';' then FoundEnd:=true;
  1493.                      if (OneChar='}') and (FoundEqual=false) then FoundEnd:=true;
  1494.                      end;
  1495.                 if FoundEnd=false then
  1496.                      ClassMember:=ClassMember+CodePageForm.CodePage.Lines[PrivateMembers.LineNumberFound+n+CompleteMemberLinesCount];
  1497.                 Inc(CompleteMemberLinesCount);
  1498.                 end;
  1499.             MemberToTable(ClassMember,'private',ClassName,PrivateMemberLineNumber);
  1500.             end;
  1501.          n:=n+CompleteMemberLinesCount-2;
  1502.          Inc(n);
  1503.          end;
  1504.       HasPrivateMembers:=false;
  1505.       PrivateMembers.SearchForString('private:',MorePrivates,ClassPosition,'Include');
  1506.       if (PrivateMembers.PositionFound<EndBracket) and (PrivateMembers.PositionFound<>-1) then
  1507.          begin
  1508.          HasPrivateMembers:=true;
  1509.          Inc(MorePrivates);
  1510.          end;
  1511.       end;
  1512.    end;
  1513.  
  1514.  
  1515. procedure TMainDlg.MemberToTable(MemberDeclaration:string;MyScope:string;CppClassName:string;MemberLineNumber:Integer);
  1516.    var
  1517.    k:Integer;
  1518.    v:Integer;
  1519.    EndOfParams:Boolean;
  1520.    ExtractObjects:TExtractObjects;
  1521.    IsItAFunction:Boolean;
  1522.    Break:Boolean;
  1523.    StrLength:Integer;
  1524.    y:Integer;
  1525.    OneChar:string;
  1526.    ArrayObjectNames:array[0..8] of string;
  1527.    ArrayObjectTypes:array[0..8]of string;
  1528.    MemberCommentSearch:TSearchEngine;
  1529.    MemberFoundPositionOne:uint;
  1530.    IsItAProperty:Integer;
  1531.    Len:Integer;
  1532.    ClassMemberName:string;
  1533.    begin
  1534.    DestTable.Append();
  1535.    MemberCommentSearch:=TSearchEngine.Create;
  1536.    IsItAFunction:=false;
  1537.    ExtractObjects:=TExtractObjects.Create;
  1538.    Break:=false;
  1539.    StrLength:=Length(MemberDeclaration);
  1540.    y:=1;
  1541.    IsItAProperty:=Pos('__property',MemberDeclaration);
  1542.  
  1543.    while (y<>StrLength+1) and (Break<>true) do { read line }
  1544.       begin
  1545.       OneChar:=''; { clear it} 
  1546.       OneChar:=Copy(MemberDeclaration,y,1);   { look for ( bracket }
  1547.       if (OneChar='(') or (y=StrLength) or (OneChar='=')or (OneChar='[')then {for data and function members }
  1548.          begin
  1549.          if OneChar='(' then IsItAFunction:=true;
  1550.          if OneChar='=' then IsItAFunction:=true;
  1551.          {skip over member comments and extract member type and name }
  1552.          MemberFoundPositionOne:=SendMessage(CodePageForm.CodePage.Handle,EM_LINEINDEX,MemberLineNumber,0);
  1553.          MemberCommentSearch.SearchForString('*/',1,MemberFoundPositionOne,'Include');
  1554.          if (MemberCommentSearch.PositionFound=-1) or (MemberCommentSearch.PositionFound>MemberFoundPositionOne+y) then
  1555.              ExtractObjects.ExtractObjectNameAndType(1,y,MemberDeclaration,'MemberName')
  1556.              else
  1557.                 begin
  1558.                 ExtractObjects.ExtractObjectNameAndType((MemberCommentSearch.PositionFound-MemberFoundPositionOne)+3,
  1559.                                                         y,MemberDeclaration,'MemberName');{ get name and type }
  1560.                 end;
  1561.          OneChar:=Copy(ExtractObjects.ObjectName,0,1);
  1562.          if OneChar='*' then
  1563.             begin  { make sure pointers are on type side }
  1564.             Len:=Length(ExtractObjects.ObjectName);
  1565.             ExtractObjects.ObjectName:=Copy(ExtractObjects.ObjectName,2,Len);
  1566.             AppendStr(ExtractObjects.ObjectType,'*');
  1567.             end;
  1568.          if OneChar='&' then
  1569.             begin  { make sure references are on type side }
  1570.             Len:=Length(ExtractObjects.ObjectName);
  1571.             ExtractObjects.ObjectName:=Copy(ExtractObjects.ObjectName,2,Len);
  1572.             AppendStr(ExtractObjects.ObjectType,'&');
  1573.             end;
  1574.          ClassMemberName:=ExtractObjects.ObjectName;
  1575.          DestTableMemberName.AsString:=ClassMemberName;
  1576.          DestTableReturnType.AsString:=ExtractObjects.ObjectType;
  1577.          Break:=true;
  1578.          EndOfParams:=false;
  1579.          v:=0;
  1580.          {extract parameters}
  1581.          while (EndOfParams<>true) and (v<>StrLength+1) and (IsItAFunction=true )do
  1582.             begin
  1583.             k:=1;
  1584.             v:=y+1;
  1585.             OneChar:=Copy(MemberDeclaration,v,1);
  1586.             if OneChar=')' then EndOfParams:=true;
  1587.             if OneChar='}' then EndOfParams:=true;
  1588.             ExtractObjects.LastCommaPosition:=y;
  1589.             while EndOfParams<>true do
  1590.                begin
  1591.                OneChar:=Copy(MemberDeclaration,v,1);
  1592.                if OneChar=')' then EndOfParams:=true;
  1593.                if OneChar='}' then EndOfParams:=true;
  1594.                if (OneChar=',') or (OneChar=')') or (OneChar='}')then
  1595.                   begin
  1596.                   ExtractObjects.ObjectName:='';
  1597.                   ExtractObjects.ObjectType:='';
  1598.                   ExtractObjects.ExtractObjectNameAndType(ExtractObjects.LastCommaPosition+1,v,MemberDeclaration,
  1599.                   'Parameter');
  1600.                   OneChar:=Copy(ExtractObjects.ObjectName,0,1);
  1601.                   if OneChar='*' then
  1602.                      begin  {make sure pointers are on type side }
  1603.                      Len:=Length(ExtractObjects.ObjectName);
  1604.                      ExtractObjects.ObjectName:=Copy(ExtractObjects.ObjectName,2,Len);
  1605.                      AppendStr(ExtractObjects.ObjectType,'*');
  1606.                      end;
  1607.                   if OneChar='&' then
  1608.                      begin  { make sure references are on type side }
  1609.                      Len:=Length(ExtractObjects.ObjectName);
  1610.                      ExtractObjects.ObjectName:=Copy(ExtractObjects.ObjectName,2,Len);
  1611.                      AppendStr(ExtractObjects.ObjectType,'&');
  1612.                      end;
  1613.                   ArrayObjectNames[k]:=ExtractObjects.ObjectName;
  1614.                   ArrayObjectTypes[k]:=ExtractObjects.ObjectType;
  1615.                   Inc(k);
  1616.                   if k=9 then EndOfParams:=true;
  1617.                   end;
  1618.                Inc(v);
  1619.                end;
  1620.             end;
  1621.             DestTablePType1.AsString:=ArrayObjectTypes[1];
  1622.             DestTablePType2.AsString:=ArrayObjectTypes[2];
  1623.             DestTablePType3.AsString:=ArrayObjectTypes[3];
  1624.             DestTablePType4.AsString:=ArrayObjectTypes[4];
  1625.             DestTablePType5.AsString:=ArrayObjectTypes[5];
  1626.             DestTablePType6.AsString:=ArrayObjectTypes[6];
  1627.             DestTablePType7.AsString:=ArrayObjectTypes[7];
  1628.             DestTablePType8.AsString:=ArrayObjectTypes[8];
  1629.             DestTablePObject1.AsString:=ArrayObjectNames[1];
  1630.             DestTablePObject2.AsString:=ArrayObjectNames[2];
  1631.             DestTablePObject3.AsString:=ArrayObjectNames[3];
  1632.             DestTablePObject4.AsString:=ArrayObjectNames[4];
  1633.             DestTablePObject5.AsString:=ArrayObjectNames[5];
  1634.             DestTablePObject6.AsString:=ArrayObjectNames[6];
  1635.             DestTablePObject7.AsString:=ArrayObjectNames[7];
  1636.             DestTablePObject8.AsString:=ArrayObjectNames[8];
  1637.             ArrayObjectTypes[1]:='';
  1638.             ArrayObjectNames[1]:='';
  1639.             ArrayObjectTypes[2]:='';
  1640.             ArrayObjectNames[2]:='';
  1641.             ArrayObjectTypes[3]:='';
  1642.             ArrayObjectNames[3]:='';
  1643.             ArrayObjectTypes[4]:='';
  1644.             ArrayObjectNames[4]:='';
  1645.             ArrayObjectTypes[5]:='';
  1646.             ArrayObjectNames[5]:='';
  1647.             ArrayObjectTypes[6]:='';
  1648.             ArrayObjectNames[6]:='';
  1649.             ArrayObjectTypes[7]:='';
  1650.             ArrayObjectNames[7]:='';
  1651.             ArrayObjectTypes[8]:='';
  1652.             ArrayObjectNames[8]:='';
  1653.             if IsItAFunction=false then DestTablePs.AsInteger:=0;
  1654.             if IsItAFunction=true then  DestTablePs.AsInteger:=k-1;
  1655.             DestTableSecondClass.AsString:=CurrentSecondClass;
  1656.             DestTableHeader.AsString:=CurrentHeaderFileName;
  1657.             DestTableScope.AsString:=MyScope;
  1658.             DestTableClassName.AsString:=CppClassName;
  1659.             DestTableMisc.AsString:=PasSourceFileName;
  1660.             if IsItAFunction=true then
  1661.                begin
  1662.                if CppClassName=ClassMemberName then DestTableMember.AsString:='constructor'
  1663.                   else DestTableMember.AsString:='function';
  1664.                end;
  1665.             if IsItAFunction=false then DestTableMember.AsString:='data';
  1666.             if IsItAProperty<>0 then DestTableMember.AsString:='property';
  1667.             DestTable.Post();
  1668.          end;
  1669.       Inc(y);
  1670.       end;
  1671.    end;
  1672.  
  1673. procedure TExtractObjects.ExtractObjectNameAndType(StartPosition:Integer;
  1674.              EndPosition:Integer; LineString:string;Phase:string);
  1675.    var
  1676.    IsItAProperty:Integer;
  1677.    FindStartofReturnType:Integer;
  1678.    MemberNameFirstCharPos:Integer;
  1679.    x:Integer;
  1680.    j:Integer;
  1681.    OneChar:string;
  1682.    NoReturnType:Boolean;
  1683.    begin
  1684.    NoReturnType:=false;
  1685.    x:=EndPosition;
  1686.    ObjectName:='';
  1687.    ObjectType:='';
  1688.    LastCommaPosition:=EndPosition;
  1689.    x:=x-1;
  1690.    OneChar:=Copy(LineString,x,1);
  1691.    while (OneChar=' ') or (OneChar=#9) do  {backup until found last letter of Object Name}
  1692.       begin
  1693.       Dec(x);
  1694.       OneChar:=Copy(LineString,x,1);
  1695.       end;  {backup until found first letter of member name or (OneChar<>'(')}
  1696.    while (OneChar<>' ') and (OneChar<>'(') and (OneChar<>#9) and (OneChar<>',') and (OneChar<>'{')and (OneChar<>'*')do
  1697.       begin
  1698.       OneChar:=Copy(LineString,x,1);
  1699.       if OneChar='{' then NoReturnType:=true;
  1700.       Dec(x);
  1701.       end;
  1702.    x:=x+2;
  1703.    MemberNameFirstCharPos:=x;
  1704.    OneChar:=Copy(LineString,x,1);
  1705.    IsItAProperty:=Pos('__property',LineString);
  1706.  
  1707.    {Handle extracting property names differently stop only at = and curl bracket}
  1708.    if (IsItAProperty<>0) and (Phase='MemberName') then
  1709.       begin
  1710.       while (OneChar<>'=') and (OneChar<>'}') and (OneChar<>';')do
  1711.          begin
  1712.          ObjectName:=ObjectName+OneChar;
  1713.          Inc(x);
  1714.          OneChar:=Copy(LineString,x,1);
  1715.          end;
  1716.       end
  1717.          else {extract object name}
  1718.          begin
  1719.          while (OneChar<>' ') and (OneChar<>#9)  and (OneChar<>';') and (OneChar<>',')
  1720.                and (OneChar<>'(') and (OneChar<>')')
  1721.                and (OneChar<>'{') and (OneChar<>'}') do
  1722.             begin
  1723.             ObjectName:=ObjectName+OneChar;
  1724.             Inc(x);
  1725.             OneChar:=Copy(LineString,x,1);
  1726.             end;
  1727.          end; 
  1728.  
  1729.    {extract return type}
  1730.    if MemberNameFirstCharPos=1 then NoReturnType:=true;  { is it constructor or destructor}
  1731.    MemberNameFirstCharPos:=MemberNameFirstCharPos-1; { move off of : }
  1732.    OneChar:=Copy(LineString,MemberNameFirstCharPos,1);
  1733.    while (OneChar=' ') and (NoReturnType<>true) do  {backup until found last letter of Return Type}
  1734.       begin
  1735.       if MemberNameFirstCharPos=1 then NoReturnType:=true;
  1736.       Dec(MemberNameFirstCharPos);
  1737.       OneChar:=Copy(LineString,MemberNameFirstCharPos,1);
  1738.       end;
  1739.    if NoReturnType=false then
  1740.       begin
  1741.       FindStartofReturnType:=StartPosition;
  1742.       OneChar:=Copy(LineString,FindStartofReturnType,1);
  1743.       while OneChar=' ' do  {find start pos of ReturnType}
  1744.          begin
  1745.          FindStartofReturnType:=FindStartofReturnType+1;
  1746.          OneChar:=Copy(LineString,FindStartofReturnType,1);
  1747.          end;
  1748.       for j:=FindStartofReturnType to MemberNameFirstCharPos do
  1749.          begin
  1750.          OneChar:=Copy(LineString,j,1);
  1751.          if OneChar<>#9 then ObjectType:=ObjectType+OneChar;
  1752.          end;
  1753.       end;
  1754.    end;
  1755.  
  1756. function TMainDlg.IsItABadLine(Line:string;DefinedLineNumber:Integer):Boolean; { or # line }
  1757.       var
  1758.       StringLength:Integer;
  1759.       x:Integer;
  1760.       FoundSemicolon:Boolean;
  1761.       FoundOpenBracket:Boolean;
  1762.       OneCharacter:string;
  1763.       BadLine:Boolean;
  1764.       DefineLineSearch:TSearchEngine;
  1765.       MemberFoundPositionOne:uint;
  1766.       FoundPound:Boolean;
  1767.       begin
  1768.       DefineLineSearch:=TSearchEngine.Create;
  1769.       FoundSemicolon:=false;
  1770.       FoundOpenBracket:=false;
  1771.       BadLine:=true;
  1772.       FoundPound:=false;
  1773.       StringLength:=Length(Line);
  1774.       for x:=1 to StringLength+1 do
  1775.          begin
  1776.          OneCharacter:=Copy(Line,x,1);
  1777.          if  OneCharacter=';' then FoundSemicolon:=true;
  1778.          if OneCharacter='#' then FoundPound:=true;
  1779.          if  (OneCharacter='(') or (OneCharacter='{') then
  1780.             begin
  1781.             FoundOpenBracket:=true;
  1782.             MemberFoundPositionOne:=SendMessage(CodePageForm.CodePage.Handle,EM_LINEINDEX,DefinedLineNumber,0);
  1783.             DefineLineSearch.SearchForString('define',1,MemberFoundPositionOne,'Include');
  1784.             if (DefineLineSearch.PositionFound<MemberFoundPositionOne+x) and (DefineLineSearch.PositionFound <>-1)
  1785.                 and (FoundPound=true) then
  1786.                 FoundOpenBracket:=false;
  1787.             end
  1788.          end;
  1789.       if FoundSemicolon=true then BadLine:=false;
  1790.       if FoundOpenBracket=true then BadLine:=false;
  1791.       Result:=BadLine;
  1792.       end;
  1793.  
  1794. procedure TMainDlg.LoadDeclarationSource(ListBoxString:string);
  1795.    var
  1796.    FoundAnEqual:Boolean;
  1797.    LineCount:Integer;
  1798.    FoundAnEnd:Boolean;
  1799.    MemberDeclareSearch:TSearchEngine;
  1800.    ClassDeclareSearch:TSearchEngine;
  1801.    ActualCodeLine:string;
  1802.    StrLength:Integer;
  1803.    OneChar:string;
  1804.    d:Integer;
  1805.    FoundFirstChar:Boolean;
  1806.    OccuranceNum:Integer;
  1807.    ListStringLen:Integer;
  1808.    x:Integer;
  1809.    CondensedString:string;
  1810.    HeaderMemberCondensed:string;
  1811.    MatchFound:Boolean;
  1812.    DeclareStringList:TStringList;
  1813.    begin
  1814.    DeclareStringList:=TStringList.Create;
  1815.    DeclareStringList.Clear;
  1816.    DeclarationRichEdit.Lines.Clear;
  1817.    MatchFound:=false;
  1818.    OccuranceNum:=1;
  1819.    FoundFirstChar:=false;
  1820.    ClassDeclareSearch:=TSearchEngine.Create;
  1821.    ClassDeclareSearch.SearchForString(CurrentTabClassName,1,0,'Include');{Search for Class}
  1822.    MemberDeclareSearch:=TSearchEngine.Create;
  1823.    if CurrentTabClassName=CurrentSelectedMemberName then
  1824.       begin
  1825.       OccuranceNum:=2;
  1826.       end;
  1827.    {strip spaces from listbox string}
  1828.    CondensedString:='';
  1829.    ListStringLen:=Length(ListBoxString);
  1830.    for x:=1 to ListStringLen do
  1831.       begin
  1832.       OneChar:=Copy(ListBoxString,x,1);
  1833.       if (OneChar<>' ') and (OneChar<>#9) then CondensedString:=CondensedString+OneChar;
  1834.       end;
  1835.    {Search for MemberName only}
  1836.    while MatchFound<>true do
  1837.       begin                               {this is the member name only}
  1838.       MemberDeclareSearch.SearchForString(CurrentSelectedMemberName,OccuranceNum,ClassDeclareSearch.PositionFound,'Include');
  1839.       if MemberDeclareSearch.PositionFound=-1 then
  1840.          begin
  1841.          Errorlogging.Open;
  1842.          ErrorLogging.Append;
  1843.          ErrorLoggingUser.AsString:=UserName;
  1844.          ErrorLoggingClassName.AsString:=CurrentTabClassName;
  1845.          ErrorLoggingListBoxText.AsString:=ListBoxString;
  1846.          ErrorLoggingMemberName.AsString:=CurrentSelectedMemberName;
  1847.          ErrorLogging.Post;
  1848.          Errorlogging.Close;
  1849.          MessageDlg('Table/ListBox error !! '+ListBoxString+
  1850.           ' record does not match header!',mtError, [mbOk], 0);
  1851.          Exit;
  1852.          end;
  1853.       FoundAnEqual:=false;
  1854.       FoundAnEnd:=false;
  1855.       LineCount:=0;
  1856.       HeaderMemberCondensed:='';
  1857.       while FoundAnEnd<>true do {Append multiple line functions}
  1858.          begin
  1859.          d:=1;
  1860.          ActualCodeLine:='';
  1861.          StrLength:=Length(CodePageForm.CodePage.Lines[MemberDeclareSearch.LineNumberFound + LineCount]);
  1862.          while (d<>StrLength+1) and (FoundAnEnd<>true) do
  1863.             begin
  1864.             OneChar:=Copy(CodePageForm.CodePage.Lines[MemberDeclareSearch.LineNumberFound + LineCount],d,1);
  1865.             if OneChar='=' then FoundAnEqual:=true;
  1866.             if OneChar=';' then FoundAnEnd:=true;
  1867.             if (OneChar='}') and (FoundAnEqual=false) then FoundAnEnd:=true;
  1868.             if (OneChar<>' ') and (OneChar<>#9) then
  1869.                begin
  1870.                FoundFirstChar:=true; { Once we found a source match we want to condense it}
  1871.                HeaderMemberCondensed:=HeaderMemberCondensed+OneChar;
  1872.                end;
  1873.             if FoundFirstChar=true then ActualCodeLine:=ActualCodeLine + OneChar;
  1874.             Inc(d);
  1875.             end;
  1876.          DeclareStringList.Add(ActualCodeLine);
  1877.          Inc(LineCount);
  1878.          end; { Use Pos to see if listbox string is in source string}
  1879.       if (Pos(CondensedString,HeaderMemberCondensed)<>0) then MatchFound:=true;
  1880.       if (Pos(CondensedString,HeaderMemberCondensed)=0) then
  1881.             begin
  1882.             Inc(OccuranceNum);
  1883.             DeclareStringList.Clear;
  1884.             end;
  1885.       end;
  1886.    DeclarationRichEdit.Lines.AddStrings(DeclareStringList);
  1887.    DeclarationRichEdit.SetFocus;
  1888.    SendMessage(DeclarationRichEdit.Handle,EM_SETSEL,0,0);
  1889.    DeclarationEditMode:=true;
  1890. end;
  1891.  
  1892. procedure TSearchEngine.SearchForString(Word:string;Occurance:Integer;StartPosition:Integer;Page:string);
  1893.    var
  1894.    MyTFindText:TFindText;
  1895.    OccuranceCount:Integer;
  1896.    SearchValue:string;
  1897.    begin
  1898.    OccuranceCount:=0;
  1899.    SearchValue:=Word;
  1900.    NewSearchPosition:=0;
  1901.    LineNumberFound:=0;
  1902.    LineFoundPositionOne:=0;
  1903.    PositionFound:=0;
  1904.  
  1905.    with MyTFindText.chrg do  { setup Find Text Struct }
  1906.       begin
  1907.       cpMin:=StartPosition;
  1908.       cpMax:=-1;
  1909.       MyTFindText.lpstrText:=PChar(Word);
  1910.       end;
  1911.           {if none found stop at defined Occurance }
  1912.    while (PositionFound<>-1)and(OccuranceCount<>Occurance) do
  1913.       begin
  1914.       if Page='Include' then PositionFound:=SendMessage(CodePageForm.CodePage.Handle,EM_FINDTEXT,FT_MATCHCASE,LongInt(@MyTFindText));
  1915.       if Page='Source' then PositionFound:=SendMessage(CodePageForm.SourceRichEdit1.Handle,EM_FINDTEXT,FT_MATCHCASE,LongInt(@MyTFindText));
  1916.       if (PositionFound<>-1) and (OccuranceCount<>Occurance) then { move cursor }
  1917.          begin
  1918.          if Page='Include' then
  1919.             begin
  1920.             SendMessage(CodePageForm.CodePage.Handle,EM_SETSEL,PositionFound,PositionFound);
  1921.             LineNumberFound := SendMessage(CodePageForm.CodePage.Handle, EM_LINEFROMCHAR,CodePageForm.CodePage.SelStart,0);
  1922.             LineFoundPositionOne := SendMessage(CodePageForm.CodePage.Handle, EM_LINEINDEX, LineNumberFound, 0);
  1923.             end;
  1924.          if Page='Source' then
  1925.             begin
  1926.             SendMessage(CodePageForm.SourceRichEdit1.Handle,EM_SETSEL,PositionFound,PositionFound);
  1927.             LineNumberFound := SendMessage(CodePageForm.SourceRichEdit1.Handle, EM_LINEFROMCHAR,CodePageForm.SourceRichEdit1.SelStart,0);
  1928.             LineFoundPositionOne := SendMessage(CodePageForm.SourceRichEdit1.Handle, EM_LINEINDEX, LineNumberFound, 0);
  1929.             end;
  1930.          MyTFindText.chrg.cpMin:=PositionFound+1;{ should be +sizeof searchvalue }
  1931.          NewSearchPosition:=PositionFound+1;
  1932.          Inc(OccuranceCount);
  1933.          end;
  1934.       if PositionFound=-1 then LineNumberFound:=999999;
  1935.       end;
  1936.   end;
  1937.  
  1938. procedure TMainDlg.MoveToClass(Sender: TObject);
  1939.    begin
  1940.    if FileOpenActive =true then Exit;
  1941.    ClassFinderSelectedItem:=QuickClassListbox.Items[QuickClassListbox.ItemIndex];
  1942.    ProcessSelectedClass;
  1943.    end;
  1944.  
  1945. procedure TMainDlg.SearchMemberName1Click(Sender: TObject);
  1946.    var
  1947.    SelectOK:Boolean;
  1948.    SearchMember:string;
  1949.    begin
  1950.    {We have to use VCL Table for secondary indexes then refresh RawVCLTable}
  1951.    Screen.Cursor := crHourglass;
  1952.    SelectOK:=InputQuery('SEARCH ENGINE','Enter Member Name',SearchMember);
  1953.    if SelectOK then
  1954.       begin
  1955.       VCLTable.IndexName:='MemberNameIndex';
  1956.       VCLTable.SetRange([SearchMember], [SearchMember]);
  1957.       DataSource1.DataSet:=VCLTable;
  1958.       MemberSearch:=true;
  1959.       if VCLTable.RecordCount=0 then
  1960.          begin
  1961.          MessageDlg(SearchMember+' is not a VCL Class member !' ,mtError, [mbOk], 0);
  1962.          VCLTable.IndexName:='';
  1963.          DataSource1.Dataset:=RawVCLTable;
  1964.          DBGrid1.DataSource:=DataSource1;
  1965.          MemberSearch:=false;
  1966.          end;
  1967.       end;
  1968.    Screen.Cursor := crDefault;
  1969.    end;
  1970.  
  1971. procedure TMainDlg.ViewHeader1Click(Sender: TObject);
  1972.    begin
  1973.    CodePageForm.Show;
  1974.    CodePageForm.SourceRichEdit1.Hide;
  1975.    CodePageForm.CodePage.Show;
  1976.    SendMessage(CodePageForm.CodePage.Handle,EM_SETSEL,CodePageForm.CodePage.SelStart,
  1977.                CodePageForm.CodePage.SelStart+Length(CurrentSelectedMemberName));
  1978.    CodePageForm.CodePage.SetFocus;
  1979.    end;
  1980.  
  1981. procedure TMainDlg.ShowRecordClass1Click(Sender: TObject); 
  1982.    begin
  1983.    if FileOpenActive =true then Exit;
  1984.    {For some reason I'm Stuck using VCLTable. Maybe its the indexing}
  1985.    if MemberSearch=true then
  1986.      begin
  1987.      ClassFinderSelectedItem:=VCLTable.FieldByName('ClassName').AsString;
  1988.      MemberSearch:=false;
  1989.      end else
  1990.             begin
  1991.             ClassFinderSelectedItem:=RawVCLTable.FieldByName('ClassName').AsString;
  1992.             end;
  1993.    ProcessSelectedClass;
  1994.    end;
  1995.  
  1996. procedure TMainDlg.About1Click(Sender: TObject);
  1997. begin
  1998.   AboutBox:=TAboutBox.Create(nil);
  1999.   AboutBox.ShowModal;
  2000.   AboutBox.Free;
  2001. end;
  2002.  
  2003. procedure TMainDlg.SearchClassName1Click(Sender: TObject);
  2004.    var
  2005.    SearchClass:string;
  2006.    SelectOK:Boolean;
  2007.    begin
  2008.    if FileOpenActive =true then Exit;
  2009.       SelectOK:=InputQuery('SEARCH ENGINE','Enter Class Name',SearchClass);
  2010.       if Not SelectOK then Exit;
  2011.       if SelectOK then
  2012.          begin
  2013.          LocateSuccess:=ClassListTab.Locate('ClassName',SearchClass,[]);
  2014.          if LocateSuccess=false then
  2015.             begin
  2016.             MessageDlg(SearchClass+' class not found! Check case sensitivity or verify possible TypeDef' ,mtError, [mbOk], 0);
  2017.             Exit;
  2018.             end;
  2019.          ClassFinderSelectedItem:=SearchClass;
  2020.          ProcessSelectedClass;
  2021.          end;
  2022.    end;
  2023.  
  2024. procedure TMainDlg.ViewSource1Click(Sender: TObject);
  2025.    begin
  2026.    CodePageForm.CodePage.Hide;
  2027.    CodePageForm.Show;
  2028.    CodePageForm.SourceRichEdit1.Show;
  2029.    SendMessage(CodePageForm.SourceRichEdit1.Handle,EM_SETSEL,CodePageForm.SourceRichEdit1.SelStart,
  2030.                CodePageForm.SourceRichEdit1.SelStart+DefinitionLength);
  2031.    CodePageForm.SourceRichEdit1.SetFocus;
  2032.    end;
  2033.  
  2034. procedure TMainDlg.LoadDefinitionSource(MemberType:string);
  2035.    var
  2036.    n:Integer;
  2037.    k:Integer;
  2038.    SearchForDefinitions:TSearchEngine;
  2039.    FoundFirstBegin:Boolean;
  2040.    ExtractionDone:Boolean;
  2041.    CheckLine:string;
  2042.    CheckLineLength:Integer;
  2043.    EndPosition:Integer;
  2044.    BeginPosition:Integer;
  2045.    TryPosition:Integer;
  2046.    SourceStringList:TStringList;
  2047.    begin
  2048.    SourceStringList:=TStringList.Create;
  2049.    n:=1;
  2050.    k:=1;
  2051.    FoundFirstBegin:=false;
  2052.    ExtractionDone:=false;
  2053.    SearchForDefinitions:=TSearchEngine.Create;
  2054.    DefinitionLength:=Length(CurrentTabClassName+'.'+CurrentSelectedMemberName);
  2055.    if MemberType='constructor' then CurrentSelectedMemberName:='Create';
  2056.  
  2057.    SearchForDefinitions.SearchForString(CurrentTabClassName+'.'+CurrentSelectedMemberName+'(',1,0,'Source');
  2058.    if SearchForDefinitions.PositionFound=-1 then
  2059.       begin
  2060.       SearchForDefinitions.SearchForString(CurrentTabClassName+'.'+CurrentSelectedMemberName+';',1,0,'Source');
  2061.       if SearchForDefinitions.PositionFound=-1 then
  2062.          begin
  2063.          SearchForDefinitions.SearchForString(CurrentTabClassName+'.'+CurrentSelectedMemberName+':',1,0,'Source');
  2064.          if SearchForDefinitions.PositionFound=-1 then
  2065.             begin
  2066.             SourceEntryPage.Lines.Clear;
  2067.             SourceStringList.Clear;
  2068.             SourceEntryPage.Lines[0]:='No function or procedure exist!';
  2069.             end;
  2070.          end
  2071.       end;
  2072.  
  2073.  
  2074.  
  2075.    if SearchForDefinitions.PositionFound<>-1 then
  2076.       begin
  2077.       SourceEntryPage.Lines.Clear;
  2078.       SourceStringList.Add(CodePageForm.SourceRichEdit1.Lines[SearchForDefinitions.LineNumberFound]);
  2079.       while ExtractionDone=false do
  2080.          begin
  2081.          CheckLine:=CodePageForm.SourceRichEdit1.Lines[SearchForDefinitions.LineNumberFound+n];
  2082.          CheckLineLength:=Length(CheckLine);
  2083.          BeginPosition:=Pos('begin',CheckLine);{'begin' by itself no indent}
  2084.          if (BeginPosition=1) and (BeginPosition=CheckLineLength-4) then
  2085.             begin
  2086.             if FoundFirstBegin<>true then
  2087.                begin
  2088.                k:=0;
  2089.                end;
  2090.             FoundFirstBegin:=true;
  2091.             k:=k+1;
  2092.             end;
  2093.          BeginPosition:=Pos(' begin',CheckLine);{'begin' by itself no indent}
  2094.          if (BeginPosition<>0) and (BeginPosition=CheckLineLength-5) then
  2095.             begin
  2096.             if FoundFirstBegin<>true then
  2097.                begin
  2098.                k:=0;
  2099.                end;
  2100.             FoundFirstBegin:=true;
  2101.             k:=k+1;
  2102.             end;
  2103.  
  2104.          TryPosition:=Pos('try',CheckLine);{'begin' by itself no indent}
  2105.          if (TryPosition=1) and ((TryPosition=CheckLineLength-4) or(TryPosition=CheckLineLength-3)) then
  2106.             begin
  2107.             k:=k+1;
  2108.             end;
  2109.          TryPosition:=Pos(' try',CheckLine);{'begin' by itself no indent}
  2110.          if (TryPosition<>0) and ((TryPosition=CheckLineLength-4) or(TryPosition=CheckLineLength-3)) then
  2111.             begin
  2112.             k:=k+1;
  2113.             end;
  2114.  
  2115.          EndPosition:=Pos('end else',CheckLine);{'end' by itself no indent}
  2116.          if (EndPosition=1) and ((EndPosition=CheckLineLength-9)or(EndPosition=CheckLineLength-8)) then
  2117.             begin
  2118.             k:=k-1;
  2119.             end else
  2120.                 EndPosition:=Pos('end',CheckLine);{'end' by itself no indent}
  2121.                 if (EndPosition=1) and ((EndPosition=CheckLineLength-4)or(EndPosition=CheckLineLength-3)) then
  2122.                    begin
  2123.                    k:=k-1;
  2124.                    end;
  2125.  
  2126.          EndPosition:=Pos(' end else',CheckLine);{' end' by itself yes indent}
  2127.          if (EndPosition<>0) and ((EndPosition=CheckLineLength-9)or(EndPosition=CheckLineLength-8)) then
  2128.             begin
  2129.             k:=k-1;
  2130.             end else
  2131.                 EndPosition:=Pos(' end',CheckLine);{' end' by itself yes indent}
  2132.                 if (EndPosition<>0) and ((EndPosition=CheckLineLength-4)or(EndPosition=CheckLineLength-3)) then
  2133.                    begin
  2134.                    k:=k-1;
  2135.                    end;
  2136.  
  2137.                    
  2138.          if ExtractionDone<>true then SourceStringList.Add(CheckLine);
  2139.          if k=0 then ExtractionDone:=true;
  2140.          Inc(n);
  2141.          end;
  2142.       SourceEntryPage.Lines.AddStrings(SourceStringList);
  2143.       end;
  2144.    end;
  2145.  
  2146. procedure TMainDlg.FormResize(Sender: TObject);
  2147.    begin
  2148.    DeclarationRichEdit.Height:=Trunc(ClientHeight * 0.18);
  2149.    Panel4.Width:=ClientWidth div 2;
  2150.  
  2151.    PageControl1.Height:=Trunc(ClientHeight * 0.6);
  2152.    QuickClassListbox.Height:=Trunc(ClientHeight* 0.4)-30;
  2153.  
  2154.    SourceEntryPage.Height:=(PageControl1.Height-15)-(DeclarationRichEdit.Height);
  2155.    MainListBox.Height:=PageControl1.Height -40;
  2156.    MainListBox.Width:=PageControl1.Width -5;
  2157.    Label1.Left:=Trunc(Panel2.Width * 0.174);
  2158.    Label2.Left:=Trunc(Panel2.Width * 0.300);
  2159.    Label3.Left:=Trunc(Panel2.Width * 0.532);
  2160.    Label4.Left:=Trunc(Panel2.Width * 0.725);
  2161.  
  2162.    end;
  2163.  
  2164. procedure TMainDlg.Print1Click(Sender: TObject);
  2165.    begin
  2166.    PrintDialog1.Execute;
  2167.    DeclarationRichEdit.Print(CurrentSelectedMemberName+' Declaration');
  2168.    end;
  2169.  
  2170. procedure TMainDlg.PrintDefinition1Click(Sender: TObject);
  2171.    begin
  2172.    PrintDialog1.Execute;
  2173.    SourceEntryPage.Print(CurrentSelectedMemberName+' Definition');
  2174.    end;
  2175.  
  2176. procedure TMainDlg.HeaderSource1Click(Sender: TObject);
  2177.    begin
  2178.    FileOPenDlg.InitialDir:=LocalVclHeaders;
  2179.    FileOPenDlg.Options := [ofHideReadOnly];
  2180.    FileOPenDlg.Filter := '*.cpp,*.hpp,*.h|*.cpp;*.hpp;*.h';
  2181.    if FileOPenDlg.Execute then
  2182.    try
  2183.       CodePageForm.CodePage.Lines.LoadFromFile(FileOPenDlg.FileName);
  2184.       except on EFOpenError do
  2185.          begin
  2186.          MessageDlg('Header File Not Found!' ,mtError, [mbOk], 0);
  2187.          Exit;
  2188.          end;
  2189.        end;
  2190.    end;
  2191.  
  2192. procedure TMainDlg.ParseaNewHeader1Click(Sender: TObject);
  2193.    var
  2194.    PasFileSearch:TSearchEngine;
  2195.    OneCharacter:string;
  2196.    GotPasName:Boolean;
  2197.    CharCount:Integer;
  2198.    Line:string;
  2199.    begin
  2200.    {Initialize stuff}
  2201.    FileOpenActive:=true;
  2202.    DestTable.Open;
  2203.    PasFileSearch:=TSearchEngine.Create;
  2204.    CharCount:=0;
  2205.    GotPasName:=false;
  2206.    PasSourceFileName:='';
  2207.    OneCharacter:='';
  2208.  
  2209.    {Get File Name}
  2210.    FileOPenDlg.InitialDir:=LocalVclHeaders;
  2211.    FileOPenDlg.Options := [ofHideReadOnly];
  2212.    FileOPenDlg.Filter := '*.hpp,*.h|*.hpp;*.h';
  2213.    if FileOPenDlg.Execute then
  2214.       begin
  2215.       Screen.Cursor:=crHourglass;
  2216.       CurrentHeaderFileName:=ExtractFileName(FileOPenDlg.FileName);
  2217.       CodePageForm.CodePage.Clear();
  2218.       try
  2219.          CodePageForm.CodePage.Lines.LoadFromFile(FileOPenDlg.FileName);
  2220.          except on EFOpenError do
  2221.             begin
  2222.             MessageDlg('Header File Not Found!' ,mtError, [mbOk], 0);
  2223.             Screen.Cursor:=crDefault;
  2224.             Exit;
  2225.             end;
  2226.       end;
  2227.  
  2228.       {Search header for .pas filename}
  2229.       CodePageForm.SourceRichEdit1.Clear();
  2230.       PasFileSearch.SearchForString('.pas',1,0,'Include');
  2231.       if PasFileSearch.PositionFound<>-1 then
  2232.          begin
  2233.          Line:=CodePageForm.CodePage.Lines[PasFileSearch.LineNumberFound];
  2234.          while not GotPasName do
  2235.             begin
  2236.             OneCharacter:=Copy(Line,(PasFileSearch.PositionFound-PasFileSearch.LineFoundPositionOne)-CharCount,1);
  2237.             if (OneCharacter=' ') or (OneCharacter='/')then GotPasName:=true;
  2238.             if GotPasName=false then
  2239.                begin
  2240.                AppendStr(OneCharacter,PasSourceFileName);
  2241.                PasSourceFileName:=OneCharacter;
  2242.                Inc(CharCount);
  2243.                end;
  2244.             end;
  2245.          AppendStr(PasSourceFileName,'.pas');
  2246.          end else
  2247.             begin
  2248.             MessageDlg('Could not find .pas for '+CurrentHeaderFileName ,mtError, [mbOk], 0);
  2249.             end;
  2250.  
  2251.       {Empty table to hold 1 header parsing and load it up}
  2252.       DestTable.Close();
  2253.       DestTable.TableName:='main2.db';
  2254.       DestTable.Open();
  2255.       DestTable.Close();
  2256.       DestTable.EmptyTable;
  2257.       DestTable.Open();
  2258.       
  2259.       {Parse and load}
  2260.       ConvertCppToDestTable;
  2261.       ConvertTableToTabs;
  2262.       RawVCLTable.Free;
  2263.       RawVCLTable := TCloneTable.CreateFromTable(DestTable, True);
  2264.       RawVCLTable.Open;
  2265.       DataSource1.Dataset:=RawVCLTable;
  2266.       DBGrid1.Refresh;
  2267.       RawVCLTable.First;
  2268.       SelectaTab(Sender);
  2269.  
  2270.       {Clean up}
  2271.       Screen.Cursor:=crDefault;
  2272.       MessageDlg('Success',mtConfirmation, [mbOk], 0);
  2273.       end;
  2274.  
  2275.    {Append Main2.db to VCL table}
  2276.    if MessageDlg('Append to VCLTable',mtConfirmation, [mbYes, mbNo], 0)=mrYes then
  2277.       begin
  2278.       MessageDlg('Your about to do a batchmove!!!',mtConfirmation, [mbOk], 0);
  2279.       ParseVclTable.Open;
  2280.       BatchMove1.Execute;
  2281.       ParseVclTable.Close;
  2282.       end else Exit;
  2283.    end;
  2284.  
  2285. procedure TMainDlg.ClosePageClick(Sender: TObject);
  2286.    begin
  2287.    if PageControl1.PageCount > 1 then
  2288.       begin
  2289.       PageControl1.ActivePage.Free;
  2290.       MainListBox.Items.Clear;
  2291.       PageControl1.ActivePage := PageControl1.Pages[0];
  2292.       SelectATab(Sender);
  2293.       end;
  2294.    end;
  2295.  
  2296. procedure TMainDlg.CloseAllPages1Click(Sender: TObject);
  2297.    begin
  2298.    if PageControl1.PageCount > 0 then
  2299.       with PageControl1 do
  2300.       begin
  2301.       ActivePage := Pages[0];
  2302.       while (ActivePage <> nil) do
  2303.          begin
  2304.          ActivePage.Free;
  2305.          SelectNextPage(TRUE);
  2306.          end;
  2307.       end;
  2308.    MainListBox.Items.Clear;
  2309.    end;
  2310.  
  2311. procedure TMainDlg.GetRegistryInfo;
  2312.    var
  2313.    MyString:string;
  2314.    Status:Boolean;
  2315.    begin
  2316.    with TRegistry.Create do
  2317.       begin
  2318.       RootKey := HKEY_LOCAL_MACHINE;
  2319.       Status:=OpenKey('\software\borland\C++Builder\1.0', false);
  2320.       if Status then MyString := ReadString('RootDir');
  2321.       LocalVclSource:=MyString+'\source\';
  2322.       LocalVclHeaders:=MyString+'\include\vcl\';
  2323.       LocalTablesDir:=MyString+'\examples\classbrw\';
  2324.       Free;
  2325.       end;
  2326.    end;
  2327.  
  2328. procedure TMainDlg.LoadSourcePage;
  2329.    begin
  2330.    CodePageForm.SourceRichEdit1.Clear();
  2331.    DoesFileExist:=FileExists(LocalVclSource+'vcl\' + CurrentSourceFileName);
  2332.    if DoesFileExist then
  2333.        CodePageForm.SourceRichEdit1.Lines.LoadFromFile(LocalVclSource+'vcl\' + CurrentSourceFileName)
  2334.           else
  2335.              begin
  2336.              DoesFileExist:=FileExists(LocalVclSource+'toolsapi\' + CurrentSourceFileName);
  2337.              if DoesFileExist then
  2338.                 CodePageForm.SourceRichEdit1.Lines.LoadFromFile(LocalVclSource+'toolsapi\' + CurrentSourceFileName)
  2339.                 else
  2340.                    begin
  2341.                    CodePageForm.SourceRichEdit1.Lines[0]:='Source Not Available for this Class!';
  2342.                    end;
  2343.              end;
  2344.  
  2345.    end;
  2346.  
  2347. procedure TMainDlg.FormActivate(Sender: TObject);
  2348.    begin
  2349.    if InitializedTable=true then Exit;
  2350.    if VCLTable.RecordCount=0 then
  2351.       begin
  2352.       RebuildVCLTable(Sender);
  2353.       end;
  2354.    InitializedTable:=true;
  2355.    end;
  2356.  
  2357. procedure TMainDlg.ChangeFontsClick(Sender: TObject);
  2358.    var
  2359.    MyFontInteger:Integer;
  2360.    begin
  2361.    if FontDialog1.Execute then
  2362.       begin
  2363.       if Sender=ChangeFonts then CodePageForm.SourceRichEdit1.Font:=FontDialog1.Font;
  2364.       if Sender=HeaderPage then CodePageForm.CodePage.Font:=FontDialog1.Font;
  2365.       if Sender=Declaration then DeclarationRichEdit.Font:=FontDialog1.Font;
  2366.       if Sender=Definition then SourceEntryPage.Font:=FontDialog1.Font;
  2367.       if Sender=QuickClassBox then QuickClassListbox.Font:=FontDialog1.Font;
  2368.       if Sender=MemberList then MainListBox.Font:=FontDialog1.Font;
  2369.       if Sender=Grid then
  2370.          begin
  2371.          DBGrid1.Columns[1].Font:=FontDialog1.Font;
  2372.          DBGrid1.Columns[2].Font:=FontDialog1.Font;
  2373.          DBGrid1.Columns[3].Font:=FontDialog1.Font;
  2374.          DBGrid1.Columns[4].Font:=FontDialog1.Font;
  2375.          end;
  2376.  
  2377.       MyFontInteger:=FontDialog1.Font.Color;
  2378.  
  2379.       with TRegistry.Create do
  2380.          begin
  2381.          RootKey := HKEY_LOCAL_MACHINE;
  2382.          OpenKey('\software\borland\VCL Class Organizer\fonts', false);
  2383.          if Sender=ChangeFonts then WriteString('DefinitionPage',IntToStr(MyFontInteger));
  2384.          if Sender=HeaderPage then WriteString('HeaderPage',IntToStr(MyFontInteger));
  2385.          if Sender=Declaration then WriteString('Declaration',IntToStr(MyFontInteger));
  2386.          if Sender=Definition then WriteString('Definition',IntToStr(MyFontInteger));
  2387.          if Sender=QuickClassBox then WriteString('QuickClass',IntToStr(MyFontInteger));
  2388.          if Sender=MemberList then WriteString('MemberList',IntToStr(MyFontInteger));
  2389.          if Sender=Grid then WriteString('Grid',IntToStr(MyFontInteger));
  2390.          Free;
  2391.          end;
  2392.       end;
  2393.    end;
  2394.  
  2395. procedure TMainDlg.ChangeBkGroundClick(Sender: TObject);
  2396.    begin
  2397.    if ColorDialog1.Execute then
  2398.       begin
  2399.       if Sender=ChangeBkGround then CodePageForm.SourceRichEdit1.Color:=ColorDialog1.Color;
  2400.       if Sender=HeaderPage1 then CodePageForm.CodePage.Color:=ColorDialog1.Color;
  2401.       if Sender=Declaration1 then DeclarationRichEdit.Color:=ColorDialog1.Color;
  2402.       if Sender=Definition1 then SourceEntryPage.Color:=ColorDialog1.Color;
  2403.       if Sender=QuickClassBox1 then QuickClassListbox.Color:=ColorDialog1.Color;
  2404.       if Sender=MemberList1 then MainListBox.Color:=ColorDialog1.Color;
  2405.       if Sender=Grid1 then DBGrid1.Color:=ColorDialog1.Color;
  2406.  
  2407.       {Store in background colors registry}
  2408.       with TRegistry.Create do
  2409.          begin
  2410.          RootKey := HKEY_LOCAL_MACHINE;
  2411.          OpenKey('\software\borland\VCL Class Organizer\colors', false);
  2412.          if Sender=ChangeBkGround then WriteString('DefinitionPage',IntToStr(ColorDialog1.Color));
  2413.          if Sender=HeaderPage1 then WriteString('HeaderPage',IntToStr(ColorDialog1.Color));
  2414.          if Sender=Declaration1 then WriteString('Declaration',IntToStr(ColorDialog1.Color));
  2415.          if Sender=Definition1 then WriteString('Definition',IntToStr(ColorDialog1.Color));
  2416.          if Sender=QuickClassBox1 then WriteString('QuickClass',IntToStr(ColorDialog1.Color));
  2417.          if Sender=MemberList1 then WriteString('MemberList',IntToStr(ColorDialog1.Color));
  2418.          if Sender=Grid1 then WriteString('Grid',IntToStr(ColorDialog1.Color));
  2419.          Free;
  2420.          end;
  2421.  
  2422.       
  2423.       end;
  2424.    end;
  2425.  
  2426. function TMainDlg.DetermineImageIndex(Scope:string;Member:string):Integer;
  2427.    begin
  2428.    if (Scope='protected') and (Member='function') then Result:=0;
  2429.    if (Scope='protected') and (Member='data') then Result:=1;
  2430.    if (Scope='protected') and (Member='constructor') then Result:=2;
  2431.    if (Scope='protected') and (Member='property') then Result:=3;
  2432.  
  2433.    if (Scope='__published') and (Member='function') then Result:=4;
  2434.    if (Scope='__published') and (Member='data') then Result:=5;
  2435.    if (Scope='__published') and (Member='constructor') then Result:=6;
  2436.    if (Scope='__published') and (Member='property') then Result:=7;
  2437.  
  2438.    if (Scope='private') and (Member='function') then Result:=8;
  2439.    if (Scope='private') and (Member='data') then Result:=9;
  2440.    if (Scope='private') and (Member='constructor') then Result:=10;
  2441.    if (Scope='private') and (Member='property') then Result:=11;
  2442.  
  2443.    if (Scope='public') and (Member='function') then Result:=12;
  2444.    if (Scope='public') and (Member='data') then Result:=13;
  2445.    if (Scope='public') and (Member='constructor') then Result:=14;
  2446.    if (Scope='public') and (Member='property') then Result:=15;
  2447.    end;
  2448.  
  2449. procedure TMainDlg.ShowNextDerivation1Click(Sender: TObject);
  2450.    begin
  2451.    if FileOpenActive =true then Exit;
  2452.    ClassFinderSelectedItem:=RawVCLTable.FieldByName('SecondClass').AsString;
  2453.    if (ClassFinderSelectedItem<> '') and (ClassFinderSelectedItem <> 'TObject')then
  2454.       begin
  2455.       DBGrid1.DataSource:=DataSource1;
  2456.       RawVClTable.Refresh;
  2457.       Screen.Cursor:=crHourGlass;
  2458.       RawVCLTable.DisableControls;
  2459.       RawVCLTable.Filtered:=false;
  2460.       RawVCLTable.SetRange([ClassFinderSelectedItem], [ClassFinderSelectedItem]);
  2461.       CurrentHeaderFileName:=RawVCLTable.FieldByName('Header').AsString;
  2462.       CurrentSourceFileName:=RawVCLTable.FieldByName('Misc').AsString;
  2463.       with TTabSheet.Create(Self) do
  2464.         begin
  2465.         Caption := ClassFinderSelectedItem;
  2466.         PageControl := PageControl1;
  2467.         end;
  2468.       PageControl1.ActivePage:=PageControl1.Pages[PageControl1.PageCount-1];
  2469.       TableToListStrings(ClassFinderSelectedItem);
  2470.       CodePageForm.CodePage.Clear();
  2471.       try
  2472.          CodePageForm.CodePage.Lines.LoadFromFile(LocalVclHeaders+ CurrentHeaderFileName);
  2473.             except on EFOpenError do
  2474.                begin
  2475.                MessageDlg('Header File Not Found!' ,mtError, [mbOk], 0);
  2476.                Screen.Cursor:=crDefault;
  2477.                Exit;
  2478.                end;
  2479.          end;
  2480.       LoadSourcePage;
  2481.       RawVCLTable.First;
  2482.       RawVCLTable.EnableControls;
  2483.       Screen.Cursor:=crDefault;
  2484.       end else
  2485.           MessageDlg('No class derivation exist or TObject class not available!' ,mtError, [mbOk], 0);
  2486.    end;
  2487.  
  2488. procedure TMainDlg.PrintHeaderhpp1Click(Sender: TObject);
  2489.    begin
  2490.    PrintDialog1.Execute;
  2491.    CodePageForm.CodePage.Print(CurrentHeaderFileName);
  2492.    end;
  2493.  
  2494. procedure TMainDlg.PrintSourcepas1Click(Sender: TObject);
  2495.    begin
  2496.    PrintDialog1.Execute;
  2497.    CodePageForm.SourceRichEdit1.Print(CurrentSourceFileName);
  2498.    end;
  2499.  
  2500. procedure TMainDlg.Project1Click(Sender: TObject);
  2501.    begin
  2502.    ParseHeaders:=TParseHeaders.Create(nil);
  2503.    with ParseHeaders do
  2504.       begin
  2505.       Position:=poScreenCenter;
  2506.       HeadersToParseTab.Open;
  2507.       ShowModal;
  2508.       end;
  2509.    end;
  2510.  
  2511. procedure TMainDlg.FormClose(Sender: TObject; var Action: TCloseAction);
  2512.    begin
  2513.    CodePageForm.Free;
  2514.    Action :=caFree;
  2515.    MainDlg := nil;
  2516.    end;
  2517.  
  2518. procedure TMainDlg.ProcessSelectedClass;
  2519.    begin
  2520.       CurrentSelectedMemberName:='';
  2521.       DefinitionLength:=0;
  2522.       VCLTable.IndexName:='';
  2523.       DataSource1.Dataset:=RawVCLTable;
  2524.       Screen.Cursor:=crHourGlass;
  2525.       RawVCLTable.DisableControls();
  2526.       RawVCLTable.Filtered:=false;
  2527.       RawVCLTable.SetRange([ClassFinderSelectedItem], [ClassFinderSelectedItem]);
  2528.       RawVCLTable.First;
  2529.       CurrentHeaderFileName:=RawVCLTable.FieldByName('Header').AsString;
  2530.       CurrentSourceFileName:=RawVCLTable.FieldByName('Misc').AsString;
  2531.       with TTabSheet.Create(Self) do
  2532.         begin
  2533.         Caption := ClassFinderSelectedItem;
  2534.         PageControl := PageControl1;
  2535.         end;
  2536.       PageControl1.ActivePage:=PageControl1.Pages[PageControl1.PageCount-1];
  2537.       TableToListStrings(ClassFinderSelectedItem);
  2538.       RawVCLTable.First;
  2539.       CodePageForm.SourceRichEdit1.Clear();
  2540.       LoadSourcePage;
  2541.       try
  2542.          CodePageForm.CodePage.Lines.LoadFromFile(LocalVclHeaders + CurrentHeaderFileName);
  2543.             except on EFOpenError do
  2544.                begin
  2545.                MessageDlg('Header File Not Found!' ,mtError, [mbOk], 0);
  2546.                Screen.Cursor:=crDefault;
  2547.                Exit;
  2548.                end;
  2549.          end;
  2550.       RawVCLTable.EnableControls();
  2551.       Screen.Cursor:=crDefault;
  2552.    end;
  2553.  
  2554. procedure TMainDlg.Exit1Click(Sender: TObject);
  2555.    begin
  2556.    Application.Terminate;
  2557.    end;
  2558.  
  2559. procedure TMainDlg.WriteRegistryKeys;
  2560.    begin
  2561.    with TRegistry.Create do
  2562.       begin
  2563.       {Check for registry keys and create if no exist}
  2564.       RootKey := HKEY_LOCAL_MACHINE;
  2565.       if  not KeyExists('\software\borland\VCL Class Organizer\colors') then
  2566.          begin
  2567.          OpenKey('\software\borland\VCL Class Organizer\colors',True);
  2568.          WriteString('Declaration','16777215');
  2569.          WriteString('Definition','16777215');
  2570.          WriteString('DefinitionPage','16777215');
  2571.          WriteString('Grid','16777215');
  2572.          WriteString('HeaderPage','16777215');
  2573.          WriteString('MemberList','16777215');
  2574.          WriteString('QuickClass','16777215');
  2575.          CloseKey;
  2576.          end;
  2577.       if  not KeyExists('\software\borland\VCL Class Organizer\fonts') then
  2578.          begin
  2579.          OpenKey('\software\borland\VCL Class Organizer\fonts',True);
  2580.          WriteString('Declaration','0');
  2581.          WriteString('Definition','0');
  2582.          WriteString('DefinitionPage','0');
  2583.          WriteString('Grid','0');
  2584.          WriteString('HeaderPage','0');
  2585.          WriteString('MemberList','0');
  2586.          WriteString('QuickClass','0');
  2587.          CloseKey;
  2588.          end;
  2589.       Free;
  2590.       end;
  2591.    end;
  2592.  
  2593. procedure TMainDlg.MainListBoxKeyUp(Sender: TObject; var Key: Word;
  2594.   Shift: TShiftState);
  2595.    begin
  2596.     MainListBoxClick(Sender);
  2597.    end;
  2598.  
  2599. end.
  2600.  
  2601.  
  2602.  
  2603.