Browse Source

Bug fix: Editor font was scaled twice on monitors with different DPI than the primary one

Caused by Issue 1544

Source commit: 41a45311af0acc9beeee6f49af8552f844f6847d
Martin Prikryl 11 tháng trước cách đây
mục cha
commit
72474b7a2c
2 tập tin đã thay đổi với 1 bổ sung29 xóa
  1. 1 27
      source/forms/Editor.cpp
  2. 0 2
      source/forms/Editor.h

+ 1 - 27
source/forms/Editor.cpp

@@ -204,7 +204,7 @@ void __fastcall TEditorRichEdit::ApplyFont()
 {
   std::unique_ptr<TFont> NewFont(new TFont());
   TWinConfiguration::RestoreFont(FFontConfiguration, NewFont.get());
-  NewFont->Size = ScaleByPixelsPerInchFromSystem(NewFont->Size, this);
+  // Rich Edit 4.1 scales the font on its own
   NewFont->Color = GetWindowTextColor(Color, FFontColor);
   // setting DefAttributes may take quite time, even if the font attributes
   // do not change, so avoid that if not necessary
@@ -1735,29 +1735,3 @@ void __fastcall TEditorForm::UpdateBackgroundColor()
   }
 }
 //---------------------------------------------------------------------------
-void __fastcall TEditorForm::CMDpiChanged(TMessage & Message)
-{
-  bool WasModified = EditorMemo->Modified;
-  EditorMemo->ApplyFont();
-  EditorMemo->Modified = WasModified;
-  // we do not want this, but we want to prevent undo of the font change too, should be improved
-  EditorMemo->ClearUndo();
-  // Clear "modified" status in the status bar, invoked by font change
-  UpdateControls();
-  TForm::Dispatch(&Message);
-}
-//---------------------------------------------------------------------------
-void __fastcall TEditorForm::Dispatch(void * Message)
-{
-  TMessage * M = static_cast<TMessage*>(Message);
-  switch (M->Msg)
-  {
-    case CM_DPICHANGED:
-      CMDpiChanged(*M);
-      break;
-
-    default:
-      TForm::Dispatch(Message);
-      break;
-  }
-}

+ 0 - 2
source/forms/Editor.h

@@ -163,8 +163,6 @@ protected:
   void __fastcall BackupSave();
   void __fastcall CheckFileSize();
   void __fastcall UpdateBackgroundColor();
-  virtual void __fastcall Dispatch(void * Message);
-  void __fastcall CMDpiChanged(TMessage & Message);
 };
 //---------------------------------------------------------------------------
 #endif