Changeset 12 for trunk/IDE/Forms


Ignore:
Timestamp:
Nov 8, 2010, 10:06:37 AM (14 years ago)
Author:
george
Message:
  • Parser renamed to Analyzer.
  • Modified: Specialized parsers and analyzers separated from compiler for purpose of creating custom parsers and analyzers. Units UParsers and UAnalyzers determine which classes will be really used.
Location:
trunk/IDE
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/IDE

    • Property svn:ignore set to
      lib
  • trunk/IDE/Forms/UCodeTreeForm.pas

    r2 r12  
    11unit UCodeTreeForm;
    22
    3 {$mode objfpc}{$H+}
     3{$mode Delphi}{$H+}
    44
    55interface
  • trunk/IDE/Forms/UCompiledForm.pas

    r2 r12  
    11unit UCompiledForm;
    22
    3 {$mode objfpc}{$H+}
     3{$mode Delphi}{$H+}
    44
    55interface
  • trunk/IDE/Forms/UMainForm.lfm

    r2 r12  
    55  Width = 695
    66  Caption = 'Transpascal IDE'
    7   ClientHeight = 476
     7  ClientHeight = 482
    88  ClientWidth = 695
    99  Font.Height = -11
     
    2020    Left = 0
    2121    Height = 5
    22     Top = 471
     22    Top = 477
    2323    Width = 695
    2424    Align = alBottom
     
    2727  object DockPanel: TPanel
    2828    Left = 0
    29     Height = 445
     29    Height = 451
    3030    Top = 26
    3131    Width = 695
     
    4141    Caption = 'ToolBar1'
    4242    TabOrder = 2
    43     object ComboBoxTargetSelection: TComboBox
     43    object ComboBoxProducer: TComboBox
    4444      Left = 192
    45       Height = 24
     45      Height = 21
    4646      Top = 2
    4747      Width = 135
    4848      Align = alLeft
    49       ItemHeight = 0
     49      ItemHeight = 13
    5050      ItemIndex = 1
    5151      Items.Strings = (
     
    5555        'XML'
    5656      )
    57       OnChange = ComboBoxTargetSelectionChange
     57      OnChange = ComboBoxProducerChange
    5858      Style = csDropDownList
    5959      TabOrder = 0
     
    7373      Height = 24
    7474      Top = 2
    75       Width = 122
     75      Width = 105
    7676      Align = alLeft
    7777      Caption = 'Log parsing to file'
    7878      TabOrder = 2
    7979    end
    80     object ComboBoxAnalyzerType: TComboBox
     80    object ComboBoxAnalyzer: TComboBox
    8181      Left = 40
    82       Height = 24
     82      Height = 21
    8383      Top = 2
    8484      Width = 124
    8585      Align = alLeft
    86       ItemHeight = 0
     86      ItemHeight = 13
    8787      Style = csDropDownList
    8888      TabOrder = 3
  • trunk/IDE/Forms/UMainForm.pas

    r10 r12  
    3030    Button1: TButton;
    3131    CheckBoxLogParsing: TCheckBox;
    32     ComboBoxAnalyzerType: TComboBox;
    33     ComboBoxTargetSelection: TComboBox;
     32    ComboBoxAnalyzer: TComboBox;
     33    ComboBoxProducer: TComboBox;
    3434    CoolDockClient1: TCoolDockClient;
    3535    CoolDockMaster1: TCoolDockMaster;
     
    5555    procedure AProjectSaveAsExecute(Sender: TObject);
    5656    procedure ComboBox1Change(Sender: TObject);
    57     procedure ComboBoxTargetSelectionChange(Sender: TObject);
     57    procedure ComboBoxProducerChange(Sender: TObject);
    5858    procedure FormShow(Sender: TObject);
    5959    procedure FormClose(Sender: TObject; var Action: TCloseAction);
     
    9191begin
    9292  // Compile project file
    93   if CheckBoxLogParsing.Checked then
    94      Compiler.Parser.OnDebugLog := CompilerDebugLog
    95      else Compiler.Parser.OnDebugLog := nil;
    96   Compiler.ProducerType := TProducerType(ComboBoxTargetSelection.ItemIndex);
    97   Compiler.Init;
    98   Compiler.Parser.OnGetSource := GetSource;
    99 
    100   if Project.Items.Count > 0 then
    101   with TProjectFile(Project.Items[0]) do begin
    102     Compiler.TargetFolder := Project.RootDir;
    103     Compiler.Compile(Parent.GetDir + ExtractFileNameOnly(Name), Source);
    104   end;
    105 
    106   ProjectManager.TreeViewProjectChange(Self, ProjectManager.TreeViewProject.Selected);
    107   MessagesForm.Reload;
     93  if (ComboBoxAnalyzer.Items.Count > 0) and (ComboBoxAnalyzer.ItemIndex <> -1) and
     94    (ComboBoxProducer.Items.Count > 0) and (ComboBoxProducer.ItemIndex <> -1) then begin
     95    Compiler.Producer := Compiler.Producers[ComboBoxProducer.ItemIndex];
     96    Compiler.Analyzer := Compiler.Analyzers[ComboBoxAnalyzer.ItemIndex];
     97    Compiler.Analyzer.OnGetSource := GetSource;
     98    Compiler.Init;
     99
     100    if CheckBoxLogParsing.Checked then
     101      Compiler.Analyzer.OnDebugLog := CompilerDebugLog
     102      else Compiler.Analyzer.OnDebugLog := nil;
     103
     104    if Project.Items.Count > 0 then
     105    with TProjectFile(Project.Items[0]) do begin
     106      Compiler.TargetFolder := Project.RootDir;
     107      Compiler.Compile(Parent.GetDir + ExtractFileNameOnly(Name), Source);
     108    end;
     109    ProjectManager.TreeViewProjectChange(Self, ProjectManager.TreeViewProject.Selected);
     110    MessagesForm.Reload;
     111  end;
    108112end;
    109113
     
    163167      OpenKey(RegistryKey, True);
    164168      ReopenLastOpenedFile := ReadBoolWithDefault('ReopenLastOpenedFile', True);
    165       ComboBoxTargetSelection.ItemIndex :=
     169      ComboBoxProducer.ItemIndex :=
    166170        ReadIntegerWithDefault('ProducerType', 0);
    167       ComboBoxAnalyzerType.ItemIndex :=
     171      ComboBoxAnalyzer.ItemIndex :=
    168172        ReadIntegerWithDefault('AnalyzerType', 0);
    169173      CheckBoxLogParsing.Checked := ReadBoolWithDefault('LogParsing', False);
     
    181185      OpenKey(RegistryKey, True);
    182186      WriteBool('ReopenLastOpenedFile', ReopenLastOpenedFile);
    183       WriteInteger('ProducerType', ComboBoxTargetSelection.ItemIndex);
    184       WriteInteger('AnalyzerType', ComboBoxAnalyzerType.ItemIndex);
     187      WriteInteger('ProducerType', ComboBoxProducer.ItemIndex);
     188      WriteInteger('AnalyzerType', ComboBoxAnalyzer.ItemIndex);
    185189      WriteBool('LogParsing', CheckBoxLogParsing.Checked);
    186190    finally
     
    208212procedure TMainForm.FormCreate(Sender: TObject);
    209213var
    210   ProducerType: TProducerType;
    211   AnalyzerType: TAnalyzerType;
     214  I: Integer;
    212215begin
    213216  DebugLog.FileName := 'DebugLog.txt';
     
    219222  LastOpenedFiles.ClickAction := OpenRecentClick;
    220223
    221   ComboBoxTargetSelection.Clear;
    222   for ProducerType := Low(ProducerType) to High(ProducerType) do
    223     ComboBoxTargetSelection.AddItem(ProducerTypeName[ProducerType], nil);
    224   ComboBoxAnalyzerType.Clear;
    225   for AnalyzerType := Low(AnalyzerType) to High(AnalyzerType) do
    226     ComboBoxAnalyzerType.AddItem(AnalyzerTypeName[AnalyzerType], nil);
     224  ComboBoxProducer.Clear;
     225  for I := 0 to Compiler.Producers.Count - 1 do
     226    ComboBoxProducer.AddItem(Compiler.Producers[I].Name, nil);
     227  ComboBoxAnalyzer.Clear;
     228  for I := 0 to Compiler.Analyzers.Count - 1 do
     229    ComboBoxAnalyzer.AddItem(Compiler.Analyzers[I].Name, nil);
    227230end;
    228231
     
    283286end;
    284287
    285 procedure TMainForm.ComboBoxTargetSelectionChange(Sender: TObject);
     288procedure TMainForm.ComboBoxProducerChange(Sender: TObject);
    286289begin
    287290  ABuildExecute(Self);
Note: See TracChangeset for help on using the changeset viewer.