Browse Source

Edit wnd dpi (#960)

* Start of getting clip edit window dpi aware

* edit clip, editwnd toolbar handle dpi changes

* edit clips, format toolbar dpi aware
sabrogden 3 weeks ago
parent
commit
422e27fc6c

+ 1 - 0
.gitignore

@@ -66,3 +66,4 @@ Debug/portable
 /focusdll/Win32/Debug
 /ICU_Loader/Debug
 /Win32/Debug
+/Debug

+ 226 - 0
CP_Main.rc

@@ -118,6 +118,28 @@ IDB_BITMAP_SEARCH_CLOSE_200 BITMAP                  "res\\search_close_200.bmp"
 
 IDB_BITMAP_SEARCH_NORMAL_200 BITMAP                  "res\\search_normal_200.bmp"
 
+IDR_EDIT_WND_200        BITMAP                  "res\\edit_wnd.bmp"
+
+IDR_EDIT_WND_125        BITMAP                  "res\\bmp00004.bmp"
+
+IDR_EDIT_WND_150        BITMAP                  "res\\bmp00005.bmp"
+
+IDR_EDIT_WND_175        BITMAP                  "res\\bmp00006.bmp"
+
+IDR_EDIT_WND_225        BITMAP                  "res\\bmp00007.bmp"
+
+IDR_EDIT_WND_FORMAT     BITMAP                  "res\\toolbar1.bmp"
+
+IDR_EDIT_WND_FORMAT_200 BITMAP                  "res\\bmp00008.bmp"
+
+IDR_EDIT_WND_FORMAT_125 BITMAP                  "res\\bmp00009.bmp"
+
+IDR_EDIT_WND_FORMAT_150 BITMAP                  "res\\bmp00010.bmp"
+
+IDR_EDIT_WND_FORMAT_175 BITMAP                  "res\\bmp00011.bmp"
+
+IDR_EDIT_WND_FORMAT_225 BITMAP                  "res\\bmp00012.bmp"
+
 
 /////////////////////////////////////////////////////////////////////////////
 //
@@ -151,6 +173,210 @@ BEGIN
     BUTTON      ID_BUTTON_CLOSE
 END
 
+IDR_EDIT_WND_200 TOOLBAR 32, 32
+BEGIN
+    BUTTON      ID_BUTTON_NEW
+    SEPARATOR
+    BUTTON      ID_BUTTON_SAVE
+    BUTTON      ID_BUTTON_SAVE_ALL
+    SEPARATOR
+    BUTTON      ID_BUTTON_SAVE_CLOSE_CLIPBOARD
+    SEPARATOR
+    BUTTON      ID_BUTTON_CLOSE
+END
+
+IDR_EDIT_WND_125 TOOLBAR 20, 20
+BEGIN
+    BUTTON      ID_BUTTON_NEW
+    SEPARATOR
+    BUTTON      ID_BUTTON_SAVE
+    BUTTON      ID_BUTTON_SAVE_ALL
+    SEPARATOR
+    BUTTON      ID_BUTTON_SAVE_CLOSE_CLIPBOARD
+    SEPARATOR
+    BUTTON      ID_BUTTON_CLOSE
+END
+
+IDR_EDIT_WND_150 TOOLBAR 24, 24
+BEGIN
+    BUTTON      ID_BUTTON_NEW
+    SEPARATOR
+    BUTTON      ID_BUTTON_SAVE
+    BUTTON      ID_BUTTON_SAVE_ALL
+    SEPARATOR
+    BUTTON      ID_BUTTON_SAVE_CLOSE_CLIPBOARD
+    SEPARATOR
+    BUTTON      ID_BUTTON_CLOSE
+END
+
+IDR_EDIT_WND_175 TOOLBAR 28, 28
+BEGIN
+    BUTTON      ID_BUTTON_NEW
+    SEPARATOR
+    BUTTON      ID_BUTTON_SAVE
+    BUTTON      ID_BUTTON_SAVE_ALL
+    SEPARATOR
+    BUTTON      ID_BUTTON_SAVE_CLOSE_CLIPBOARD
+    SEPARATOR
+    BUTTON      ID_BUTTON_CLOSE
+END
+
+IDR_EDIT_WND_225 TOOLBAR 36, 36
+BEGIN
+    BUTTON      ID_BUTTON_NEW
+    SEPARATOR
+    BUTTON      ID_BUTTON_SAVE
+    BUTTON      ID_BUTTON_SAVE_ALL
+    SEPARATOR
+    BUTTON      ID_BUTTON_SAVE_CLOSE_CLIPBOARD
+    SEPARATOR
+    BUTTON      ID_BUTTON_CLOSE
+END
+
+IDR_EDIT_WND_FORMAT TOOLBAR 16, 15
+BEGIN
+    BUTTON      BUTTON_FONT
+    SEPARATOR
+    SEPARATOR
+    SEPARATOR
+    SEPARATOR
+    SEPARATOR
+    SEPARATOR
+    SEPARATOR
+    BUTTON      BUTTON_BOLD
+    BUTTON      BUTTON_ITALIC
+    BUTTON      BUTTON_UNDERLINE
+    SEPARATOR
+    BUTTON      BUTTON_LEFTALIGN
+    BUTTON      BUTTON_CENTERALIGN
+    BUTTON      BUTTON_RIGHTALIGN
+    SEPARATOR
+    BUTTON      BUTTON_INDENT
+    BUTTON      BUTTON_OUTDENT
+    BUTTON      BUTTON_BULLET
+    BUTTON      ID_BUTTONWRAP
+END
+
+IDR_EDIT_WND_FORMAT_200 TOOLBAR 32, 32
+BEGIN
+    BUTTON      BUTTON_FONT
+    SEPARATOR
+    SEPARATOR
+    SEPARATOR
+    SEPARATOR
+    SEPARATOR
+    SEPARATOR
+    SEPARATOR
+    BUTTON      BUTTON_BOLD
+    BUTTON      BUTTON_ITALIC
+    BUTTON      BUTTON_UNDERLINE
+    SEPARATOR
+    BUTTON      BUTTON_LEFTALIGN
+    BUTTON      BUTTON_CENTERALIGN
+    BUTTON      BUTTON_RIGHTALIGN
+    SEPARATOR
+    BUTTON      BUTTON_INDENT
+    BUTTON      BUTTON_OUTDENT
+    BUTTON      BUTTON_BULLET
+    BUTTON      ID_BUTTONWRAP
+END
+
+IDR_EDIT_WND_FORMAT_125 TOOLBAR 20, 20
+BEGIN
+    BUTTON      BUTTON_FONT
+    SEPARATOR
+    SEPARATOR
+    SEPARATOR
+    SEPARATOR
+    SEPARATOR
+    SEPARATOR
+    SEPARATOR
+    BUTTON      BUTTON_BOLD
+    BUTTON      BUTTON_ITALIC
+    BUTTON      BUTTON_UNDERLINE
+    SEPARATOR
+    BUTTON      BUTTON_LEFTALIGN
+    BUTTON      BUTTON_CENTERALIGN
+    BUTTON      BUTTON_RIGHTALIGN
+    SEPARATOR
+    BUTTON      BUTTON_INDENT
+    BUTTON      BUTTON_OUTDENT
+    BUTTON      BUTTON_BULLET
+    BUTTON      ID_BUTTONWRAP
+END
+
+IDR_EDIT_WND_FORMAT_150 TOOLBAR 24, 24
+BEGIN
+    BUTTON      BUTTON_FONT
+    SEPARATOR
+    SEPARATOR
+    SEPARATOR
+    SEPARATOR
+    SEPARATOR
+    SEPARATOR
+    SEPARATOR
+    BUTTON      BUTTON_BOLD
+    BUTTON      BUTTON_ITALIC
+    BUTTON      BUTTON_UNDERLINE
+    SEPARATOR
+    BUTTON      BUTTON_LEFTALIGN
+    BUTTON      BUTTON_CENTERALIGN
+    BUTTON      BUTTON_RIGHTALIGN
+    SEPARATOR
+    BUTTON      BUTTON_INDENT
+    BUTTON      BUTTON_OUTDENT
+    BUTTON      BUTTON_BULLET
+    BUTTON      ID_BUTTONWRAP
+END
+
+IDR_EDIT_WND_FORMAT_175 TOOLBAR 28, 28
+BEGIN
+    BUTTON      BUTTON_FONT
+    SEPARATOR
+    SEPARATOR
+    SEPARATOR
+    SEPARATOR
+    SEPARATOR
+    SEPARATOR
+    SEPARATOR
+    BUTTON      BUTTON_BOLD
+    BUTTON      BUTTON_ITALIC
+    BUTTON      BUTTON_UNDERLINE
+    SEPARATOR
+    BUTTON      BUTTON_LEFTALIGN
+    BUTTON      BUTTON_CENTERALIGN
+    BUTTON      BUTTON_RIGHTALIGN
+    SEPARATOR
+    BUTTON      BUTTON_INDENT
+    BUTTON      BUTTON_OUTDENT
+    BUTTON      BUTTON_BULLET
+    BUTTON      ID_BUTTONWRAP
+END
+
+IDR_EDIT_WND_FORMAT_225 TOOLBAR 36, 36
+BEGIN
+    BUTTON      BUTTON_FONT
+    SEPARATOR
+    SEPARATOR
+    SEPARATOR
+    SEPARATOR
+    SEPARATOR
+    SEPARATOR
+    SEPARATOR
+    BUTTON      BUTTON_BOLD
+    BUTTON      BUTTON_ITALIC
+    BUTTON      BUTTON_UNDERLINE
+    SEPARATOR
+    BUTTON      BUTTON_LEFTALIGN
+    BUTTON      BUTTON_CENTERALIGN
+    BUTTON      BUTTON_RIGHTALIGN
+    SEPARATOR
+    BUTTON      BUTTON_INDENT
+    BUTTON      BUTTON_OUTDENT
+    BUTTON      BUTTON_BULLET
+    BUTTON      ID_BUTTONWRAP
+END
+
 
 /////////////////////////////////////////////////////////////////////////////
 //

+ 12 - 15
CP_Main.vcxproj

@@ -713,7 +713,6 @@
     <ClCompile Include="src\RulerRichEditCtrl\External\ColourPopup.cpp" />
     <ClCompile Include="src\RulerRichEditCtrl\External\StdioFileEx.cpp" />
     <ClCompile Include="src\RulerRichEditCtrl\FontComboBox.cpp" />
-    <ClCompile Include="src\RulerRichEditCtrl\RRECRuler.cpp" />
     <ClCompile Include="src\RulerRichEditCtrl\RRECToolbar.cpp" />
     <ClCompile Include="src\RulerRichEditCtrl\RulerRichEdit.cpp" />
     <ClCompile Include="src\RulerRichEditCtrl\RulerRichEditCtrl.cpp" />
@@ -790,18 +789,6 @@
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NDEBUG;_AFXDLL</PreprocessorDefinitions>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">NDEBUG;_AFXDLL</PreprocessorDefinitions>
     </ResourceCompile>
-    <ResourceCompile Include="src\RulerRichEditCtrl\RulerRichEditCtrl.rc" >
-	  <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</ExcludedFromBuild>
-	</ResourceCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="resource.h" />
@@ -938,8 +925,7 @@
     <ClInclude Include="src\RulerRichEditCtrl\External\ColourPopup.h" />
     <ClInclude Include="src\RulerRichEditCtrl\External\StdioFileEx.h" />
     <ClInclude Include="src\RulerRichEditCtrl\FontComboBox.h" />
-    <ClInclude Include="src\RulerRichEditCtrl\ids.h" />
-    <ClInclude Include="src\RulerRichEditCtrl\RRECRuler.h" />
+    <ClInclude Include="src\RulerRichEditCtrl\resource.h" />
     <ClInclude Include="src\RulerRichEditCtrl\RRECToolbar.h" />
     <ClInclude Include="src\RulerRichEditCtrl\RulerRichEdit.h" />
     <ClInclude Include="src\RulerRichEditCtrl\RulerRichEditCtrl.h" />
@@ -1191,6 +1177,15 @@
     </Midl>
   </ItemGroup>
   <ItemGroup>
+    <Image Include="res\bmp00004.bmp" />
+    <Image Include="res\bmp00005.bmp" />
+    <Image Include="res\bmp00006.bmp" />
+    <Image Include="res\bmp00007.bmp" />
+    <Image Include="res\bmp00008.bmp" />
+    <Image Include="res\bmp00009.bmp" />
+    <Image Include="res\bmp00010.bmp" />
+    <Image Include="res\bmp00011.bmp" />
+    <Image Include="res\bmp00012.bmp" />
     <Image Include="res\ChevronLeft_Black_36.png" />
     <Image Include="res\ChevronLeft_Black_40.png" />
     <Image Include="res\ChevronLeft_Black_44.png" />
@@ -1215,6 +1210,7 @@
     <Image Include="res\down_24.png" />
     <Image Include="res\down_28.png" />
     <Image Include="res\down_32.png" />
+    <Image Include="res\edit_wnd.bmp" />
     <Image Include="res\icon3.ico" />
     <Image Include="res\maximize_36.png" />
     <Image Include="res\maximize_40.png" />
@@ -1246,6 +1242,7 @@
     <Image Include="res\system_menu_78.png" />
     <Image Include="res\system_menu_84.png" />
     <Image Include="src\RulerRichEditCtrl\toolbar.bmp" />
+    <Image Include="src\RulerRichEditCtrl\toolbar_.bmp" />
   </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">

+ 12 - 12
CP_Main.vcxproj.filters

@@ -454,9 +454,6 @@
     <ClCompile Include="src\RulerRichEditCtrl\FontComboBox.cpp">
       <Filter>src\RulerRichEditCtrl</Filter>
     </ClCompile>
-    <ClCompile Include="src\RulerRichEditCtrl\RRECRuler.cpp">
-      <Filter>src\RulerRichEditCtrl</Filter>
-    </ClCompile>
     <ClCompile Include="src\RulerRichEditCtrl\RRECToolbar.cpp">
       <Filter>src\RulerRichEditCtrl</Filter>
     </ClCompile>
@@ -973,12 +970,6 @@
     <ClInclude Include="src\RulerRichEditCtrl\FontComboBox.h">
       <Filter>src\RulerRichEditCtrl</Filter>
     </ClInclude>
-    <ClInclude Include="src\RulerRichEditCtrl\ids.h">
-      <Filter>src\RulerRichEditCtrl</Filter>
-    </ClInclude>
-    <ClInclude Include="src\RulerRichEditCtrl\RRECRuler.h">
-      <Filter>src\RulerRichEditCtrl</Filter>
-    </ClInclude>
     <ClInclude Include="src\RulerRichEditCtrl\RRECToolbar.h">
       <Filter>src\RulerRichEditCtrl</Filter>
     </ClInclude>
@@ -1012,14 +1003,12 @@
     <ClInclude Include="src\EditFrameWnd.h">
       <Filter>src</Filter>
     </ClInclude>
+    <ClInclude Include="src\RulerRichEditCtrl\resource.h" />
   </ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="CP_Main.rc">
       <Filter>res</Filter>
     </ResourceCompile>
-    <ResourceCompile Include="src\RulerRichEditCtrl\RulerRichEditCtrl.rc">
-      <Filter>src\RulerRichEditCtrl</Filter>
-    </ResourceCompile>
   </ItemGroup>
   <ItemGroup>
     <CustomBuild Include="RulerRichEditCtrl\toolbar.bmp">
@@ -1681,5 +1670,16 @@
     <Image Include="src\RulerRichEditCtrl\toolbar.bmp">
       <Filter>src\RulerRichEditCtrl</Filter>
     </Image>
+    <Image Include="res\edit_wnd.bmp" />
+    <Image Include="res\bmp00004.bmp" />
+    <Image Include="res\bmp00005.bmp" />
+    <Image Include="res\bmp00006.bmp" />
+    <Image Include="res\bmp00007.bmp" />
+    <Image Include="src\RulerRichEditCtrl\toolbar_.bmp" />
+    <Image Include="res\bmp00008.bmp" />
+    <Image Include="res\bmp00009.bmp" />
+    <Image Include="res\bmp00010.bmp" />
+    <Image Include="res\bmp00011.bmp" />
+    <Image Include="res\bmp00012.bmp" />
   </ItemGroup>
 </Project>

+ 0 - 31
res/CP_Main.rc2

@@ -12,34 +12,3 @@
 
 /////////////////////////////////////////////////////////////////////////////
 
-#include "..\src\RulerRichEditCtrl/RulerRichEditCtrl.rc"
-
-/*
-/////////////////////////////////////////////////////////////////////////////
-//
-// Toolbar resources
-//
-
-#include "RulerRichEditCtrl/ids.h"
-
-TOOLBAR_CONTROL         BITMAP  DISCARDABLE     "RulerRichEditCtrl/toolbar.bmp"
-
-TOOLBAR_CONTROL TOOLBAR DISCARDABLE  16, 15
-BEGIN
-    BUTTON      BUTTON_1
-    BUTTON      BUTTON_2
-    SEPARATOR
-    BUTTON      BUTTON_3
-    BUTTON      BUTTON_4
-    BUTTON      BUTTON_5
-    SEPARATOR
-    BUTTON      BUTTON_6
-    BUTTON      BUTTON_7
-    BUTTON      BUTTON_8
-    SEPARATOR
-    BUTTON      BUTTON_9
-    BUTTON      BUTTON_10
-    BUTTON      BUTTON_11
-END
-
-*/

BIN
res/bmp00004.bmp


BIN
res/bmp00005.bmp


BIN
res/bmp00006.bmp


BIN
res/bmp00007.bmp


BIN
res/bmp00008.bmp


BIN
res/bmp00009.bmp


BIN
res/bmp00010.bmp


BIN
res/bmp00011.bmp


BIN
res/bmp00012.bmp


BIN
res/edit_wnd.bmp


BIN
res/toolbar1.bmp


+ 28 - 2
resource.h

@@ -8,12 +8,24 @@
 #define IDR_CP_MAITYPE                  129
 #define IDR_EDIT_WND                    129
 #define IDR_MENU                        130
+#define IDR_EDIT_WND1                   130
+#define IDR_EDIT_WND_200                130
 #define IDD_SELECT_DB                   131
+#define IDR_EDIT_WND_125                131
 #define IDD_OPTIONS_STATS               132
+#define IDR_EDIT_WND_150                132
+#define IDR_EDIT_WND_175                133
 #define IDD_ADD_TYPE                    134
+#define IDR_EDIT_WND_225                134
 #define IDD_COPY_PROPERTIES             135
+#define IDR_EDIT_WND_FORMAT_200         135
 #define IDD_ABOUT                       136
+#define IDR_EDIT_WND_FORMAT_125         136
+#define IDR_EDIT_WND_FORMAT_150         137
 #define IDD_GROUP_NAME                  138
+#define IDR_EDIT_WND_FORMAT_175         138
+#define IDR_EDIT_WND_FORMAT_201         139
+#define IDR_EDIT_WND_FORMAT_225         139
 #define IDB_CLOSED_FOLDER               141
 #define IDB_CLOSED_FOLDER_PRESSED       142
 #define IDB_CLOSED_FOLDER_FOCUSED       143
@@ -841,14 +853,28 @@
 #define ID__VIEWFULLDESCRIPTION         32980
 #define ID__SAVETOFILE                  32981
 #define ID__PROPERTIES                  32982
+#define ID_BUTTON32983                  32983
+#define IDR_EDIT_WND_FORMAT             32984
+#define BUTTON_FONT                     32985
+#define BUTTON_COLOR                    32986
+#define BUTTON_BOLD                     32987
+#define BUTTON_ITALIC                   32988
+#define BUTTON_UNDERLINE                32989
+#define BUTTON_LEFTALIGN                32990
+#define BUTTON_CENTERALIGN              32991
+#define BUTTON_RIGHTALIGN               32992
+#define BUTTON_INDENT                   32993
+#define BUTTON_OUTDENT                  32994
+#define BUTTON_BULLET                   32995
+#define ID_BUTTONWRAP                   32996
 
 // Next default values for new objects
 // 
 #ifdef APSTUDIO_INVOKED
 #ifndef APSTUDIO_READONLY_SYMBOLS
 #define _APS_3D_CONTROLS                     1
-#define _APS_NEXT_RESOURCE_VALUE        392
-#define _APS_NEXT_COMMAND_VALUE         32983
+#define _APS_NEXT_RESOURCE_VALUE        394
+#define _APS_NEXT_COMMAND_VALUE         32997
 #define _APS_NEXT_CONTROL_VALUE         2173
 #define _APS_NEXT_SYMED_VALUE           104
 #endif

+ 1 - 0
src/EditFrameWnd.cpp

@@ -260,6 +260,7 @@ LRESULT CEditFrameWnd::OnDpiChanged(WPARAM wParam, LPARAM lParam)
 {
 	int dpi = HIWORD(wParam);
 	m_DittoWindow.OnDpiChanged(this, dpi);
+	m_EditWnd.OnDpiChanged(this, dpi);
 
 	RECT* const prcNewWindow = (RECT*)lParam;
 	SetWindowPos(NULL,

+ 128 - 64
src/EditWnd.cpp

@@ -11,7 +11,7 @@
 IMPLEMENT_DYNAMIC(CEditWnd, CWnd)
 CEditWnd::CEditWnd()
 {
-	m_lLastSaveID = -1;
+	m_lastSaveID = -1;
 }
 
 CEditWnd::~CEditWnd()
@@ -35,55 +35,116 @@ int CEditWnd::OnCreate(LPCREATESTRUCT lpCreateStruct)
 	if (CWnd::OnCreate(lpCreateStruct) == -1)
 		return -1;
 
-	m_ToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD|WS_VISIBLE|CBRS_TOP|CBRS_TOOLTIPS);
-	m_ToolBar.LoadToolBar(IDR_EDIT_WND);
-	m_ToolBar.EnableWindow();
+	m_dpi.SetHwnd(m_hWnd);
+
+	m_toolBarControl.CreateEx(this, TBSTYLE_FLAT, WS_CHILD|WS_VISIBLE|CBRS_TOP|CBRS_TOOLTIPS);
+	
+	LoadToolbarDPI();
+
+	m_toolBarControl.EnableWindow();
 	
-	m_Tabs.Create(WS_CHILD|WS_VISIBLE|WS_TABSTOP|SCS_TOP, CRect(0, 0, 0, 0), this, 101);
+	m_tabControl.Create(WS_CHILD|WS_VISIBLE|WS_TABSTOP|SCS_TOP, CRect(0, 0, 0, 0), this, 101);
 	
-	m_Font.CreatePointFont(90, _T("Arial Unicode MS"));
-	m_cbUpdateDescription.Create(theApp.m_Language.GetString("Update_Desc", "Update clip description on save?"), WS_CHILD|WS_VISIBLE|BS_AUTOCHECKBOX, CRect(0,0,0,0), this, 101);
-	m_cbUpdateDescription.SetFont(&m_Font);
+	//m_font.CreatePointFont(m_dpi.Scale(90), _T("Arial Unicode MS"), this->GetDC());
+	m_font.CreateFont(-m_dpi.Scale(13), 0, 0, 0, 400, 0, 0, 0, DEFAULT_CHARSET, 3, 2, 1, 34, _T("Segoe UI"));
+	m_updateDescriptionButton.Create(theApp.m_Language.GetString("Update_Desc", "Update clip description on save?"), WS_CHILD|WS_VISIBLE|BS_AUTOCHECKBOX, CRect(0,0,0,0), this, 101);
+	m_updateDescriptionButton.SetFont(&m_font);
 
 	if(CGetSetOptions::GetUpdateDescWhenSavingClip())
 	{
-		m_cbUpdateDescription.SetCheck(BST_CHECKED);
+		m_updateDescriptionButton.SetCheck(BST_CHECKED);
 	}
 
 	MoveControls();
 
-	m_ToolTip.Create(this);
+	m_toolTipControl.Create(this);
 	CRect cr;
 	CString csText;
 
-	m_ToolBar.GetItemRect(m_ToolBar.CommandToIndex(ID_BUTTON_NEW), cr);
+	m_toolBarControl.GetItemRect(m_toolBarControl.CommandToIndex(ID_BUTTON_NEW), cr);
 	csText.Format(_T("%s     Ctrl - N"), theApp.m_Language.GetString("New_Clip", "New Clip"));
-	m_ToolTip.AddTool(&m_ToolBar, csText, cr, 1);
+	m_toolTipControl.AddTool(&m_toolBarControl, csText, cr, 1);
 
-	m_ToolBar.GetItemRect(m_ToolBar.CommandToIndex(ID_BUTTON_SAVE), cr);
+	m_toolBarControl.GetItemRect(m_toolBarControl.CommandToIndex(ID_BUTTON_SAVE), cr);
 	csText.Format(_T("%s    Ctrl - S"), theApp.m_Language.GetString("Save", "Save"));
-	m_ToolTip.AddTool(&m_ToolBar, csText, cr, 2);
+	m_toolTipControl.AddTool(&m_toolBarControl, csText, cr, 2);
 
-	m_ToolBar.GetItemRect(m_ToolBar.CommandToIndex(ID_BUTTON_SAVE_ALL), cr);
+	m_toolBarControl.GetItemRect(m_toolBarControl.CommandToIndex(ID_BUTTON_SAVE_ALL), cr);
 	csText.Format(_T("%s    Ctrl - Shift - S"), theApp.m_Language.GetString("Save_All", "Save All"));
-	m_ToolTip.AddTool(&m_ToolBar, csText, cr, 3);
+	m_toolTipControl.AddTool(&m_toolBarControl, csText, cr, 3);
 
-	m_ToolBar.GetItemRect(m_ToolBar.CommandToIndex(ID_BUTTON_CLOSE), cr);
+	m_toolBarControl.GetItemRect(m_toolBarControl.CommandToIndex(ID_BUTTON_CLOSE), cr);
 	csText.Format(_T("%s    Escape"), theApp.m_Language.GetString("Close", "Close Current Tab"));
-	m_ToolTip.AddTool(&m_ToolBar, csText, cr, 4);
+	m_toolTipControl.AddTool(&m_toolBarControl, csText, cr, 4);
 
-	m_ToolBar.GetItemRect(m_ToolBar.CommandToIndex(ID_BUTTON_SAVE_CLOSE_CLIPBOARD), cr);
+	m_toolBarControl.GetItemRect(m_toolBarControl.CommandToIndex(ID_BUTTON_SAVE_CLOSE_CLIPBOARD), cr);
 	csText.Format(_T("%s    Shift - Escape"), theApp.m_Language.GetString("Save_Close", "Save, Close and place on clipboard"));
-	m_ToolTip.AddTool(&m_ToolBar, csText, cr, 4);
+	m_toolTipControl.AddTool(&m_toolBarControl, csText, cr, 4);
 
 	return 0;
 }
 
+void CEditWnd::LoadToolbarDPI()
+{
+	int scale = m_dpi.Scale(100);
+
+	if (scale >= 225)
+	{
+		m_toolBarControl.LoadToolBar(IDR_EDIT_WND_225);
+	}
+	else if (scale >= 200)
+	{
+		m_toolBarControl.LoadToolBar(IDR_EDIT_WND_200);
+	}
+	else if (scale >= 175)
+	{
+		m_toolBarControl.LoadToolBar(IDR_EDIT_WND_175);
+	}
+	else if (scale >= 150)
+	{
+		m_toolBarControl.LoadToolBar(IDR_EDIT_WND_150);
+	}
+	else if (scale >= 125)
+	{
+		m_toolBarControl.LoadToolBar(IDR_EDIT_WND_125);
+	}	
+	else
+	{
+		m_toolBarControl.LoadToolBar(IDR_EDIT_WND);
+	}
+}
+
+void CEditWnd::OnDpiChanged(CWnd* pParent, int dpi)
+{
+	m_dpi.Update(dpi);
+
+	m_font.DeleteObject();
+	auto x = m_dpi.Scale(90);
+	m_font.CreateFont(-m_dpi.Scale(13), 0, 0, 0, 400, 0, 0, 0, DEFAULT_CHARSET, 3, 2, 1, 34, _T("Segoe UI"));
+	
+	m_updateDescriptionButton.SetFont(&m_font);
+	
+	m_tabControl.OnDpiChanged(pParent, dpi);
+
+	LoadToolbarDPI();
+
+	for (int i = 0; i < m_edits.size(); i++)
+	{
+		CDittoRulerRichEditCtrl* pEdit = m_edits[i];
+		if (pEdit)
+		{
+			pEdit->OnDpiChanged(pParent, dpi);
+		}
+	}
+
+	MoveControls();
+}
+
 void CEditWnd::OnSize(UINT nType, int cx, int cy)
 {
 	CWnd::OnSize(nType, cx, cy);
 
-	if(::IsWindow(m_ToolBar.GetSafeHwnd()))
+	if(::IsWindow(m_toolBarControl.GetSafeHwnd()))
 	{
 		MoveControls();
 	}
@@ -91,20 +152,24 @@ void CEditWnd::OnSize(UINT nType, int cx, int cy)
 
 void CEditWnd::MoveControls()
 {
-	static int nToolbarHeight = 23;
+	int toolbarHeight = m_dpi.Scale(23);
+	int descriptionHeight = m_dpi.Scale(20);
+
 	CRect rc;
 	GetClientRect(rc);
-	m_ToolBar.MoveWindow(0, 0, rc.Width(), nToolbarHeight);
 
-	m_Tabs.MoveWindow(0, nToolbarHeight, rc.Width(), rc.Height()-nToolbarHeight - 20);
+	CRect toolbarRect(0, 0, rc.Width(), toolbarHeight);
+	m_toolBarControl.MoveWindow(toolbarRect);
+
+	m_tabControl.MoveWindow(0, toolbarHeight, rc.Width(), rc.Height() - toolbarHeight - descriptionHeight);
 
-	m_cbUpdateDescription.MoveWindow(2, rc.Height()-20, rc.Width()-2, 20);
+	m_updateDescriptionButton.MoveWindow(2, rc.Height()- descriptionHeight, rc.Width()-m_dpi.Scale(2), descriptionHeight);
 }
 
 void CEditWnd::OnSaveAll() 
 {
-	BOOL bUpdateDesc = m_cbUpdateDescription.GetCheck();
-	INT_PTR size = m_Edits.size();
+	BOOL bUpdateDesc = m_updateDescriptionButton.GetCheck();
+	INT_PTR size = m_edits.size();
 	for(int tab = 0; tab < size; tab++)
 	{
 		DoSaveItem(tab);
@@ -119,8 +184,8 @@ void CEditWnd::OnSave()
 bool CEditWnd::DoSave()
 {
 	bool bRet = false;
-	int nTab = m_Tabs.GetActiveTab();
-	if(nTab >= 0 && nTab < (int)m_Edits.size())
+	int nTab = m_tabControl.GetActiveTab();
+	if(nTab >= 0 && nTab < (int)m_edits.size())
 	{
 		bRet = DoSaveItem(nTab);
 	}
@@ -131,9 +196,9 @@ bool CEditWnd::DoSave()
 bool CEditWnd::DoSaveItem(int index)
 {
 	bool bRet = false;
-	BOOL bUpdateDesc = m_cbUpdateDescription.GetCheck();
+	BOOL bUpdateDesc = m_updateDescriptionButton.GetCheck();
 
-	CDittoRulerRichEditCtrl *pEdit = m_Edits[index];
+	CDittoRulerRichEditCtrl *pEdit = m_edits[index];
 	if(pEdit)
 	{
 		int nRet = pEdit->SaveToDB(bUpdateDesc);
@@ -141,7 +206,7 @@ bool CEditWnd::DoSaveItem(int index)
 		{
 			if(bUpdateDesc)
 			{
-				m_Tabs.SetTabTitle(index, pEdit->GetDesc());
+				m_tabControl.SetTabTitle(index, pEdit->GetDesc());
 			}
 
 			if(nRet == SAVED_CLIP_TO_DB)
@@ -150,17 +215,17 @@ bool CEditWnd::DoSaveItem(int index)
 				CRect cr;
 				pEdit->GetWindowRect(cr);
 				CRect crSave;
-				m_ToolBar.GetItemRect(2, crSave);
+				m_toolBarControl.GetItemRect(2, crSave);
 				Ani.DoAnimation(cr, crSave, this);
 			}
 
-			m_lLastSaveID = pEdit->GetDBID();
+			m_lastSaveID = pEdit->GetDBID();
 			bRet = true;
 		}
 		else
 		{
 			CString cs;
-			cs.Format(_T("%s '%s'"), theApp.m_Language.GetString("ErrorSaving", "Error saving clip"), m_Tabs.GetTabTitle(index));
+			cs.Format(_T("%s '%s'"), theApp.m_Language.GetString("ErrorSaving", "Error saving clip"), m_tabControl.GetTabTitle(index));
 			MessageBox(cs, _T("Ditto"), MB_OK);
 		}
 	}
@@ -211,15 +276,14 @@ bool CEditWnd::AddItem(int id)
 		}
 
 		pEdit->Create(WS_TABSTOP|WS_CHILD|WS_VISIBLE, CRect(100, 100, 105, 105), this, 100, TRUE);
-		pEdit->ShowRuler();
 		pEdit->ShowToolbar();
 		pEdit->LoadItem(id, csTitle);		
 
-		m_Tabs.AddItem(csTitle, pEdit);
-		int nTab = m_Tabs.GetTabCount();
-		m_Tabs.SetActiveTab(nTab-1);
+		m_tabControl.AddItem(csTitle, pEdit);
+		int nTab = m_tabControl.GetTabCount();
+		m_tabControl.SetActiveTab(nTab-1);
 
-		m_Edits.push_back(pEdit);
+		m_edits.push_back(pEdit);
 		bRet = true;
 	}
 
@@ -229,17 +293,17 @@ bool CEditWnd::AddItem(int id)
 
 int CEditWnd::IsIDAlreadyInEdit(int id, bool bSetFocus)
 {
-	INT_PTR size = m_Edits.size();
+	INT_PTR size = m_edits.size();
 	for(int i = 0; i < size; i++)
 	{
-		CDittoRulerRichEditCtrl *pEdit = m_Edits[i];
+		CDittoRulerRichEditCtrl *pEdit = m_edits[i];
 		if(pEdit)
 		{
 			if(pEdit->GetDBID() == id)
 			{
 				if(bSetFocus)
 				{
-					m_Tabs.SetActiveTab(i);
+					m_tabControl.SetActiveTab(i);
 				}
 				return (int)i;
 			}
@@ -252,10 +316,10 @@ void CEditWnd::OnDestroy()
 {
 	CWnd::OnDestroy();
 
-	INT_PTR size = m_Edits.size();
+	INT_PTR size = m_edits.size();
 	for(int i = 0; i < size; i++)
 	{
-		CDittoRulerRichEditCtrl *pEdit = m_Edits[i];
+		CDittoRulerRichEditCtrl *pEdit = m_edits[i];
 		if(pEdit)
 		{
 			pEdit->DestroyWindow();
@@ -265,19 +329,19 @@ void CEditWnd::OnDestroy()
 		}
 	}
 
-	m_Edits.erase(m_Edits.begin(), m_Edits.end());
+	m_edits.erase(m_edits.begin(), m_edits.end());
 
-	CGetSetOptions::SetUpdateDescWhenSavingClip(m_cbUpdateDescription.GetCheck());
+	CGetSetOptions::SetUpdateDescWhenSavingClip(m_updateDescriptionButton.GetCheck());
 }
 
 void CEditWnd::OnSetFocus(CWnd* pOldWnd)
 {
 	CWnd::OnSetFocus(pOldWnd);
 
-	int nTab = m_Tabs.GetActiveTab();
-	if(nTab >= 0 && nTab < (int)m_Edits.size())
+	int nTab = m_tabControl.GetActiveTab();
+	if(nTab >= 0 && nTab < (int)m_edits.size())
 	{
-		CDittoRulerRichEditCtrl *pEdit = m_Edits[nTab];
+		CDittoRulerRichEditCtrl *pEdit = m_edits[nTab];
 		if(pEdit)
 		{
 			pEdit->SetFocus();
@@ -287,10 +351,10 @@ void CEditWnd::OnSetFocus(CWnd* pOldWnd)
 
 bool CEditWnd::CloseEdits(bool bPrompt)
 {
-	BOOL bUpdateDesc = m_cbUpdateDescription.GetCheck();
+	BOOL bUpdateDesc = m_updateDescriptionButton.GetCheck();
 
 	int nTab = 0;
-	for(std::vector<CDittoRulerRichEditCtrl*>::iterator it = m_Edits.begin(); it != m_Edits.end();)
+	for(std::vector<CDittoRulerRichEditCtrl*>::iterator it = m_edits.begin(); it != m_edits.end();)
 	{
 		CDittoRulerRichEditCtrl *pEdit = *it;
 		if(pEdit)
@@ -298,12 +362,12 @@ bool CEditWnd::CloseEdits(bool bPrompt)
 			if(pEdit->CloseEdit(bPrompt, bUpdateDesc) == false)
 				return false;
 
-			m_Tabs.DeleteItem(nTab);
+			m_tabControl.DeleteItem(nTab);
 			pEdit->DestroyWindow();
 			delete pEdit;
 			pEdit = NULL;
 
-			it = m_Edits.erase(it);
+			it = m_edits.erase(it);
 		}
 		else
 		{
@@ -317,22 +381,22 @@ bool CEditWnd::CloseEdits(bool bPrompt)
 
 void CEditWnd::OnClose()
 {	
-	BOOL bUpdateDesc = m_cbUpdateDescription.GetCheck();
-	int nTab = m_Tabs.GetActiveTab();
-	if(nTab >= 0 && nTab < (int)m_Edits.size())
+	BOOL bUpdateDesc = m_updateDescriptionButton.GetCheck();
+	int activeTab = m_tabControl.GetActiveTab();
+	if(activeTab >= 0 && activeTab < (int)m_edits.size())
 	{
-		CDittoRulerRichEditCtrl *pEdit = m_Edits[nTab];
+		CDittoRulerRichEditCtrl *pEdit = m_edits[activeTab];
 		if(pEdit)
 		{
 			if(pEdit->CloseEdit(true, bUpdateDesc))
 			{
-				m_Tabs.DeleteItem(nTab);
+				m_tabControl.DeleteItem(activeTab);
 				pEdit->DestroyWindow();
 				delete pEdit;
 				pEdit = NULL;
-				m_Edits.erase(m_Edits.begin()+nTab);
+				m_edits.erase(m_edits.begin()+ activeTab);
 
-				if(m_Edits.size() <= 0)
+				if(m_edits.size() <= 0)
 				{
 					CWnd *pParent = GetParent();
 					if(pParent)
@@ -354,10 +418,10 @@ void CEditWnd::OnSaveCloseClipboard()
 {
 	if(DoSave())
 	{
-		if(m_lLastSaveID >= 0)
+		if(m_lastSaveID >= 0)
 		{
 			CProcessPaste Paste;
-			Paste.GetClipIDs().Add(m_lLastSaveID);
+			Paste.GetClipIDs().Add(m_lastSaveID);
 			Paste.m_bSendPaste = false;
 			Paste.DoPaste();
 		}
@@ -368,7 +432,7 @@ void CEditWnd::OnSaveCloseClipboard()
 
 BOOL CEditWnd::PreTranslateMessage(MSG* pMsg)
 {
-	m_ToolTip.RelayEvent(pMsg);
+	m_toolTipControl.RelayEvent(pMsg);
 
 	if(pMsg->message == WM_KEYDOWN)
 	{

+ 13 - 7
src/EditWnd.h

@@ -3,6 +3,7 @@
 #include "DittoRulerRichEditCtrl.h"
 #include "TabCtrl.h"
 #include "ClipIds.h"
+#include "DPI.h"
 
 class CEditWnd : public CWnd
 {
@@ -15,16 +16,20 @@ public:
 	bool EditIds(CClipIDs &Ids);
 	bool CloseEdits(bool bPrompt);
 
+	void OnDpiChanged(CWnd* pParent, int dpi);
+
 protected:
 	DECLARE_MESSAGE_MAP()
 
-	CTabCtrlEx m_Tabs;
-	CToolBar m_ToolBar;
-	CToolTipCtrl m_ToolTip;
-	std::vector<CDittoRulerRichEditCtrl*> m_Edits;
-	CButton m_cbUpdateDescription;
-	CFont m_Font;
-	long m_lLastSaveID;
+	CTabCtrlEx m_tabControl;
+	CToolBar m_toolBarControl;
+	CToolTipCtrl m_toolTipControl;
+	std::vector<CDittoRulerRichEditCtrl*> m_edits;
+	CButton m_updateDescriptionButton;
+	CFont m_font;
+	long m_lastSaveID;
+
+	CDPI m_dpi;
 
 protected:
 	void MoveControls();
@@ -32,6 +37,7 @@ protected:
 	bool AddItem(int id);
 	bool DoSave();
 	bool DoSaveItem(int index);
+	void LoadToolbarDPI();
 
 public:
 	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);

+ 0 - 451
src/RulerRichEditCtrl/RRECRuler.cpp

@@ -1,451 +0,0 @@
-/* ==========================================================================
-	File :			RRECRuler.cpp
-
-	Class :			CRRECRuler
-
-	Author :		Johan Rosengren, Abstrakt Mekanik AB
-					Iain Clarke
-
-	Date :			2004-04-19
-
-	Purpose :		This class encapsulates a ruler that can be used with 
-					"CRulerRichEditCtrl". The class is derived from "CWnd", and 
-					draws a ruler. 
-
-	Description :	A plain "CWnd"-derived class. The mouse messages 
-					"WM_LBUTTONDOWN", "WM_MOUSEMOVE" and "WM_LBUTTONUP" are handled, 
-					and a registered message is sent to the control parent.	
-
-	Usage :			Only tested with "CRulerRichEditCtrl". Add a member to the 
-					parent class, and create it with "Create". Handle the 
-					registered message "urm_RULERACTION" in the parent class. 
-					The parent class is also expected to handle 
-					"urm_GETSCROLLPOS", which should return the current 
-					horisontal scrollbar position.
-
-   ========================================================================*/
-
-#include "stdafx.h"
-#include "StdGrfx.h"
-#include "RRECRuler.h"
-#include "ids.h"
-
-#ifdef _DEBUG
-#define new DEBUG_NEW
-#undef THIS_FILE
-static char THIS_FILE[] = __FILE__;
-#endif
-
-CRRECRuler::CRRECRuler()
-/* ============================================================
-	Function :		CRRECRuler::CRRECRuler
-	Description :	constructor
-	Access :		Public
-					
-	Return :		void
-	Parameters :	none
-
-	Usage :			
-
-   ============================================================*/
-{
-
-	m_physicalInch = 0;
-	m_mode = MODE_METRIC;
-	m_margin = 0;
-
-}
-
-CRRECRuler::~CRRECRuler()
-/* ============================================================
-	Function :		CRRECRuler::~CRRECRuler
-	Description :	destructor
-	Access :		Public
-					
-	Return :		void
-	Parameters :	none
-
-	Usage :			
-
-   ============================================================*/
-{
-}
-
-BEGIN_MESSAGE_MAP(CRRECRuler, CWnd)
-	ON_WM_PAINT()
-	ON_WM_ERASEBKGND()
-	ON_WM_LBUTTONDOWN()
-	ON_WM_LBUTTONUP()
-	ON_WM_MOUSEMOVE()
-END_MESSAGE_MAP()
-
-
-BOOL CRRECRuler::Create( const CRect& rect, CWnd* parent, UINT id )
-/* ============================================================
-	Function :		CRRECRuler::Create
-	Description :	Creates the ruler control
-	Access :		Public
-					
-	Return :		BOOL				-	Result, "TRUE" if ok.
-	Parameters :	const CRect& rect	-	Coordinate rect
-					CWnd* parent		-	Parent
-					UINT id				-	Child window id.
-					
-	Usage :			Call to create the ruler control
-
-   ============================================================*/
-{
-	BOOL result = CWnd::Create( NULL, NULL, WS_CHILD | WS_VISIBLE, rect, parent, id );
-	if( result )
-	{
-		CClientDC dc( this );
-		m_physicalInch = dc.GetDeviceCaps( LOGPIXELSX );
-	}
-
-	return result;
-
-}
-
-void CRRECRuler::OnPaint()
-/* ============================================================
-	Function :		CRRECRuler::OnPaint
-	Description :	Handles the "WM_PAINT" message from Windows.
-					Draws the ruler to a memory "CDC" that is 
-					blitted to the screen (double buffering)
-	Access :		Protected
-					
-	Return :		void
-	Parameters :	none
-
-	Usage :			Called from MFC
-
-   ============================================================*/
-{
-	CPaintDC mainDC(this);
-
-	// Set up data
-	int pos = (int)GetParent()->SendMessage( urm_GETSCROLLPOS );
-
-	CRect rect;
-	GetClientRect( rect );
-
-	// Create off-screen canvas
-	CDC dc;
-	CBitmap bmp;
-	bmp.CreateCompatibleBitmap( &mainDC, rect.Width(), rect.Height() );
-	dc.CreateCompatibleDC( &mainDC );
-	CBitmap* oldbmp = dc.SelectObject( &bmp );
-
-	// Set up canvas
-	dc.FillSolidRect( rect, RGB( 255, 255, 255 ) );
-	dc.SelectStockObject( BLACK_PEN );
-	dc.SelectStockObject( DEFAULT_GUI_FONT );
-	dc.SetBkColor( RGB( 255, 255, 255 ) );
-
-	// Set up data for the inner ruler window
-	CRect winRect( rect );
-	winRect.top += 3;
-	winRect.bottom -= 5;
-	winRect.right -= 3;
-	winRect.left += m_margin - 2;
-
-	int midpoint = winRect.top + ( winRect.Height() / 2 );
-	int leftmarg = winRect.left + 2 - pos;
-	int width = winRect.Height();
-	int t;
-
-	// Print the values in the ruler scale
-	if( m_mode == MODE_INCH )
-	{
-		int inch4 = ( int ) ( ( double ) m_physicalInch / 4.0 +.5 );
-		int inch8 = ( int ) ( ( double ) m_physicalInch / 8.0 +.5 );
-
-		// Drawing scale markers
-		for( t = ( leftmarg + ( int ) ( inch8 +.5 ) ) ; t < rect.right - m_margin ; t += ( int ) ( inch8 + .5 ) )
-		{
-			dc.MoveTo( t, midpoint - 1 );
-			dc.LineTo( t, midpoint + 1 );
-		}
-
-		for( t = leftmarg + inch4 ; t < rect.right - m_margin ; t += inch4 )
-		{
-			dc.MoveTo( t, midpoint - 3 );
-			dc.LineTo( t, midpoint + 3 );
-		}
-
-		CRect rectInch;
-		CString counter;
-		int count = 1;
-
-		// Drawing numbers
-		for( t = leftmarg + m_physicalInch ; t < rect.right - m_margin ; t += m_physicalInch )
-		{
-
-			rectInch.SetRect( t - width / 2, winRect.top + 2, t + width / 2, winRect.bottom - 2 );
-			counter.Format( _T( "%i" ), count );
-			dc.DrawText( counter, rectInch, DT_SINGLELINE | DT_CENTER | DT_VCENTER );
-			count++;
-
-		}
-	}
-	else
-	{
-		int cm = ( int ) ( ( double ) m_physicalInch / 2.54 + .5 );
-		int cm2 = ( int ) ( ( double ) cm / 2.0 );
-
-		// Drawing scale markers
-		for( t = leftmarg + cm2 ; t < rect.right - m_margin ; t += cm2 )
-		{
-			dc.MoveTo( t, midpoint - 1 );
-			dc.LineTo( t, midpoint + 2 );
-		}
-
-		CRect rectNum;
-		CString counter;
-		int count = 1;
-
-		// Drawing numbers
-		for( t = leftmarg + cm ; t < rect.right - m_margin ; t += cm )
-		{
-			rectNum.SetRect( t - width / 2, winRect.top + 2, t + width / 2, winRect.bottom - 2 );
-			counter.Format( _T( "%i" ), count );
-			dc.DrawText( counter, rectNum, DT_SINGLELINE | DT_CENTER | DT_VCENTER );
-			count++;
-
-		}
-	}
-
-	// Mask the surroundings
-	CRect left( rect );
-	left.right = winRect.left;
-	CRect right( rect );
-	right.left = rect.right - 3;
-	CRect top( rect );
-	top.bottom = winRect.top;
-	CRect bottom( rect );
-	bottom.top = winRect.bottom;
-
-	dc.FillRect( left, CStdGrfx::dialogBrush() );
-	dc.FillRect( right, CStdGrfx::dialogBrush() );
-	dc.FillRect( top, CStdGrfx::dialogBrush() );
-	dc.FillRect( bottom, CStdGrfx::dialogBrush() );
-
-	// Frame the inside
-	CStdGrfx::drawdoublesunken3dFrame( &dc, winRect );
-
-	// Draw tab markers
-	int max = (int)m_tabs.GetSize();
-	for( t = 0 ; t < max ; t++ )
-	{
-
-		int x = ( leftmarg + m_tabs[ t ] - 2 );
-		if( x > winRect.left && x + 3 < winRect.right )
-		{
-			dc.MoveTo( x, midpoint + 5 );
-			dc.LineTo( x + 6, midpoint + 5 );
-			dc.MoveTo( x, midpoint + 6 );
-			dc.LineTo( x + 6, midpoint + 6 );
-
-			dc.MoveTo( x + 2, midpoint + 7 );
-			dc.LineTo( x + 2, midpoint + 10 );
-			dc.MoveTo( x + 3, midpoint + 7 );
-			dc.LineTo( x + 3, midpoint + 10 );
-		}
-	}
-
-	// Frame the outside
-	dc.SelectObject( CStdGrfx::highlightPen() );
-	dc.MoveTo( rect.left + 1, rect.top );
-	dc.LineTo( rect.right - 1, rect.top );
-
-	// Restore...
-	dc.SelectStockObject( BLACK_PEN );
-
-	//... and out to screen
-	mainDC.BitBlt( 0, 0, rect.Width(), rect.Height(), &dc, 0, 0, SRCCOPY );
-	dc.SelectObject( oldbmp );
-}
-
-BOOL CRRECRuler::OnEraseBkgnd( CDC* /*pDC*/ ) 
-/* ============================================================
-	Function :		CRRECRuler::OnEraseBkgnd
-	Description :	Returns "TRUE" to avoid flicker.
-	Access :		Protected
-					
-	Return :		BOOL		-	Always "TRUE"
-	Parameters :	CDC* pDC	-	Not used
-					
-	Usage :			Called from MFC. 
-
-   ============================================================*/
-{
-	
-	return TRUE;
-
-}
-
-void CRRECRuler::SetMode( int mode )
-/* ============================================================
-	Function :		CRRECRuler::SetMode
-	Description :	Sets the internal mode, that is, if the 
-					ruler should display inches or centimeters.
-	Access :		Public
-					
-	Return :		void
-	Parameters :	int mode	-	Mode to use, "MODE_INCH" or 
-									"MODE_METRIC" (default)
-					
-	Usage :			Call to change the mode.
-
-   ============================================================*/
-{
-
-	m_mode = mode;
-
-	if( m_hWnd )
-	{
-
-		RedrawWindow();
-
-	}
-
-}
-
-void CRRECRuler::SetMargin( int margin )
-/* ============================================================
-	Function :		CRRECRuler::SetMargin
-	Description :	Sets the margin, in pixels, of the ruler.
-	Access :		Public
-					
-	Return :		void
-	Parameters :	int margin	-	The margin to set
-					
-	Usage :			Call to set the margin of the ruler scale.
-
-   ============================================================*/
-{
-
-	m_margin = margin;
-
-	if( m_hWnd )
-	{
-
-		RedrawWindow();
-
-	}
-
-}
-
-int CRRECRuler::GetMode() const
-/* ============================================================
-	Function :		CRRECRuler::GetMode
-	Description :	Gets the mode, that is, either "MODE_INCH" or 
-					"MODE_METRIC", that is used to draw the ruler.
-	Access :		Public
-					
-	Return :		int		-	The mode, either "MODE_INCH" or 
-								"MODE_METRIC"
-	Parameters :	none
-
-	Usage :			Call to get the current mode.
-
-   ============================================================*/
-{
-
-	return m_mode;
-
-}
-
-void CRRECRuler::SetTabStops( const CDWordArray& arr )
-/* ============================================================
-	Function :		CRRECRuler::SetTabStops
-	Description :	Sets the tab stops in the internal tab stop 
-					array, in device pixels
-	Access :		Public
-					
-	Return :		void
-	Parameters :	const CDWordArray& arr	-	The array to 
-												copy from
-					
-	Usage :			Call to set the tab stops of the ruler.
-
-   ============================================================*/
-{
-
-	m_tabs.RemoveAll();
-	int max = (int)arr.GetSize();
-	for (int t = 0 ; t < max ; t++)
-	{
-		m_tabs.Add(arr[ t ]);
-	}
-
-}
-
-void CRRECRuler::OnLButtonDown(UINT nFlags, CPoint point)
-/* ============================================================
-	Function :		CRRECRuler::OnLButtonDown
-	Description :	Handles the "WM_LBUTTONDOWN" message. We send 
-					a message with the current cursor position 
-					to the parent control.
-	Access :		Protected
-					
-	Return :		void
-	Parameters :	UINT nFlags		-	Not used
-					CPoint point	-	Cursor position
-					
-	Usage :			Called from MFC
-
-   ============================================================*/
-{
-
-	SetCapture();
-	GetParent()->SendMessage( urm_RULERACTION, DOWN, ( LPARAM ) &point );
-	CWnd::OnLButtonDown( nFlags,  point );
-
-}
-
-void CRRECRuler::OnLButtonUp(UINT nFlags, CPoint point)
-/* ============================================================
-	Function :		CRRECRuler::OnLButtonUp
-	Description :	Handles the "WM_LBUTTONUP" message. We send 
-					a message with the current cursor position 
-					to the parent control.
-	Access :		Protected
-					
-	Return :		void
-	Parameters :	UINT nFlags		-	Not used
-					CPoint point	-	Cursor position
-					
-	Usage :			Called from MFC
-
-   ============================================================*/
-{
-
-	ReleaseCapture();
-	GetParent()->SendMessage( urm_RULERACTION, UP, ( LPARAM ) &point );
-	CWnd::OnLButtonUp( nFlags,  point );
-
-}
-
-void CRRECRuler::OnMouseMove(UINT nFlags, CPoint point)
-/* ============================================================
-	Function :		CRRECRuler::OnMouseMove
-	Description :	Handles the "WM_MOUSEMOVE" message. We send 
-					a message with the current cursor position 
-					to the parent control.
-	Access :		Protected
-					
-	Return :		void
-	Parameters :	UINT nFlags		-	Not used
-					CPoint point	-	Cursor position
-					
-	Usage :			Called from MFC
-
-   ============================================================*/
-{
-
-	GetParent()->SendMessage( urm_RULERACTION, MOVE, ( LPARAM ) &point );
-	CWnd::OnMouseMove( nFlags,  point );
-
-}
-

+ 0 - 39
src/RulerRichEditCtrl/RRECRuler.h

@@ -1,39 +0,0 @@
-#ifndef _RRECRULER_H_
-#define _RRECRULER_H_
-
-class CRRECRuler : public CWnd 
-{
-
-public:
-// Construction/creation/destruction
-	CRRECRuler();
-	virtual ~CRRECRuler();
-	virtual BOOL Create( const CRect& rect, CWnd* parent, UINT id );
-
-// Implementation
-	void	SetMode( int mode );
-	int		GetMode() const;
-	void	SetMargin( int margin );
-	void	SetTabStops( const CDWordArray& arr );
-
-protected:
-// Message handlers
-	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
-	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
-	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
-	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
-	afx_msg void OnPaint();
-	DECLARE_MESSAGE_MAP()
-
-private:
-// Internal data
-	int m_margin;		// Left margin of ruler in pixels
-	int m_mode;			// MODE_INCH/MODE_METRIC, what units 
-						// to use for the ruler measure.
-	int m_physicalInch;	// The number of device pixels for a 
-						// physical inch of the window CDC
-
-	CDWordArray	m_tabs;	// Tabulator settings in device pixels
-};
-
-#endif // _RRECRULER_H_

+ 69 - 94
src/RulerRichEditCtrl/RRECToolbar.cpp

@@ -24,7 +24,7 @@
 
 #include "stdafx.h"
 #include "RRECToolbar.h"
-#include "ids.h"
+#include "..\..\resource.h"
 
 #include <tchar.h>
 
@@ -71,7 +71,7 @@ CRRECToolbar::~CRRECToolbar()
 {
 }
 
-BOOL CRRECToolbar::Create( CWnd* parent, CRect& rc )
+BOOL CRRECToolbar::Create( CWnd* parent, CRect& rc, int resourceId)
 /* ============================================================
 	Function :		CRRECToolbar::Create
 	Description :	Creates the toolbar control
@@ -86,42 +86,47 @@ BOOL CRRECToolbar::Create( CWnd* parent, CRect& rc )
 
    ============================================================*/
 {
-
 	BOOL result = FALSE;
 
-	HINSTANCE hInstance = AfxFindResourceHandle( MAKEINTRESOURCE( TOOLBAR_CONTROL ), RT_TOOLBAR );
+	HINSTANCE hInstance = AfxFindResourceHandle(MAKEINTRESOURCE(resourceId), RT_TOOLBAR);
 	if(!hInstance)
 		return FALSE;
 
-	HRSRC hRsrc = ::FindResource( hInstance, MAKEINTRESOURCE( TOOLBAR_CONTROL ), RT_TOOLBAR );
-	if( !hRsrc )
+	HRSRC hRsrc = ::FindResource(hInstance, MAKEINTRESOURCE(resourceId), RT_TOOLBAR);
+	if(!hRsrc)
 		return FALSE;
 
-	HGLOBAL hGlobal = LoadResource( hInstance, hRsrc );
+	HGLOBAL hGlobal = LoadResource(hInstance, hRsrc);
 	if (hGlobal == NULL)
 		return FALSE;
 
-	CToolBarData* pData = ( CToolBarData* ) LockResource( hGlobal );
+	CToolBarData* pData = (CToolBarData*) LockResource(hGlobal);
 	if (pData == NULL)
 		return FALSE;
 
-	ASSERT( pData->wVersion == 1 );
+	ASSERT(pData->wVersion == 1);
 
 	TBBUTTON tb, tbSep;
-	memset ( &tb, 0, sizeof( tb ) );
-	memset ( &tbSep, 0, sizeof( tbSep ) );
+	memset(&tb, 0, sizeof(tb));
+	memset(&tbSep, 0, sizeof(tbSep));
 
-	result = CToolBarCtrl::Create(WS_VISIBLE|WS_CHILD, rc, parent, TOOLBAR_CONTROL);
+	result = CToolBarCtrl::Create(WS_VISIBLE|WS_CHILD, rc, parent, resourceId);
 
-	if( result )
+	if(result)
 	{
-		SetButtonStructSize( sizeof ( tb ) );
+		m_dpi.Invalidate();
+		m_dpi.SetHwnd(m_hWnd);
+
+		m_font.DeleteObject();
+		m_font.CreateFont(-m_dpi.Scale(12), 0, 0, 0, 400, 0, 0, 0, DEFAULT_CHARSET, 3, 2, 1, 34, _T("Segoe UI"));
+
+		SetButtonStructSize(sizeof(tb));
 
-		CSize sz ( pData->wWidth, pData->wHeight );
-		SetBitmapSize( sz );
+		CSize sz(pData->wWidth, pData->wHeight);
+		SetBitmapSize(sz);
 		sz.cx += 4;
 		sz.cy += 4;
-		SetButtonSize( sz );
+		SetButtonSize(sz);
 
 		// Loop through adding buttons.
 		tb.fsState = TBSTATE_ENABLED;
@@ -132,107 +137,79 @@ BOOL CRRECToolbar::Create( CWnd* parent, CRect& rc )
 		tbSep.iString = -1;
 		tbSep.fsStyle = TBSTYLE_SEP;
 
-		for( WORD w = 0; w < pData->wItemCount; w++ )
+		for(WORD w = 0; w < pData->wItemCount; w++)
 		{
-			if ( pData->items()[ w ] == 0 )
-				AddButtons( 1, &tbSep );
+			if (pData->items()[w] == 0)
+			{
+				AddButtons(1, &tbSep);
+			}
 			else
 			{
-				tb.idCommand = pData->items()[ w ];
-				AddButtons( 1, &tb );
+				tb.idCommand = pData->items()[w];
+				AddButtons(1, &tb);
 				tb.iBitmap++;
 			}
 		}
 
-		HBITMAP	hBitmap = (HBITMAP) ::LoadImage( hInstance, MAKEINTRESOURCE( TOOLBAR_CONTROL ), IMAGE_BITMAP, 0,0, LR_LOADMAP3DCOLORS );
+		HBITMAP	hBitmap = (HBITMAP)::LoadImage( hInstance, MAKEINTRESOURCE(resourceId), IMAGE_BITMAP, 0,0, LR_LOADMAP3DCOLORS );
 		if( !hBitmap )
 			return FALSE;
 
 		BITMAP bm;
-		memset( &bm, 0, sizeof ( bm ) );
-		::GetObject( hBitmap, sizeof ( bm ), &bm );
-		AddBitmap( bm.bmWidth / pData->wWidth, CBitmap::FromHandle ( hBitmap ) );
+		memset(&bm, 0, sizeof (bm));
+		::GetObject(hBitmap, sizeof (bm), &bm);
+		AddBitmap(bm.bmWidth / pData->wWidth, CBitmap::FromHandle (hBitmap));
 
-		UnlockResource( hGlobal );
-		FreeResource( hGlobal );
-
-		/////////////////////////////////////
-		// Map in combo boxes
-		//
+		UnlockResource(hGlobal);
+		FreeResource(hGlobal);
 
 		CRect rect;
 
 		TBBUTTONINFO tbi;
 		tbi.cbSize = sizeof( TBBUTTONINFO );
-		tbi.cx = FONT_COMBO_WIDTH;
+		tbi.cx = m_dpi.Scale(100);
 		tbi.dwMask = TBIF_SIZE | 0x80000000;  // By index
 
-		SetButtonInfo( FONT_NAME_POS, &tbi );
-		GetItemRect( FONT_NAME_POS, &rect );
-		rect.bottom += COMBO_HEIGHT;
+		SetButtonInfo(2, &tbi);
+		GetItemRect(2, &rect);
 
 		// The font name combo
-		if( m_font.Create( WS_CHILD | 
-							WS_VSCROLL |
-							WS_VISIBLE |
-							CBS_AUTOHSCROLL | 
-							CBS_DROPDOWN | 
-							CBS_SORT | 
-							CBS_HASSTRINGS, 
-							rect, this, DROPDOWN_FONT ) )
+		if(m_fontCombo.Create(WS_CHILD | WS_VSCROLL | WS_VISIBLE | CBS_AUTOHSCROLL | CBS_DROPDOWN | CBS_SORT | CBS_HASSTRINGS, rect, this, 31))
 		{
-
-			m_font.SetFont( CFont::FromHandle( ( HFONT ) ::GetStockObject( ANSI_VAR_FONT ) ) );
-			m_font.FillCombo();
-
-			tbi.cx = COMBO_WIDTH;
-			SetButtonInfo( FONT_SIZE_POS, &tbi );
-			GetItemRect( FONT_SIZE_POS, &rect );
-			rect.bottom += COMBO_HEIGHT;
-
-			// The font size combo
-			if( m_size.Create( WS_CHILD | 
-								WS_VISIBLE | 
-								CBS_AUTOHSCROLL | 
-								CBS_DROPDOWNLIST | 
-								CBS_HASSTRINGS, 
-								rect, this, DROPDOWN_SIZE ) )
+			m_fontCombo.SetFont(&m_font);
+			m_fontCombo.FillCombo();
+			
+			tbi.cx = m_dpi.Scale(48);
+			SetButtonInfo(4, &tbi);
+			GetItemRect(4, &rect);
+
+			//The font size combo
+			if( m_size.Create( WS_CHILD | WS_VISIBLE | CBS_AUTOHSCROLL | CBS_DROPDOWNLIST | CBS_HASSTRINGS, rect, this, 32))
 			{
-
-				m_size.SetFont( CFont::FromHandle( ( HFONT ) ::GetStockObject( ANSI_VAR_FONT ) ) );
+				m_size.SetFont(&m_font);
 				m_size.FillCombo();
-				CString color;
-				CString defaultText;
-				CString customText;
-				color.LoadString( STRING_COLOR );
-				defaultText.LoadString( STRING_DEFAULT );
-				customText.LoadString( STRING_CUSTOM );
 
-				tbi.cx = COLOR_WIDTH;
-				SetButtonInfo( FONT_COLOR_POS, &tbi );
-				GetItemRect( FONT_COLOR_POS, &rect );
+				CString color = _T("Color");
+				CString defaultText = _T("Automatic");
+				CString customText = _T("More Colours...");
+
+				tbi.cx = m_dpi.Scale(64);
+				SetButtonInfo(6, &tbi);
+				GetItemRect(6, &rect);
 
 				// The color picker
-				if( m_color.Create( color,
-									WS_VISIBLE|
-									WS_CHILD,
-									rect, this, BUTTON_COLOR ) )
+				if(m_color.Create(color, WS_VISIBLE | WS_CHILD, rect, this, BUTTON_COLOR))
 				{
+					m_color.SetDefaultText(defaultText);
+					m_color.SetCustomText(customText);
+					m_color.SetSelectionMode(CP_MODE_TEXT);
+					m_color.SetBkColour(RGB(255, 255, 255 ));
+					m_color.SetFont(&m_font);
 
-					m_color.SetDefaultText( defaultText );
-					m_color.SetCustomText( customText );
-					m_color.SetSelectionMode( CP_MODE_TEXT );
-					m_color.SetBkColour( RGB( 255, 255, 255 ) );
-
-					m_color.SetFont( CFont::FromHandle( ( HFONT ) ::GetStockObject( ANSI_VAR_FONT ) ) );
 					result = TRUE;
-
 				}
-
 			}
-
 		}
-
 	}
 
 	return result;
@@ -242,8 +219,8 @@ BOOL CRRECToolbar::Create( CWnd* parent, CRect& rc )
 BEGIN_MESSAGE_MAP(CRRECToolbar, CToolBarCtrl)
 	//{{AFX_MSG_MAP(CRRECToolbar)
 		// NOTE - the ClassWizard will add and remove mapping macros here.
-	ON_CBN_SELCHANGE(DROPDOWN_FONT, OnSelchangeFont)
-	ON_CBN_SELCHANGE(DROPDOWN_SIZE, OnSelchangeSize)
+	ON_CBN_SELCHANGE(31, OnSelchangeFont)
+	ON_CBN_SELCHANGE(32, OnSelchangeSize)
 	ON_MESSAGE(CPN_SELENDOK, OnColorButton)
 	//}}AFX_MSG_MAP
 END_MESSAGE_MAP()
@@ -268,10 +245,10 @@ void CRRECToolbar::OnSelchangeFont()
 {
 
 	CString font;
-	int index = m_font.GetCurSel();
+	int index = m_fontCombo.GetCurSel();
 	if( index != CB_ERR )
 	{
-		m_font.GetLBText( index, font );
+		m_fontCombo.GetLBText( index, font );
 		GetParent()->SendMessage( urm_SETCURRENTFONTNAME, ( WPARAM ) ( LPCTSTR ) font, 0 );
 
 	}	
@@ -346,8 +323,8 @@ void CRRECToolbar::SetFontName( const CString& font )
    ============================================================*/
 {
 
-	if( m_font.m_hWnd )
-		m_font.SelectFontName( font );
+	if(m_fontCombo.m_hWnd )
+		m_fontCombo.SelectFontName( font );
 
 }
 
@@ -368,7 +345,6 @@ void CRRECToolbar::SetFontSize( int size )
 
 	if( m_size.m_hWnd )
 		m_size.SelectSize( size );
-
 }
 
 void CRRECToolbar::SetFontColor( COLORREF color )
@@ -389,5 +365,4 @@ void CRRECToolbar::SetFontColor( COLORREF color )
 	if( m_color.m_hWnd )
 		m_color.SetColour( color );
 
-}
-
+}

+ 7 - 2
src/RulerRichEditCtrl/RRECToolbar.h

@@ -10,6 +10,7 @@
 #include "FontComboBox.h"
 #include "SizeComboBox.h"
 #include "External/ColourPicker.h"
+#include "../DPI.h"
 
 struct CToolBarData
 {
@@ -31,7 +32,7 @@ class CRRECToolbar : public CToolBarCtrl
 // Construction
 public:
 	CRRECToolbar();
-	BOOL Create( CWnd* parent, CRect& rect );
+	BOOL Create( CWnd* parent, CRect& rect, int resourceId);
 
 // Attributes
 public:
@@ -65,10 +66,14 @@ protected:
 
 private:
 
-	CFontComboBox	m_font;
+	CFontComboBox	m_fontCombo;
 	CSizeComboBox	m_size;
 	CColourPicker	m_color;
 
+	CFont m_font;
+
+	CDPI m_dpi;
+
 };
 
 /////////////////////////////////////////////////////////////////////////////

+ 23 - 24
src/RulerRichEditCtrl/RulerRichEdit.cpp

@@ -23,7 +23,6 @@
    ========================================================================*/
 
 #include "stdafx.h"
-#include "ids.h"
 #include "RulerRichEdit.h"
 
 #ifdef _DEBUG
@@ -133,7 +132,7 @@ void CRulerRichEdit::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
 
 	}
 
-	UpdateRuler();
+	//UpdateRuler();
 
 }
 
@@ -152,7 +151,7 @@ void CRulerRichEdit::OnChange()
    ============================================================*/
 {
 
-	UpdateRuler();
+	//UpdateRuler();
 
 }
 
@@ -178,25 +177,25 @@ UINT CRulerRichEdit::OnGetDlgCode()
 /////////////////////////////////////////////////////////////////////////////
 // CRulerRichEdit private helpers
 
-void CRulerRichEdit::UpdateRuler()
-/* ============================================================
-	Function :		CRulerRichEdit::UpdateRuler
-	Description :	Updates the ruler.
-	Access :		Private
-					
-	Return :		void
-	Parameters :	none
-
-	Usage :			Call to update the parent ruler field.
-
-   ============================================================*/
-{
-
-	CRect rect;
-	GetClientRect( rect );
-	rect.top = TOOLBAR_HEIGHT;
-	rect.bottom = rect.top + TOP_HEIGHT;
-	GetParent()->RedrawWindow( rect );
-
-}
+//void CRulerRichEdit::UpdateRuler()
+///* ============================================================
+//	Function :		CRulerRichEdit::UpdateRuler
+//	Description :	Updates the ruler.
+//	Access :		Private
+//					
+//	Return :		void
+//	Parameters :	none
+//
+//	Usage :			Call to update the parent ruler field.
+//
+//   ============================================================*/
+//{
+//
+//	CRect rect;
+//	GetClientRect( rect );
+//	rect.top = TOOLBAR_HEIGHT;
+//	rect.bottom = rect.top + TOP_HEIGHT;
+//	GetParent()->RedrawWindow( rect );
+//
+//}
 

+ 3 - 1
src/RulerRichEditCtrl/RulerRichEdit.h

@@ -8,6 +8,8 @@
 // CRulerRichEdit window
 #include "../RichEditCtrlEx.h"
 
+#define RTF_CONTROL		12
+
 class CRulerRichEdit : public CRichEditCtrlEx
 {
 public:
@@ -29,7 +31,7 @@ protected:
 
 private:
 // Private helpers
-	void UpdateRuler();
+	//void UpdateRuler();
 
 };
 

+ 66 - 253
src/RulerRichEditCtrl/RulerRichEditCtrl.cpp

@@ -50,9 +50,10 @@
 #include "..\Options.h"
 #include "..\Misc.h"
 #include "..\HyperLink.h"
-
-#include "ids.h"
 #include ".\rulerricheditctrl.h"
+#include "..\..\resource.h"
+
+
 
 #ifdef _DEBUG
 #define new DEBUG_NEW
@@ -69,6 +70,8 @@ UINT urm_SETCURRENTFONTNAME = ::RegisterWindowMessage( _T( "_RULERRICHEDITCTRL_S
 UINT urm_SETCURRENTFONTSIZE = ::RegisterWindowMessage( _T( "_RULERRICHEDITCTRL_SET_CURRENT_FONT_SIZE" ) );
 UINT urm_SETCURRENTFONTCOLOR = ::RegisterWindowMessage( _T( "_RULERRICHEDITCTRL_SET_CURRENT_FONT_COLOR" ) );
 
+#define TOOLBAR_HEIGHT		28
+
 /////////////////////////////////////////////////////////////////////////////
 // Stream callback functions
 // Callbacks to the Save and Load functions.
@@ -150,7 +153,7 @@ static DWORD CALLBACK StreamIn( DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG
 /////////////////////////////////////////////////////////////////////////////
 // CRulerRichEditCtrl
 
-CRulerRichEditCtrl::CRulerRichEditCtrl() : m_pen( PS_DOT, 0, RGB( 0, 0, 0 ) )
+CRulerRichEditCtrl::CRulerRichEditCtrl()
 /* ============================================================
 	Function :		CRulerRichEditCtrl::CRulerRichEditCtrl
 	Description :	constructor
@@ -163,14 +166,12 @@ CRulerRichEditCtrl::CRulerRichEditCtrl() : m_pen( PS_DOT, 0, RGB( 0, 0, 0 ) )
 
    ============================================================*/
 {
-	m_rulerPosition = 0;
 	m_margin = 0;
 	m_movingtab = -1;
 	m_offset = 0;
 	m_readOnly = FALSE;
 	m_bInWrapMode = g_Opt.GetEditWordWrap();
 	ShowToolbar();
-	ShowRuler();
 }
 
 CRulerRichEditCtrl::~CRulerRichEditCtrl()
@@ -185,8 +186,7 @@ CRulerRichEditCtrl::~CRulerRichEditCtrl()
 	Usage :			
 
    ============================================================*/
-{
-	m_pen.DeleteObject();
+{	
 }
 
 
@@ -215,7 +215,6 @@ BOOL CRulerRichEditCtrl::Create( DWORD dwStyle, const RECT &rect, CWnd* pParentW
 	BOOL result = CWnd::Create(NULL, _T( "" ), dwStyle, rect, pParentWnd, nID);
 	if ( result )
 	{
-
 		result = FALSE;
 		// Save screen resolution for
 		// later on.
@@ -228,61 +227,57 @@ BOOL CRulerRichEditCtrl::Create( DWORD dwStyle, const RECT &rect, CWnd* pParentW
 			CreateMargins();
 			if( CreateToolbar() )
 			{
-				if( CreateRuler() )
-				{
-					UpdateToolbarButtons();
-					result = TRUE;
-				}
+				UpdateToolbarButtons();
+				result = TRUE;				
 			}
 
 			//Do wrap will reverse the saved option so initially set it as opposite of what it's saved as
 			m_bInWrapMode = !m_bInWrapMode;
 			DoWrap();
-		}		
+		}
+
+		m_dpi.SetHwnd(m_hWndOwner);
 	}
 
 	return result;
 }
 
-BOOL CRulerRichEditCtrl::CreateToolbar()
-/* ============================================================
-	Function :		CRulerRichEditCtrl::CreateToolbar
-	Description :	Creates the toolbar control
-	Access :		Private
-
-	Return :		BOOL	-	"TRUE" if the toolbar was created ok.
-	Parameters :	none
+void CRulerRichEditCtrl::OnDpiChanged(CWnd* pParent, int dpi)
+{
+	m_dpi.Update(dpi);
+	
+	m_toolbar.DestroyWindow();
+	CreateToolbar();
 
-	Usage :			Called during control creation
+	UpdateToolbarButtons();
 
-   ============================================================*/
-{
+	m_toolbar.Invalidate();
+	m_toolbar.RedrawWindow();
 
 	CRect rect;
-	GetClientRect( rect );
-
-	CRect toolbarRect( 0, 0, rect.right, TOOLBAR_HEIGHT );
-	return m_toolbar.Create( this, toolbarRect );
+	GetClientRect(rect);
+	LayoutControls(rect.Width(), rect.Height());
 }
 
-BOOL CRulerRichEditCtrl::CreateRuler()
+BOOL CRulerRichEditCtrl::CreateToolbar()
 /* ============================================================
-	Function :		CRulerRichEditCtrl::CreateRuler
-	Description :	Creates the ruler control
+	Function :		CRulerRichEditCtrl::CreateToolbar
+	Description :	Creates the toolbar control
 	Access :		Private
 
-	Return :		BOOL	-	"TRUE" if created ok.
+	Return :		BOOL	-	"TRUE" if the toolbar was created ok.
 	Parameters :	none
 
 	Usage :			Called during control creation
 
    ============================================================*/
 {
+
 	CRect rect;
 	GetClientRect( rect );
 
-	CRect rulerRect( 0, TOOLBAR_HEIGHT, rect.right, TOOLBAR_HEIGHT + RULER_HEIGHT );
-	return m_ruler.Create( rulerRect, this, RULER_CONTROL );
+	CRect toolbarRect( 0, 0, rect.right, m_dpi.Scale(TOOLBAR_HEIGHT));
+	return m_toolbar.Create( this, toolbarRect, ToolbarIdPerDPI());
 }
 
 BOOL CRulerRichEditCtrl::CreateRTFControl( BOOL autohscroll )
@@ -306,7 +301,7 @@ BOOL CRulerRichEditCtrl::CreateRTFControl( BOOL autohscroll )
 	CRect rect;
 	GetClientRect( rect );
 
-	int top = TOOLBAR_HEIGHT + RULER_HEIGHT;
+	int top = TOOLBAR_HEIGHT;
 	CRect rtfRect( 0, top, rect.right, rect.bottom );
 	DWORD style = ES_NOHIDESEL|WS_CHILD|WS_VISIBLE|WS_HSCROLL|WS_VSCROLL|ES_WANTRETURN|ES_MULTILINE;
 	if( autohscroll )
@@ -392,7 +387,7 @@ void CRulerRichEditCtrl::CreateMargins()
 	// Create the margin for the toolbar 
 	// controls and the ruler.
 	m_margin = scmargin * 2 + r2.left - r1.left;
-	m_ruler.SetMargin( m_margin );
+	//m_ruler.SetMargin( m_margin );
 }
 
 BEGIN_MESSAGE_MAP(CRulerRichEditCtrl, CWnd)
@@ -416,7 +411,6 @@ BEGIN_MESSAGE_MAP(CRulerRichEditCtrl, CWnd)
 	ON_BN_CLICKED(BUTTON_BULLET, OnButtonBullet)
 	ON_BN_CLICKED(ID_BUTTONWRAP, OnButtonWrap)
 	ON_WM_SETFOCUS()
-	ON_REGISTERED_MESSAGE(urm_RULERACTION, OnTrackRuler)
 	ON_REGISTERED_MESSAGE(urm_GETSCROLLPOS, OnGetScrollPos)
 	ON_REGISTERED_MESSAGE(urm_SETCURRENTFONTNAME, OnSetCurrentFontName)
 	ON_REGISTERED_MESSAGE(urm_SETCURRENTFONTSIZE, OnSetCurrentFontSize)
@@ -514,7 +508,7 @@ BOOL CRulerRichEditCtrl::OnNotify( WPARAM wParam, LPARAM lParam, LRESULT* pResul
 		CRect rect;
 		GetClientRect( rect );
 		rect.top = TOOLBAR_HEIGHT;
-		rect.bottom = rect.top + RULER_HEIGHT;
+		rect.bottom = rect.top;
 
 		RedrawWindow( rect );
 
@@ -593,166 +587,6 @@ LRESULT CRulerRichEditCtrl::OnGetScrollPos(WPARAM, LPARAM)
 
 }
 
-LRESULT CRulerRichEditCtrl::OnTrackRuler(WPARAM mode, LPARAM pt)
-/* ============================================================
-	Function :		CRulerRichEditCtrl::OnTrackRuler
-	Description :	The function handles the registered message 
-					"urm_RULERACTION", that is sent from the 
-					mouse handling mappings in the ruler control.
-					The function handles dragging of tabulator 
-					points in the ruler.
-	Access :		Protected
-					
-	Return :		LRESULT		-	Not used
-	Parameters :	WPARAM mode	-	The type of mouse operation, 
-									"DOWN", "MOVE" or "UP"
-					LPARAM pt	-	Cursor point for the cursor.
-					
-	Usage :			Called from MFC.
-
-   ============================================================*/
-{
-
-	CPoint* point = ( CPoint* ) pt;
-	int toolbarHeight = 0;
-	if( m_showToolbar )
-		toolbarHeight = TOOLBAR_HEIGHT;
-
-	switch( mode )
-	{
-		case DOWN:
-			// The left mouse button is clicked
-			{
-				// Check if we clicked on a tab-marker.
-				int pos = m_rtf.GetScrollPos( SB_HORZ );
-				m_movingtab = -1;
-				CRect hitRect;
-				int y = RULER_HEIGHT - 9;
-				for( int t = 0 ; t < MAX_TAB_STOPS ; t++ )
-				{
-					int x = m_tabs[ t ] + m_margin - pos;
-					hitRect.SetRect( x - 2, y - 1, x + 3, y + 3 );
-					if( hitRect.PtInRect( *point ) )
-					{
-						// Yes, we did.
-						m_movingtab = t;
-
-						// Calc offset, as the hit area is wider than
-						// the 1 pixel tab line
-						m_offset = point->x - ( m_tabs[ t ] + m_margin - pos );
-					}
-				}
-
-				if( m_movingtab != -1 )
-				{
-
-					// We did click in a tab marker.
-					// Start dragging
-
-					// Find initial ruler position
-					m_rulerPosition = point->x - m_offset;
-					CRect rect;
-					GetClientRect( rect );
-
-					// Draw a new ruler line
-					CClientDC dc( this );
-					dc.SelectObject( &m_pen );
-					dc.SetROP2( R2_XORPEN );
-
-					dc.MoveTo( m_rulerPosition, toolbarHeight + 3 );
-					dc.LineTo( m_rulerPosition, rect.Height() );
-
-					dc.SelectStockObject( BLACK_PEN );
-
-				}
-			}
-			break;
-
-		case MOVE:
-			// The mouse is moved
-			{
-				if( m_movingtab != -1 )
-				{
-					CRect rect;
-					GetClientRect( rect );
-					CClientDC dc( this );
-
-					// Erase previous line
-					dc.SelectObject( &m_pen );
-					dc.SetROP2( R2_XORPEN );
-
-					dc.MoveTo( m_rulerPosition, toolbarHeight + 3 );
-					dc.LineTo( m_rulerPosition, rect.Height() );
-
-					// Set up new line
-					// Calc min and max. We can not place this marker 
-					// before the previous or after the next. Neither 
-					// can we move the marker outside the ruler.
-					int pos = m_rtf.GetScrollPos( SB_HORZ );
-					int min = m_margin + m_offset;
-					if( m_movingtab > 0 )
-						min = ( m_tabs[ m_movingtab - 1 ] + m_margin - pos ) + 3 + m_offset;
-
-					int max = rect.Width() - 5 + m_offset;
-					if( m_movingtab < m_tabs.GetUpperBound() )
-						max = ( m_tabs[ m_movingtab + 1 ] + m_margin - pos ) - 3 + m_offset;
-					max = min( max, rect.Width() - 5 + m_offset );
-
-					// Set new positions
-					m_rulerPosition = max( min, point->x - m_offset );
-					m_rulerPosition = min( m_rulerPosition, max );
-
-					// Draw the new line
-					dc.MoveTo( m_rulerPosition, toolbarHeight + 3 );
-					dc.LineTo( m_rulerPosition, rect.Height() );
-
-					dc.SelectStockObject( BLACK_PEN );
-
-				}
-			}
-			break;
-
-		case UP:
-			// The mouse button is released
-			{
-				if( m_movingtab != -1 )
-				{
-
-					// Set new value for tab position
-					int pos = m_rtf.GetScrollPos( SB_HORZ );
-					m_tabs[ m_movingtab ] = m_rulerPosition - m_margin + pos - m_offset;
-
-					// Get the current tabstops, as we
-					// must set all tabs in one operation
-					ParaFormat para( PFM_TABSTOPS );
-					para.cTabCount = MAX_TAB_STOPS;
-					m_rtf.GetParaFormat( para );
-
-					// Convert current position to twips
-					double twip = ( double )m_physicalInch / 1440;
-					int tabpos = m_tabs[ m_movingtab ];
-					tabpos = ( int ) ( ( double ) tabpos / twip +.5 );
-					para.rgxTabs[ m_movingtab ] = tabpos; 
-
-					// Set tabs to control
-					m_rtf.SetParaFormat( para );
-
-					// Erase the ruler
-					m_ruler.RedrawWindow();
-					m_rtf.RedrawWindow();
-
-					m_movingtab = -1;
-					m_rtf.SetFocus();
-
-				}
-			}
-			break;
-	}
-
-	return 0;
-
-}
-
 LRESULT CRulerRichEditCtrl::OnSetText( WPARAM wParam, LPARAM lParam )
 /* ============================================================
 	Function :		CRulerRichEditCtrl::OnSetText
@@ -1026,7 +860,7 @@ void CRulerRichEditCtrl::SetMode( int mode )
    ============================================================*/
 {
 
-	m_ruler.SetMode( mode );
+	//m_ruler.SetMode( mode );
 
 }
 
@@ -1046,7 +880,8 @@ int CRulerRichEditCtrl::GetMode() const
    ============================================================*/
 {
 
-	return m_ruler.GetMode();
+	return 0;
+	//return m_ruler.GetMode();
 
 }
 
@@ -1121,9 +956,35 @@ void CRulerRichEditCtrl::OnButtonBold()
 
    ============================================================*/
 {
-
 	DoBold();
+}
+
+int CRulerRichEditCtrl::ToolbarIdPerDPI()
+{
+	int scale = m_dpi.Scale(100);
 
+	if (scale >= 225)
+	{
+		return IDR_EDIT_WND_FORMAT_225;
+	}
+	else if (scale >= 200)
+	{
+		return IDR_EDIT_WND_FORMAT_200;
+	}
+	else if (scale >= 175)
+	{
+		return IDR_EDIT_WND_FORMAT_175;
+	}
+	else if (scale >= 150)
+	{
+		return IDR_EDIT_WND_FORMAT_150;
+	}
+	else if (scale >= 125)
+	{
+		return IDR_EDIT_WND_FORMAT_125;
+	}
+	
+	return IDR_EDIT_WND_FORMAT;	
 }
 
 void CRulerRichEditCtrl::OnButtonWrap()
@@ -1308,7 +1169,7 @@ void CRulerRichEditCtrl::SetTabStops( LPLONG tabs, int size )
 
 	}
 
-	m_ruler.SetTabStops( m_tabs );
+	//m_ruler.SetTabStops( m_tabs );
 }
 
 void CRulerRichEditCtrl::UpdateTabStops()
@@ -1985,34 +1846,6 @@ void CRulerRichEditCtrl::ShowToolbar( BOOL show )
 	}
 }
 
-void CRulerRichEditCtrl::ShowRuler( BOOL show )
-/* ============================================================
-	Function :		CRulerRichEditCtrl::ShowRuler
-	Description :	Shows or hides the ruler
-	Access :		Public
-					
-	Return :		void
-	Parameters :	BOOL show	-	"TRUE" to show
-					
-	Usage :			Call to show or hide the ruler subcontrol
-
-   ============================================================*/
-{
-	m_showRuler = show;
-
-	if( m_hWnd )
-	{
-		if( show )
-			m_ruler.ShowWindow( SW_SHOW );
-		else
-			m_ruler.ShowWindow( SW_HIDE );
-
-		CRect rect;
-		GetClientRect( rect );
-		LayoutControls( rect.Width(), rect.Height() );
-	}
-}
-
 void CRulerRichEditCtrl::LayoutControls( int width, int height )
 /* ============================================================
 	Function :		CRulerRichEditCtrl::LayoutControls
@@ -2030,15 +1863,11 @@ void CRulerRichEditCtrl::LayoutControls( int width, int height )
 {
 	int toolbarHeight = 0;
 	if( m_showToolbar )
-		toolbarHeight = TOOLBAR_HEIGHT;
-	int rulerHeight = 0;
-	if( m_showRuler )
-		rulerHeight = RULER_HEIGHT;
+		toolbarHeight = m_dpi.Scale(TOOLBAR_HEIGHT);
 
 	m_toolbar.MoveWindow( 0, 0, width, toolbarHeight );
-	m_ruler.MoveWindow( 0, toolbarHeight, width, rulerHeight );
 
-	int top = toolbarHeight + rulerHeight;
+	int top = toolbarHeight;
 	CRect rect( 0, top, width, height );
 	m_rtf.MoveWindow( rect );
 }
@@ -2059,22 +1888,6 @@ BOOL CRulerRichEditCtrl::IsToolbarVisible() const
 	return m_showToolbar;
 }
 
-BOOL CRulerRichEditCtrl::IsRulerVisible() const
-/* ============================================================
-	Function :		CRulerRichEditCtrl::IsRulerVisible
-	Description :	Returns if the ruler is visible or not
-	Access :		Public
-					
-	Return :		BOOL	-	"TRUE" if visible
-	Parameters :	none
-					
-	Usage :			Call to get the visibility of the ruler
-
-   ============================================================*/
-{
-	return m_showRuler;
-}
-
 void CRulerRichEditCtrl::SetReadOnly( BOOL readOnly )
 /* ============================================================
 	Function :		CRulerRichEditCtrl::SetReadOnly

+ 6 - 14
src/RulerRichEditCtrl/RulerRichEditCtrl.h

@@ -2,11 +2,8 @@
 #define AFX_RULERRICHEDITCTRL_H__4CD13283_82E4_484A_83B4_DBAD5B64F17C__INCLUDED_
 
 #include "RulerRichEdit.h"
-#include "RRECRuler.h"
 #include "RRECToolbar.h"
-
-#include "ids.h"
-
+#include "../DPI.h"
 #include "../RichEditCtrlEx.h"
 
 /////////////////////////////////////////////////////////////////////////////
@@ -53,10 +50,8 @@ public:
 	int		GetMode() const;
 
 	void ShowToolbar( BOOL show = TRUE );
-	void ShowRuler( BOOL show = TRUE );
 
 	BOOL IsToolbarVisible() const;
-	BOOL IsRulerVisible() const;
 
 	CRichEditCtrl& GetRichEditCtrl( );
 
@@ -70,6 +65,7 @@ public:
 
 	void SetReadOnly( BOOL readOnly );
 	BOOL GetReadOnly() const;
+	void OnDpiChanged(CWnd* pParent, int dpi);
 
 // Formatting
 	virtual void DoFont();
@@ -120,7 +116,6 @@ protected:
 	afx_msg void OnLink(NMHDR* pnm, LRESULT* pResult);
 	//}}AFX_MSG
 
-	LRESULT OnTrackRuler(WPARAM mode, LPARAM pt);
 	LRESULT OnGetScrollPos(WPARAM, LPARAM);
 	LRESULT OnSetCurrentFontName(WPARAM font, LPARAM size);
 	LRESULT OnSetCurrentFontSize(WPARAM font, LPARAM size);
@@ -130,9 +125,6 @@ protected:
 
 protected:
 	// Internal data
-	int				m_rulerPosition;	// The x-position of the ruler line when dragging a tab
-	CPen			m_pen;				// The pen to use for drawing the XORed ruler line
-
 	CDWordArray		m_tabs;				// An array containing the tab-positions in device pixels
 	int				m_margin;			// The margin to use for the ruler and buttons
 
@@ -141,22 +133,19 @@ protected:
 	int				m_offset;			// Internal offset of the tab-marker being moved.
 
 	BOOL			m_showToolbar;
-	BOOL			m_showRuler;
 	BOOL			m_readOnly;
 
 	BOOL			m_bInWrapMode;
 
 	// Sub-controls
 	CRulerRichEdit	m_rtf;
-	CRRECToolbar	m_toolbar;
-	CRRECRuler		m_ruler;
+	CRRECToolbar	m_toolbar;	
 
 	// Private helpers
 	void	SetTabStops( LPLONG tabs, int size );
 	void	UpdateTabStops();
 
 	BOOL	CreateToolbar();
-	BOOL	CreateRuler();
 	BOOL	CreateRTFControl( BOOL autohscroll );
 	void	CreateMargins();
 
@@ -166,6 +155,9 @@ protected:
 	void	SetAlignment( int alignment );
 
 	void	LayoutControls( int width, int height );
+	int		ToolbarIdPerDPI();
+
+	CDPI m_dpi;
 
 public:
 	virtual BOOL PreTranslateMessage(MSG* pMsg);

+ 0 - 59
src/RulerRichEditCtrl/ids.h

@@ -1,59 +0,0 @@
-//
-// Assorted defines and ids for the RulerRichEditCtrl
-//
-
-#ifndef _IDS_H_
-#define _IDS_H_
-
-// Some measures
-#define TOOLBAR_HEIGHT		28
-#define RULER_HEIGHT		26
-#define TOP_HEIGHT			RULER_HEIGHT + TOOLBAR_HEIGHT
-#define FONT_COMBO_WIDTH	128
-#define SIZE_COMBO_WIDTH	48
-#define COMBO_HEIGHT		128
-#define COMBO_WIDTH			48
-#define COLOR_WIDTH			64
-
-#define FONT_NAME_POS		2
-#define FONT_SIZE_POS		4
-#define FONT_COLOR_POS		6
-
-// Measures for the ruler
-#define MODE_INCH	0
-#define MODE_METRIC	1
-
-// ID of sub-controls
-#define TOOLBAR_CONTROL	10
-#define RULER_CONTROL	11
-#define RTF_CONTROL		12
-
-// Toolbar buttons
-#define BUTTON_FONT			20
-#define BUTTON_COLOR		21
-#define BUTTON_BOLD			22
-#define BUTTON_ITALIC		23
-#define BUTTON_UNDERLINE	24
-#define BUTTON_LEFTALIGN	25
-#define BUTTON_CENTERALIGN	26
-#define BUTTON_RIGHTALIGN	27
-#define BUTTON_INDENT		28
-#define BUTTON_OUTDENT		29
-#define BUTTON_BULLET		30
-
-#define DROPDOWN_FONT		31
-#define DROPDOWN_SIZE		32
-
-#define STRING_COLOR		33
-#define STRING_DEFAULT		34
-#define STRING_CUSTOM		35
-#define ID_BUTTONWRAP		36
-
-// Mouse handling
-extern UINT urm_RULERACTION;
-extern UINT urm_GETSCROLLPOS;
-#define UP		0
-#define DOWN	1
-#define MOVE	2
-
-#endif // _IDS_H_

+ 0 - 0
src/RulerRichEditCtrl/toolbar.bmp → src/RulerRichEditCtrl/toolbar1.bmp


+ 20 - 0
src/TabCtrl.cpp

@@ -119,7 +119,11 @@ BOOL CTabCtrlEx::Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT
 	}
 
 	if (bRet)
+	{
 		bRet = CWnd::Create(SHEET_CLASSNAME, _T(""), dwStyle, rect, pParentWnd, nID);
+	}
+
+	m_dpi.SetHwnd(m_hWnd);
 
 	return bRet;
 }
@@ -135,11 +139,27 @@ int CTabCtrlEx::OnCreate(LPCREATESTRUCT lpCreateStruct)
 	m_penGray.CreatePen(PS_SOLID, 1, RGB(172, 168, 153));
 	m_penBlack.CreatePen(PS_SOLID, 1, RGB(0, 0, 0));
 
+	m_nTabHeight = m_dpi.Scale(19);
+
 	SetTabHeight(m_nTabHeight);
 
 	return 0;
 }
 
+void CTabCtrlEx::OnDpiChanged(CWnd* pParent, int dpi)
+{
+	m_dpi.Update(dpi);
+
+	m_nTabHeight = m_dpi.Scale(19);
+
+	SetTabHeight(m_nTabHeight);
+
+	for (int iTab = 0; iTab < m_Tabs.GetSize(); iTab++)
+	{
+		m_Tabs[iTab].lWidth = GetTextWidth(m_Tabs[iTab].csTitle);
+	}
+}
+
 void CTabCtrlEx::SetTabHeight(int nTabHeight)
 {
 	m_nTabHeight = nTabHeight;

+ 4 - 0
src/TabCtrl.h

@@ -1,6 +1,7 @@
 #pragma once
 
 #include <afxtempl.h>
+#include "DPI.h"
 
 #define SHEET_CLASSNAME		_T("_TabCtrlClass_")
 #define SHEET_CLASSTYLE		(CS_DBLCLKS)
@@ -96,6 +97,8 @@ public:
 
 	void SetTabColors(COLORREF Selected, COLORREF NonSelected)	{ m_SelectedColor = Selected; m_NonSelectedColor = NonSelected;}
 
+	void OnDpiChanged(CWnd* pParent, int dpi);
+
 protected:
 	class CTab
 	{
@@ -132,6 +135,7 @@ protected:
 	bool m_bSetFocusToNewlySelectedTab;
 	COLORREF m_SelectedColor;
 	COLORREF m_NonSelectedColor;
+	CDPI m_dpi;
 
 	
 protected: