~ubuntu-branches/ubuntu/vivid/lazarus/vivid-proposed

« back to all changes in this revision

Viewing changes to lcl/shellctrls.pas

  • Committer: Package Import Robot
  • Author(s): Abou Al Montacir
  • Date: 2014-07-14 20:16:50 UTC
  • mfrom: (1.1.15)
  • Revision ID: package-import@ubuntu.com-20140714201650-ossm36rrsdomp379
Tags: 1.2.4+dfsg-1
* New upstream release with few fixes and official support of FPC 2.6.4.
  - The detailed list of changes can be found here:
    http://wiki.lazarus.freepascal.org/Lazarus_1.2_fixes_branch#Fixes_for_1.2.4_.28Merged.29

Show diffs side-by-side

added added

removed removed

Lines of Context:
874
874
    Raise EInvalidPath.CreateFmt(SShellCtrlsInvalidPathRelative,[AValue, FQRootPath]);
875
875
  end;
876
876
 
 
877
  //writeln('RelPath = ',RelPath);
 
878
  if (RelPath = '') then
 
879
  begin
 
880
    //writeln('Root selected');
 
881
    Node := Items.GetFirstVisibleNode;
 
882
    if Assigned(Node) then
 
883
    begin
 
884
      Node.Expanded := True;
 
885
      Node.Selected := True;
 
886
    end;
 
887
    Exit;
 
888
  end;
877
889
 
878
890
  sl := TStringList.Create;
879
891
  sl.Delimiter := PathDelim;
881
893
  sl.DelimitedText := RelPath;
882
894
  if (sl.Count > 0) and (sl[0] = '') then  // This happens when root dir is empty
883
895
    sl[0] := PathDelim;                    //  and PathDelim was the first char
 
896
  if (sl.Count > 0) and (sl[sl.Count-1] = '') then sl.Delete(sl.Count-1); //remove last empty string
 
897
  if (sl.Count = 0) then Exit;
884
898
 
885
899
  //for i := 0 to sl.Count - 1 do writeln('sl[',i:2,']="',sl[i],'"');
886
900
 
888
902
  BeginUpdate;
889
903
  try
890
904
    Node := Items.GetFirstVisibleNode;
 
905
    //if assigned(node) then writeln('GetFirstVisibleNode = ',GetAdjustedNodeText(Node));
891
906
    //Root node doesn't have Siblings in this case, we need one level deeper
892
 
    if (GetRootPath <> '') and Assigned(Node) then Node := Node.GetFirstVisibleChild;
 
907
    if (GetRootPath <> '') and Assigned(Node) then
 
908
    begin
 
909
      //writeln('Root node doesn''t have Siblings');
 
910
      Node := Node.GetFirstVisibleChild;
 
911
      //writeln('Node = ',GetAdjustedNodeText(Node));
 
912
      if RootIsAbsolute then sl.Delete(0);
 
913
    end;
893
914
 
894
915
    for i := 0 to sl.Count-1 do
895
916
    begin
896
917
      {
897
918
      write('i=',i,' sl[',i,']=',sl[i],' ');
898
919
      if Node <> nil then write('GetAdjustedNodeText = ',GetAdjustedNodeText(Node))
899
 
      else  write('GetAdjustedNodeText = NIL');
 
920
      else  write('Node = NIL');
900
921
      writeln;
901
922
      }
902
923
      while (Node <> Nil) and
907
928
            {$ENDIF}
908
929
            do
909
930
            begin
 
931
              //write('  i=',i,' "',GetAdjustedNodeText(Node),' <> ',sl[i],' -> GetNextVisibleSibling -> ');
910
932
              Node := Node.GetNextVisibleSibling;
911
933
              {
912
 
              write('i=',i,' sl[',i,']=',sl[i],' ');
913
934
              if Node <> nil then write('GetAdjustedNodeText = ',GetAdjustedNodeText(Node))
914
 
              else  write('GetAdjustedNodeText = NIL');
 
935
              else  write('Node = NIL');
915
936
              writeln;
916
937
              }
917
938
            end;