Browse Source

- reset list count when dpi or rows per clip change, keeps list from drawing funning after these

scott brogden 8 years ago
parent
commit
92e334cdd8
4 changed files with 51 additions and 17 deletions
  1. 3 2
      CP_Main.vcxproj
  2. 3 0
      MainFrm.cpp
  3. 44 14
      QPasteWnd.cpp
  4. 1 1
      QPasteWnd.h

+ 3 - 2
CP_Main.vcxproj

@@ -261,6 +261,7 @@
       <MapFileName>.\Debug/Ditto.map</MapFileName>
       <MapExports>true</MapExports>
       <RegisterOutput>false</RegisterOutput>
+      <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
     </Link>
     <Midl>
       <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -300,7 +301,7 @@
       <ProgramDataBaseFileName>.\Debug64/</ProgramDataBaseFileName>
       <WarningLevel>Level3</WarningLevel>
       <SuppressStartupBanner>true</SuppressStartupBanner>
-      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
       <CompileAs>Default</CompileAs>
       <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
     </ClCompile>
@@ -317,7 +318,7 @@
       <MapFileName>.\Debug64/Ditto.map</MapFileName>
       <MapExports>true</MapExports>
       <TargetMachine>MachineX64</TargetMachine>
-      <AdditionalLibraryDirectories>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Lib\x64</AdditionalLibraryDirectories>
+      <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
       <RegisterOutput>false</RegisterOutput>
     </Link>
     <Midl>

+ 3 - 0
MainFrm.cpp

@@ -1365,6 +1365,9 @@ LRESULT CMainFrame::OnResolutionChange(WPARAM wParam, LPARAM lParam)
 	if (m_startupScreenWidth != GetScreenWidth() ||
 		m_startupScreenHeight != GetScreenHeight())
 	{
+		m_startupScreenWidth = GetScreenWidth();
+		m_startupScreenHeight = GetScreenHeight();
+
 		SetTimer(SCREEN_RESOLUTION_CHANGED, 1000, NULL);
 	}
 

+ 44 - 14
QPasteWnd.cpp

@@ -1829,31 +1829,46 @@ LRESULT CQPasteWnd::OnSearch(WPARAM wParam, LPARAM lParam)
 ///////////////////////////////////////////////////////////////////////
 void CQPasteWnd::OnMenuLinesperrow1()
 {
-    SetLinesPerRow(1, false);
+    SetLinesPerRow(1, false, true);
 }
 
 void CQPasteWnd::OnMenuLinesperrow2()
 {
-    SetLinesPerRow(2, false);
+    SetLinesPerRow(2, false, true);
 }
 
 void CQPasteWnd::OnMenuLinesperrow3()
 {
-    SetLinesPerRow(3, false);
+    SetLinesPerRow(3, false, true);
 }
 
 void CQPasteWnd::OnMenuLinesperrow4()
 {
-    SetLinesPerRow(4, false);
+    SetLinesPerRow(4, false, true);
 }
 
 void CQPasteWnd::OnMenuLinesperrow5()
 {
-    SetLinesPerRow(5, false);
+    SetLinesPerRow(5, false, true);
 }
 
-void CQPasteWnd::SetLinesPerRow(int lines, bool force)
+void CQPasteWnd::SetLinesPerRow(int lines, bool force, bool resetListCount)
 {
+	ARRAY Indexs;
+	int listCount = 0;
+
+	if (resetListCount)
+	{
+		//save and restore state, list box seems to pain funny (gap at header) if items are not reset
+		m_lstHeader.GetSelectionIndexes(Indexs);
+		if (Indexs.GetCount() <= 0)
+		{
+			Indexs.Add(0);
+		}
+		listCount = m_lstHeader.GetItemCount();
+		m_lstHeader.SetItemCountEx(0);
+	}
+
     CGetSetOptions::SetLinesPerRow(lines);
     m_lstHeader.SetNumberOfLinesPerRow(lines, force);
 
@@ -1864,7 +1879,12 @@ void CQPasteWnd::SetLinesPerRow(int lines, bool force)
 	m_cf_rtfCache.clear();
 	m_cf_NO_rtfCache.clear();
 
-    //FillList();
+	if (resetListCount)
+	{
+		m_lstHeader.SetItemCountEx(listCount);
+		m_lstHeader.SetListPos(Indexs[0]);
+		m_lstHeader.RefreshVisibleRows();
+	}
 }
 
 void CQPasteWnd::OnMenuTransparencyNone()
@@ -2488,7 +2508,7 @@ void CQPasteWnd::OnMenuQuickoptionsFont()
         CGetSetOptions::SetFont(*dlg.m_cf.lpLogFont);
 		(*dlg.m_cf.lpLogFont).lfHeight = m_DittoWindow.m_dpi.PointsToPixels((*dlg.m_cf.lpLogFont).lfHeight);
         m_lstHeader.SetLogFont(*dlg.m_cf.lpLogFont);
-		this->SetLinesPerRow(CGetSetOptions::GetLinesPerRow(), true);
+		this->SetLinesPerRow(CGetSetOptions::GetLinesPerRow(), true, true);
     }
 
     m_bHideWnd = true;
@@ -6637,6 +6657,15 @@ LRESULT CQPasteWnd::OnSearchFocused(WPARAM wParam, LPARAM lParam)
 
 LRESULT CQPasteWnd::OnDpiChanged(WPARAM wParam, LPARAM lParam)
 {
+	ARRAY Indexs;
+	m_lstHeader.GetSelectionIndexes(Indexs);
+	if (Indexs.GetCount() <= 0)
+	{
+		Indexs.Add(0);
+	}
+	int c = m_lstHeader.GetItemCount();
+	m_lstHeader.SetItemCountEx(0);
+
 	int dpi = HIWORD(wParam);	
 	m_DittoWindow.OnDpiChanged(this, dpi);
 		
@@ -6661,15 +6690,16 @@ LRESULT CQPasteWnd::OnDpiChanged(WPARAM wParam, LPARAM lParam)
 	m_lstHeader.OnDpiChanged();	
 
 	UpdateFont();
-	this->SetLinesPerRow(CGetSetOptions::GetLinesPerRow(), true);
+	this->SetLinesPerRow(CGetSetOptions::GetLinesPerRow(), true, false);
 		
 	MoveControls();
-
-	m_lstHeader.RefreshVisibleRows();
-
-	this->SetWindowPos(NULL, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER);
-
+	
+	m_lstHeader.SetItemCountEx(c);
+	m_lstHeader.SetListPos(Indexs[0]);
+	
+	InvalidateNc();
 	this->Invalidate();
+	m_lstHeader.RefreshVisibleRows();
 	this->RedrawWindow();
 
 	return TRUE;

+ 1 - 1
QPasteWnd.h

@@ -188,7 +188,7 @@ public:
     bool SaveDescription(int nItem, CString text);
 
     //Menu Items
-    void SetLinesPerRow(int lines, bool force);
+    void SetLinesPerRow(int lines, bool force, bool resetListCount);
     void SetTransparency(int percent);
     void OnUpdateLinesPerRow(CCmdUI *pCmdUI, int nValue);
     void OnUpdateTransparency(CCmdUI *pCmdUI, int nValue);