瀏覽代碼

Using BCB11 LockDrawing

Source commit: 36a6efeb7ebe4356e7fe2c3cfc24200e676bca3a
Martin Prikryl 11 月之前
父節點
當前提交
8b557e8e94

+ 2 - 2
source/forms/CustomScpExplorer.cpp

@@ -7393,7 +7393,7 @@ void __fastcall TCustomScpExplorerForm::SessionListChanged(bool ForceTruncationU
 
   Configuration->Usage->SetMax(L"MaxOpenedSessions", Manager->Count);
 
-  SendMessage(SessionsPageControl->Handle, WM_SETREDRAW, 0, 0);
+  SessionsPageControl->LockDrawing();
   try
   {
     int PrevTabsWidth = SessionsPageControl->TotalTabsWidth();
@@ -7443,7 +7443,7 @@ void __fastcall TCustomScpExplorerForm::SessionListChanged(bool ForceTruncationU
   }
   __finally
   {
-    SendMessage(SessionsPageControl->Handle, WM_SETREDRAW, 1, 0);
+    SessionsPageControl->UnlockDrawing();
   }
 
   SessionsPageControl->ActivePageIndex = ActiveSessionIndex;

+ 2 - 2
source/forms/SynchronizeChecklist.cpp

@@ -1758,7 +1758,7 @@ void __fastcall TSynchronizeChecklistDialog::FindMoveCandidateActionExecute(TObj
             if (FlickerExpected)
             {
               // does not seem to have any effect
-              DisableRedraw(ListView);
+              ListView->LockDrawing();
             }
             try
             {
@@ -1771,7 +1771,7 @@ void __fastcall TSynchronizeChecklistDialog::FindMoveCandidateActionExecute(TObj
             {
               if (FlickerExpected)
               {
-                EnableRedraw(ListView);
+                ListView->UnlockDrawing();
               }
             }
 

+ 2 - 2
source/packages/filemng/CustomDirView.pas

@@ -1672,11 +1672,11 @@ begin
     // When scrolling with double-buffering enabled, ugly artefacts
     // are shown temporarily.
     // LVS_EX_TRANSPARENTBKGND fixes it on Vista and newer
-    SendMessage(Handle, WM_SETREDRAW, 0, 0);
+    LockDrawing;
     try
       inherited;
     finally
-      SendMessage(Handle, WM_SETREDRAW, 1, 0);
+      UnlockDrawing;
     end;
     Repaint;
   end

+ 2 - 16
source/windows/VCLCommon.cpp

@@ -48,20 +48,6 @@ static int __fastcall GetColumnTextWidth(TListView * ListView, int ColumnPadding
     ListView->Canvas->TextExtent(Text).Width;
 }
 //---------------------------------------------------------------------------
-void DisableRedraw(TWinControl * Control)
-{
-  SendMessage(Control->Handle, WM_SETREDRAW, false, 0);
-}
-//---------------------------------------------------------------------------
-void EnableRedraw(TWinControl * Control)
-{
-  SendMessage(Control->Handle, WM_SETREDRAW, true, 0);
-  // As recommended by documentation for WM_SETREDRAW.
-  // Without this, session list on Import dialog stops working after the list is reloaded while visible
-  // (i.e. when chaing import source)
-  RedrawWindow(Control->Handle, NULL, NULL, RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN);
-}
-//---------------------------------------------------------------------------
 void __fastcall AutoSizeListColumnsWidth(TListView * ListView, int ColumnToShrinkIndex)
 {
   // Preallocate handle to precreate columns, otherwise our changes may get
@@ -71,7 +57,7 @@ void __fastcall AutoSizeListColumnsWidth(TListView * ListView, int ColumnToShrin
   // what may cause a flicker of the currently focused window title.
   ListView->HandleNeeded();
 
-  DisableRedraw(ListView);
+  ListView->LockDrawing();
 
   try
   {
@@ -212,7 +198,7 @@ void __fastcall AutoSizeListColumnsWidth(TListView * ListView, int ColumnToShrin
   }
   __finally
   {
-    EnableRedraw(ListView);
+    ListView->UnlockDrawing();
   }
 }
 //---------------------------------------------------------------------------

+ 0 - 2
source/windows/VCLCommon.h

@@ -101,7 +101,5 @@ void GiveTBItemPriority(Tb2item::TTBCustomItem * Item);
 void DeleteChildren(TWinControl * Control);
 void AutoSizeLabel(TLabel * Label);
 void AutoSizeLabel(TStaticText * Label);
-void DisableRedraw(TWinControl * Control);
-void EnableRedraw(TWinControl * Control);
 //---------------------------------------------------------------------------
 #endif  // VCLCommonH