Changeset 4


Ignore:
Timestamp:
Feb 3, 2011, 8:01:00 AM (13 years ago)
Author:
chronos
Message:
  • Fixed: Add and edit operations.
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/FreePascalManager.lpi

    r3 r4  
    3838      </Item2>
    3939    </RequiredPackages>
    40     <Units Count="11">
     40    <Units Count="14">
    4141      <Unit0>
    4242        <Filename Value="FreePascalManager.lpr"/>
    4343        <IsPartOfProject Value="True"/>
    4444        <UnitName Value="FreePascalManager"/>
    45         <UsageCount Value="27"/>
     45        <WindowIndex Value="0"/>
     46        <TopLine Value="1"/>
     47        <CursorPos X="1" Y="15"/>
     48        <UsageCount Value="63"/>
    4649      </Unit0>
    4750      <Unit1>
     
    5154        <ResourceBaseClass Value="Form"/>
    5255        <UnitName Value="UMainForm"/>
     56        <IsVisibleTab Value="True"/>
    5357        <EditorIndex Value="0"/>
    5458        <WindowIndex Value="0"/>
    55         <TopLine Value="1"/>
    56         <CursorPos X="33" Y="18"/>
    57         <UsageCount Value="27"/>
     59        <TopLine Value="140"/>
     60        <CursorPos X="60" Y="144"/>
     61        <UsageCount Value="63"/>
    5862        <Loaded Value="True"/>
    5963        <LoadedDesigner Value="True"/>
     
    6771        <EditorIndex Value="2"/>
    6872        <WindowIndex Value="0"/>
    69         <TopLine Value="37"/>
    70         <CursorPos X="29" Y="52"/>
    71         <UsageCount Value="27"/>
     73        <TopLine Value="81"/>
     74        <CursorPos X="77" Y="102"/>
     75        <UsageCount Value="63"/>
    7276        <Loaded Value="True"/>
    7377        <LoadedDesigner Value="True"/>
     
    7781        <IsPartOfProject Value="True"/>
    7882        <UnitName Value="UInstance"/>
    79         <EditorIndex Value="4"/>
    80         <WindowIndex Value="0"/>
    81         <TopLine Value="4"/>
    82         <CursorPos X="1" Y="18"/>
    83         <UsageCount Value="27"/>
     83        <EditorIndex Value="3"/>
     84        <WindowIndex Value="0"/>
     85        <TopLine Value="13"/>
     86        <CursorPos X="24" Y="27"/>
     87        <UsageCount Value="63"/>
    8488        <Loaded Value="True"/>
    8589      </Unit3>
     
    8892        <IsPartOfProject Value="True"/>
    8993        <UnitName Value="USource"/>
    90         <IsVisibleTab Value="True"/>
    91         <EditorIndex Value="5"/>
    92         <WindowIndex Value="0"/>
    93         <TopLine Value="49"/>
    94         <CursorPos X="14" Y="54"/>
    95         <UsageCount Value="27"/>
     94        <EditorIndex Value="4"/>
     95        <WindowIndex Value="0"/>
     96        <TopLine Value="77"/>
     97        <CursorPos X="39" Y="108"/>
     98        <UsageCount Value="63"/>
    9699        <Loaded Value="True"/>
    97100      </Unit4>
     
    101104        <TopLine Value="1670"/>
    102105        <CursorPos X="14" Y="1683"/>
    103         <UsageCount Value="10"/>
     106        <UsageCount Value="7"/>
    104107      </Unit5>
    105108      <Unit6>
    106109        <Filename Value="E:\Programy\Lazarus\0.9.31_2.5.1\lcl\lclclasses.pp"/>
    107110        <UnitName Value="LCLClasses"/>
    108         <WindowIndex Value="0"/>
    109         <TopLine Value="5"/>
     111        <EditorIndex Value="1"/>
     112        <WindowIndex Value="0"/>
     113        <TopLine Value="34"/>
    110114        <CursorPos X="20" Y="47"/>
    111         <UsageCount Value="9"/>
     115        <UsageCount Value="10"/>
     116        <Loaded Value="True"/>
    112117      </Unit6>
    113118      <Unit7>
    114119        <Filename Value="E:\Programy\Lazarus\0.9.31_2.5.1\fpc\2.5.1\source\packages\fcl-xml\src\dom.pp"/>
    115120        <UnitName Value="DOM"/>
    116         <EditorIndex Value="1"/>
    117         <WindowIndex Value="0"/>
    118         <TopLine Value="233"/>
    119         <CursorPos X="14" Y="246"/>
    120         <UsageCount Value="13"/>
    121         <Loaded Value="True"/>
     121        <WindowIndex Value="0"/>
     122        <TopLine Value="253"/>
     123        <CursorPos X="14" Y="266"/>
     124        <UsageCount Value="29"/>
    122125      </Unit7>
    123126      <Unit8>
    124127        <Filename Value="E:\Projekty\Knihovny\Free Pascal\synapse\httpsend.pas"/>
    125128        <UnitName Value="httpsend"/>
    126         <EditorIndex Value="3"/>
    127129        <WindowIndex Value="0"/>
    128130        <TopLine Value="749"/>
    129131        <CursorPos X="3" Y="753"/>
    130         <UsageCount Value="11"/>
    131         <Loaded Value="True"/>
     132        <UsageCount Value="27"/>
    132133      </Unit8>
    133134      <Unit9>
     
    136137        <TopLine Value="58"/>
    137138        <CursorPos X="72" Y="81"/>
    138         <UsageCount Value="21"/>
     139        <UsageCount Value="18"/>
    139140        <DefaultSyntaxHighlighter Value="XML"/>
    140141      </Unit9>
     
    144145        <TopLine Value="1"/>
    145146        <CursorPos X="46" Y="49"/>
    146         <UsageCount Value="20"/>
     147        <UsageCount Value="16"/>
    147148        <DefaultSyntaxHighlighter Value="XML"/>
    148149      </Unit10>
     150      <Unit11>
     151        <Filename Value="E:\Programy\Lazarus\0.9.31_2.5.1\fpc\2.5.1\source\packages\fcl-base\src\contnrs.pp"/>
     152        <UnitName Value="contnrs"/>
     153        <WindowIndex Value="0"/>
     154        <TopLine Value="67"/>
     155        <CursorPos X="17" Y="80"/>
     156        <UsageCount Value="27"/>
     157      </Unit11>
     158      <Unit12>
     159        <Filename Value="E:\Programy\Lazarus\0.9.31_2.5.1\lcl\include\customform.inc"/>
     160        <WindowIndex Value="0"/>
     161        <TopLine Value="865"/>
     162        <CursorPos X="1" Y="878"/>
     163        <UsageCount Value="10"/>
     164      </Unit12>
     165      <Unit13>
     166        <Filename Value="E:\Programy\Lazarus\0.9.31_2.5.1\lcl\forms.pp"/>
     167        <UnitName Value="Forms"/>
     168        <WindowIndex Value="0"/>
     169        <TopLine Value="594"/>
     170        <CursorPos X="14" Y="607"/>
     171        <UsageCount Value="10"/>
     172      </Unit13>
    149173    </Units>
    150174    <JumpHistory Count="30" HistoryIndex="29">
    151175      <Position1>
    152         <Filename Value="USource.pas"/>
    153         <Caret Line="79" Column="1" TopLine="65"/>
     176        <Filename Value="UOptions.pas"/>
     177        <Caret Line="106" Column="18" TopLine="95"/>
    154178      </Position1>
    155179      <Position2>
    156         <Filename Value="USource.pas"/>
    157         <Caret Line="80" Column="1" TopLine="65"/>
     180        <Filename Value="UMainForm.pas"/>
     181        <Caret Line="77" Column="24" TopLine="65"/>
    158182      </Position2>
    159183      <Position3>
    160         <Filename Value="USource.pas"/>
    161         <Caret Line="78" Column="36" TopLine="65"/>
     184        <Filename Value="UOptions.pas"/>
     185        <Caret Line="139" Column="1" TopLine="128"/>
    162186      </Position3>
    163187      <Position4>
    164         <Filename Value="USource.pas"/>
    165         <Caret Line="77" Column="1" TopLine="65"/>
     188        <Filename Value="UOptions.pas"/>
     189        <Caret Line="72" Column="1" TopLine="62"/>
    166190      </Position4>
    167191      <Position5>
    168         <Filename Value="USource.pas"/>
    169         <Caret Line="79" Column="1" TopLine="65"/>
     192        <Filename Value="UOptions.pas"/>
     193        <Caret Line="102" Column="77" TopLine="81"/>
    170194      </Position5>
    171195      <Position6>
    172         <Filename Value="USource.pas"/>
    173         <Caret Line="80" Column="1" TopLine="65"/>
     196        <Filename Value="UMainForm.pas"/>
     197        <Caret Line="243" Column="35" TopLine="221"/>
    174198      </Position6>
    175199      <Position7>
    176         <Filename Value="USource.pas"/>
    177         <Caret Line="85" Column="1" TopLine="65"/>
     200        <Filename Value="UMainForm.pas"/>
     201        <Caret Line="141" Column="35" TopLine="139"/>
    178202      </Position7>
    179203      <Position8>
    180         <Filename Value="USource.pas"/>
    181         <Caret Line="78" Column="17" TopLine="65"/>
     204        <Filename Value="UMainForm.pas"/>
     205        <Caret Line="142" Column="35" TopLine="140"/>
    182206      </Position8>
    183207      <Position9>
    184         <Filename Value="UOptions.pas"/>
    185         <Caret Line="48" Column="16" TopLine="37"/>
     208        <Filename Value="UMainForm.pas"/>
     209        <Caret Line="143" Column="35" TopLine="141"/>
    186210      </Position9>
    187211      <Position10>
    188         <Filename Value="UOptions.pas"/>
    189         <Caret Line="52" Column="29" TopLine="37"/>
     212        <Filename Value="UMainForm.pas"/>
     213        <Caret Line="144" Column="35" TopLine="142"/>
    190214      </Position10>
    191215      <Position11>
    192         <Filename Value="USource.pas"/>
    193         <Caret Line="76" Column="19" TopLine="59"/>
     216        <Filename Value="UMainForm.pas"/>
     217        <Caret Line="145" Column="35" TopLine="143"/>
    194218      </Position11>
    195219      <Position12>
    196         <Filename Value="USource.pas"/>
    197         <Caret Line="85" Column="1" TopLine="72"/>
     220        <Filename Value="UMainForm.pas"/>
     221        <Caret Line="146" Column="35" TopLine="144"/>
    198222      </Position12>
    199223      <Position13>
    200         <Filename Value="USource.pas"/>
    201         <Caret Line="97" Column="54" TopLine="78"/>
     224        <Filename Value="UMainForm.pas"/>
     225        <Caret Line="158" Column="1" TopLine="145"/>
    202226      </Position13>
    203227      <Position14>
    204         <Filename Value="USource.pas"/>
    205         <Caret Line="83" Column="1" TopLine="78"/>
     228        <Filename Value="UMainForm.pas"/>
     229        <Caret Line="164" Column="1" TopLine="145"/>
    206230      </Position14>
    207231      <Position15>
    208         <Filename Value="USource.pas"/>
    209         <Caret Line="84" Column="1" TopLine="78"/>
     232        <Filename Value="UMainForm.pas"/>
     233        <Caret Line="165" Column="1" TopLine="145"/>
    210234      </Position15>
    211235      <Position16>
    212         <Filename Value="USource.pas"/>
    213         <Caret Line="85" Column="1" TopLine="78"/>
     236        <Filename Value="UMainForm.pas"/>
     237        <Caret Line="166" Column="1" TopLine="145"/>
    214238      </Position16>
    215239      <Position17>
    216         <Filename Value="USource.pas"/>
    217         <Caret Line="86" Column="1" TopLine="78"/>
     240        <Filename Value="UMainForm.pas"/>
     241        <Caret Line="167" Column="1" TopLine="146"/>
    218242      </Position17>
    219243      <Position18>
    220         <Filename Value="USource.pas"/>
    221         <Caret Line="87" Column="1" TopLine="78"/>
     244        <Filename Value="UMainForm.pas"/>
     245        <Caret Line="168" Column="1" TopLine="147"/>
    222246      </Position18>
    223247      <Position19>
    224         <Filename Value="USource.pas"/>
    225         <Caret Line="88" Column="1" TopLine="78"/>
     248        <Filename Value="UMainForm.pas"/>
     249        <Caret Line="165" Column="1" TopLine="148"/>
    226250      </Position19>
    227251      <Position20>
    228         <Filename Value="USource.pas"/>
    229         <Caret Line="89" Column="1" TopLine="78"/>
     252        <Filename Value="UMainForm.pas"/>
     253        <Caret Line="164" Column="6" TopLine="148"/>
    230254      </Position20>
    231255      <Position21>
    232         <Filename Value="USource.pas"/>
    233         <Caret Line="90" Column="1" TopLine="78"/>
     256        <Filename Value="UMainForm.pas"/>
     257        <Caret Line="155" Column="11" TopLine="154"/>
    234258      </Position21>
    235259      <Position22>
    236         <Filename Value="USource.pas"/>
    237         <Caret Line="91" Column="1" TopLine="78"/>
     260        <Filename Value="UMainForm.pas"/>
     261        <Caret Line="101" Column="15" TopLine="98"/>
    238262      </Position22>
    239263      <Position23>
    240         <Filename Value="USource.pas"/>
    241         <Caret Line="92" Column="1" TopLine="78"/>
     264        <Filename Value="UMainForm.pas"/>
     265        <Caret Line="130" Column="1" TopLine="130"/>
    242266      </Position23>
    243267      <Position24>
    244         <Filename Value="USource.pas"/>
    245         <Caret Line="93" Column="1" TopLine="78"/>
     268        <Filename Value="UMainForm.pas"/>
     269        <Caret Line="174" Column="46" TopLine="160"/>
    246270      </Position24>
    247271      <Position25>
    248         <Filename Value="USource.pas"/>
    249         <Caret Line="94" Column="1" TopLine="78"/>
     272        <Filename Value="UMainForm.pas"/>
     273        <Caret Line="176" Column="11" TopLine="163"/>
    250274      </Position25>
    251275      <Position26>
    252         <Filename Value="USource.pas"/>
    253         <Caret Line="95" Column="1" TopLine="78"/>
     276        <Filename Value="UMainForm.pas"/>
     277        <Caret Line="131" Column="56" TopLine="127"/>
    254278      </Position26>
    255279      <Position27>
    256         <Filename Value="USource.pas"/>
    257         <Caret Line="96" Column="1" TopLine="78"/>
     280        <Filename Value="UMainForm.pas"/>
     281        <Caret Line="132" Column="56" TopLine="128"/>
    258282      </Position27>
    259283      <Position28>
    260         <Filename Value="USource.pas"/>
    261         <Caret Line="99" Column="1" TopLine="78"/>
     284        <Filename Value="UMainForm.pas"/>
     285        <Caret Line="133" Column="56" TopLine="129"/>
    262286      </Position28>
    263287      <Position29>
    264         <Filename Value="USource.pas"/>
    265         <Caret Line="100" Column="1" TopLine="79"/>
     288        <Filename Value="UMainForm.pas"/>
     289        <Caret Line="134" Column="56" TopLine="130"/>
    266290      </Position29>
    267291      <Position30>
    268         <Filename Value="USource.pas"/>
    269         <Caret Line="99" Column="30" TopLine="80"/>
     292        <Filename Value="UMainForm.pas"/>
     293        <Caret Line="133" Column="1" TopLine="131"/>
    270294      </Position30>
    271295    </JumpHistory>
     
    281305      <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
    282306    </SearchPaths>
     307    <CodeGeneration>
     308      <Checks>
     309        <IOChecks Value="True"/>
     310        <RangeChecks Value="True"/>
     311        <OverflowChecks Value="True"/>
     312        <StackChecks Value="True"/>
     313      </Checks>
     314      <VerifyObjMethodCallValidity Value="True"/>
     315    </CodeGeneration>
    283316    <Linking>
     317      <Debugging>
     318        <UseHeaptrc Value="True"/>
     319      </Debugging>
    284320      <Options>
    285321        <Win32>
     
    289325    </Linking>
    290326    <Other>
     327      <CompilerMessages>
     328        <UseMsgFile Value="True"/>
     329      </CompilerMessages>
    291330      <CompilerPath Value="$(CompPath)"/>
    292331    </Other>
    293332  </CompilerOptions>
    294333  <Debugging>
    295     <BreakPoints Count="3">
    296       <Item1>
    297         <Source Value="UMainForm.pas"/>
    298         <Line Value="240"/>
    299       </Item1>
    300       <Item2>
    301         <Source Value="USource.pas"/>
    302         <Line Value="83"/>
    303       </Item2>
    304       <Item3>
    305         <Source Value="USource.pas"/>
    306         <Line Value="52"/>
    307       </Item3>
    308     </BreakPoints>
    309334    <Exceptions Count="3">
    310335      <Item1>
  • trunk/UInstance.pas

    r2 r4  
    66
    77uses
    8   Classes, SysUtils, USource;
     8  Classes, SysUtils, USource, Contnrs;
    99
    1010type
    11 
    1211  { TInstance }
    1312
     
    1514    Id: Integer;
    1615    Name: string;
     16    Downloaded: Boolean;
     17    Compiled: Boolean;
    1718    IDESource: TSource;
    1819    IDERevision: string;
     
    2425    procedure Start;
    2526    procedure Update;
     27    procedure Download;
     28  end;
     29
     30  { TInstanceList }
     31
     32  TInstanceList = class(TObjectList)
     33    function GetNewId: Integer;
    2634  end;
    2735
    2836implementation
     37
     38{ TInstanceList }
     39
     40function TInstanceList.GetNewId: Integer;
     41var
     42  I: Integer;
     43begin
     44  Result := 1;
     45  for I := 0 to Count - 1 do
     46    if TInstance(Items[I]).Id >= Result then
     47      Result := TInstance(Items[I]).Id + 1;
     48end;
    2949
    3050{ TInstance }
     
    4565end;
    4666
     67procedure TInstance.Download;
     68begin
     69
     70end;
     71
    4772end.
    4873
  • trunk/UMainForm.lfm

    r3 r4  
    11object MainForm: TMainForm
    2   Left = 266
     2  Left = 259
    33  Height = 363
    4   Top = 139
    5   Width = 567
     4  Top = 138
     5  Width = 643
    66  Caption = 'Free Pascal Manager'
    77  ClientHeight = 363
    8   ClientWidth = 567
     8  ClientWidth = 643
    99  OnCreate = FormCreate
    1010  OnDestroy = FormDestroy
     
    1515    Height = 301
    1616    Top = 24
    17     Width = 548
     17    Width = 624
    1818    Anchors = [akTop, akLeft, akRight, akBottom]
    1919    Columns = <   
     
    2929        Caption = 'IDE version'
    3030        Width = 150
     31      end   
     32      item
     33        Caption = 'Downloaded'
     34      end   
     35      item
     36        Caption = 'Compiled'
    3137      end>
    3238    OwnerData = True
     39    PopupMenu = PopupMenu1
    3340    ReadOnly = True
    3441    RowSelect = True
     
    4855  object Button1: TButton
    4956    Left = 8
    50     Height = 27
     57    Height = 25
    5158    Top = 333
    5259    Width = 75
     
    5663  end
    5764  object Button2: TButton
    58     Left = 96
     65    Left = 90
    5966    Height = 25
    6067    Top = 333
     
    6572  end
    6673  object Button3: TButton
    67     Left = 184
     74    Left = 172
    6875    Height = 25
    6976    Top = 333
     
    7582  end
    7683  object Button4: TButton
    77     Left = 272
     84    Left = 336
    7885    Height = 25
    7986    Top = 333
     
    8390    TabOrder = 4
    8491  end
    85   object Button5: TButton
    86     Left = 440
     92  object ButtonEdit: TButton
     93    Left = 496
    8794    Height = 25
    8895    Top = 333
    8996    Width = 75
    90     Action = AOptions
    91     Anchors = [akLeft]
     97    Action = AEdit
     98    Anchors = [akLeft, akBottom]
    9299    TabOrder = 5
    93100  end
    94101  object Button6: TButton
    95     Left = 355
     102    Left = 416
    96103    Height = 25
    97104    Top = 333
     
    100107    Anchors = [akLeft, akBottom]
    101108    TabOrder = 6
     109  end
     110  object Button5: TButton
     111    Left = 254
     112    Height = 25
     113    Top = 333
     114    Width = 75
     115    Action = ADownload
     116    TabOrder = 7
    102117  end
    103118  object ActionList1: TActionList
     
    116131      OnExecute = AStartExecute
    117132    end
    118     object AUpdate: TAction
    119       Caption = 'Update'
    120       OnExecute = AUpdateExecute
     133    object ADownload: TAction
     134      Caption = 'Download'
     135      OnExecute = ADownloadExecute
    121136    end
    122     object AOptions: TAction
    123       Caption = 'Options'
     137    object AEdit: TAction
     138      Caption = 'Edit'
     139      OnExecute = AEditExecute
    124140    end
    125141    object ACompile: TAction
     
    127143      OnExecute = ACompileExecute
    128144    end
     145    object AUpdate: TAction
     146      Caption = 'Update'
     147      OnExecute = AUpdateExecute
     148    end
     149  end
     150  object PopupMenu1: TPopupMenu
     151    left = 40
     152    top = 66
     153    object MenuItem2: TMenuItem
     154      Action = AStart
     155    end
     156    object MenuItem6: TMenuItem
     157      Action = ADownload
     158    end
     159    object MenuItem3: TMenuItem
     160      Action = ACompile
     161    end
     162    object MenuItem4: TMenuItem
     163      Action = ADownload
     164    end
     165    object MenuItem5: TMenuItem
     166      Action = ARemove
     167    end
     168    object MenuItem1: TMenuItem
     169      Action = AEdit
     170    end
    129171  end
    130172end
  • trunk/UMainForm.pas

    r3 r4  
    77uses
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ComCtrls,
    9   StdCtrls, ActnList, Contnrs, USource, UInstance, UOptions,
     9  StdCtrls, ActnList, Menus, Contnrs, USource, UInstance, UOptions,
    1010  DOM, XMLWrite, XMLRead, HTTPSend;
    1111
     
    1414  SourceURL = 'http://tv.zdechov.net/fpc/SourceList.xml';
    1515
     16const
     17  BooleanText: array[Boolean] of string = ('No', 'Yes');
     18
    1619type
    1720
     
    2124    AAdd: TAction;
    2225    ACompile: TAction;
    23     AOptions: TAction;
     26    AUpdate: TAction;
     27    AEdit: TAction;
    2428    ARemove: TAction;
    2529    AStart: TAction;
    26     AUpdate: TAction;
     30    ADownload: TAction;
    2731    ActionList1: TActionList;
    2832    Button1: TButton;
     
    3135    Button4: TButton;
    3236    Button5: TButton;
     37    ButtonEdit: TButton;
    3338    Button6: TButton;
    3439    Label1: TLabel;
    3540    ListView1: TListView;
     41    MenuItem1: TMenuItem;
     42    MenuItem2: TMenuItem;
     43    MenuItem3: TMenuItem;
     44    MenuItem4: TMenuItem;
     45    MenuItem5: TMenuItem;
     46    MenuItem6: TMenuItem;
     47    PopupMenu1: TPopupMenu;
    3648    procedure AAddExecute(Sender: TObject);
    3749    procedure ACompileExecute(Sender: TObject);
     50    procedure AEditExecute(Sender: TObject);
    3851    procedure ARemoveExecute(Sender: TObject);
    3952    procedure AStartExecute(Sender: TObject);
     53    procedure ADownloadExecute(Sender: TObject);
    4054    procedure AUpdateExecute(Sender: TObject);
    4155    procedure FormCreate(Sender: TObject);
     
    5064    procedure SaveInstanceList;
    5165  public
    52     Instances: TObjectList;
     66    Instances: TInstanceList;
    5367    Sources: TSourceList;
    5468  end;
     
    6579procedure TMainForm.FormCreate(Sender: TObject);
    6680begin
    67   Instances := TObjectList.Create;
     81  Instances := TInstanceList.Create;
    6882  Sources := TSourceList.Create;
    6983  LoadInstanceList;
     
    7286procedure TMainForm.AAddExecute(Sender: TObject);
    7387begin
    74   OptionsForm.ShowModal;
     88  OptionsForm.Instance := nil;
     89  if OptionsForm.ShowModal = mrOK then begin
     90    Instances.Add(OptionsForm.Instance);
     91    ReloadList;
     92  end;
    7593end;
    7694
     
    84102end;
    85103
     104procedure TMainForm.AEditExecute(Sender: TObject);
     105begin
     106  if Assigned(ListView1.Selected) then begin
     107    OptionsForm.Instance := ListView1.Selected.Data;
     108    if OptionsForm.ShowModal = mrYes then
     109      ReloadList;
     110  end;
     111end;
     112
    86113procedure TMainForm.ARemoveExecute(Sender: TObject);
    87114begin
     
    98125    if ListView1.Selected.Index < Instances.Count then begin
    99126      TInstance(Instances[ListView1.Selected.Index]).Start;
     127      ReloadList;
     128    end;
     129end;
     130
     131procedure TMainForm.ADownloadExecute(Sender: TObject);
     132begin
     133  if Assigned(ListView1.Selected) then
     134    if ListView1.Selected.Index < Instances.Count then begin
     135      TInstance(Instances[ListView1.Selected.Index]).Download;
    100136      ReloadList;
    101137    end;
     
    120156procedure TMainForm.FormShow(Sender: TObject);
    121157begin
     158  ReloadList;
    122159  ListView1SelectItem(nil, nil, False);
    123160end;
     
    129166    Item.Caption := Name;
    130167    Item.Data := Instances[Item.Index];
    131     Item.SubItems.Add(FPCRevision);
    132     Item.SubItems.Add(IDERevision);
     168    if Assigned(FPCSource) then
     169      Item.SubItems.Add(FPCSource.Name + ' ' + FPCSource.VersionNumber)
     170      else Item.SubItems.Add('');
     171    if Assigned(IDESource) then
     172      Item.SubItems.Add(IDESource.Name + ' ' + IDESource.VersionNumber)
     173      else Item.SubItems.Add('');
     174    Item.SubItems.Add(BooleanText[Downloaded]);
     175    Item.SubItems.Add(BooleanText[Compiled]);
    133176  end;
    134177end;
     
    137180  Selected: Boolean);
    138181begin
    139   ACompile.Enabled := Assigned(ListView1.Selected);
    140   AUpdate.Enabled := Assigned(ListView1.Selected);
    141   AStart.Enabled := Assigned(ListView1.Selected);
    142   ARemove.Enabled := Assigned(ListView1.Selected);
    143   AOptions.Enabled := Assigned(ListView1.Selected);
     182  if Assigned(ListView1.Selected) then
     183  with TInstance(ListView1.Selected.Data) do begin
     184    AEdit.Enabled := True;
     185    ACompile.Enabled := Downloaded;
     186    ADownload.Enabled := True;
     187    AStart.Enabled := Downloaded and Compiled;
     188    ARemove.Enabled := True;
     189  end else begin
     190    AEdit.Enabled := False;
     191    ACompile.Enabled := False;
     192    ADownload.Enabled := False;
     193    AStart.Enabled := False;
     194    ARemove.Enabled := False;
     195  end;
    144196end;
    145197
     
    164216    ReadXMLFile(Doc, UTF8Decode(ConfigFileName));
    165217
    166     Instances.Free;
    167     Sources.Free;
     218    Instances.Clear;
     219    Sources.Clear;
    168220
    169221    NewNode := Doc.DocumentElement.FindNode('Sources');
     
    172224      NewSource := TSource.Create;
    173225      with NewSource do begin
    174         NewNode := Doc.DocumentElement.FindNode('Id');
     226        NewNode := Child.FindNode('Id');
    175227        if Assigned(NewNode) then
    176228          Id := StrToInt(NewNode.TextContent);
    177         NewNode := Doc.DocumentElement.FindNode('Name');
     229        NewNode := Child.FindNode('Name');
    178230        if Assigned(NewNode) then
    179231          Name := UTF8Encode(string(NewNode.TextContent));
    180         NewNode := Doc.DocumentElement.FindNode('SubversionURL');
     232        NewNode := Child.FindNode('SubversionURL');
    181233        if Assigned(NewNode) then
    182234          SubversionURL := UTF8Encode(string(NewNode.TextContent));
    183         NewNode := Doc.DocumentElement.FindNode('VersionNumber');
     235        NewNode := Child.FindNode('VersionNumber');
    184236        if Assigned(NewNode) then
    185237          VersionNumber := UTF8Encode(string(NewNode.TextContent));
    186         NewNode := Doc.DocumentElement.FindNode('VersionType');
     238        NewNode := Child.FindNode('VersionType');
    187239        if Assigned(NewNode) then
    188240          VersionType := UTF8Encode(string(NewNode.TextContent));
    189         NewNode := Doc.DocumentElement.FindNode('SourceType');
     241        NewNode := Child.FindNode('SourceType');
    190242        if Assigned(NewNode) then
    191243          SourceType := TSourceType(StrToInt(NewNode.TextContent));
    192244      end;
     245      Sources.Add(NewSource);
    193246      Child := Child.NextSibling;
    194247    end;
     
    199252      NewInstance := TInstance.Create;
    200253      with NewInstance do begin
    201         NewNode := Doc.DocumentElement.FindNode('Id');
     254        NewNode := Child.FindNode('Id');
    202255        if Assigned(NewNode) then
    203256          Id := StrToInt(NewNode.TextContent);
    204         NewNode := Doc.DocumentElement.FindNode('Name');
     257        NewNode := Child.FindNode('Name');
    205258        if Assigned(NewNode) then
    206259          Name := UTF8Encode(string(NewNode.TextContent));
    207         NewNode := Doc.DocumentElement.FindNode('IDEDate');
     260        NewNode := Child.FindNode('IDEDate');
    208261        if Assigned(NewNode) then
    209262          IDEDate := StrToDateTime(string(NewNode.TextContent));
    210         NewNode := Doc.DocumentElement.FindNode('IDERevision');
     263        NewNode := Child.FindNode('IDERevision');
    211264        if Assigned(NewNode) then
    212265          IDERevision := UTF8Encode(string(NewNode.TextContent));
    213         NewNode := Doc.DocumentElement.FindNode('IDESource');
     266        NewNode := Child.FindNode('IDESource');
    214267        if Assigned(NewNode) then
    215268          IDESource := Sources.FindById(StrToInt(NewNode.TextContent));
    216         NewNode := Doc.DocumentElement.FindNode('FPCDate');
     269        NewNode := Child.FindNode('FPCDate');
    217270        if Assigned(NewNode) then
    218271          FPCDate := StrToDateTime(string(NewNode.TextContent));
    219         NewNode := Doc.DocumentElement.FindNode('FPCRevision');
     272        NewNode := Child.FindNode('FPCRevision');
    220273        if Assigned(NewNode) then
    221274          FPCRevision := UTF8Encode(string(NewNode.TextContent));
    222         NewNode := Doc.DocumentElement.FindNode('FPCSource');
     275        NewNode := Child.FindNode('FPCSource');
    223276        if Assigned(NewNode) then
    224277          FPCSource := Sources.FindById(StrToInt(NewNode.TextContent));
    225278      end;
     279      Instances.Add(NewInstance);
    226280      Child := Child.NextSibling;
    227281    end;
     
    238292  NewNode: TDOMNode;
    239293  NewNode2: TDOMNode;
     294  NewNode3: TDOMNode;
    240295begin
    241296  Doc := TXMLDocument.Create;
     
    249304      for I := 0 to Instances.Count - 1 do
    250305      with TInstance(Instances[I]) do begin
     306        NewNode3 := OwnerDocument.CreateElement('Id');
     307        with NewNode3 do begin
    251308        NewNode2 := OwnerDocument.CreateElement('Id');
    252309        NewNode2.TextContent := IntToStr(Id);
    253         AppendChild(NewNode);
     310        AppendChild(NewNode2);
    254311        NewNode2 := OwnerDocument.CreateElement('Name');
    255312        NewNode2.TextContent := UTF8Decode(Name);
    256         AppendChild(NewNode);
     313        AppendChild(NewNode2);
    257314        NewNode2 := OwnerDocument.CreateElement('IDEDate');
    258315        NewNode2.TextContent := DateTimeToStr(IDEDate);
    259         AppendChild(NewNode);
     316        AppendChild(NewNode2);
    260317        NewNode2 := OwnerDocument.CreateElement('IDERevision');
    261318        NewNode2.TextContent := UTF8Decode(IDERevision);
    262         AppendChild(NewNode);
     319        AppendChild(NewNode2);
    263320        NewNode2 := OwnerDocument.CreateElement('IDESource');
    264         NewNode2.TextContent := IntToStr(IDESource.Id);
    265         AppendChild(NewNode);
     321        if Assigned(IDESource) then NewNode2.TextContent := IntToStr(IDESource.Id)
     322          else NewNode2.TextContent := '0';
     323        AppendChild(NewNode2);
    266324        NewNode2 := OwnerDocument.CreateElement('FPCDate');
    267325        NewNode2.TextContent := DateTimeToStr(FPCDate);
    268         AppendChild(NewNode);
     326        AppendChild(NewNode2);
    269327        NewNode2 := OwnerDocument.CreateElement('FPCRevision');
    270328        NewNode2.TextContent := UTF8Decode(FPCRevision);
    271         AppendChild(NewNode);
     329        AppendChild(NewNode2);
    272330        NewNode2 := OwnerDocument.CreateElement('FPCSource');
    273         NewNode2.TextContent := IntToStr(FPCSource.Id);
    274         AppendChild(NewNode);
     331        if Assigned(IDESource) then NewNode2.TextContent := IntToStr(FPCSource.Id)
     332          else NewNode2.TextContent := '0';
     333        AppendChild(NewNode2);
     334        end;
     335        AppendChild(NewNode3);
    275336      end;
    276337      AppendChild(NewNode);
     
    280341      for I := 0 to Sources.Count - 1 do
    281342      with TSource(Sources[I]) do begin
     343        NewNode3 := OwnerDocument.CreateElement('Item');
     344        with NewNode3 do begin
    282345        NewNode2 := OwnerDocument.CreateElement('Id');
    283346        NewNode2.TextContent := IntToStr(Id);
    284         AppendChild(NewNode);
     347        AppendChild(NewNode2);
    285348        NewNode2 := OwnerDocument.CreateElement('Name');
    286349        NewNode2.TextContent := UTF8Decode(Name);
    287         AppendChild(NewNode);
     350        AppendChild(NewNode2);
    288351        NewNode2 := OwnerDocument.CreateElement('SubversionURL');
    289352        NewNode2.TextContent := UTF8Decode(SubversionURL);
    290         AppendChild(NewNode);
     353        AppendChild(NewNode2);
    291354        NewNode2 := OwnerDocument.CreateElement('VersionType');
    292355        NewNode2.TextContent := UTF8Decode(VersionType);
    293         AppendChild(NewNode);
     356        AppendChild(NewNode2);
    294357        NewNode2 := OwnerDocument.CreateElement('VersionNumber');
    295358        NewNode2.TextContent := UTF8Decode(VersionNumber);
    296         AppendChild(NewNode);
     359        AppendChild(NewNode2);
    297360        NewNode2 := OwnerDocument.CreateElement('SourceType');
    298361        NewNode2.TextContent := IntToStr(Byte(SourceType));
    299         AppendChild(NewNode);
     362        AppendChild(NewNode2);
     363        end;
     364        AppendChild(NewNode3);
    300365      end;
    301366      AppendChild(NewNode);
  • trunk/UOptions.lfm

    r3 r4  
    11object OptionsForm: TOptionsForm
    2   Left = 338
    3   Height = 410
    4   Top = 161
     2  Left = 274
     3  Height = 424
     4  Top = 106
    55  Width = 573
    66  Caption = 'Options'
    7   ClientHeight = 410
     7  ClientHeight = 424
    88  ClientWidth = 573
     9  OnCreate = FormCreate
     10  OnDestroy = FormDestroy
     11  OnShow = FormShow
    912  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
    8813  object ButtonCancel: TButton
    8914    Left = 408
    9015    Height = 25
    91     Top = 380
     16    Top = 394
    9217    Width = 75
     18    Anchors = [akRight, akBottom]
    9319    Caption = 'Cancel'
    94     TabOrder = 2
     20    ModalResult = 2
     21    OnClick = ButtonCancelClick
     22    TabOrder = 0
    9523  end
    9624  object ButtonOk: TButton
    9725    Left = 493
    9826    Height = 25
    99     Top = 380
     27    Top = 394
    10028    Width = 75
     29    Anchors = [akRight, akBottom]
    10130    Caption = 'Ok'
    102     TabOrder = 3
     31    ModalResult = 1
     32    OnClick = ButtonOkClick
     33    TabOrder = 1
    10334  end
    10435  object ButtonUpdateSource: TButton
    10536    Left = 10
    10637    Height = 25
    107     Top = 381
     38    Top = 395
    10839    Width = 75
     40    Anchors = [akLeft, akBottom]
    10941    Caption = 'Update list'
    11042    OnClick = ButtonUpdateSourceClick
     43    TabOrder = 2
     44  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
     54    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
     71  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
    11181    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
     127  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
     138    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
    112184  end
    113185end
  • trunk/UOptions.pas

    r3 r4  
    77uses
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
    9   ComCtrls, DOM, XMLWrite, XMLRead, HTTPSend;
     9  ComCtrls, ExtCtrls, DOM, XMLWrite, XMLRead, HTTPSend, USource, UInstance;
    1010
    1111type
     
    1717    ButtonCancel: TButton;
    1818    ButtonOk: TButton;
     19    Edit1: TEdit;
    1920    Label1: TLabel;
    2021    Label2: TLabel;
     22    Label3: TLabel;
    2123    ListView1: TListView;
    2224    ListView2: TListView;
     25    Panel1: TPanel;
     26    Panel2: TPanel;
     27    Panel3: TPanel;
     28    procedure ButtonCancelClick(Sender: TObject);
     29    procedure ButtonOkClick(Sender: TObject);
    2330    procedure ButtonUpdateSourceClick(Sender: TObject);
     31    procedure FormCreate(Sender: TObject);
     32    procedure FormDestroy(Sender: TObject);
     33    procedure FormShow(Sender: TObject);
     34    procedure ListView1Data(Sender: TObject; Item: TListItem);
     35    procedure ListView2Data(Sender: TObject; Item: TListItem);
    2436  private
    2537    procedure ReloadList;
    2638  public
    27     { public declarations }
    28   end;
     39    Instance: TInstance;
     40    FPCSources: TSourceList;
     41    IDESources: TSourceList;
     42  end;
    2943
    3044var
     
    5468end;
    5569
     70procedure TOptionsForm.ButtonOkClick(Sender: TObject);
     71begin
     72  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;
     79end;
     80
     81procedure TOptionsForm.ButtonCancelClick(Sender: TObject);
     82begin
     83  Instance.Free;
     84end;
     85
     86procedure TOptionsForm.FormCreate(Sender: TObject);
     87begin
     88  FPCSources := TSourceList.Create;
     89  FPCSources.OwnsObjects := False;
     90  IDESources := TSourceList.Create;
     91  IDESources.OwnsObjects := False;
     92end;
     93
     94procedure TOptionsForm.FormDestroy(Sender: TObject);
     95begin
     96  FPCSources.Free;
     97  IDESources.Free;
     98end;
     99
     100procedure TOptionsForm.FormShow(Sender: TObject);
     101begin
     102  ReloadList;
     103  if not Assigned(Instance) then begin
     104    Instance := TInstance.Create;
     105    Instance.Id := MainForm.Instances.GetNewId;
     106    Instance.Name := 'Instance ' + IntToStr(Instance.Id);
     107  end;
     108  //    ListView1.Items[;
     109  Edit1.Text := Instance.Name;
     110end;
     111
     112procedure TOptionsForm.ListView1Data(Sender: TObject; Item: TListItem);
     113begin
     114  if Item.Index < FPCSources.Count then
     115  with TSource(FPCSources[Item.Index]) do begin
     116    Item.Caption := Name;
     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;
     124end;
     125
     126procedure TOptionsForm.ListView2Data(Sender: TObject; Item: TListItem);
     127begin
     128  if Item.Index < IDESources.Count then
     129  with TSource(IDESources[Item.Index]) do begin
     130    Item.Caption := Name;
     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;
     138end;
     139
    56140procedure TOptionsForm.ReloadList;
     141var
     142  I: Integer;
    57143begin
    58   ListView1.Items.Count := MainForm.Sources.Count;
     144  FPCSources.Clear;
     145  for I := 0 to MainForm.Sources.Count - 1 do
     146    if TSource(MainForm.Sources[I]).Name = 'FPC' then
     147      FPCSources.Add(MainForm.Sources[I]);
     148  ListView1.Items.Count := FPCSources.Count;
    59149  ListView1.Refresh;
     150  IDESources.Clear;
     151  for I := 0 to MainForm.Sources.Count - 1 do
     152    if TSource(MainForm.Sources[I]).Name = 'Lazarus' then
     153      IDESources.Add(MainForm.Sources[I]);
     154  ListView2.Items.Count := IDESources.Count;
     155  ListView2.Refresh;
    60156end;
    61157
  • trunk/USource.pas

    r3 r4  
    66
    77uses
    8   Classes, SysUtils, Contnrs, FileUtil,
     8  Classes, SysUtils, Contnrs, FileUtil, Dialogs,
    99  DOM, XMLWrite, XMLRead, HTTPSend;
    1010
     
    102102        end else begin
    103103          Add(NewSource);
    104           FreeAndNil(NewSource);
     104          NewSource := nil;
    105105        end;
    106106      finally
Note: See TracChangeset for help on using the changeset viewer.