Changeset 16 for trunk/UKConfig.pas


Ignore:
Timestamp:
Jan 8, 2016, 5:09:58 PM (8 years ago)
Author:
chronos
Message:
  • Added: Preparation for filtering of non visible nodes.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UKConfig.pas

    r15 r16  
    3333    Parent: TExpression;
    3434    function Show: String; virtual;
     35    function CanBeTrue: Boolean; virtual;
    3536    procedure GetList(List: TStringList); virtual;
    3637    constructor Create; virtual;
     
    4445  TExpressionVar = class(TExpression)
    4546    Name: string;
    46     Node: TMenuNode;
     47    //Node: TMenuNode;
    4748    Negative: Boolean;
    4849    Compare: TCompareType;
    4950    Value: string;
     51    function CompareValue: Boolean;
     52    function CanBeTrue: Boolean; override;
    5053    constructor Create; override;
    5154    procedure GetList(List: TStringList); override;
     
    8891    function GetTopNode: TMenuNode; virtual;
    8992    function FindNode(ID: string): TMenuNode; virtual;
     93    function CanBeVisible: Boolean;
    9094    property Visible: Boolean read GetVisible;
    9195  end;
     
    138142{ TExpressionVar }
    139143
     144function TExpressionVar.CompareValue: Boolean;
     145begin
     146
     147end;
     148
     149function TExpressionVar.CanBeTrue: Boolean;
     150begin
     151  if Compare = ctNone then begin
     152
     153  end else
     154  if Compare = ctEqual then begin
     155    Result := Result and CompareValue;
     156  end else
     157  if Compare = ctNotEqual then begin
     158    Result := Result and not CompareValue;
     159  end;
     160//  Result := Node.CanBeVisible;
     161end;
     162
    140163constructor TExpressionVar.Create;
    141164begin
     
    176199  end;
    177200  if Assigned(Parent) then Result := '(' + Result + ')';
     201end;
     202
     203function TExpression.CanBeTrue: Boolean;
     204var
     205  I: Integer;
     206begin
     207  if ExpOperator = eoAnd then begin
     208    Result := True;
     209    for I := 0 to Items.Count - 1 do
     210      Result := Result and TExpression(Items[I]).CanBeTrue;
     211  end else
     212  if ExpOperator = eoOr then begin
     213    Result := False;
     214    for I := 0 to Items.Count - 1 do
     215      Result := Result or TExpression(Items[I]).CanBeTrue;
     216  end;
    178217end;
    179218
     
    320359  I: Integer;
    321360begin
    322   if ID <> '' then List.Add(ID);
     361  if ID <> '' then List.AddObject(ID, Self);
    323362  for I := 0 to Items.Count - 1 do
    324363  with TMenuNode(Items[I]) do begin
     
    403442    end;
    404443  end;
     444end;
     445
     446function TMenuNode.CanBeVisible: Boolean;
     447begin
     448  // TODO
     449  // Check if it can be selected manually if manual option
     450  // Check if it can be selected automatically by other option
     451
    405452end;
    406453
Note: See TracChangeset for help on using the changeset viewer.