Changeset 2


Ignore:
Timestamp:
Feb 2, 2011, 11:31:12 AM (13 years ago)
Author:
chronos
Message:
  • Added: Routines for Load and Save configuration.
Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/FreePascalManager.lpi

    r1 r2  
    3535      </Item1>
    3636    </RequiredPackages>
    37     <Units Count="5">
     37    <Units Count="7">
    3838      <Unit0>
    3939        <Filename Value="FreePascalManager.lpr"/>
    4040        <IsPartOfProject Value="True"/>
    4141        <UnitName Value="FreePascalManager"/>
    42         <UsageCount Value="20"/>
     42        <UsageCount Value="22"/>
    4343      </Unit0>
    4444      <Unit1>
     
    4848        <ResourceBaseClass Value="Form"/>
    4949        <UnitName Value="UMainForm"/>
     50        <IsVisibleTab Value="True"/>
    5051        <EditorIndex Value="0"/>
    5152        <WindowIndex Value="0"/>
    52         <TopLine Value="1"/>
    53         <CursorPos X="86" Y="14"/>
    54         <UsageCount Value="20"/>
     53        <TopLine Value="117"/>
     54        <CursorPos X="45" Y="122"/>
     55        <UsageCount Value="22"/>
    5556        <Loaded Value="True"/>
    5657        <LoadedDesigner Value="True"/>
     
    5960        <Filename Value="UOptions.pas"/>
    6061        <IsPartOfProject Value="True"/>
    61         <ComponentName Value="Form2"/>
     62        <ComponentName Value="OptionsForm"/>
    6263        <ResourceBaseClass Value="Form"/>
    6364        <UnitName Value="UOptions"/>
     
    6566        <WindowIndex Value="0"/>
    6667        <TopLine Value="1"/>
    67         <CursorPos X="1" Y="1"/>
    68         <UsageCount Value="20"/>
     68        <CursorPos X="3" Y="9"/>
     69        <UsageCount Value="22"/>
    6970        <Loaded Value="True"/>
    7071        <LoadedDesigner Value="True"/>
     
    7475        <IsPartOfProject Value="True"/>
    7576        <UnitName Value="UInstance"/>
    76         <IsVisibleTab Value="True"/>
    7777        <EditorIndex Value="2"/>
    7878        <WindowIndex Value="0"/>
    79         <TopLine Value="1"/>
    80         <CursorPos X="29" Y="8"/>
    81         <UsageCount Value="20"/>
     79        <TopLine Value="23"/>
     80        <CursorPos X="3" Y="44"/>
     81        <UsageCount Value="22"/>
    8282        <Loaded Value="True"/>
    8383      </Unit3>
     
    8888        <EditorIndex Value="3"/>
    8989        <WindowIndex Value="0"/>
    90         <TopLine Value="1"/>
    91         <CursorPos X="23" Y="17"/>
    92         <UsageCount Value="20"/>
     90        <TopLine Value="16"/>
     91        <CursorPos X="1" Y="40"/>
     92        <UsageCount Value="22"/>
    9393        <Loaded Value="True"/>
    9494      </Unit4>
     95      <Unit5>
     96        <Filename Value="E:\Programy\Lazarus\0.9.31_2.5.1\fpc\2.5.1\source\rtl\objpas\classes\classesh.inc"/>
     97        <WindowIndex Value="0"/>
     98        <TopLine Value="1670"/>
     99        <CursorPos X="14" Y="1683"/>
     100        <UsageCount Value="11"/>
     101      </Unit5>
     102      <Unit6>
     103        <Filename Value="E:\Programy\Lazarus\0.9.31_2.5.1\lcl\lclclasses.pp"/>
     104        <UnitName Value="LCLClasses"/>
     105        <WindowIndex Value="0"/>
     106        <TopLine Value="5"/>
     107        <CursorPos X="20" Y="47"/>
     108        <UsageCount Value="10"/>
     109      </Unit6>
    95110    </Units>
    96     <JumpHistory Count="3" HistoryIndex="2">
     111    <JumpHistory Count="30" HistoryIndex="28">
    97112      <Position1>
    98113        <Filename Value="UMainForm.pas"/>
    99         <Caret Line="1" Column="1" TopLine="1"/>
     114        <Caret Line="165" Column="36" TopLine="144"/>
    100115      </Position1>
    101116      <Position2>
    102117        <Filename Value="UMainForm.pas"/>
    103         <Caret Line="14" Column="86" TopLine="1"/>
     118        <Caret Line="102" Column="9" TopLine="87"/>
    104119      </Position2>
    105120      <Position3>
    106         <Filename Value="UInstance.pas"/>
    107         <Caret Line="20" Column="8" TopLine="1"/>
     121        <Filename Value="UMainForm.pas"/>
     122        <Caret Line="127" Column="33" TopLine="106"/>
    108123      </Position3>
     124      <Position4>
     125        <Filename Value="UMainForm.pas"/>
     126        <Caret Line="96" Column="1" TopLine="83"/>
     127      </Position4>
     128      <Position5>
     129        <Filename Value="UMainForm.pas"/>
     130        <Caret Line="97" Column="19" TopLine="89"/>
     131      </Position5>
     132      <Position6>
     133        <Filename Value="UMainForm.pas"/>
     134        <Caret Line="106" Column="17" TopLine="93"/>
     135      </Position6>
     136      <Position7>
     137        <Filename Value="UMainForm.pas"/>
     138        <Caret Line="127" Column="54" TopLine="114"/>
     139      </Position7>
     140      <Position8>
     141        <Filename Value="UMainForm.pas"/>
     142        <Caret Line="159" Column="16" TopLine="137"/>
     143      </Position8>
     144      <Position9>
     145        <Filename Value="UMainForm.pas"/>
     146        <Caret Line="97" Column="8" TopLine="84"/>
     147      </Position9>
     148      <Position10>
     149        <Filename Value="UMainForm.pas"/>
     150        <Caret Line="3" Column="14" TopLine="1"/>
     151      </Position10>
     152      <Position11>
     153        <Filename Value="UMainForm.pas"/>
     154        <Caret Line="152" Column="17" TopLine="130"/>
     155      </Position11>
     156      <Position12>
     157        <Filename Value="UMainForm.pas"/>
     158        <Caret Line="161" Column="30" TopLine="138"/>
     159      </Position12>
     160      <Position13>
     161        <Filename Value="USource.pas"/>
     162        <Caret Line="25" Column="45" TopLine="1"/>
     163      </Position13>
     164      <Position14>
     165        <Filename Value="USource.pas"/>
     166        <Caret Line="35" Column="13" TopLine="13"/>
     167      </Position14>
     168      <Position15>
     169        <Filename Value="USource.pas"/>
     170        <Caret Line="24" Column="23" TopLine="11"/>
     171      </Position15>
     172      <Position16>
     173        <Filename Value="USource.pas"/>
     174        <Caret Line="8" Column="29" TopLine="1"/>
     175      </Position16>
     176      <Position17>
     177        <Filename Value="UMainForm.pas"/>
     178        <Caret Line="45" Column="25" TopLine="11"/>
     179      </Position17>
     180      <Position18>
     181        <Filename Value="UMainForm.pas"/>
     182        <Caret Line="61" Column="21" TopLine="48"/>
     183      </Position18>
     184      <Position19>
     185        <Filename Value="UMainForm.pas"/>
     186        <Caret Line="73" Column="49" TopLine="69"/>
     187      </Position19>
     188      <Position20>
     189        <Filename Value="UMainForm.pas"/>
     190        <Caret Line="89" Column="35" TopLine="75"/>
     191      </Position20>
     192      <Position21>
     193        <Filename Value="UInstance.pas"/>
     194        <Caret Line="23" Column="21" TopLine="1"/>
     195      </Position21>
     196      <Position22>
     197        <Filename Value="UMainForm.pas"/>
     198        <Caret Line="77" Column="1" TopLine="65"/>
     199      </Position22>
     200      <Position23>
     201        <Filename Value="UMainForm.pas"/>
     202        <Caret Line="78" Column="1" TopLine="71"/>
     203      </Position23>
     204      <Position24>
     205        <Filename Value="UInstance.pas"/>
     206        <Caret Line="24" Column="20" TopLine="11"/>
     207      </Position24>
     208      <Position25>
     209        <Filename Value="UMainForm.pas"/>
     210        <Caret Line="94" Column="56" TopLine="81"/>
     211      </Position25>
     212      <Position26>
     213        <Filename Value="UInstance.pas"/>
     214        <Caret Line="25" Column="22" TopLine="11"/>
     215      </Position26>
     216      <Position27>
     217        <Filename Value="UMainForm.pas"/>
     218        <Caret Line="96" Column="56" TopLine="83"/>
     219      </Position27>
     220      <Position28>
     221        <Filename Value="UMainForm.pas"/>
     222        <Caret Line="44" Column="15" TopLine="30"/>
     223      </Position28>
     224      <Position29>
     225        <Filename Value="UMainForm.pas"/>
     226        <Caret Line="119" Column="19" TopLine="117"/>
     227      </Position29>
     228      <Position30>
     229        <Filename Value="UMainForm.pas"/>
     230        <Caret Line="44" Column="15" TopLine="31"/>
     231      </Position30>
    109232    </JumpHistory>
    110233  </ProjectOptions>
  • trunk/FreePascalManager.lpr

    r1 r2  
    1616  Application.Initialize;
    1717  Application.CreateForm(TForm1, Form1);
    18   Application.CreateForm(TForm2, Form2);
     18  Application.CreateForm(TOptionsForm, OptionsForm);
    1919  Application.Run;
    2020end.
  • trunk/UInstance.pas

    r1 r2  
    99
    1010type
     11
     12  { TInstance }
     13
    1114  TInstance = class
     15    Id: Integer;
    1216    Name: string;
    13     IDEVersion: string;
    1417    IDESource: TSource;
    1518    IDERevision: string;
    16     //IDEDate: TDateTime;
    17     FPCVersion: string;
     19    IDEDate: TDateTime;
    1820    FPCSource: TSource;
    1921    FPCRevision: string;
    20     //FPCDate: TDateTime;
     22    FPCDate: TDateTime;
     23    procedure Build;
     24    procedure Start;
     25    procedure Update;
    2126  end;
    2227
    2328implementation
    2429
     30{ TInstance }
     31
     32procedure TInstance.Build;
     33begin
     34
     35end;
     36
     37procedure TInstance.Start;
     38begin
     39
     40end;
     41
     42procedure TInstance.Update;
     43begin
     44
     45end;
     46
    2547end.
    2648
  • trunk/UMainForm.lfm

    r1 r2  
    77  ClientHeight = 363
    88  ClientWidth = 567
     9  OnCreate = FormCreate
     10  OnDestroy = FormDestroy
     11  OnShow = FormShow
    912  LCLVersion = '0.9.31'
    1013  object ListView1: TListView
     
    1720      item
    1821        Caption = 'Name'
     22        Width = 100
    1923      end   
    2024      item
    2125        Caption = 'FPC version'
    22         Width = 100
     26        Width = 150
    2327      end   
    2428      item
    2529        Caption = 'IDE version'
    26         Width = 100
     30        Width = 150
    2731      end>
    2832    OwnerData = True
     
    3135    TabOrder = 0
    3236    ViewStyle = vsReport
     37    OnData = ListView1Data
     38    OnSelectItem = ListView1SelectItem
    3339  end
    3440  object Label1: TLabel
     
    6571    Action = AStart
    6672    Anchors = [akLeft, akBottom]
     73    Default = True
    6774    TabOrder = 3
    6875  end
     
    7784  end
    7885  object Button5: TButton
    79     Left = 360
     86    Left = 440
    8087    Height = 25
    8188    Top = 333
     
    8592    TabOrder = 5
    8693  end
     94  object Button6: TButton
     95    Left = 355
     96    Height = 25
     97    Top = 333
     98    Width = 75
     99    Action = ACompile
     100    Anchors = [akLeft, akBottom]
     101    TabOrder = 6
     102  end
    87103  object ActionList1: TActionList
    88104    left = 453
     
    90106    object AAdd: TAction
    91107      Caption = 'Add'
     108      OnExecute = AAddExecute
    92109    end
    93110    object ARemove: TAction
    94111      Caption = 'Remove'
     112      OnExecute = ARemoveExecute
    95113    end
    96114    object AStart: TAction
    97115      Caption = 'Start'
     116      OnExecute = AStartExecute
    98117    end
    99118    object AUpdate: TAction
    100119      Caption = 'Update'
     120      OnExecute = AUpdateExecute
    101121    end
    102122    object AOptions: TAction
    103123      Caption = 'Options'
    104124    end
     125    object ACompile: TAction
     126      Caption = 'Compile'
     127      OnExecute = ACompileExecute
     128    end
    105129  end
    106130end
  • trunk/UMainForm.pas

    r1 r2  
    11unit UMainForm;
    22
    3 {$mode objfpc}{$H+}
     3{$mode Delphi}{$H+}
    44
    55interface
     
    77uses
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ComCtrls,
    9   StdCtrls, ActnList;
     9  StdCtrls, ActnList, Contnrs, USource, UInstance, UOptions,
     10  DOM, XMLWrite, XMLRead;
     11
     12const
     13  ConfigFileName = 'Config.xml';
    1014
    1115type
     
    1519  TForm1 = class(TForm)
    1620    AAdd: TAction;
     21    ACompile: TAction;
    1722    AOptions: TAction;
    1823    ARemove: TAction;
     
    2530    Button4: TButton;
    2631    Button5: TButton;
     32    Button6: TButton;
    2733    Label1: TLabel;
    2834    ListView1: TListView;
     35    procedure AAddExecute(Sender: TObject);
     36    procedure ACompileExecute(Sender: TObject);
     37    procedure ARemoveExecute(Sender: TObject);
     38    procedure AStartExecute(Sender: TObject);
     39    procedure AUpdateExecute(Sender: TObject);
     40    procedure FormCreate(Sender: TObject);
     41    procedure FormDestroy(Sender: TObject);
     42    procedure FormShow(Sender: TObject);
     43    procedure ListView1Data(Sender: TObject; Item: TListItem);
     44    procedure ListView1SelectItem(Sender: TObject; Item: TListItem;
     45      Selected: Boolean);
    2946  private
    30     { private declarations }
     47    procedure ReloadList;
     48    procedure LoadInstanceList;
     49    procedure SaveInstanceList;
    3150  public
    32     { public declarations }
     51    Instances: TObjectList;
     52    Sources: TSourceList;
    3353  end;
    3454
     
    4060{$R *.lfm}
    4161
     62{ TForm1 }
     63
     64procedure TForm1.FormCreate(Sender: TObject);
     65begin
     66  Instances := TObjectList.Create;
     67  Sources := TSourceList.Create;
     68end;
     69
     70procedure TForm1.AAddExecute(Sender: TObject);
     71begin
     72  OptionsForm.ShowModal;
     73end;
     74
     75procedure TForm1.ACompileExecute(Sender: TObject);
     76begin
     77  if Assigned(ListView1.Selected) then
     78    if ListView1.Selected.Index < Instances.Count then begin
     79      TInstance(Instances[ListView1.Selected.Index]).Build;
     80      ReloadList;
     81    end;
     82end;
     83
     84procedure TForm1.ARemoveExecute(Sender: TObject);
     85begin
     86  if Assigned(ListView1.Selected) then
     87    if ListView1.Selected.Index < Instances.Count then begin
     88      Instances.Remove(ListView1.Selected.Data);
     89      ReloadList;
     90    end;
     91end;
     92
     93procedure TForm1.AStartExecute(Sender: TObject);
     94begin
     95  if Assigned(ListView1.Selected) then
     96    if ListView1.Selected.Index < Instances.Count then begin
     97      TInstance(Instances[ListView1.Selected.Index]).Start;
     98      ReloadList;
     99    end;
     100end;
     101
     102procedure TForm1.AUpdateExecute(Sender: TObject);
     103begin
     104  if Assigned(ListView1.Selected) then
     105    if ListView1.Selected.Index < Instances.Count then begin
     106      TInstance(Instances[ListView1.Selected.Index]).Update;
     107      ReloadList;
     108    end;
     109end;
     110
     111procedure TForm1.FormDestroy(Sender: TObject);
     112begin
     113  Instances.Free;
     114  Sources.Free;
     115end;
     116
     117procedure TForm1.FormShow(Sender: TObject);
     118begin
     119  ListView1SelectItem(nil, nil, False);
     120end;
     121
     122procedure TForm1.ListView1Data(Sender: TObject; Item: TListItem);
     123begin
     124  if Item.Index < Instances.Count then
     125  with TInstance(Instances[Item.Index]) do begin
     126    Item.Caption := Name;
     127    Item.Data := Instances[Item.Index];
     128    Item.SubItems.Add(FPCRevision);
     129    Item.SubItems.Add(IDERevision);
     130  end;
     131end;
     132
     133procedure TForm1.ListView1SelectItem(Sender: TObject; Item: TListItem;
     134  Selected: Boolean);
     135begin
     136  ACompile.Enabled := Assigned(ListView1.Selected);
     137  AUpdate.Enabled := Assigned(ListView1.Selected);
     138  AStart.Enabled := Assigned(ListView1.Selected);
     139  ARemove.Enabled := Assigned(ListView1.Selected);
     140  AOptions.Enabled := Assigned(ListView1.Selected);
     141end;
     142
     143procedure TForm1.ReloadList;
     144begin
     145  ListView1.Items.Count := Instances.Count;
     146  ListView1.Refresh;
     147end;
     148
     149procedure TForm1.LoadInstanceList;
     150var
     151  Doc: TXMLDocument;
     152  NewNode: TDOMNode;
     153  NewSubNode: TDOMNode;
     154  I: Integer;
     155  NewSource: TSource;
     156  NewInstance: TInstance;
     157  Child: TDOMNode;
     158begin
     159  try
     160    ReadXMLFile(Doc, UTF8Decode(ConfigFileName));
     161
     162    Instances.Free;
     163    Sources.Free;
     164
     165    NewNode := Doc.DocumentElement.FindNode('Sources');
     166    Child := NewNode.FirstChild;
     167    while Assigned(Child) do begin
     168      NewSource := TSource.Create;
     169      with NewSource do begin
     170        NewNode := Doc.DocumentElement.FindNode('Id');
     171        if Assigned(NewNode) then
     172          Id := StrToInt(NewNode.TextContent);
     173        NewNode := Doc.DocumentElement.FindNode('Name');
     174        if Assigned(NewNode) then
     175          Name := UTF8Encode(string(NewNode.TextContent));
     176        NewNode := Doc.DocumentElement.FindNode('SubversionURL');
     177        if Assigned(NewNode) then
     178          SubversionURL := UTF8Encode(string(NewNode.TextContent));
     179        NewNode := Doc.DocumentElement.FindNode('Version');
     180        if Assigned(NewNode) then
     181          Version := UTF8Encode(string(NewNode.TextContent));
     182        NewNode := Doc.DocumentElement.FindNode('Variation');
     183        if Assigned(NewNode) then
     184          Variation := UTF8Encode(string(NewNode.TextContent));
     185        NewNode := Doc.DocumentElement.FindNode('SourceType');
     186        if Assigned(NewNode) then
     187          SourceType := TSourceType(StrToInt(NewNode.TextContent));
     188      end;
     189      Child := Child.NextSibling;
     190    end;
     191
     192    NewNode := Doc.DocumentElement.FindNode('Instances');
     193    Child := NewNode.FirstChild;
     194    while Assigned(Child) do begin
     195      NewInstance := TInstance.Create;
     196      with NewInstance do begin
     197        NewNode := Doc.DocumentElement.FindNode('Id');
     198        if Assigned(NewNode) then
     199          Id := StrToInt(NewNode.TextContent);
     200        NewNode := Doc.DocumentElement.FindNode('Name');
     201        if Assigned(NewNode) then
     202          Name := UTF8Encode(string(NewNode.TextContent));
     203        NewNode := Doc.DocumentElement.FindNode('IDEDate');
     204        if Assigned(NewNode) then
     205          IDEDate := StrToDateTime(string(NewNode.TextContent));
     206        NewNode := Doc.DocumentElement.FindNode('IDERevision');
     207        if Assigned(NewNode) then
     208          IDERevision := UTF8Encode(string(NewNode.TextContent));
     209        NewNode := Doc.DocumentElement.FindNode('IDESource');
     210        if Assigned(NewNode) then
     211          IDESource := Sources.FindById(StrToInt(NewNode.TextContent));
     212        NewNode := Doc.DocumentElement.FindNode('FPCDate');
     213        if Assigned(NewNode) then
     214          FPCDate := StrToDateTime(string(NewNode.TextContent));
     215        NewNode := Doc.DocumentElement.FindNode('FPCRevision');
     216        if Assigned(NewNode) then
     217          FPCRevision := UTF8Encode(string(NewNode.TextContent));
     218        NewNode := Doc.DocumentElement.FindNode('FPCSource');
     219        if Assigned(NewNode) then
     220          FPCSource := Sources.FindById(StrToInt(NewNode.TextContent));
     221      end;
     222      Child := Child.NextSibling;
     223    end;
     224  finally
     225    Doc.Free;
     226  end;
     227end;
     228
     229procedure TForm1.SaveInstanceList;
     230var
     231  I: Integer;
     232  Doc: TXMLDocument;
     233  RootNode: TDOMNode;
     234  NewNode: TDOMNode;
     235  NewNode2: TDOMNode;
     236begin
     237  Doc := TXMLDocument.Create;
     238  with Doc do
     239  try
     240    RootNode := CreateElement('InstanceList');
     241    AppendChild(RootNode);
     242    with RootNode do begin
     243      NewNode := OwnerDocument.CreateElement('Instances');
     244      with NewNode do
     245      for I := 0 to Instances.Count - 1 do
     246      with TInstance(Instances[I]) do begin
     247        NewNode2 := OwnerDocument.CreateElement('Id');
     248        NewNode2.TextContent := IntToStr(Id);
     249        AppendChild(NewNode);
     250        NewNode2 := OwnerDocument.CreateElement('Name');
     251        NewNode2.TextContent := UTF8Decode(Name);
     252        AppendChild(NewNode);
     253        NewNode2 := OwnerDocument.CreateElement('IDEDate');
     254        NewNode2.TextContent := DateTimeToStr(IDEDate);
     255        AppendChild(NewNode);
     256        NewNode2 := OwnerDocument.CreateElement('IDERevision');
     257        NewNode2.TextContent := UTF8Decode(IDERevision);
     258        AppendChild(NewNode);
     259        NewNode2 := OwnerDocument.CreateElement('IDESource');
     260        NewNode2.TextContent := IntToStr(IDESource.Id);
     261        AppendChild(NewNode);
     262        NewNode2 := OwnerDocument.CreateElement('FPCDate');
     263        NewNode2.TextContent := DateTimeToStr(FPCDate);
     264        AppendChild(NewNode);
     265        NewNode2 := OwnerDocument.CreateElement('FPCRevision');
     266        NewNode2.TextContent := UTF8Decode(FPCRevision);
     267        AppendChild(NewNode);
     268        NewNode2 := OwnerDocument.CreateElement('FPCSource');
     269        NewNode2.TextContent := IntToStr(FPCSource.Id);
     270        AppendChild(NewNode);
     271      end;
     272      AppendChild(RootNode);
     273
     274      NewNode := OwnerDocument.CreateElement('Sources');
     275      with NewNode do
     276      for I := 0 to Sources.Count - 1 do
     277      with TSource(Sources[I]) do begin
     278        NewNode2 := OwnerDocument.CreateElement('Id');
     279        NewNode2.TextContent := IntToStr(Id);
     280        AppendChild(NewNode);
     281        NewNode2 := OwnerDocument.CreateElement('Name');
     282        NewNode2.TextContent := UTF8Decode(Name);
     283        AppendChild(NewNode);
     284        NewNode2 := OwnerDocument.CreateElement('SubversionURL');
     285        NewNode2.TextContent := UTF8Decode(SubversionURL);
     286        AppendChild(NewNode);
     287        NewNode2 := OwnerDocument.CreateElement('Version');
     288        NewNode2.TextContent := UTF8Decode(Version);
     289        AppendChild(NewNode);
     290        NewNode2 := OwnerDocument.CreateElement('Variation');
     291        NewNode2.TextContent := UTF8Decode(Variation);
     292        AppendChild(NewNode);
     293        NewNode2 := OwnerDocument.CreateElement('SourceType');
     294        NewNode2.TextContent := IntToStr(Byte(SourceType));
     295        AppendChild(NewNode);
     296      end;
     297      AppendChild(RootNode);
     298    end;
     299    WriteXMLFile(Doc, UTF8Decode(ConfigFileName));
     300  finally
     301    Free;
     302  end;
     303end;
     304
    42305end.
    43306
  • trunk/UOptions.lfm

    r1 r2  
    1 object Form2: TForm2
    2   Left = 292
    3   Height = 409
    4   Top = 113
     1object OptionsForm: TOptionsForm
     2  Left = 338
     3  Height = 410
     4  Top = 161
    55  Width = 573
    66  Caption = 'Options'
     7  ClientHeight = 410
     8  ClientWidth = 573
    79  LCLVersion = '0.9.31'
     10  object Label1: TLabel
     11    Left = 9
     12    Height = 14
     13    Top = 8
     14    Width = 112
     15    Caption = 'Available FPC variants:'
     16    ParentColor = False
     17  end
     18  object ListView1: TListView
     19    Left = 7
     20    Height = 173
     21    Top = 27
     22    Width = 561
     23    Anchors = [akTop, akLeft, akRight]
     24    Columns = <   
     25      item
     26        Caption = 'Name'
     27        Width = 70
     28      end   
     29      item
     30        Caption = 'Version'
     31      end   
     32      item
     33        Caption = 'Revision'
     34      end   
     35      item
     36        Caption = 'Date'
     37        Width = 60
     38      end   
     39      item
     40        Caption = 'Source URL'
     41        Width = 300
     42      end>
     43    OwnerData = True
     44    ReadOnly = True
     45    RowSelect = True
     46    TabOrder = 0
     47    ViewStyle = vsReport
     48  end
     49  object Label2: TLabel
     50    Left = 9
     51    Height = 14
     52    Top = 208
     53    Width = 110
     54    Caption = 'Available IDE variants:'
     55    ParentColor = False
     56  end
     57  object ListView2: TListView
     58    Left = 9
     59    Height = 150
     60    Top = 226
     61    Width = 559
     62    Anchors = [akTop, akLeft, akRight]
     63    Columns = <   
     64      item
     65        Caption = 'Name'
     66        Width = 70
     67      end   
     68      item
     69        Caption = 'Version'
     70      end   
     71      item
     72        Caption = 'Revision'
     73      end   
     74      item
     75        Caption = 'Date'
     76        Width = 60
     77      end   
     78      item
     79        Caption = 'Source URL'
     80        Width = 300
     81      end>
     82    OwnerData = True
     83    ReadOnly = True
     84    RowSelect = True
     85    TabOrder = 1
     86    ViewStyle = vsReport
     87  end
     88  object ButtonCancel: TButton
     89    Left = 408
     90    Height = 25
     91    Top = 380
     92    Width = 75
     93    Caption = 'Cancel'
     94    TabOrder = 2
     95  end
     96  object ButtonOk: TButton
     97    Left = 493
     98    Height = 25
     99    Top = 380
     100    Width = 75
     101    Caption = 'Ok'
     102    TabOrder = 3
     103  end
    8104end
  • trunk/UOptions.pas

    r1 r2  
    66
    77uses
    8   Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs;
     8  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
     9  ComCtrls;
    910
    1011type
    11   TForm2 = class(TForm)
     12
     13  { TOptionsForm }
     14
     15  TOptionsForm = class(TForm)
     16    ButtonCancel: TButton;
     17    ButtonOk: TButton;
     18    Label1: TLabel;
     19    Label2: TLabel;
     20    ListView1: TListView;
     21    ListView2: TListView;
    1222  private
    1323    { private declarations }
     
    1727
    1828var
    19   Form2: TForm2;
     29  OptionsForm: TOptionsForm;
    2030
    2131implementation
  • trunk/USource.pas

    r1 r2  
    66
    77uses
    8   Classes, SysUtils;
     8  Classes, SysUtils, Contnrs;
    99
    1010type
     
    1212
    1313  TSource = class
     14    Id: Integer;
    1415    Name: string;
    1516    SubversionURL: string;
     
    1920  end;
    2021
     22  { TSourceList }
     23
     24  TSourceList = class(TObjectList)
     25    function FindById(Id: Integer): TSource;
     26  end;
     27
    2128implementation
     29
     30{ TSourceList }
     31
     32function TSourceList.FindById(Id: Integer): TSource;
     33var
     34  I: Integer;
     35begin
     36  I := 0;
     37  while (I < Count) and (TSource(Items[I]).Id <> Id) do Inc(I);
     38  if I < Count then Result := TSource(Items[I])
     39    else Result := nil;
     40end;
    2241
    2342end.
Note: See TracChangeset for help on using the changeset viewer.