Changeset 6 for trunk/Forms


Ignore:
Timestamp:
Feb 4, 2011, 9:45:01 AM (14 years ago)
Author:
chronos
Message:
  • Modified: Source selection separated to single form.
  • Added: Starting compiler and IDE with updated paths in configuration files.
Location:
trunk/Forms
Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UInstanceOptions.lfm

    r5 r6  
    11object InstanceOptionsForm: TInstanceOptionsForm
    2   Left = 274
    3   Height = 424
    4   Top = 106
    5   Width = 573
     2  Left = 307
     3  Height = 225
     4  Top = 132
     5  Width = 454
    66  Caption = 'Options'
    7   ClientHeight = 424
    8   ClientWidth = 573
     7  ClientHeight = 225
     8  ClientWidth = 454
    99  OnCreate = FormCreate
    1010  OnDestroy = FormDestroy
     
    1212  LCLVersion = '0.9.31'
    1313  object ButtonCancel: TButton
    14     Left = 408
     14    Left = 289
    1515    Height = 25
    16     Top = 394
     16    Top = 195
    1717    Width = 75
    1818    Anchors = [akRight, akBottom]
     
    2323  end
    2424  object ButtonOk: TButton
    25     Left = 493
     25    Left = 374
    2626    Height = 25
    27     Top = 394
     27    Top = 195
    2828    Width = 75
    2929    Anchors = [akRight, akBottom]
     
    3333    TabOrder = 1
    3434  end
    35   object ButtonUpdateSource: TButton
    36     Left = 10
    37     Height = 25
    38     Top = 395
    39     Width = 75
    40     Anchors = [akLeft, akBottom]
    41     Caption = 'Update list'
    42     OnClick = ButtonUpdateSourceClick
     35  object Label2: TLabel
     36    Left = 8
     37    Height = 14
     38    Top = 72
     39    Width = 67
     40    Caption = 'IDE selection:'
     41    ParentColor = False
     42  end
     43  object Label1: TLabel
     44    Left = 8
     45    Height = 14
     46    Top = 40
     47    Width = 69
     48    Caption = 'FPC selection:'
     49    ParentColor = False
     50  end
     51  object Edit1: TEdit
     52    Left = 128
     53    Height = 21
     54    Top = 8
     55    Width = 320
     56    Anchors = [akTop, akLeft, akRight]
    4357    TabOrder = 2
    4458  end
    45   object Panel1: TPanel
    46     Left = 0
    47     Height = 26
    48     Top = 0
    49     Width = 573
    50     Align = alTop
    51     BevelOuter = bvNone
    52     ClientHeight = 26
    53     ClientWidth = 573
     59  object Label3: TLabel
     60    Left = 8
     61    Height = 14
     62    Top = 8
     63    Width = 32
     64    Caption = 'Name:'
     65    ParentColor = False
     66  end
     67  object Edit2: TEdit
     68    Left = 128
     69    Height = 21
     70    Top = 39
     71    Width = 233
     72    Anchors = [akTop, akLeft, akRight]
     73    ReadOnly = True
    5474    TabOrder = 3
    55     object Edit1: TEdit
    56       Left = 56
    57       Height = 21
    58       Top = 3
    59       Width = 512
    60       Anchors = [akTop, akLeft, akRight]
    61       TabOrder = 0
    62     end
    63     object Label3: TLabel
    64       Left = 7
    65       Height = 14
    66       Top = 5
    67       Width = 32
    68       Caption = 'Name:'
    69       ParentColor = False
    70     end
    7175  end
    72   object Panel2: TPanel
    73     Left = 0
    74     Height = 178
    75     Top = 26
    76     Width = 573
    77     Align = alTop
    78     BevelOuter = bvNone
    79     ClientHeight = 178
    80     ClientWidth = 573
     76  object Button1: TButton
     77    Left = 374
     78    Height = 25
     79    Top = 39
     80    Width = 75
     81    Anchors = [akTop, akRight]
     82    Caption = 'Select'
     83    OnClick = Button1Click
    8184    TabOrder = 4
    82     object ListView1: TListView
    83       Left = 7
    84       Height = 156
    85       Top = 22
    86       Width = 561
    87       Anchors = [akTop, akLeft, akRight, akBottom]
    88       Columns = <     
    89         item
    90           Caption = 'Name'
    91           Width = 70
    92         end     
    93         item
    94           Caption = 'Type'
    95           Width = 80
    96         end     
    97         item
    98           Caption = 'Version'
    99           Width = 60
    100         end     
    101         item
    102           Caption = 'Revision'
    103         end     
    104         item
    105           Caption = 'Date'
    106           Width = 60
    107         end     
    108         item
    109           Caption = 'Source URL'
    110           Width = 300
    111         end>
    112       OwnerData = True
    113       ReadOnly = True
    114       RowSelect = True
    115       TabOrder = 0
    116       ViewStyle = vsReport
    117       OnData = ListView1Data
    118     end
    119     object Label1: TLabel
    120       Left = 9
    121       Height = 14
    122       Top = 8
    123       Width = 69
    124       Caption = 'FPC selection:'
    125       ParentColor = False
    126     end
    12785  end
    128   object Panel3: TPanel
    129     Left = 0
    130     Height = 186
    131     Top = 204
    132     Width = 573
    133     Align = alTop
    134     Anchors = [akTop, akLeft, akRight, akBottom]
    135     BevelOuter = bvNone
    136     ClientHeight = 186
    137     ClientWidth = 573
     86  object Edit3: TEdit
     87    Left = 128
     88    Height = 21
     89    Top = 72
     90    Width = 233
     91    Anchors = [akTop, akLeft, akRight]
     92    ReadOnly = True
    13893    TabOrder = 5
    139     object Label2: TLabel
    140       Left = 11
    141       Height = 14
    142       Top = 12
    143       Width = 67
    144       Caption = 'IDE selection:'
    145       ParentColor = False
    146     end
    147     object ListView2: TListView
    148       Left = 9
    149       Height = 158
    150       Top = 28
    151       Width = 559
    152       Anchors = [akTop, akLeft, akRight, akBottom]
    153       Columns = <     
    154         item
    155           Caption = 'Name'
    156           Width = 70
    157         end     
    158         item
    159           Caption = 'Type'
    160           Width = 80
    161         end     
    162         item
    163           Caption = 'Version'
    164           Width = 60
    165         end     
    166         item
    167           Caption = 'Revision'
    168         end     
    169         item
    170           Caption = 'Date'
    171           Width = 60
    172         end     
    173         item
    174           Caption = 'Source URL'
    175           Width = 300
    176         end>
    177       OwnerData = True
    178       ReadOnly = True
    179       RowSelect = True
    180       TabOrder = 0
    181       ViewStyle = vsReport
    182       OnData = ListView2Data
    183     end
     94  end
     95  object Button2: TButton
     96    Left = 374
     97    Height = 25
     98    Top = 70
     99    Width = 75
     100    Anchors = [akTop, akRight]
     101    Caption = 'Select'
     102    OnClick = Button2Click
     103    TabOrder = 6
    184104  end
    185105end
  • trunk/Forms/UInstanceOptions.pas

    r5 r6  
    77uses
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
    9   ComCtrls, ExtCtrls, DOM, XMLWrite, XMLRead, HTTPSend, USource, UInstance;
     9  ComCtrls, ExtCtrls, DOM, XMLWrite, XMLRead, HTTPSend, USource, UInstance,
     10  USourceSelection;
    1011
    1112type
     
    1415
    1516  TInstanceOptionsForm = class(TForm)
    16     ButtonUpdateSource: TButton;
     17    Button1: TButton;
     18    Button2: TButton;
    1719    ButtonCancel: TButton;
    1820    ButtonOk: TButton;
    1921    Edit1: TEdit;
     22    Edit2: TEdit;
     23    Edit3: TEdit;
    2024    Label1: TLabel;
    2125    Label2: TLabel;
    2226    Label3: TLabel;
    23     ListView1: TListView;
    24     ListView2: TListView;
    25     Panel1: TPanel;
    26     Panel2: TPanel;
    27     Panel3: TPanel;
     27    procedure Button1Click(Sender: TObject);
     28    procedure Button2Click(Sender: TObject);
    2829    procedure ButtonCancelClick(Sender: TObject);
    2930    procedure ButtonOkClick(Sender: TObject);
    30     procedure ButtonUpdateSourceClick(Sender: TObject);
    3131    procedure FormCreate(Sender: TObject);
    3232    procedure FormDestroy(Sender: TObject);
    3333    procedure FormShow(Sender: TObject);
    34     procedure ListView1Data(Sender: TObject; Item: TListItem);
    35     procedure ListView2Data(Sender: TObject; Item: TListItem);
    3634  private
    37     procedure ReloadList;
     35    IsNew: Boolean;
    3836  public
    3937    Instance: TInstance;
    40     FPCSources: TSourceList;
    41     IDESources: TSourceList;
     38    FPCSource: TSource;
     39    IDESource: TSource;
    4240  end;
    4341
     
    5452{ TInstanceOptionsForm }
    5553
    56 procedure TInstanceOptionsForm.ButtonUpdateSourceClick(Sender: TObject);
    57 var
    58   fs: TFileStream;
    59 begin
    60   fs := TFileStream.Create(ExtractFileName(MainForm.SourceURL), fmOpenWrite or fmCreate);
    61   try
    62     HttpGetBinary(MainForm.SourceURL, fs);
    63   finally
    64     fs.Free;
    65   end;
    66   MainForm.Sources.UpdateFormFile(ExtractFileName(MainForm.SourceURL));
    67   ReloadList;
    68 end;
    69 
    7054procedure TInstanceOptionsForm.ButtonOkClick(Sender: TObject);
    7155begin
    7256  Instance.Name := Edit1.Text;
    73   if Assigned(ListView1.Selected) then
    74     Instance.FPCSource := TSource(ListView1.Selected.Data)
    75     else Instance.FPCSource := nil;
    76   if Assigned(ListView2.Selected) then
    77     Instance.IDESource := TSource(ListView2.Selected.Data)
    78     else Instance.IDESource := nil;
     57  Instance.FPCSource := FPCSource;
     58  Instance.IDESource := IDESource;
    7959end;
    8060
    8161procedure TInstanceOptionsForm.ButtonCancelClick(Sender: TObject);
    8262begin
    83   Instance.Free;
     63  if IsNew then Instance.Free;
     64end;
     65
     66procedure TInstanceOptionsForm.Button1Click(Sender: TObject);
     67begin
     68  SourceSelectionForm.ProjectType := 'Compiler';
     69  if SourceSelectionForm.ShowModal = mrOk then begin
     70    if Assigned(SourceSelectionForm.ListView1.Selected) then
     71      FPCSource := TSource(SourceSelectionForm.ListView1.Selected.Data)
     72      else FPCSource := nil;
     73    if Assigned(FPCSource) then
     74      Edit2.Text := FPCSource.GetName
     75      else Edit2.Text := '';
     76  end;
     77end;
     78
     79procedure TInstanceOptionsForm.Button2Click(Sender: TObject);
     80begin
     81  SourceSelectionForm.ProjectType := 'IDE';
     82  if SourceSelectionForm.ShowModal = mrOk then begin
     83    if Assigned(SourceSelectionForm.ListView1.Selected) then
     84      IDESource := TSource(SourceSelectionForm.ListView1.Selected.Data)
     85      else IDESource := nil;
     86    if Assigned(IDESource) then
     87      Edit3.Text := IDESource.GetName
     88      else Edit3.Text := '';
     89  end;
    8490end;
    8591
    8692procedure TInstanceOptionsForm.FormCreate(Sender: TObject);
    8793begin
    88   FPCSources := TSourceList.Create;
    89   FPCSources.OwnsObjects := False;
    90   IDESources := TSourceList.Create;
    91   IDESources.OwnsObjects := False;
    9294end;
    9395
    9496procedure TInstanceOptionsForm.FormDestroy(Sender: TObject);
    9597begin
    96   FPCSources.Free;
    97   IDESources.Free;
    9898end;
    9999
    100100procedure TInstanceOptionsForm.FormShow(Sender: TObject);
    101101begin
    102   ReloadList;
    103102  if not Assigned(Instance) then begin
    104103    Instance := TInstance.Create;
    105104    Instance.Id := MainForm.Instances.GetNewId;
    106105    Instance.Name := 'Instance ' + IntToStr(Instance.Id);
    107   end;
    108   //    ListView1.Items[;
     106    IsNew := True;
     107  end else IsNew := False;
     108
    109109  Edit1.Text := Instance.Name;
    110 end;
    111 
    112 procedure TInstanceOptionsForm.ListView1Data(Sender: TObject; Item: TListItem);
    113 begin
    114   if Item.Index < FPCSources.Count then
    115   with TSource(FPCSources[Item.Index]) do begin
    116     Item.Caption := ProjectName;
    117     Item.Data := FPCSources[Item.Index];
    118     Item.SubItems.Add(VersionType);
    119     Item.SubItems.Add(VersionNumber);
    120     Item.SubItems.Add('');
    121     Item.SubItems.Add('');
    122     Item.SubItems.Add(SubversionURL);
    123   end;
    124 end;
    125 
    126 procedure TInstanceOptionsForm.ListView2Data(Sender: TObject; Item: TListItem);
    127 begin
    128   if Item.Index < IDESources.Count then
    129   with TSource(IDESources[Item.Index]) do begin
    130     Item.Caption := ProjectName;
    131     Item.Data := IDESources[Item.Index];
    132     Item.SubItems.Add(VersionType);
    133     Item.SubItems.Add(VersionNumber);
    134     Item.SubItems.Add('');
    135     Item.SubItems.Add('');
    136     Item.SubItems.Add(SubversionURL);
    137   end;
    138 end;
    139 
    140 procedure TInstanceOptionsForm.ReloadList;
    141 var
    142   I: Integer;
    143 begin
    144   FPCSources.Clear;
    145   for I := 0 to MainForm.Sources.Count - 1 do
    146     if TSource(MainForm.Sources[I]).ProjectType = 'Compiler' then
    147       FPCSources.Add(MainForm.Sources[I]);
    148   if ListView1.Items.Count <> FPCSources.Count then
    149     ListView1.Items.Count := FPCSources.Count;
    150   ListView1.Items[-1]; // workaround
    151   ListView1.Refresh;
    152   IDESources.Clear;
    153   for I := 0 to MainForm.Sources.Count - 1 do
    154     if TSource(MainForm.Sources[I]).ProjectType = 'IDE' then
    155       IDESources.Add(MainForm.Sources[I]);
    156   if ListView2.Items.Count <> IDESources.Count then
    157     ListView2.Items.Count := IDESources.Count;
    158   ListView2.Items[-1]; // workaround
    159   ListView2.Refresh;
     110  if Assigned(Instance.FPCSource) then
     111    Edit2.Text := Instance.FPCSource.GetName
     112    else Edit2.Text := '';
     113  if Assigned(Instance.IDESource) then
     114    Edit3.Text := Instance.IDESource.GetName
     115    else Edit3.Text := '';
    160116end;
    161117
  • trunk/Forms/UMainForm.lfm

    r5 r6  
    2323      end   
    2424      item
    25         Caption = 'FPC version'
    26         Width = 150
     25        Caption = 'Compiler'
     26        Width = 200
    2727      end   
    2828      item
    29         Caption = 'IDE version'
    30         Width = 150
     29        Caption = 'IDE'
     30        Width = 200
    3131      end   
    3232      item
  • trunk/Forms/UMainForm.pas

    r5 r6  
    6767  public
    6868    Platform: string;
     69    TemplateDir: string;
    6970    BinUtilsDir: string;
    7071    InstanceDir: string;
     72    SubversionDir: string;
    7173    SourceDir: string;
    7274    SourceURL: string;
     
    9092  Instances := TInstanceList.Create;
    9193  Sources := TSourceList.Create;
    92   Platform := 'i386-win32';
    9394  BinUtilsDir := 'BinUtils';
    9495  InstanceDir := 'Instance';
     96  TemplateDir := 'Template';
    9597  SourceDir := 'Source';
    9698  SourceURL := 'http://tv.zdechov.net/fpc/SourceList.xml';
     99  {$IFDEF Windows}
     100  Platform := 'i386-win32';
     101  SubversionDir := 'C:\Program Files\Subversion\bin';
     102  {$ENDIF}
     103  {$IFDEF Linux}
     104  Platform := 'i386-linux';
     105  SubversionDir := '';
     106  {$ENDIF}
    97107  LoadInstanceList;
    98108end;
     
    154164    if ListView1.Selected.Index < Instances.Count then
    155165    with TInstance(Instances[ListView1.Selected.Index]) do begin
     166      ForceDirectoriesUTF8(GetPath);
    156167      if Assigned(FPCSource) then begin
    157168        FPCSource.Download;
     
    203214    Item.Data := Instances[Item.Index];
    204215    if Assigned(FPCSource) then
    205       Item.SubItems.Add(FPCSource.ProjectName + ' ' + FPCSource.VersionNumber)
     216      Item.SubItems.Add(FPCSource.GetName)
    206217      else Item.SubItems.Add('');
    207218    if Assigned(IDESource) then
    208       Item.SubItems.Add(IDESource.ProjectName + ' ' + IDESource.VersionNumber)
     219      Item.SubItems.Add(IDESource.GetName)
    209220      else Item.SubItems.Add('');
    210221    Item.SubItems.Add(BooleanText[Downloaded]);
  • trunk/Forms/UMainOptions.lfm

    r5 r6  
    4343    Anchors = [akTop, akLeft, akRight]
    4444    TabOrder = 2
    45     Text = 'Edit1'
    4645  end
    4746  object Label2: TLabel
     
    6059    Anchors = [akTop, akLeft, akRight]
    6160    TabOrder = 3
    62     Text = 'Edit1'
    6361  end
    6462  object Label3: TLabel
     
    7775    Anchors = [akTop, akLeft, akRight]
    7876    TabOrder = 4
    79     Text = 'Edit1'
     77  end
     78  object Label4: TLabel
     79    Left = 9
     80    Height = 14
     81    Top = 128
     82    Width = 98
     83    Caption = 'Subversion location:'
     84    ParentColor = False
     85  end
     86  object Edit4: TEdit
     87    Left = 9
     88    Height = 21
     89    Top = 144
     90    Width = 621
     91    Anchors = [akTop, akLeft, akRight]
     92    TabOrder = 5
    8093  end
    8194end
  • trunk/Forms/UMainOptions.pas

    r5 r6  
    1818    Edit2: TEdit;
    1919    Edit3: TEdit;
     20    Edit4: TEdit;
    2021    Label1: TLabel;
    2122    Label2: TLabel;
    2223    Label3: TLabel;
     24    Label4: TLabel;
    2325    procedure Button2Click(Sender: TObject);
    2426    procedure FormShow(Sender: TObject);
     
    4648  Edit2.Text := MainForm.Platform;
    4749  Edit3.Text := MainForm.SourceURL;
     50  Edit4.Text := MainForm.SubversionDir;
    4851end;
    4952
     
    5356  MainForm.Platform := Edit2.Text;
    5457  MainForm.SourceURL := Edit3.Text;
     58  MainForm.SubversionDir := Edit4.Text;
    5559end;
    5660
  • trunk/Forms/UOperationProgress.lfm

    r5 r6  
    77  ClientHeight = 440
    88  ClientWidth = 562
     9  OnClose = FormClose
    910  OnShow = FormShow
    1011  LCLVersion = '0.9.31'
     
    3738    Caption = 'Close'
    3839    ModalResult = 6
     40    OnClick = ButtonCloseClick
    3941    TabOrder = 2
    4042  end
  • trunk/Forms/UOperationProgress.pas

    r5 r6  
    2020    Timer1: TTimer;
    2121    procedure ButtonAbortClick(Sender: TObject);
     22    procedure ButtonCloseClick(Sender: TObject);
     23    procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
    2224    procedure FormShow(Sender: TObject);
    2325    procedure Timer1Timer(Sender: TObject);
     
    4446  if Assigned(Process) then
    4547    Process.Terminate(0);
     48end;
     49
     50procedure TOperationProgressForm.ButtonCloseClick(Sender: TObject);
     51begin
     52
     53end;
     54
     55procedure TOperationProgressForm.FormClose(Sender: TObject;
     56  var CloseAction: TCloseAction);
     57begin
     58  Memo1.Clear;
    4659end;
    4760
Note: See TracChangeset for help on using the changeset viewer.