Changeset 11 for trunk


Ignore:
Timestamp:
May 3, 2014, 12:09:24 AM (11 years ago)
Author:
chronos
Message:
Location:
trunk
Files:
36 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LinuxBuilder.lpi

    r6 r11  
    2828      </local>
    2929    </RunParams>
    30     <RequiredPackages Count="1">
     30    <RequiredPackages Count="2">
    3131      <Item1>
     32        <PackageName Value="Common"/>
     33        <DefaultFilename Value="Packages/Common/Common.lpk" Prefer="True"/>
     34      </Item1>
     35      <Item2>
    3236        <PackageName Value="LCL"/>
    33       </Item1>
     37      </Item2>
    3438    </RequiredPackages>
    3539    <Units Count="7">
     
    8084        <IsPartOfProject Value="True"/>
    8185        <ComponentName Value="FormSearch"/>
     86        <HasResources Value="True"/>
    8287        <ResourceBaseClass Value="Form"/>
    8388        <UnitName Value="UFormSearch"/>
  • trunk/LinuxBuilder.lpr

    r6 r11  
    88  {$ENDIF}{$ENDIF}
    99  Interfaces, // this includes the LCL widgetset
    10   Forms, UFormMain, UKConfig, UFormList, UFormLog, UFormCompare, UFormSearch
     10  Forms, UFormMain, UKConfig, UFormList, UFormLog, UFormCompare, UFormSearch,
     11  Common
    1112  { you can add units after this };
    1213
  • trunk/UFormMain.lfm

    r6 r11  
    99  ClientWidth = 857
    1010  Menu = MainMenu1
     11  OnClose = FormClose
    1112  OnCreate = FormCreate
    1213  OnDestroy = FormDestroy
     
    8586  object MainMenu1: TMainMenu
    8687    Images = ImageList1
    87     left = 320
    88     top = 72
     88    left = 280
     89    top = 112
    8990    object MenuItem1: TMenuItem
    9091      Caption = 'File'
     
    128129        }
    129130      end
     131      object MenuItemOpenRecent: TMenuItem
     132        Caption = 'Open recent'
     133        OnClick = MenuItemOpenRecentClick
     134      end
    130135      object MenuItem7: TMenuItem
    131136        Action = ACompare
     137      end
     138      object MenuItem9: TMenuItem
     139        Caption = '-'
     140      end
     141      object MenuItem10: TMenuItem
     142        Caption = 'Exit'
    132143      end
    133144    end
     
    258269  object ActionList1: TActionList
    259270    Images = ImageList1
    260     left = 240
    261     top = 264
     271    left = 280
     272    top = 256
    262273    object AOpenDir: TAction
    263274      Caption = 'Open directory'
     
    457468    }
    458469  end
     470  object LastOpenedList1: TLastOpenedList
     471    MaxCount = 10
     472    OnChange = LastOpenedList1Change
     473    left = 144
     474    top = 160
     475  end
    459476end
  • trunk/UFormMain.pas

    r8 r11  
    77uses
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, Menus,
    9   ActnList, ComCtrls, StdCtrls, UKConfig;
     9  ActnList, ComCtrls, StdCtrls, UKConfig, ULastOpenedList, URegistry, Registry;
     10
     11const
     12  RootKey = HKEY_CURRENT_USER;
     13  RootPath = '\Software\LinuxBuilder';
    1014
    1115type
     
    2226    ActionList1: TActionList;
    2327    ImageList1: TImageList;
     28    LastOpenedList1: TLastOpenedList;
    2429    MainMenu1: TMainMenu;
    2530    Memo1: TMemo;
    2631    MenuItem1: TMenuItem;
     32    MenuItem10: TMenuItem;
    2733    MenuItem2: TMenuItem;
    2834    MenuItem3: TMenuItem;
     
    3238    MenuItem7: TMenuItem;
    3339    MenuItem8: TMenuItem;
     40    MenuItem9: TMenuItem;
     41    MenuItemOpenRecent: TMenuItem;
    3442    StatusBar1: TStatusBar;
    3543    ToolBar1: TToolBar;
     
    4553    procedure AShowLogExecute(Sender: TObject);
    4654    procedure AViemSystemExecute(Sender: TObject);
     55    procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
    4756    procedure FormCreate(Sender: TObject);
    4857    procedure FormDestroy(Sender: TObject);
    4958    procedure FormShow(Sender: TObject);
     59    procedure LastOpenedList1Change(Sender: TObject);
     60    procedure MenuItemOpenRecentClick(Sender: TObject);
    5061    procedure TreeView1SelectionChanged(Sender: TObject);
    5162  private
    5263    procedure DoLog(Text: string);
     64    procedure OpenDir(Dir: string);
    5365  public
     66    AutoOpen: Boolean;
    5467    Config: TConfigMenu;
    5568    procedure Reload;
     
    7184procedure TFormMain.FormShow(Sender: TObject);
    7285begin
    73   Config.LoadFromDir('/home/jha/Projekty/fpc/kernel_options/linux-3.0', 'x86');
    74   Reload;
     86  AutoOpen := True;
     87  LastOpenedList1.LoadFromRegistry(RegContext(RootKey, RootPath));
     88  if AutoOpen and (LastOpenedList1.Items.Count > 0) then
     89    OpenDir(LastOpenedList1.Items[0])
     90    else Reload;
     91end;
     92
     93procedure TFormMain.LastOpenedList1Change(Sender: TObject);
     94begin
     95  LastOpenedList1.LoadToMenuItem(MenuItemOpenRecent, AOpenDirExecute);
     96end;
     97
     98procedure TFormMain.MenuItemOpenRecentClick(Sender: TObject);
     99begin
     100
    75101end;
    76102
     
    89115end;
    90116
     117procedure TFormMain.OpenDir(Dir: string);
     118begin
     119  Config.LoadFromDir(Dir);
     120  LastOpenedList1.AddItem(Dir);
     121  Reload;
     122end;
     123
    91124procedure TFormMain.Reload;
    92125var
     
    94127begin
    95128  TreeView1.Items.Clear;
    96   TreeView1.Items.AddChild(nil, Config.TopNode.GetName);
    97   Options := [];
    98   if AViemSystem.Checked then Include(Options, toShowSystem);
    99   Config.TopNode.LoadTreeNode(TreeView1.TopItem, Options);
    100   TreeView1.TopItem.Expanded := True;
    101   StatusBar1.Panels[0].Text := 'Count: ' + IntToStr(Config.TopNode.GetCount);
     129  if Assigned(Config.TopNode) then begin
     130    TreeView1.Items.AddChild(nil, Config.TopNode.GetName);
     131    Options := [];
     132    if AViemSystem.Checked then Include(Options, toShowSystem);
     133    Config.TopNode.LoadTreeNode(TreeView1.TopItem, Options);
     134    TreeView1.TopItem.Expanded := True;
     135    StatusBar1.Panels[0].Text := 'Count: ' + IntToStr(Config.TopNode.GetCount);
     136  end else begin
     137    StatusBar1.Panels[0].Text := '';
     138  end;
    102139end;
    103140
     
    117154  OutDir: string;
    118155begin
     156  if Sender is TMenuItem then begin
     157    OpenDir(TMenuItem(Sender).Caption);
     158  end;
    119159  if SelectDirectory('Select Linux source directory', Config.BaseDir, OutDir) then begin
    120     Config.LoadFromDir(OutDir, 'x86');
    121     Reload;
     160    OpenDir(OutDir);
    122161  end;
    123162end;
     
    141180    Config2 := TConfigMenu.Create;
    142181    Config.TopNode.SaveToList(List1);
    143     Config2.LoadFromDir('/opt/elinos-D6.0/linux/linux-p4-3.0/', 'p4');
     182    Config2.LoadFromDir('/opt/elinos-D6.0/linux/linux-p4-3.0/');
    144183    Config2.TopNode.SaveToList(List2);
    145184    Config.CompareStringLists(List1, List2, Missing1, Missing2);
     
    176215end;
    177216
     217procedure TFormMain.FormClose(Sender: TObject; var CloseAction: TCloseAction);
     218begin
     219  LastOpenedList1.SaveToRegistry(RegContext(RootKey, RootPath));
     220end;
     221
    178222procedure TFormMain.FormCreate(Sender: TObject);
    179223begin
  • trunk/UKConfig.pas

    r10 r11  
    9797    procedure CompareStringLists(List1, List2: TStringList; Missing1,
    9898      Missing2: TStrings);
    99     procedure LoadFromDir(Dir: string; Arch: string);
     99    procedure LoadFromDir(Dir: string);
    100100    property OnLog: TOnLogEvent read FOnLog write FOnLog;
    101101    constructor Create;
     
    721721end;
    722722
    723 procedure TConfigMenu.LoadFromDir(Dir: string; Arch: string);
     723procedure TConfigMenu.LoadFromDir(Dir: string);
    724724var
    725725  Moves: TObjectMoves;
    726726  I: Integer;
    727727begin
    728   Self.Arch := Arch;
     728  Self.Arch := 'x86';
    729729  BaseDir := Dir;
    730730  ParseMakeFile;
Note: See TracChangeset for help on using the changeset viewer.