Changeset 68 for trunk/IDE


Ignore:
Timestamp:
Jul 30, 2012, 3:52:56 PM (12 years ago)
Author:
chronos
Message:
  • Added: Addon modules support.
  • Modified: Restored usage of URegistry unit.
Location:
trunk/IDE
Files:
4 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/IDE/Forms/UFormMain.lfm

    r66 r68  
    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
     
    8989    object ComboBoxTarget: TComboBox
    9090      Left = 230
    91       Height = 27
     91      Height = 21
    9292      Top = 2
    9393      Width = 100
    94       ItemHeight = 0
     94      ItemHeight = 13
    9595      OnChange = ComboBoxTargetChange
    9696      Style = csDropDownList
     
    105105  object Splitter1: TSplitter
    106106    Left = 490
    107     Height = 339
     107    Height = 345
    108108    Top = 26
    109109    Width = 5
     
    113113  object PageControlRight: TPageControl
    114114    Left = 495
    115     Height = 339
     115    Height = 345
    116116    Top = 26
    117117    Width = 200
     
    137137    Left = 0
    138138    Height = 101
    139     Top = 370
     139    Top = 376
    140140    Width = 695
    141141    ActivePage = TabSheetMessages
     
    155155    Left = 0
    156156    Height = 5
    157     Top = 365
     157    Top = 371
    158158    Width = 695
    159159    Align = alBottom
     
    162162  object PageControlMain: TPageControl
    163163    Left = 0
    164     Height = 339
     164    Height = 345
    165165    Top = 26
    166166    Width = 490
  • trunk/IDE/Forms/UFormMain.pas

    r66 r68  
    77uses
    88  SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls,
    9   ComCtrls, ExtCtrls, SynEdit, SynHighlighterPas,
     9  ComCtrls, ExtCtrls, SynEdit, SynHighlighterPas, Registry,
    1010  UProject, FileUtil, Menus, ActnList, DateUtils,
    11   UFormTargetCode, UFormCodeTree, UGeneralRegistry;
     11  UFormTargetCode, UFormCodeTree, URegistry;
    1212
    1313type
     
    146146    procedure ProducerProcessOutput(Text: string);
    147147  public
    148     procedure LoadFromRegistry(Root: Integer; const Key: string);
    149     procedure SaveToRegistry(Root: Integer; const Key: string);
     148    procedure LoadFromRegistry(Root: HKEY; const Key: string);
     149    procedure SaveToRegistry(Root: HKEY; const Key: string);
    150150    procedure OpenRecentClick(Sender: TObject);
    151151    function GetSource(Name: string; var SourceCode: string): Boolean;
     
    402402end;
    403403
    404 procedure TFormMain.LoadFromRegistry(Root: Integer; const Key: string);
    405 begin
    406   with TGeneralRegistry.Create(nil) do
     404procedure TFormMain.LoadFromRegistry(Root: HKEY; const Key: string);
     405begin
     406  with TRegistryEx.Create do
    407407    try
    408       CurrentRoot := Root;
     408      RootKey := Root;
    409409      OpenKey(Key, True);
    410410      if ValueExists('RightPanelWidth') then
     
    419419end;
    420420
    421 procedure TFormMain.SaveToRegistry(Root: Integer; const Key: string);
    422 begin
    423   with TGeneralRegistry.Create(nil) do
     421procedure TFormMain.SaveToRegistry(Root: HKEY; const Key: string);
     422begin
     423  with TRegistryEx.Create do
    424424    try
    425       CurrentRoot := Root;
     425      RootKey := Root;
    426426      OpenKey(Key, True);
    427427      WriteInteger('RightPanelWidth', PageControlRight.Width);
     
    477477begin
    478478  AProjectClose.Execute;
    479   Core.SaveToRegistry(Integer(Core.ApplicationInfo.RegistryRoot), Core.ApplicationInfo.RegistryKey);
     479  Core.SaveToRegistry(HKEY(Core.ApplicationInfo.RegistryRoot), Core.ApplicationInfo.RegistryKey);
    480480end;
    481481
     
    503503procedure TFormMain.FormShow(Sender: TObject);
    504504begin
    505   Core.LoadFromRegistry(Integer(Core.ApplicationInfo.RegistryRoot), Core.ApplicationInfo.RegistryKey);
     505  Core.LoadFromRegistry(HKEY(Core.ApplicationInfo.RegistryRoot), Core.ApplicationInfo.RegistryKey);
    506506  DockInit;
    507507  Core.ProjectTemplatesInit;
  • trunk/IDE/Transpascal.lpi

    r66 r68  
    110110      </Item8>
    111111    </RequiredPackages>
    112     <Units Count="18">
     112    <Units Count="21">
    113113      <Unit0>
    114114        <Filename Value="Transpascal.lpr"/>
     
    240240        <UnitName Value="UFormExternalProducerOutput"/>
    241241      </Unit17>
     242      <Unit18>
     243        <Filename Value="Notes.txt"/>
     244        <IsPartOfProject Value="True"/>
     245      </Unit18>
     246      <Unit19>
     247        <Filename Value="Common\UModule.pas"/>
     248        <IsPartOfProject Value="True"/>
     249        <UnitName Value="UModule"/>
     250      </Unit19>
     251      <Unit20>
     252        <Filename Value="Modules\Pascal\UModulePascal.pas"/>
     253        <IsPartOfProject Value="True"/>
     254        <UnitName Value="UModulePascal"/>
     255      </Unit20>
    242256    </Units>
    243257  </ProjectOptions>
     
    250264    <SearchPaths>
    251265      <IncludeFiles Value="$(ProjOutDir)"/>
    252       <OtherUnitFiles Value="Forms"/>
     266      <OtherUnitFiles Value="Forms;Common;Modules\Pascal"/>
    253267      <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
    254268    </SearchPaths>
  • trunk/IDE/Transpascal.lpr

    r61 r68  
    1414  UFormAbout, UFormOptions, UFormTargets,
    1515UFormProjectNew, UProjectTemplates, UFormTargetProject, UCore,
    16 UFormTargetOptions, UFormExternalProducerOutput;
     16UFormTargetOptions, UFormExternalProducerOutput, UModule, UModulePascal;
    1717
    1818{$R *.res}
  • trunk/IDE/UCore.lfm

    r66 r68  
    3737    EmailContact = 'robie@centrum.cz'
    3838    AppName = 'Transpascal IDE'
    39     ReleaseDate = 41107
     39    ReleaseDate = 41120
    4040    RegistryKey = '\Software\Chronosoft\Transpascal'
    41     RegistryRoot = rrApplicationUser
     41    RegistryRoot = rrKeyCurrentUser
    4242    left = 48
    4343    top = 200
  • trunk/IDE/UCore.pas

    r66 r68  
    77uses
    88  Classes, SysUtils, FileUtil, ULastOpenedList, UProject, UApplicationInfo,
    9   UCompiler, UGeneralRegistry, UDebugLog, UCoolTranslator, UTarget;
     9  UCompiler, URegistry, Registry, UDebugLog, UCoolTranslator, UTarget,
     10  USourceCode, UModule;
    1011
    1112type
     
    1314
    1415  TCustomCompiler = class(TCompiler)
     16  private
     17    procedure InitSystemModule;
     18  public
    1519    StartTime: TDateTime;
    1620    SourceFiles: TSourceFileManager;
     
    1822    procedure Init; override;
    1923    function ElapsedTime: TDateTime;
    20     procedure LoadFromRegistry(Root: Integer; const Key: string);
    21     procedure SaveToRegistry(Root: Integer; const Key: string);
     24    procedure LoadFromRegistry(Root: HKEY; const Key: string);
     25    procedure SaveToRegistry(Root: HKEY; const Key: string);
    2226    constructor Create; override;
    2327    destructor Destroy; override;
     
    4549    TargetProject: TProject;
    4650    Compiler: TCustomCompiler;
     51    ModuleManager: TModuleManager;
    4752    procedure ProjectTemplatesInit;
    4853    procedure ProjectOpen(FileName: string);
    4954    procedure ProjectNew;
    5055    procedure CompilerDebugLog(Text: string);
    51     procedure LoadFromRegistry(Root: Integer; const Key: string);
    52     procedure SaveToRegistry(Root: Integer; const Key: string);
     56    procedure LoadFromRegistry(Root: HKEY; const Key: string);
     57    procedure SaveToRegistry(Root: HKEY; const Key: string);
    5358  end;
    5459
     
    100105  ReopenLastOpenedFile := True;
    101106  LogParsing := False;
     107
     108  ModuleManager := TModuleManager.Create;
    102109end;
    103110
    104111procedure TCore.DataModuleDestroy(Sender: TObject);
    105112begin
     113  ModuleManager.Free;
    106114  ProjectTemplates.Free;
    107115  LastOpenedFiles.Free;
     
    142150end;
    143151
    144 procedure TCore.LoadFromRegistry(Root: Integer; const Key: string);
    145 begin
    146   with TGeneralRegistry.Create(nil) do
     152procedure TCore.LoadFromRegistry(Root: HKEY; const Key: string);
     153begin
     154  with TRegistryEx.Create do
    147155    try
    148       CurrentRoot := Root;
     156      RootKey := Root;
    149157      OpenKey(Key, True);
    150158      if ValueExists('ReopenLastOpenedFile') then
     
    163171      Free;
    164172    end;
    165   LastOpenedFiles.LoadFromRegistry(Root, Key + '\LastOpenedFiles');
     173  LastOpenedFiles.LoadFromRegistry(Root, Key + '\LastOpenedFiles'); //Root, Key + '\LastOpenedFiles');
    166174  Compiler.LoadFromRegistry(Root, Key + '\Compiler');
    167175  FormMain.LoadFromRegistry(Root, Key);
    168176end;
    169177
    170 procedure TCore.SaveToRegistry(Root: Integer; const Key: string);
    171 begin
    172   with TGeneralRegistry.Create(nil) do
     178procedure TCore.SaveToRegistry(Root: HKEY; const Key: string);
     179begin
     180  with TRegistryEx.Create do
    173181    try
    174       CurrentRoot := Root;
     182      RootKey := Root;
    175183      OpenKey(Key, True);
    176184      WriteBool('ReopenLastOpenedFile', ReopenLastOpenedFile);
     
    192200{ TCustomCompiler }
    193201
     202procedure TCustomCompiler.InitSystemModule;
     203var
     204  SystemModule: TSourceModule;
     205begin
     206  SystemModule := TSourceModule.Create;
     207  with SystemModule do begin
     208    Name := 'System';
     209    Internal := True;
     210    with TType(Body.Types.AddNew(TType.Create)) do begin
     211      Name := 'Byte';
     212      Size := 1;
     213      Internal := True;
     214    end;
     215    with TType(Body.Types.AddNew(TType.Create)) do begin
     216      Name := 'ShortInt';
     217      Size := 1;
     218      Internal := True;
     219    end;
     220    with TType(Body.Types.AddNew(TType.Create)) do begin
     221      Name := 'Word';
     222      Size := 2;
     223      Internal := True;
     224    end;
     225    with TType(Body.Types.AddNew(TType.Create)) do begin
     226      Name := 'SmallInt';
     227      Size := 2;
     228      Internal := True;
     229    end;
     230    with TType(Body.Types.AddNew(TType.Create)) do begin
     231      Name := 'Cardinal';
     232      Size := 4;
     233      Internal := True;
     234    end;
     235    with TType(Body.Types.AddNew(TType.Create)) do begin
     236      Name := 'Integer';
     237      Size := 4;
     238      Internal := True;
     239    end;
     240    with TType(Body.Types.AddNew(TType.Create)) do begin
     241      Name := 'UInt64';
     242      Size := 8;
     243      Internal := True;
     244    end;
     245    with TType(Body.Types.AddNew(TType.Create)) do begin
     246      Name := 'Int64';
     247      Size := 8;
     248      Internal := True;
     249    end;
     250    with TFunction(Body.Functions.AddNew(TFunction.Create)) do begin
     251      Name := 'WriteLn';
     252      Internal := True;
     253    end;
     254    ParentProgram := AbstractCode;
     255  end;
     256  AbstractCode.Modules.Add(SystemModule);
     257end;
     258
    194259procedure TCustomCompiler.Init;
    195260begin
    196261  inherited;
    197262  StartTime := Now;
     263  InitSystemModule;
    198264end;
    199265
     
    203269end;
    204270
    205 procedure TCustomCompiler.LoadFromRegistry(Root: Integer; const Key: string);
     271procedure TCustomCompiler.LoadFromRegistry(Root: HKEY; const Key: string);
    206272var
    207273  I: Integer;
    208274begin
    209   with TGeneralRegistry.Create(nil) do
     275  with TRegistryEx.Create do
    210276    try
    211       CurrentRoot := Root;
     277      RootKey := Root;
    212278      for I := 0 to Targets.Count - 1 do
    213279      with TTarget(Targets[I]) do begin
     
    225291end;
    226292
    227 procedure TCustomCompiler.SaveToRegistry(Root: Integer; const Key: string);
     293procedure TCustomCompiler.SaveToRegistry(Root: HKEY; const Key: string);
    228294var
    229295  I: Integer;
    230296begin
    231   with TGeneralRegistry.Create(nil) do
     297  with TRegistryEx.Create do
    232298    try
    233       CurrentRoot := Root;
     299      RootKey := Root;
    234300      for I := 0 to Targets.Count - 1 do
    235301      with TTarget(Targets[I]) do begin
Note: See TracChangeset for help on using the changeset viewer.