View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0000282 | Double Commander | Graphical user interface | public | 2011-12-13 22:52 | 2016-06-26 12:01 |
Reporter | vitaliyg | Assigned To | cobines | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Projection | none | ETA | none | ||
Product Version | 0.6.0 (trunk) | ||||
Fixed in Version | 0.5.5 | ||||
Summary | 0000282: Blinking of file list panel while browsing FTP | ||||
Description | Check this video http://dl.dropbox.com/u/49647350/DCrepaint.mov It looks like it blinks less when browsing with keyboard | ||||
Tags | No tags attached. | ||||
Attached Files | ucolumnsfileview.pas.patch (3,636 bytes)
Index: src/newdesign/ucolumnsfileview.pas =================================================================== --- src/newdesign/ucolumnsfileview.pas (revision 4188) +++ src/newdesign/ucolumnsfileview.pas (working copy) @@ -3314,17 +3314,10 @@ end; //of DrawOtherCell //------------------------------------------------------ - procedure PrepareColors; - //------------------------------------------------------ + procedure DrawBackground; var - TextColor: TColor = -1; BackgroundColor: TColor; - //--------------------- begin - Canvas.Font.Name := ColumnsSet.GetColumnFontName(ACol); - Canvas.Font.Size := ColumnsSet.GetColumnFontSize(ACol); - Canvas.Font.Style := ColumnsSet.GetColumnFontStyle(ACol); - // Set up default background color first. if (gdSelected in aState) and ColumnsView.Active and (not gUseFrameCursor) then BackgroundColor := ColumnsSet.GetColumnCursorColor(ACol) @@ -3336,7 +3329,26 @@ else BackgroundColor := ColumnsSet.GetColumnBackground2(ACol); end; + if gUseInvertedSelection and not + ((gdSelected in aState) and ColumnsView.Active and (not gUseFrameCursor)) + then + BackgroundColor := ColumnsSet.GetColumnMarkColor(ACol); + // Draw background. + Canvas.Brush.Color := ColumnsView.DimColor(BackgroundColor); + Canvas.FillRect(aRect); + end; + + procedure PrepareColors; + //------------------------------------------------------ + var + TextColor: TColor = -1; + //--------------------- + begin + Canvas.Font.Name := ColumnsSet.GetColumnFontName(ACol); + Canvas.Font.Size := ColumnsSet.GetColumnFontSize(ACol); + Canvas.Font.Style := ColumnsSet.GetColumnFontStyle(ACol); + // Set text color. if ColumnsSet.GetColumnOvercolor(ACol) then TextColor := gColorExt.GetColorBy(AFile.FSFile); @@ -3354,7 +3366,6 @@ end else begin - BackgroundColor := ColumnsSet.GetColumnMarkColor(ACol); Canvas.Font.Color := ColumnsSet.GetColumnBackground(ACol); end; //------------------------------------------------------ @@ -3372,10 +3383,6 @@ begin Canvas.Font.Color := TextColor; end; - - // Draw background. - Canvas.Brush.Color := ColumnsView.DimColor(BackgroundColor); - Canvas.FillRect(aRect); end;// of PrepareColors; procedure DrawLines; @@ -3407,19 +3414,23 @@ begin DrawFixed // Draw column headers end - else if ColumnsView.FFiles.Count > 0 then + else begin - AFile := ColumnsView.FFiles[ARow - FixedRows]; // substract fixed rows (header) - FileSourceDirectAccess := fspDirectAccess in ColumnsView.FileSource.Properties; + DrawBackground; + if ColumnsView.FFiles.Count > 0 then + begin + AFile := ColumnsView.FFiles[ARow - FixedRows]; // substract fixed rows (header) + FileSourceDirectAccess := fspDirectAccess in ColumnsView.FileSource.Properties; - PrepareColors; + PrepareColors; - iTextTop := aRect.Top + (RowHeights[aRow] - Canvas.TextHeight('Wg')) div 2; + iTextTop := aRect.Top + (RowHeights[aRow] - Canvas.TextHeight('Wg')) div 2; - if ACol = 0 then - DrawIconCell // Draw icon in the first column - else - DrawOtherCell; + if ACol = 0 then + DrawIconCell // Draw icon in the first column + else + DrawOtherCell; + end; end; DrawCellGrid(aCol,aRow,aRect,aState); @@ -3895,4 +3906,4 @@ end; end. - + test1.patch (661 bytes)
Index: ucolumnsfileview.pas =================================================================== --- ucolumnsfileview.pas (revision 4191) +++ ucolumnsfileview.pas (working copy) @@ -3407,8 +3407,14 @@ begin DrawFixed // Draw column headers end - else if ColumnsView.FFiles.Count > 0 then + else if ColumnsView.FFiles.Count <= 0 then begin + // Draw background. + Canvas.Brush.Color := gBackColor; + Canvas.FillRect(aRect); + end + else + begin AFile := ColumnsView.FFiles[ARow - FixedRows]; // substract fixed rows (header) FileSourceDirectAccess := fspDirectAccess in ColumnsView.FileSource.Properties; ufileview.pas.patch (513 bytes)
Index: ufileview.pas =================================================================== --- ufileview.pas (revision 4224) +++ ufileview.pas (working copy) @@ -881,13 +881,14 @@ if gListFilesInThread then begin +{ // Clear files. if Assigned(FFileSourceFiles) then begin FFiles.Clear; // Clear references to files from the source. FreeAndNil(FFileSourceFiles); end; - +} BeforeMakeFileList; AThread.QueueFunction(@Worker.StartParam); end lock_input.diff (12,823 bytes)
Index: newdesign/ufileview.pas =================================================================== --- newdesign/ufileview.pas (revision 4390) +++ newdesign/ufileview.pas (working copy) @@ -187,6 +187,7 @@ } procedure BeforeMakeFileList; virtual; procedure ChooseFile(const AFile: TDisplayFile; FolderMode: Boolean = False); virtual; + procedure ClearFiles; virtual; procedure DoUpdateView; virtual; {en Returns current work type in progress. @@ -1076,13 +1077,7 @@ if gListFilesInThread then begin - // Clear files. - if Assigned(FAllDisplayFiles) then - begin - FFiles.Clear; - FAllDisplayFiles.Clear; // Clear references to files from the source. - end; - + ClearFiles; BeforeMakeFileList; AThread.QueueFunction(@Worker.StartParam); end @@ -1130,6 +1125,16 @@ end; end; +procedure TFileView.ClearFiles; +begin + // Clear files. + if Assigned(FAllDisplayFiles) then + begin + FFiles.Clear; + FAllDisplayFiles.Clear; // Clear references to files from the source. + end; +end; + procedure TFileView.DoUpdateView; begin // Empty. @@ -2028,4 +2033,4 @@ end; end. - + Index: newdesign/ucolumnsfileview.pas =================================================================== --- newdesign/ucolumnsfileview.pas (revision 4398) +++ newdesign/ucolumnsfileview.pas (working copy) @@ -139,6 +139,7 @@ FUpdatingGrid: Boolean; FLastSelectionStartRow: Integer; FLastSelectionState: Boolean; + FInputLocked: Boolean; // To prevent file list blinking we don't clear the files but instead prevent user input pnlFooter: TPanel; lblInfo: TLabel; @@ -288,6 +289,7 @@ procedure BeforeMakeFileList; override; procedure AfterMakeFileList; override; + procedure ClearFiles; override; procedure DoUpdateView; override; {en Changes drawing colors depending on if this panel is active. @@ -635,7 +637,7 @@ iRow, iCol : Integer; AFile: TDisplayFile; begin - if (Y < dgPanel.GetHeaderHeight) then Exit; // if is header + if (Y < dgPanel.GetHeaderHeight) or FInputLocked then Exit; // if is header or locked SetFocus; @@ -802,6 +804,9 @@ MI:TMenuItem; Background: Boolean; begin + if FInputLocked then + Exit; + if Button = mbRight then begin { If right click on header } @@ -877,7 +882,7 @@ begin Accept := False; - if (not (Source is TDrawGridEx)) or (not (Sender is TDrawGridEx)) then + if (not (Source is TDrawGridEx)) or (not (Sender is TDrawGridEx)) or FInputLocked then Exit; // Always allow dropping into an empty panel. @@ -1009,7 +1014,7 @@ ShiftState : TShiftState; SortingDirection : TSortDirection = sdAscending; begin - if not IsColumn then Exit; + if not IsColumn or FInputLocked then Exit; ShiftState := GetKeyShiftState; if not ((ssShift in ShiftState) or (ssCtrl in ShiftState)) then @@ -1034,14 +1039,17 @@ I: Integer; begin Handled:= True; - case gScrollMode of - smLineByLine: - for I:= 1 to gWheelScrollLines do - dgPanel.Perform(LM_VSCROLL, SB_LINEUP, 0); - smPageByPage: - dgPanel.Perform(LM_VSCROLL, SB_PAGEUP, 0); - else - Handled:= False; + if not FInputLocked then + begin + case gScrollMode of + smLineByLine: + for I:= 1 to gWheelScrollLines do + dgPanel.Perform(LM_VSCROLL, SB_LINEUP, 0); + smPageByPage: + dgPanel.Perform(LM_VSCROLL, SB_PAGEUP, 0); + else + Handled:= False; + end; end; end; @@ -1051,14 +1059,17 @@ I: Integer; begin Handled:= True; - case gScrollMode of - smLineByLine: - for I:= 1 to gWheelScrollLines do - dgPanel.Perform(LM_VSCROLL, SB_LINEDOWN, 0); - smPageByPage: - dgPanel.Perform(LM_VSCROLL, SB_PAGEDOWN, 0); - else - Handled:= False; + if not FInputLocked then + begin + case gScrollMode of + smLineByLine: + for I:= 1 to gWheelScrollLines do + dgPanel.Perform(LM_VSCROLL, SB_LINEDOWN, 0); + smPageByPage: + dgPanel.Perform(LM_VSCROLL, SB_PAGEDOWN, 0); + else + Handled:= False; + end; end; end; @@ -1092,7 +1103,7 @@ AFile: TDisplayFile; sHint: UTF8String; begin - if HintInfo^.HintStr = EmptyStr then Exit; // don't show + if (HintInfo^.HintStr = EmptyStr) or FInputLocked then Exit; // don't show with dgPanel do begin @@ -1169,12 +1180,15 @@ procedure TColumnsFileView.AfterChangePath; begin - FUpdatingGrid := True; - dgPanel.Row := 0; - FUpdatingGrid := False; - inherited AfterChangePath; + if not FInputLocked then + begin + FUpdatingGrid := True; + dgPanel.Row := 0; + FUpdatingGrid := False; + end; + pnlHeader.UpdatePathLabel; end; @@ -1951,6 +1965,24 @@ aFile: TDisplayFile; mi: TMenuItem; begin + if FInputLocked then + case Key of + VK_BACK: + begin + ChangePathToParent(True); + Key := 0; + end; + VK_ESCAPE: + if GetCurrentWorkType <> fvwtNone then + begin + StopWorkers; + inherited ClearFiles; + Key := 0; + end; + else + Key := 0; + end; + // check if ShiftState is equal to quick search / filter modes if quickSearch.CheckSearchOrFilter(Key) then Exit; @@ -2168,7 +2200,8 @@ procedure TColumnsFileView.lblFilterClick(Sender: TObject); begin - quickSearch.Initialize(qsFilter); + if not FInputLocked then + quickSearch.Initialize(qsFilter); end; procedure TColumnsFileView.ColumnsMenuClick(Sender: TObject); @@ -2450,18 +2483,36 @@ EnsureDisplayProperties; // After displaying. end; +procedure TColumnsFileView.ClearFiles; +begin + // Don't clear files. Lock input instead. + FInputLocked := True; +end; + procedure TColumnsFileView.DisplayFileListHasChanged; +var + NewRowSet: Boolean = False; begin // Update grid row count. SetRowCount(FFiles.Count); RedrawGrid; if SetActiveFileNow(RequestedActiveFile) then - RequestedActiveFile := '' + begin + RequestedActiveFile := ''; + NewRowSet := True; + end else // Requested file was not found, restore position to last active file. - SetActiveFileNow(LastActiveFile); + NewRowSet := SetActiveFileNow(LastActiveFile); + if not NewRowSet and FInputLocked then + begin + FUpdatingGrid := True; + dgPanel.Row := 0; + FUpdatingGrid := False; + end; + UpdateInfoPanel; end; @@ -2655,6 +2706,7 @@ end; dgPanel.Cursor := crDefault; UpdateInfoPanel; + FInputLocked := False; end; procedure TColumnsFileView.DoUpdateView; @@ -2774,8 +2826,8 @@ procedure TColumnsFileView.UTF8KeyPressEvent(Sender: TObject; var UTF8Key: TUTF8Char); begin // check if ShiftState is equal to quick search / filter modes - if quickSearch.CheckSearchOrFilter(UTF8Key) then - Exit; + if not FInputLocked then + quickSearch.CheckSearchOrFilter(UTF8Key); end; procedure TColumnsFileView.DoDragDropOperation(Operation: TDragDropOperation; @@ -2826,51 +2878,61 @@ procedure TColumnsFileView.cm_MarkInvert(param: string=''); begin - InvertAll; + if not FInputLocked then + InvertAll; end; procedure TColumnsFileView.cm_MarkMarkAll(param: string=''); begin - MarkAll; + if not FInputLocked then + MarkAll; end; procedure TColumnsFileView.cm_MarkUnmarkAll(param: string=''); begin - UnMarkAll; + if not FInputLocked then + UnMarkAll; end; procedure TColumnsFileView.cm_MarkPlus(param: string=''); begin - MarkPlus; + if not FInputLocked then + MarkPlus; end; procedure TColumnsFileView.cm_MarkMinus(param: string=''); begin - MarkMinus; + if not FInputLocked then + MarkMinus; end; procedure TColumnsFileView.cm_MarkCurrentExtension(param: string=''); begin - MarkShiftPlus; + if not FInputLocked then + MarkShiftPlus; end; procedure TColumnsFileView.cm_UnmarkCurrentExtension(param: string=''); begin - MarkShiftMinus; + if not FInputLocked then + MarkShiftMinus; end; procedure TColumnsFileView.cm_SaveSelection(param: string); begin - SaveSelection; + if not FInputLocked then + SaveSelection; end; procedure TColumnsFileView.cm_RestoreSelection(param: string); begin - RestoreSelection; + if not FInputLocked then + RestoreSelection; end; procedure TColumnsFileView.cm_SaveSelectionToFile(param: string); begin + if not FInputLocked then with dmComData do begin SaveDialog.DefaultExt:= '.txt'; @@ -2889,6 +2951,7 @@ procedure TColumnsFileView.cm_LoadSelectionFromFile(param: string); begin + if not FInputLocked then with dmComData do begin OpenDialog.DefaultExt:= '.txt'; @@ -2907,8 +2970,11 @@ procedure TColumnsFileView.cm_LoadSelectionFromClip(param: string); begin - FSavedSelection.Text:= Clipboard.AsText; - RestoreSelection; + if not FInputLocked then + begin + FSavedSelection.Text:= Clipboard.AsText; + RestoreSelection; + end; end; { @@ -2921,10 +2987,13 @@ } procedure TColumnsFileView.cm_QuickSearch(param: string=''); begin - if param = EmptyStr then - quickSearch.Initialize(qsSearch) - else - quickSearch.ToggleOption(param); + if not FInputLocked then + begin + if param = EmptyStr then + quickSearch.Initialize(qsSearch) + else + quickSearch.ToggleOption(param); + end; end; { @@ -2937,27 +3006,32 @@ } procedure TColumnsFileView.cm_QuickFilter(param: string=''); begin - if param = EmptyStr then - quickSearch.Initialize(qsFilter) - else - quickSearch.ToggleOption(param); + if not FInputLocked then + begin + if param = EmptyStr then + quickSearch.Initialize(qsFilter) + else + quickSearch.ToggleOption(param); + end; end; procedure TColumnsFileView.cm_Open(param: string=''); begin - ChooseFile(GetActiveDisplayFile); + if not FInputLocked then + ChooseFile(GetActiveDisplayFile); end; procedure TColumnsFileView.cm_CountDirContent(param: string=''); begin - CalculateSpaceOfAllDirectories; + if not FInputLocked then + CalculateSpaceOfAllDirectories; end; procedure TColumnsFileView.cm_RenameOnly(param: string=''); var aFile: TFile; begin - if (fsoSetFileProperty in FileSource.GetOperationsTypes) then + if (fsoSetFileProperty in FileSource.GetOperationsTypes) and not FInputLocked then begin aFile:= CloneActiveFile; if Assigned(aFile) then @@ -2977,11 +3051,14 @@ Rect: TRect; Point: TPoint; begin - Rect := dgPanel.CellRect(0, dgPanel.Row); - Point.X := Rect.Left + ((Rect.Right - Rect.Left) div 2); - Point.Y := Rect.Top + ((Rect.Bottom - Rect.Top) div 2); - Point := dgPanel.ClientToScreen(Point); - frmMain.Commands.DoContextMenu(Self, Point.X, Point.Y, False); + if not FInputLocked then + begin + Rect := dgPanel.CellRect(0, dgPanel.Row); + Point.X := Rect.Left + ((Rect.Right - Rect.Left) div 2); + Point.Y := Rect.Top + ((Rect.Bottom - Rect.Top) div 2); + Point := dgPanel.ClientToScreen(Point); + frmMain.Commands.DoContextMenu(Self, Point.X, Point.Y, False); + end; end; procedure TColumnsFileView.cm_EditPath(param: string); @@ -2991,12 +3068,14 @@ procedure TColumnsFileView.cm_GoToFirstFile(param: string); begin - dgPanel.Row:= dgPanel.FixedRows; + if not FInputLocked then + dgPanel.Row:= dgPanel.FixedRows; end; procedure TColumnsFileView.cm_GoToLastFile(param: string); begin - dgPanel.Row:= dgPanel.RowCount - 1; + if not FInputLocked then + dgPanel.Row:= dgPanel.RowCount - 1; end; { TDrawGridEx } @@ -3419,7 +3498,8 @@ if gdFixed in aState then begin - DrawFixed // Draw column headers + DrawFixed; // Draw column headers + DrawCellGrid(aCol,aRow,aRect,aState); end else if ColumnsView.FFiles.Count > 0 then begin @@ -3434,10 +3514,15 @@ DrawIconCell // Draw icon in the first column else DrawOtherCell; - end; DrawCellGrid(aCol,aRow,aRect,aState); DrawLines; + end + else + begin + Canvas.Brush.Color := Self.Color; + Canvas.FillRect(aRect); + end; end; procedure TDrawGridEx.MouseMove(Shift: TShiftState; X, Y: Integer); @@ -3573,6 +3658,8 @@ // doubleclick events we have to also drop MouseDown events that precede them. if TooManyDoubleClicks then Exit; {$ENDIF} + if ColumnsView.FInputLocked then + Exit; FMouseDown := True; lock_input4446.diff (13,001 bytes)
Index: src/newdesign/ufileview.pas =================================================================== --- src/newdesign/ufileview.pas (revision 4446) +++ src/newdesign/ufileview.pas (working copy) @@ -223,6 +223,7 @@ } procedure BeforeMakeFileList; virtual; procedure ChooseFile(const AFile: TDisplayFile; FolderMode: Boolean = False); virtual; + procedure ClearFiles; virtual; procedure DoUpdateView; virtual; {en Returns current work type in progress. @@ -1395,14 +1396,9 @@ if gListFilesInThread then begin - // Clear files. - if Assigned(FAllDisplayFiles) then - begin - if Assigned(FRecentlyUpdatedFiles) then - FRecentlyUpdatedFiles.Clear; - FFiles.Clear; - FAllDisplayFiles.Clear; // Clear references to files from the source. - end; + if Assigned(FRecentlyUpdatedFiles) then + FRecentlyUpdatedFiles.Clear; + ClearFiles; BeforeMakeFileList; AThread.QueueFunction(@Worker.StartParam); @@ -1451,6 +1447,16 @@ end; end; +procedure TFileView.ClearFiles; +begin + // Clear files. + if Assigned(FAllDisplayFiles) then + begin + FFiles.Clear; + FAllDisplayFiles.Clear; // Clear references to files from the source. + end; +end; + procedure TFileView.DoUpdateView; begin // Empty. Index: src/newdesign/ucolumnsfileview.pas =================================================================== --- src/newdesign/ucolumnsfileview.pas (revision 4446) +++ src/newdesign/ucolumnsfileview.pas (working copy) @@ -139,6 +139,7 @@ FUpdatingGrid: Boolean; FLastSelectionStartRow: Integer; FLastSelectionState: Boolean; + FInputLocked: Boolean; // To prevent file list blinking we don't clear the files but instead prevent user input pnlFooter: TPanel; lblInfo: TLabel; @@ -288,6 +289,7 @@ procedure BeforeMakeFileList; override; procedure AfterMakeFileList; override; + procedure ClearFiles; override; procedure DoUpdateView; override; {en Changes drawing colors depending on if this panel is active. @@ -635,7 +637,7 @@ iRow, iCol : Integer; AFile: TDisplayFile; begin - if (Y < dgPanel.GetHeaderHeight) then Exit; // if is header + if (Y < dgPanel.GetHeaderHeight) or FInputLocked then Exit; // if is header or locked SetFocus; @@ -802,6 +804,9 @@ MI:TMenuItem; Background: Boolean; begin + if FInputLocked then + Exit; + if Button = mbRight then begin { If right click on header } @@ -877,7 +882,7 @@ begin Accept := False; - if (not (Source is TDrawGridEx)) or (not (Sender is TDrawGridEx)) then + if (not (Source is TDrawGridEx)) or (not (Sender is TDrawGridEx)) or FInputLocked then Exit; // Always allow dropping into an empty panel. @@ -1009,7 +1014,7 @@ ShiftState : TShiftState; SortingDirection : TSortDirection = sdAscending; begin - if not IsColumn then Exit; + if not IsColumn or FInputLocked then Exit; ShiftState := GetKeyShiftState; if not ((ssShift in ShiftState) or (ssCtrl in ShiftState)) then @@ -1034,14 +1039,17 @@ I: Integer; begin Handled:= True; - case gScrollMode of - smLineByLine: - for I:= 1 to gWheelScrollLines do - dgPanel.Perform(LM_VSCROLL, SB_LINEUP, 0); - smPageByPage: - dgPanel.Perform(LM_VSCROLL, SB_PAGEUP, 0); - else - Handled:= False; + if not FInputLocked then + begin + case gScrollMode of + smLineByLine: + for I:= 1 to gWheelScrollLines do + dgPanel.Perform(LM_VSCROLL, SB_LINEUP, 0); + smPageByPage: + dgPanel.Perform(LM_VSCROLL, SB_PAGEUP, 0); + else + Handled:= False; + end; end; end; @@ -1051,14 +1059,17 @@ I: Integer; begin Handled:= True; - case gScrollMode of - smLineByLine: - for I:= 1 to gWheelScrollLines do - dgPanel.Perform(LM_VSCROLL, SB_LINEDOWN, 0); - smPageByPage: - dgPanel.Perform(LM_VSCROLL, SB_PAGEDOWN, 0); - else - Handled:= False; + if not FInputLocked then + begin + case gScrollMode of + smLineByLine: + for I:= 1 to gWheelScrollLines do + dgPanel.Perform(LM_VSCROLL, SB_LINEDOWN, 0); + smPageByPage: + dgPanel.Perform(LM_VSCROLL, SB_PAGEDOWN, 0); + else + Handled:= False; + end; end; end; @@ -1092,7 +1103,7 @@ AFile: TDisplayFile; sHint: UTF8String; begin - if HintInfo^.HintStr = EmptyStr then Exit; // don't show + if (HintInfo^.HintStr = EmptyStr) or FInputLocked then Exit; // don't show with dgPanel do begin @@ -1169,12 +1180,15 @@ procedure TColumnsFileView.AfterChangePath; begin - FUpdatingGrid := True; - dgPanel.Row := 0; - FUpdatingGrid := False; - inherited AfterChangePath; + if not FInputLocked then + begin + FUpdatingGrid := True; + dgPanel.Row := 0; + FUpdatingGrid := False; + end; + pnlHeader.UpdatePathLabel; end; @@ -1948,6 +1962,24 @@ aFile: TDisplayFile; mi: TMenuItem; begin + if FInputLocked then + case Key of + VK_BACK: + begin + ChangePathToParent(True); + Key := 0; + end; + VK_ESCAPE: + if GetCurrentWorkType <> fvwtNone then + begin + StopWorkers; + inherited ClearFiles; + Key := 0; + end; + else + Key := 0; + end; + // check if ShiftState is equal to quick search / filter modes if quickSearch.CheckSearchOrFilter(Key) then Exit; @@ -2165,7 +2197,8 @@ procedure TColumnsFileView.lblFilterClick(Sender: TObject); begin - quickSearch.Initialize(qsFilter); + if not FInputLocked then + quickSearch.Initialize(qsFilter); end; procedure TColumnsFileView.ColumnsMenuClick(Sender: TObject); @@ -2447,18 +2480,36 @@ EnsureDisplayProperties; // After displaying. end; +procedure TColumnsFileView.ClearFiles; +begin + // Don't clear files. Lock input instead. + FInputLocked := True; +end; + procedure TColumnsFileView.DisplayFileListHasChanged; +var + NewRowSet: Boolean = False; begin // Update grid row count. SetRowCount(FFiles.Count); RedrawGrid; if SetActiveFileNow(RequestedActiveFile) then - RequestedActiveFile := '' + begin + RequestedActiveFile := ''; + NewRowSet := True; + end else // Requested file was not found, restore position to last active file. - SetActiveFileNow(LastActiveFile); + NewRowSet := SetActiveFileNow(LastActiveFile); + if not NewRowSet and FInputLocked then + begin + FUpdatingGrid := True; + dgPanel.Row := 0; + FUpdatingGrid := False; + end; + UpdateInfoPanel; end; @@ -2652,6 +2703,7 @@ end; dgPanel.Cursor := crDefault; UpdateInfoPanel; + FInputLocked := False; end; procedure TColumnsFileView.DoUpdateView; @@ -2771,8 +2823,8 @@ procedure TColumnsFileView.UTF8KeyPressEvent(Sender: TObject; var UTF8Key: TUTF8Char); begin // check if ShiftState is equal to quick search / filter modes - if quickSearch.CheckSearchOrFilter(UTF8Key) then - Exit; + if not FInputLocked then + quickSearch.CheckSearchOrFilter(UTF8Key); end; procedure TColumnsFileView.DoDragDropOperation(Operation: TDragDropOperation; @@ -2823,51 +2875,61 @@ procedure TColumnsFileView.cm_MarkInvert(param: string=''); begin - InvertAll; + if not FInputLocked then + InvertAll; end; procedure TColumnsFileView.cm_MarkMarkAll(param: string=''); begin - MarkAll; + if not FInputLocked then + MarkAll; end; procedure TColumnsFileView.cm_MarkUnmarkAll(param: string=''); begin - UnMarkAll; + if not FInputLocked then + UnMarkAll; end; procedure TColumnsFileView.cm_MarkPlus(param: string=''); begin - MarkPlus; + if not FInputLocked then + MarkPlus; end; procedure TColumnsFileView.cm_MarkMinus(param: string=''); begin - MarkMinus; + if not FInputLocked then + MarkMinus; end; procedure TColumnsFileView.cm_MarkCurrentExtension(param: string=''); begin - MarkShiftPlus; + if not FInputLocked then + MarkShiftPlus; end; procedure TColumnsFileView.cm_UnmarkCurrentExtension(param: string=''); begin - MarkShiftMinus; + if not FInputLocked then + MarkShiftMinus; end; procedure TColumnsFileView.cm_SaveSelection(param: string); begin - SaveSelection; + if not FInputLocked then + SaveSelection; end; procedure TColumnsFileView.cm_RestoreSelection(param: string); begin - RestoreSelection; + if not FInputLocked then + RestoreSelection; end; procedure TColumnsFileView.cm_SaveSelectionToFile(param: string); begin + if not FInputLocked then with dmComData do begin SaveDialog.DefaultExt:= '.txt'; @@ -2886,6 +2948,7 @@ procedure TColumnsFileView.cm_LoadSelectionFromFile(param: string); begin + if not FInputLocked then with dmComData do begin OpenDialog.DefaultExt:= '.txt'; @@ -2904,8 +2967,11 @@ procedure TColumnsFileView.cm_LoadSelectionFromClip(param: string); begin - FSavedSelection.Text:= Clipboard.AsText; - RestoreSelection; + if not FInputLocked then + begin + FSavedSelection.Text:= Clipboard.AsText; + RestoreSelection; + end; end; { @@ -2918,10 +2984,13 @@ } procedure TColumnsFileView.cm_QuickSearch(param: string=''); begin - if param = EmptyStr then - quickSearch.Initialize(qsSearch) - else - quickSearch.ToggleOption(param); + if not FInputLocked then + begin + if param = EmptyStr then + quickSearch.Initialize(qsSearch) + else + quickSearch.ToggleOption(param); + end; end; { @@ -2934,27 +3003,32 @@ } procedure TColumnsFileView.cm_QuickFilter(param: string=''); begin - if param = EmptyStr then - quickSearch.Initialize(qsFilter) - else - quickSearch.ToggleOption(param); + if not FInputLocked then + begin + if param = EmptyStr then + quickSearch.Initialize(qsFilter) + else + quickSearch.ToggleOption(param); + end; end; procedure TColumnsFileView.cm_Open(param: string=''); begin - ChooseFile(GetActiveDisplayFile); + if not FInputLocked then + ChooseFile(GetActiveDisplayFile); end; procedure TColumnsFileView.cm_CountDirContent(param: string=''); begin - CalculateSpaceOfAllDirectories; + if not FInputLocked then + CalculateSpaceOfAllDirectories; end; procedure TColumnsFileView.cm_RenameOnly(param: string=''); var aFile: TFile; begin - if (fsoSetFileProperty in FileSource.GetOperationsTypes) then + if (fsoSetFileProperty in FileSource.GetOperationsTypes) and not FInputLocked then begin aFile:= CloneActiveFile; if Assigned(aFile) then @@ -2974,11 +3048,14 @@ Rect: TRect; Point: TPoint; begin - Rect := dgPanel.CellRect(0, dgPanel.Row); - Point.X := Rect.Left + ((Rect.Right - Rect.Left) div 2); - Point.Y := Rect.Top + ((Rect.Bottom - Rect.Top) div 2); - Point := dgPanel.ClientToScreen(Point); - frmMain.Commands.DoContextMenu(Self, Point.X, Point.Y, False); + if not FInputLocked then + begin + Rect := dgPanel.CellRect(0, dgPanel.Row); + Point.X := Rect.Left + ((Rect.Right - Rect.Left) div 2); + Point.Y := Rect.Top + ((Rect.Bottom - Rect.Top) div 2); + Point := dgPanel.ClientToScreen(Point); + frmMain.Commands.DoContextMenu(Self, Point.X, Point.Y, False); + end; end; procedure TColumnsFileView.cm_EditPath(param: string); @@ -2988,12 +3065,14 @@ procedure TColumnsFileView.cm_GoToFirstFile(param: string); begin - dgPanel.Row:= dgPanel.FixedRows; + if not FInputLocked then + dgPanel.Row:= dgPanel.FixedRows; end; procedure TColumnsFileView.cm_GoToLastFile(param: string); begin - dgPanel.Row:= dgPanel.RowCount - 1; + if not FInputLocked then + dgPanel.Row:= dgPanel.RowCount - 1; end; { TDrawGridEx } @@ -3421,7 +3500,8 @@ if gdFixed in aState then begin - DrawFixed // Draw column headers + DrawFixed; // Draw column headers + DrawCellGrid(aCol,aRow,aRect,aState); end else if ColumnsView.FFiles.Count > 0 then begin @@ -3436,10 +3516,16 @@ DrawIconCell // Draw icon in the first column else DrawOtherCell; - end; DrawCellGrid(aCol,aRow,aRect,aState); DrawLines; + end + else + begin + WriteLn('Drawing background'); + Canvas.Brush.Color := Self.Color; + Canvas.FillRect(aRect); + end; end; procedure TDrawGridEx.MouseMove(Shift: TShiftState; X, Y: Integer); @@ -3575,6 +3661,8 @@ // doubleclick events we have to also drop MouseDown events that precede them. if TooManyDoubleClicks then Exit; {$ENDIF} + if ColumnsView.FInputLocked then + Exit; FMouseDown := True; | ||||
Fixed in Revision | 4821 | ||||
Operating system | Windows | ||||
Widgetset | |||||
Architecture | 64-bit | ||||
|
Fixed to always paint background (this removed blinking of background) But ideally it should show old file list and then instantly update to display new list (without empty panel like now) |
|
With such solution we can get view like on EmptyPanel.PNG, that is not pretty too. May be is better when files count is zero then fill background by gBackColor for any cell (see test1.patch). But this solution has some small problems too. |
|
> With such solution we can get view like on EmptyPanel.PNG,.. Problem here is not in drawing logic(it should always paint background and than everything else what it can), view like this we get when file list is empty but there is still rows left in drawgrid (so this should be fixed by synchronizing files with corresponding rows: "no files - no rows") |
|
Yes, the problem in synchronising files and rows count. My solution is workaround only. |
|
I suggest to not clear files list BEFORE preparing new list Clear only AFTER new list is ready to display Check ufileview.pas.patch Is seems to be working ok, but maybe there is some problems with this approach |
|
There is a problem with such solution, when open a folder (with many files) in the end of filelist then old folder content is showed first (at begin of filelist) and only later it replaced by new. |
|
Please test with lock_input.diff. |
|
It seems to be still blinking (but I couldn't test on FTP) Also I think that locking is not a good idea (than why listing files in second thread) I think that user should be able: - to cancel browsing to another folder if it takes to long (by Esc) - browse to another folder without waiting to finish previous change (cancel and list another). - open some file while new list is still loading On opening FTP connections I get AV error(possibly because I have only filename column in panel, this is happening only in ftp plugin, local drive works ok). Starting GuiMessageQueue Starting Double Commander Double Commander 0.5.5 alpha Revision: Build: 2012/03/15 Lazarus: 0.9.30.2-33306 Free Pascal: 2.4.4 Platform: x86_64-Win64-win32/win64 System: Windows 7 SP1 x86_64 This program is free software released under terms of GNU GPL 2 (C)opyright 2006-2011 Koblov Alexander (Alexx2000@mail.ru) and contributors (see about dialog) Executable directory: E:\Projects\DoubleCommander\ Loading configuration... Loading lng file: E:\Projects\DoubleCommander\language\doublecmd.uk_UA.po Creating PixmapManager Loading icon theme DCTheme TColumnsFileView.Create components Creating TFileSystemFileSource TColumnsFileView.Create components TColumnsFileView.Create components TColumnsFileView.Create components FileSystemWatcher thread starting frmMain.frmMainShow Cannot read configuration file: E:\Projects\DoubleCommander\highlighters.xml Creating TVfsFileSource Creating TWfxPluginFileSource WFX module loaded E:\Projects\DoubleCommander\plugins\wfx\ftp\ftp.wfx at 0000000 110000000 Found registered plugin E:\Projects\DoubleCommander\plugins\wfx\ftp\ftp.wfx for file system FTP TApplication.HandleException Access violation Stack trace: $00000000006EA316 TCOLUMNSFILEVIEW__UPDATEINFOPANEL, line 1537 of ./newdesig n/ucolumnsfileview.pas $00000000006E602F TCOLUMNSFILEVIEW__DGPANELMOUSEDOWN, line 726 of ./newdesig n/ucolumnsfileview.pas $000000000056F448 TCONTROL__MOUSEDOWN, line 3622 of ./include/control.inc $0000000000621085 TCUSTOMGRID__MOUSEDOWN, line 5569 of grids.pas $00000000006F5F0E TDRAWGRIDEX__MOUSEDOWN, line 3580 of ./newdesign/ucolumnsf ileview.pas $000000000056A61E TCONTROL__DOMOUSEDOWN, line 1721 of ./include/control.inc $000000000056AB25 TCONTROL__WMLBUTTONDOWN, line 1855 of ./include/control.in c $000000000040E766 $000000000055E57B TWINCONTROL__WNDPROC, line 5241 of ./include/wincontrol.in c $000000000061D591 TCUSTOMGRID__WNDPROC, line 4274 of grids.pas $0000000000612EB5 DELIVERMESSAGE, line 110 of lclmessageglue.pas $00000000005910CA WINDOWPROC, line 2441 of win32callback.inc |
|
>> It seems to be still blinking (but I couldn't test on FTP) Is it better or worse than with test1.patch? >> Also I think that locking is not a good idea (than why listing files in second thread) The point of using a thread is so that the whole application is not locked. Only the panel in which reloading takes place would be locked. >>- to cancel browsing to another folder if it takes to long (by Esc) Escape is not filtered out, you can cancel loading. Backspace is also not filtered (to go to parent dir). >>- browse to another folder without waiting to finish previous change (cancel and list another). >>- open some file while new list is still loading I don't like this solution, because I think that there should be a clear indication that a new file list is being loaded and user should be forbidden to interact with the old filelist, while a new one is being loaded. So, either remove the old file list before loading new one, or lock the panel. There could also be inconsistency where for example you press Enter to change to another directory in the old file list but before it is handled a new filelist is shown and Enter works on the new filelist. |
|
So I guess the best approach will be to clear list immediately and immediately update draw grid rows to paint empty panel correctly. I think filling new list incrementally (like each 100 files) during load would be good |
|
>> So I guess the best approach will be to clear list immediately and immediately update draw grid rows to paint empty panel correctly. That also blinks, because the background is drawn over the old file list, and then the new file list is drawn. It is visible when quickly traversing through directories. It's just that which solution blinks less test1.patch or lock_input.diff. |
|
By blinking I mean painting gray background (for some moment) instead of black panel background. And it seems it still present with patch lock_input.diff applied. So test1.patch is better but it is not finished (need to update draw grid rows count ) |
|
I made more tests, for me lock_input doesn't blink at all. Try setting panel background to white and change the code to draw background when there are no files to: Canvas.Brush.Color := clPurple; Canvas.FillRect(aRect); When I enter directories that take long time to load purple color is displayed with current SVN and with test1.patch but not with lock_input. |
|
This is how it looks with lock_input.diff patch applied to 4444 revision http://dl.dropbox.com/u/49647350/DCWithLockPatch.avi |
|
I cannot reproduce this. I connected to an FTP, walked around for 10 minutes and it didn't blink once (I didn't see any grey background). Please attach your settings, maybe I have something different. There should never be a moment where the filelist is empty and grid background is drawn instead of the row background. That means, ColumnsView.FFiles.Count is always > 0 in TDrawGridEx.DrawCell (except when there's no files on the drive). Add something like: if ColumnsView.FFiles.Count = 0 Writeln('NoFiles'); at the beginning of TDrawGridEx.DrawCell and see if it is written. Attached new patch, since the old one doesn't apply cleanly. |
|
Yes, probably patch wasn't applied correctly. Now it works like you described (file list remains untill new one is loading). There is still one issue: if hit Esc during file list loading than panel goes empty without even ".." on it (maybe it should leave old files list instead) |
|
Yes, it could leave old filelist. This is a separate issue though, plus there is also an issue of restoring previous path and file source (maybe it could be read from history). Also currently there's a timer to clear the filelist when loading takes much time, so I guess this should be removed. |
Date Modified | Username | Field | Change |
---|---|---|---|
2011-12-13 22:52 | vitaliyg | New Issue | |
2011-12-17 01:08 | vitaliyg | File Added: ucolumnsfileview.pas.patch | |
2011-12-17 01:16 | vitaliyg | Note Added: 0000282 | |
2011-12-17 01:17 | vitaliyg | Status | new => feedback |
2011-12-18 13:54 | Alexx2000 | File Added: EmptyPanel.PNG | |
2011-12-18 14:01 | Alexx2000 | Note Added: 0000284 | |
2011-12-18 14:02 | Alexx2000 | File Added: test1.patch | |
2011-12-18 14:03 | Alexx2000 | File Deleted: EmptyPanel.PNG | |
2011-12-18 14:07 | Alexx2000 | File Added: EmptyPanel.PNG | |
2011-12-18 22:18 | vitaliyg | Note Added: 0000286 | |
2011-12-18 22:18 | vitaliyg | Status | feedback => new |
2011-12-22 14:58 | Alexx2000 | Note Added: 0000295 | |
2012-01-03 19:34 | vitaliyg | File Added: ufileview.pas.patch | |
2012-01-03 19:38 | vitaliyg | Note Added: 0000299 | |
2012-01-03 19:38 | vitaliyg | Assigned To | => vitaliyg |
2012-01-03 19:38 | vitaliyg | Status | new => feedback |
2012-01-06 19:43 | vitaliyg | Assigned To | vitaliyg => Alexx2000 |
2012-01-06 19:43 | vitaliyg | Status | feedback => assigned |
2012-01-06 19:44 | vitaliyg | Assigned To | Alexx2000 => vitaliyg |
2012-01-18 23:13 | Alexx2000 | Note Added: 0000328 | |
2012-03-14 05:19 | cobines | File Added: lock_input.diff | |
2012-03-14 05:20 | cobines | Note Added: 0000453 | |
2012-03-14 05:35 | cobines | File Deleted: lock_input.diff | |
2012-03-14 05:36 | cobines | File Added: lock_input.diff | |
2012-03-15 14:45 | vitaliyg | Note Added: 0000463 | |
2012-03-15 18:19 | cobines | Note Added: 0000464 | |
2012-03-15 18:30 | vitaliyg | Note Added: 0000465 | |
2012-03-15 18:42 | cobines | Note Added: 0000466 | |
2012-03-15 19:44 | vitaliyg | Note Added: 0000467 | |
2012-03-16 19:41 | cobines | Note Added: 0000468 | |
2012-03-21 17:17 | vitaliyg | Note Added: 0000483 | |
2012-03-22 02:08 | cobines | Note Added: 0000484 | |
2012-03-22 02:09 | cobines | File Added: lock_input4446.diff | |
2012-03-22 13:56 | vitaliyg | Note Added: 0000486 | |
2012-03-26 00:08 | cobines | Note Added: 0000489 | |
2012-05-13 00:07 | cobines | Fixed in Revision | => 4821 |
2012-05-13 00:07 | cobines | Status | assigned => resolved |
2012-05-13 00:07 | cobines | Fixed in Version | => 0.5.5 |
2012-05-13 00:07 | cobines | Resolution | open => fixed |
2012-05-13 00:07 | cobines | Assigned To | vitaliyg => cobines |
2016-06-26 12:01 | Alexx2000 | Status | resolved => closed |