Changeset 65


Ignore:
Timestamp:
Jul 18, 2012, 10:57:48 PM (12 years ago)
Author:
chronos
Message:
Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Compiler/Target/Delphi/UProducerPascal.pas

    r63 r65  
    102102    EmitLn('program ' + Name + ';');
    103103    EmitLn;
    104     EnitLn('{$APPTYPE Console}');
     104    EmitLn('{$APPTYPE Console}');
    105105    EmitLn;
    106106    GenerateUses(UsedModules);
  • trunk/Compiler/UAnalyzer.pas

    r62 r65  
    4545    CurrentChar: Char;
    4646    TokenCodePosition: TPoint;
     47    LineEndingChar: Char;
    4748    procedure GetNextToken;
    4849  public
     
    125126begin
    126127  Tokens := TObjectList.Create;
     128  {$IFDEF windows}
     129  LineEndingChar := LineEnding[1];
     130  {$ELSE}
     131  LineEndingChar := LineEnding;
     132  {$ENDIF}
    127133end;
    128134
     
    374380        // Update cursor position
    375381        Inc(CodePosition.X);
    376         if (CurrentChar = LineEnding[1]) then begin
     382        if (CurrentChar = LineEndingChar) then begin
    377383          CodePosition.X := 0;
    378384          Inc(CodePosition.Y);
  • trunk/IDE/Forms/UFormMain.lfm

    r61 r65  
    55  Width = 695
    66  Caption = 'Transpascal IDE'
    7   ClientHeight = 482
     7  ClientHeight = 476
    88  ClientWidth = 695
    99  Font.Height = -11
     
    2020    Left = 0
    2121    Height = 5
    22     Top = 477
     22    Top = 471
    2323    Width = 695
    2424    Align = alBottom
     
    8989    object ComboBoxTarget: TComboBox
    9090      Left = 230
    91       Height = 21
     91      Height = 27
    9292      Top = 2
    9393      Width = 100
    94       ItemHeight = 13
     94      ItemHeight = 0
    9595      OnChange = ComboBoxTargetChange
    9696      Style = csDropDownList
     
    105105  object Splitter1: TSplitter
    106106    Left = 490
    107     Height = 345
     107    Height = 339
    108108    Top = 26
    109109    Width = 5
     
    113113  object PageControlRight: TPageControl
    114114    Left = 495
    115     Height = 345
     115    Height = 339
    116116    Top = 26
    117117    Width = 200
     
    137137    Left = 0
    138138    Height = 101
    139     Top = 376
     139    Top = 370
    140140    Width = 695
    141141    ActivePage = TabSheetMessages
     
    155155    Left = 0
    156156    Height = 5
    157     Top = 371
     157    Top = 365
    158158    Width = 695
    159159    Align = alBottom
     
    162162  object PageControlMain: TPageControl
    163163    Left = 0
    164     Height = 345
     164    Height = 339
    165165    Top = 26
    166166    Width = 490
     
    667667      object MenuItem24: TMenuItem
    668668        Action = AViewTargets
     669        Bitmap.Data = {
     670          36040000424D3604000000000000360000002800000010000000100000000100
     671          2000000000000004000064000000640000000000000000000000000000000000
     672          000000000000000000000000000000000000000000000202022F020202FF0303
     673          031F000000000000000000000000000000000000000000000000000000000000
     674          000000000000000000000000000000000000000000000505053F050505FF0505
     675          053F000000000000000000000000000000000000000000000000000000000000
     676          00000000000000000000000000000909097F090909DF090909FF090909FF0909
     677          09FF090909DF0909096F00000000000000000000000000000000000000000000
     678          000000000000000000000D0D0D9F0C0C0CFF0C0C0CAF0B0B0B4F0C0C0CFF0B0B
     679          0B4F0C0C0CAF0C0C0CFF0D0D0D9F000000000000000000000000000000000000
     680          0000000000000F0F0F7F0F0F0FFF0E0E0E5F00000000000000000F0F0FFF0000
     681          0000000000000E0E0E5F0F0F0FFF1010106F0000000000000000000000000000
     682          000000000000131313DF131313AF000000000000000000000000131313FF0000
     683          00000000000000000000131313AF131313DF0000000000000000000000001818
     684          182F1818183F161616FF1616167F1818183F1818183F1818183F161616FF1818
     685          183F1818183F1818183F1616167F161616FF1818183F1818181F1A1A1A1F1A1A
     686          1AFF1A1A1AFF1A1A1AFF1A1A1AFF1A1A1AFF1A1A1AFF1A1A1AFF1A1A1ABF1A1A
     687          1AFF1A1A1AFF1A1A1AFF1A1A1AFF1A1A1AFF1A1A1AFF1A1A1AFF000000001C1C
     688          1C1F1C1C1C3F1D1D1DFF1D1D1D4F0000000000000000000000001D1D1DFF0000
     689          000000000000000000001D1D1D4F1D1D1DFF1C1C1C3F1C1C1C1F000000000000
     690          000000000000202020DF202020AF000000000000000000000000202020FF0000
     691          00000000000000000000202020AF202020DF0000000000000000000000000000
     692          0000000000002424247F242424FF2424245F0000000000000000242424FF0000
     693          0000000000002424245F242424FF2424247F0000000000000000000000000000
     694          000000000000000000002727279F272727FF282828AF2828284F272727FF2828
     695          284F282828AF272727FF2727279F000000000000000000000000000000000000
     696          00000000000000000000000000002A2A2A7F2A2A2ADF2B2B2BFF2B2B2BFF2B2B
     697          2BFF2A2A2ADF2A2A2A7F00000000000000000000000000000000000000000000
     698          000000000000000000000000000000000000000000002E2E2E3F2E2E2EFF2E2E
     699          2E3F000000000000000000000000000000000000000000000000000000000000
     700          000000000000000000000000000000000000000000003131312F313131FF3030
     701          301F000000000000000000000000000000000000000000000000000000000000
     702          0000000000000000000000000000000000000000000000000000000000000000
     703          0000000000000000000000000000000000000000000000000000
     704        }
    669705      end
    670706    end
     
    877913    end
    878914  end
    879   object OpenDialog1: TOpenDialog
     915  object OpenDialogProject: TOpenDialog
    880916    DefaultExt = '.tppr'
    881917    Filter = 'Project file (*.tppr)|*.tppr|Any file (*.*)|*.*'
    882918    left = 115
    883     top = 52
     919    top = 54
    884920  end
    885   object SaveDialog1: TSaveDialog
     921  object SaveDialogProject: TSaveDialog
    886922    DefaultExt = '.tppr'
    887923    Filter = 'Project file (*.tppr)|*.tppr|Any file (*.*)|*.*'
  • trunk/IDE/Forms/UFormMain.pas

    r62 r65  
    77uses
    88  SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls,
    9   Registry, ComCtrls, ExtCtrls, SynEdit, SynHighlighterPas,
     9  ComCtrls, ExtCtrls, SynEdit, SynHighlighterPas,
    1010  UProject, FileUtil, Menus, ActnList,
    11   UFormTargetCode, UFormCodeTree, URegistry, UApplicationInfo;
     11  UFormTargetCode, UFormCodeTree, UGeneralRegistry, UApplicationInfo;
    1212
    1313type
     
    8181    MenuItem9: TMenuItem;
    8282    MenuItemOpenRecent: TMenuItem;
    83     OpenDialog1: TOpenDialog;
     83    OpenDialogProject: TOpenDialog;
    8484    PageControlMain: TPageControl;
    8585    PageControlRight: TPageControl;
    8686    PageControlBottom: TPageControl;
    8787    PopupMenu1: TPopupMenu;
    88     SaveDialog1: TSaveDialog;
     88    SaveDialogProject: TSaveDialog;
    8989    Splitter1: TSplitter;
    9090    Splitter2: TSplitter;
     
    146146    procedure ProducerProcessOutput(Text: string);
    147147  public
    148     procedure LoadFromRegistry(Root: HKEY; Key: string);
    149     procedure SaveToRegistry(Root: HKEY; Key: string);
     148    procedure LoadFromRegistry(Root: Integer; Key: string);
     149    procedure SaveToRegistry(Root: Integer; Key: string);
    150150    procedure OpenRecentClick(Sender: TObject);
    151151    function GetSource(Name: string; var SourceCode: string): Boolean;
     
    397397end;
    398398
    399 procedure TFormMain.LoadFromRegistry(Root: HKEY; Key: string);
    400 begin
    401   with TRegistryEx.Create do
     399procedure TFormMain.LoadFromRegistry(Root: Integer; Key: string);
     400begin
     401  with TGeneralRegistry.Create(nil) do
    402402    try
    403       RootKey := Root;
     403      CurrentRoot := Root;
    404404      OpenKey(Key, True);
    405       PageControlRight.Width := ReadIntegerWithDefault('RightPanelWidth', 120);
    406       PageControlBottom.Height := ReadIntegerWithDefault('BottomPanelHeight', 100);
     405      if ValueExists('RightPanelWidth') then
     406        PageControlRight.Width := ReadInteger('RightPanelWidth')
     407        else PageControlRight.Width := 150;
     408      if ValueExists('BottomPanelHeight') then
     409        PageControlBottom.Height := ReadInteger('BottomPanelHeight')
     410        else PageControlBottom.Height := 100;
    407411    finally
    408412      Free;
     
    410414end;
    411415
    412 procedure TFormMain.SaveToRegistry(Root: HKEY; Key: string);
    413 begin
    414   with TRegistryEx.Create do
     416procedure TFormMain.SaveToRegistry(Root: Integer; Key: string);
     417begin
     418  with TGeneralRegistry.Create(nil) do
    415419    try
    416       RootKey := Root;
     420      CurrentRoot := Root;
    417421      OpenKey(Key, True);
    418422      WriteInteger('RightPanelWidth', PageControlRight.Width);
     
    468472begin
    469473  AProjectClose.Execute;
    470   Core.SaveToRegistry(HKEY(Core.ApplicationInfo.RegistryRoot), Core.ApplicationInfo.RegistryKey);
     474  Core.SaveToRegistry(Integer(Core.ApplicationInfo.RegistryRoot), Core.ApplicationInfo.RegistryKey);
    471475end;
    472476
     
    494498procedure TFormMain.FormShow(Sender: TObject);
    495499begin
    496   Core.LoadFromRegistry(HKEY(Core.ApplicationInfo.RegistryRoot), Core.ApplicationInfo.RegistryKey);
     500  Core.LoadFromRegistry(Integer(Core.ApplicationInfo.RegistryRoot), Core.ApplicationInfo.RegistryKey);
    497501  DockInit;
    498502  Core.ProjectTemplatesInit;
     
    503507
    504508  WindowState := wsMaximized;
     509  UpdateInterface;
    505510end;
    506511
    507512procedure TFormMain.AProjectOpenExecute(Sender: TObject);
    508513begin
    509   if OpenDialog1.Execute then begin
    510     Core.ProjectOpen(OpenDialog1.FileName);
     514  if Core.LastOpenedFiles.Items.Count > 0 then
     515    OpenDialogProject.FileName := Core.LastOpenedFiles.Items[0]
     516    else OpenDialogProject.FileName := ExtractFileDir(Application.ExeName);
     517  if OpenDialogProject.Execute then begin
     518    Core.ProjectOpen(OpenDialogProject.FileName);
    511519  end;
    512520end;
     
    555563procedure TFormMain.AProjectSaveAsExecute(Sender: TObject);
    556564begin
     565  if Core.LastOpenedFiles.Items.Count > 0 then
     566    SaveDialogProject.FileName := Core.LastOpenedFiles.Items[0]
     567    else SaveDialogProject.FileName := ExtractFileDir(Application.ExeName);
    557568  if Assigned(Core.Project) then
    558   if SaveDialog1.Execute then begin
    559     Core.Project.SaveToFile(SaveDialog1.FileName);
     569  if SaveDialogProject.Execute then begin
     570    Core.Project.SaveToFile(SaveDialogProject.FileName);
    560571    FormSourceCode.Save;
    561572    Core.Project.Save;
    562573    UpdateInterface;
    563     Core.LastOpenedFiles.AddItem(SaveDialog1.FileName);
     574    Core.LastOpenedFiles.AddItem(SaveDialogProject.FileName);
    564575  end;
    565576end;
  • trunk/IDE/UCore.lfm

    r62 r65  
    3939    ReleaseDate = 41107
    4040    RegistryKey = '\Software\Chronosoft\Transpascal'
    41     RegistryRoot = rrKeyCurrentUser
     41    RegistryRoot = rrApplicationUser
    4242    left = 48
    4343    top = 195
  • trunk/IDE/UCore.pas

    r59 r65  
    77uses
    88  Classes, SysUtils, FileUtil, ULastOpenedList, UProject, UApplicationInfo,
    9   UCompiler, Registry, URegistry, UDebugLog, UCoolTranslator, UTarget;
     9  UCompiler, UGeneralRegistry, UDebugLog, UCoolTranslator, UTarget;
    1010
    1111type
     
    1515    SourceFiles: TSourceFileManager;
    1616    TargetFiles: TSourceFileManager;
    17     procedure LoadFromRegistry(Root: HKEY; Key: string);
    18     procedure SaveToRegistry(Root: HKEY; Key: string);
     17    procedure LoadFromRegistry(Root: Integer; Key: string);
     18    procedure SaveToRegistry(Root: Integer; Key: string);
    1919    constructor Create; override;
    2020    destructor Destroy; override;
     
    4646    procedure ProjectNew;
    4747    procedure CompilerDebugLog(Text: string);
    48     procedure LoadFromRegistry(Root: HKEY; Key: string);
    49     procedure SaveToRegistry(Root: HKEY; Key: string);
     48    procedure LoadFromRegistry(Root: Integer; Key: string);
     49    procedure SaveToRegistry(Root: Integer; Key: string);
    5050  end;
    5151
     
    136136end;
    137137
    138 procedure TCore.LoadFromRegistry(Root: HKEY; Key: string);
    139 begin
    140   with TRegistryEx.Create do
    141     try
    142       RootKey := Root;
    143       OpenKey(Key, True);
    144       ReopenLastOpenedFile := ReadBoolWithDefault('ReopenLastOpenedFile', True);
    145       Compiler.Target := Compiler.Targets.SearchBySysName(ReadStringWithDefault('TargetName', ''));
    146       LogParsing := ReadBoolWithDefault('LogParsing', False);
     138procedure TCore.LoadFromRegistry(Root: Integer; Key: string);
     139begin
     140  with TGeneralRegistry.Create(nil) do
     141    try
     142      CurrentRoot := Root;
     143      OpenKey(Key, True);
     144      if ValueExists('ReopenLastOpenedFile') then
     145        ReopenLastOpenedFile := ReadBool('ReopenLastOpenedFile')
     146        else ReopenLastOpenedFile := True;
     147      if ValueExists('TargetName') then
     148        Compiler.Target := Compiler.Targets.SearchBySysName(ReadString('TargetName'))
     149        else Compiler.Target := nil;
     150      if ValueExists('LogParsing') then
     151        LogParsing := ReadBool('LogParsing')
     152        else LogParsing := False;
    147153      if ValueExists('LanguageCode') then
    148         CoolTranslator1.Language := CoolTranslator1.Languages.SearchByCode(ReadStringWithDefault('LanguageCode', ''))
     154        CoolTranslator1.Language := CoolTranslator1.Languages.SearchByCode(ReadString('LanguageCode'))
    149155        else CoolTranslator1.Language := CoolTranslator1.Languages.SearchByCode('');
    150156    finally
     
    156162end;
    157163
    158 procedure TCore.SaveToRegistry(Root: HKEY; Key: string);
    159 begin
    160   with TRegistryEx.Create do
    161     try
    162       RootKey := Root;
     164procedure TCore.SaveToRegistry(Root: Integer; Key: string);
     165begin
     166  with TGeneralRegistry.Create(nil) do
     167    try
     168      CurrentRoot := Root;
    163169      OpenKey(Key, True);
    164170      WriteBool('ReopenLastOpenedFile', ReopenLastOpenedFile);
    165171      if Assigned(Compiler.Target) then
    166172        WriteString('TargetName', Compiler.Target.SysName)
    167         else DeleteValue('TargetName');
     173        else WriteString('TargetName', '');
    168174      WriteBool('LogParsing', LogParsing);
    169175      if Assigned(CoolTranslator1.Language) and (CoolTranslator1.Language.Code <> '') then
    170176        WriteString('LanguageCode', CoolTranslator1.Language.Code)
    171         else DeleteValue('LanguageCode');
     177        else WriteString('LanguageCode', '');
    172178    finally
    173179      Free;
     
    180186{ TCustomCompiler }
    181187
    182 procedure TCustomCompiler.LoadFromRegistry(Root: HKEY; Key: string);
     188procedure TCustomCompiler.LoadFromRegistry(Root: Integer; Key: string);
    183189var
    184190  I: Integer;
    185191begin
    186   with TRegistryEx.Create do
    187     try
    188       RootKey := Root;
     192  with TGeneralRegistry.Create(nil) do
     193    try
     194      CurrentRoot := Root;
    189195      for I := 0 to Targets.Count - 1 do
    190196      with TTarget(Targets[I]) do begin
    191197        OpenKey(Key + '\Targets\' + Name, True);
    192198        if ValueExists('CompilerPath') then
    193           Producer.CompilerPath := ReadStringWithDefault('CompilerPath', Producer.CompilerPath);
     199          Producer.CompilerPath := ReadString('CompilerPath');
    194200      end;
     201      OpenKey(Key, True);
    195202      if ValueExists('SelectedTarget') then
    196       Target := Targets.SearchBySysName(ReadString('SelectedTarget'))
     203        Target := Targets.SearchBySysName(ReadString('SelectedTarget'))
    197204        else Target := nil;
    198205    finally
     
    201208end;
    202209
    203 procedure TCustomCompiler.SaveToRegistry(Root: HKEY; Key: string);
     210procedure TCustomCompiler.SaveToRegistry(Root: Integer; Key: string);
    204211var
    205212  I: Integer;
    206213begin
    207   with TRegistryEx.Create do
    208     try
    209       RootKey := Root;
     214  with TGeneralRegistry.Create(nil) do
     215    try
     216      CurrentRoot := Root;
    210217      for I := 0 to Targets.Count - 1 do
    211218      with TTarget(Targets[I]) do begin
     
    213220        if Assigned(Producer) then begin
    214221          if Producer.CompilerPath <> '' then WriteString('CompilerPath', Producer.CompilerPath)
    215             else DeleteValue('CompilerPath');
     222            else WriteString('CompilerPath', '');
    216223        end;
    217224      end;
     225      OpenKey(Key, True);
    218226      if Assigned(Target) then WriteString('SelectedTarget', Target.SysName)
    219         else DeleteValue('SelectedTarget');
     227        else WriteString('SelectedTarget', '');
    220228    finally
    221229      Free;
Note: See TracChangeset for help on using the changeset viewer.