Browse Source

- Updates to QR code viewer
- Start of more special paste options, pass in class rather than individual options

git-svn-id: svn://svn.code.sf.net/p/ditto-cp/code/trunk@731 595ec19a-5cb4-439b-94a8-42fb3063c22c

sabrogden 11 years ago
parent
commit
d4566bf516
16 changed files with 109 additions and 82 deletions
  1. 2 0
      CP_Main.vcxproj
  2. 2 0
      CP_Main.vcxproj.filters
  3. 6 3
      GdiImageDrawer.cpp
  4. 1 1
      GdiImageDrawer.h
  5. 0 4
      Misc.cpp
  6. 4 6
      OleClipSource.cpp
  7. 2 2
      OleClipSource.h
  8. 4 6
      Options.cpp
  9. 2 2
      Options.h
  10. 1 2
      ProcessPaste.cpp
  11. 2 4
      ProcessPaste.h
  12. 30 36
      QPasteWnd.cpp
  13. 3 2
      QPasteWnd.h
  14. 13 14
      QRCodeViewer.cpp
  15. 22 0
      SpecialPasteOptions.cpp
  16. 15 0
      SpecialPasteOptions.h

+ 2 - 0
CP_Main.vcxproj

@@ -634,6 +634,7 @@
     <ClCompile Include="Shared\TextConvert.cpp" />
     <ClCompile Include="Shared\TextConvert.cpp" />
     <ClCompile Include="Shared\Tokenizer.cpp" />
     <ClCompile Include="Shared\Tokenizer.cpp" />
     <ClCompile Include="ShowTaskBarIcon.cpp" />
     <ClCompile Include="ShowTaskBarIcon.cpp" />
+    <ClCompile Include="SpecialPasteOptions.cpp" />
     <ClCompile Include="sqlite\CppSQLite3.cpp">
     <ClCompile Include="sqlite\CppSQLite3.cpp">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization>
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@@ -1860,6 +1861,7 @@
     <ClInclude Include="Shared\TextConvert.h" />
     <ClInclude Include="Shared\TextConvert.h" />
     <ClInclude Include="Shared\Tokenizer.h" />
     <ClInclude Include="Shared\Tokenizer.h" />
     <ClInclude Include="ShowTaskBarIcon.h" />
     <ClInclude Include="ShowTaskBarIcon.h" />
+    <ClInclude Include="SpecialPasteOptions.h" />
     <ClInclude Include="sqlite\sqlite3.h" />
     <ClInclude Include="sqlite\sqlite3.h" />
     <ClInclude Include="sqlite\sqlite3ext.h" />
     <ClInclude Include="sqlite\sqlite3ext.h" />
     <ClInclude Include="ToolTipEx.h" />
     <ClInclude Include="ToolTipEx.h" />

+ 2 - 0
CP_Main.vcxproj.filters

@@ -385,6 +385,7 @@
     <ClCompile Include="QRCodeViewer.cpp">
     <ClCompile Include="QRCodeViewer.cpp">
       <Filter>source</Filter>
       <Filter>source</Filter>
     </ClCompile>
     </ClCompile>
+    <ClCompile Include="SpecialPasteOptions.cpp" />
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <ClInclude Include="sqlite\CppSQLite3.h">
     <ClInclude Include="sqlite\CppSQLite3.h">
@@ -822,6 +823,7 @@
     <ClInclude Include="QRCodeViewer.h">
     <ClInclude Include="QRCodeViewer.h">
       <Filter>header</Filter>
       <Filter>header</Filter>
     </ClInclude>
     </ClInclude>
+    <ClInclude Include="SpecialPasteOptions.h" />
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="CP_Main.rc">
     <ResourceCompile Include="CP_Main.rc">

+ 6 - 3
GdiImageDrawer.cpp

@@ -49,10 +49,14 @@ BOOL CGdiImageDrawer::LoadStdImageDPI(UINT id96, UINT id120, UINT id144, UINT id
 	return ret;
 	return ret;
 }
 }
 
 
-void CGdiImageDrawer::Draw(CDC* pScreenDC, CWnd *pWnd, int posX, int posY, bool mouseHover, bool mouseDown)
+void CGdiImageDrawer::Draw(CDC* pScreenDC, CWnd *pWnd, int posX, int posY, bool mouseHover, bool mouseDown, int forceWidth, int forceHeight)
 {
 {
 	int width = m_pStdImage->m_pBitmap->GetWidth();
 	int width = m_pStdImage->m_pBitmap->GetWidth();
+	if (forceWidth != INT_MAX)
+		width = forceWidth;
 	int height = m_pStdImage->m_pBitmap->GetHeight();
 	int height = m_pStdImage->m_pBitmap->GetHeight();
+	if (forceHeight != INT_MAX)
+		height = forceHeight;
 
 
 	CRect rectWithBorder(posX, posY, posX + width, posY + height);
 	CRect rectWithBorder(posX, posY, posX + width, posY + height);
 
 
@@ -68,9 +72,8 @@ void CGdiImageDrawer::Draw(CDC* pScreenDC, CWnd *pWnd, int posX, int posY, bool
 	bmp.CreateCompatibleBitmap(&clDC, 1, 1);
 	bmp.CreateCompatibleBitmap(&clDC, 1, 1);
 	dcBk.SelectObject(&bmp);
 	dcBk.SelectObject(&bmp);
 	dcBk.BitBlt(0, 0, 1, 1, &clDC, rectWithBorder.left-1, rectWithBorder.top, SRCCOPY);
 	dcBk.BitBlt(0, 0, 1, 1, &clDC, rectWithBorder.left-1, rectWithBorder.top, SRCCOPY);
-	bmp.DeleteObject();
 	
 	
-	//pScreenDC->StretchBlt(rectWithBorder.left, rectWithBorder.top, rectWithBorder.Width(), rectWithBorder.Height(), &dcBk, 0, 0, 1, 1, SRCCOPY);
+	bmp.DeleteObject();		
 
 
 	//Draw the png file
 	//Draw the png file
 	if (mouseDown)
 	if (mouseDown)

+ 1 - 1
GdiImageDrawer.h

@@ -10,7 +10,7 @@ public:
 
 
 	BOOL LoadStdImage(UINT id, LPCTSTR pType);
 	BOOL LoadStdImage(UINT id, LPCTSTR pType);
 	BOOL LoadStdImageDPI(UINT id96, UINT id120, UINT id144, UINT id192, LPCTSTR pType);
 	BOOL LoadStdImageDPI(UINT id96, UINT id120, UINT id144, UINT id192, LPCTSTR pType);
-	void Draw(CDC* pScreenDC, CWnd *pWnd, int posX, int posY, bool mouseHover, bool mouseDown);
+	void Draw(CDC* pScreenDC, CWnd *pWnd, int posX, int posY, bool mouseHover, bool mouseDown, int forceWidth = INT_MAX, int forceHeight = INT_MAX);
 	BOOL LoadRaw(unsigned char* bitmapData, int imageSize);
 	BOOL LoadRaw(unsigned char* bitmapData, int imageSize);
 
 
 	UINT ImageWidth() { return m_pStdImage->m_pBitmap->GetWidth(); }
 	UINT ImageWidth() { return m_pStdImage->m_pBitmap->GetWidth(); }

+ 0 - 4
Misc.cpp

@@ -810,14 +810,12 @@ BOOL EnsureWindowVisible(CRect *pcrRect)
 	if(lDiff < 0)
 	if(lDiff < 0)
 	{
 	{
 		pcrRect->left += abs(lDiff);
 		pcrRect->left += abs(lDiff);
-		pcrRect->right += abs(lDiff);
 	}
 	}
 
 
 	//Right side
 	//Right side
 	lDiff = pcrRect->right - crMonitor.right;
 	lDiff = pcrRect->right - crMonitor.right;
 	if(lDiff > 0)
 	if(lDiff > 0)
 	{
 	{
-		pcrRect->left -= abs(lDiff);
 		pcrRect->right -= abs(lDiff);
 		pcrRect->right -= abs(lDiff);
 	}
 	}
 
 
@@ -826,14 +824,12 @@ BOOL EnsureWindowVisible(CRect *pcrRect)
 	if(lDiff < 0)
 	if(lDiff < 0)
 	{
 	{
 		pcrRect->top += abs(lDiff);
 		pcrRect->top += abs(lDiff);
-		pcrRect->bottom += abs(lDiff);
 	}
 	}
 
 
 	//Bottom
 	//Bottom
 	lDiff = pcrRect->bottom - crMonitor.bottom;
 	lDiff = pcrRect->bottom - crMonitor.bottom;
 	if(lDiff > 0)
 	if(lDiff > 0)
 	{
 	{
-		pcrRect->top -= abs(lDiff);
 		pcrRect->bottom -= abs(lDiff);
 		pcrRect->bottom -= abs(lDiff);
 	}
 	}
 
 

+ 4 - 6
OleClipSource.cpp

@@ -15,8 +15,6 @@ COleClipSource
 COleClipSource::COleClipSource()
 COleClipSource::COleClipSource()
 {
 {
 	m_bLoadedFormats = false;
 	m_bLoadedFormats = false;
-	m_bOnlyPaste_CF_TEXT = false;
-	m_pCustomPasteFormats = NULL;
 }
 }
 
 
 COleClipSource::~COleClipSource()
 COleClipSource::~COleClipSource()
@@ -47,9 +45,9 @@ BOOL COleClipSource::DoImmediateRender()
 
 
 	m_bLoadedFormats = true;
 	m_bLoadedFormats = true;
 
 
-	if(m_pCustomPasteFormats != NULL)
+	if(m_pasteOptions.m_pPasteFormats != NULL)
 	{
 	{
-		return PutFormatOnClipboard(m_pCustomPasteFormats) > 0;
+		return PutFormatOnClipboard(m_pasteOptions.m_pPasteFormats) > 0;
 	}
 	}
 	
 	
 	INT_PTR count = m_ClipIDs.GetSize();
 	INT_PTR count = m_ClipIDs.GetSize();
@@ -76,7 +74,7 @@ BOOL COleClipSource::DoImmediateRender()
 			bProcessedMult = TRUE;
 			bProcessedMult = TRUE;
 		}
 		}
 
 
-		if(m_bOnlyPaste_CF_TEXT == false)
+		if(m_pasteOptions.m_pasteAsPlainText == false)
 		{
 		{
 			CCF_HDropAggregator HDrop;
 			CCF_HDropAggregator HDrop;
 			if(m_ClipIDs.AggregateData(HDrop, CF_HDROP, g_Opt.m_bMultiPasteReverse))
 			if(m_ClipIDs.AggregateData(HDrop, CF_HDROP, g_Opt.m_bMultiPasteReverse))
@@ -106,7 +104,7 @@ BOOL COleClipSource::DoImmediateRender()
 		CClip clip;
 		CClip clip;
 		CClipFormats formats;
 		CClipFormats formats;
 
 
-		clip.LoadFormats(m_ClipIDs[0], m_bOnlyPaste_CF_TEXT);
+		clip.LoadFormats(m_ClipIDs[0], m_pasteOptions.m_pasteAsPlainText);
 		
 		
 		return PutFormatOnClipboard(&clip.m_Formats) > 0;
 		return PutFormatOnClipboard(&clip.m_Formats) > 0;
 	}		
 	}		

+ 2 - 2
OleClipSource.h

@@ -1,6 +1,7 @@
 #pragma once
 #pragma once
 
 
 #include "ClipIds.h"
 #include "ClipIds.h"
+#include "SpecialPasteOptions.h"
 
 
 /*------------------------------------------------------------------*\
 /*------------------------------------------------------------------*\
 	COleClipSource
 	COleClipSource
@@ -12,8 +13,7 @@ class COleClipSource : public COleDataSource
 public:
 public:
 	CClipIDs	m_ClipIDs;
 	CClipIDs	m_ClipIDs;
 	bool		m_bLoadedFormats;
 	bool		m_bLoadedFormats;
-	bool		m_bOnlyPaste_CF_TEXT;
-	CClipFormats *m_pCustomPasteFormats;
+	CSpecialPasteOptions m_pasteOptions;
 
 
 	COleClipSource();
 	COleClipSource();
 	virtual ~COleClipSource();
 	virtual ~COleClipSource();

+ 4 - 6
Options.cpp

@@ -2154,14 +2154,12 @@ CString	CGetSetOptions::GetDiffApp()
 	return GetProfileString(_T("DiffApp"), _T(""));
 	return GetProfileString(_T("DiffApp"), _T(""));
 }
 }
 
 
-void CGetSetOptions::SetQRCodeBorderPercent(double val)
+void CGetSetOptions::SetQRCodeBorderPixels(int val)
 {
 {
-	SetProfileLong(_T("QRCodeBorderPercent"), (int)val);
+	SetProfileLong(_T("QRCodeBorderPixels"), val);
 }
 }
 
 
-double CGetSetOptions::GetQRCodeBorderPercent()
+int CGetSetOptions::GetQRCodeBorderPixels()
 {
 {
-	int val = GetProfileLong(_T("QRCodeBorderPercent"), 25);
-
-	return val / 100.0;
+	return GetProfileLong(_T("QRCodeBorderPixels"), 30);
 }
 }

+ 2 - 2
Options.h

@@ -461,8 +461,8 @@ public:
 	static void		SetDiffApp(CString val);
 	static void		SetDiffApp(CString val);
 	static CString	GetDiffApp();
 	static CString	GetDiffApp();
 
 
-	static void		SetQRCodeBorderPercent(double val);
-	static double	GetQRCodeBorderPercent();
+	static void		SetQRCodeBorderPixels(int val);
+	static int	GetQRCodeBorderPixels();
 };
 };
 
 
 // global for easy access and for initialization of fast access variables
 // global for easy access and for initialization of fast access variables

+ 1 - 2
ProcessPaste.cpp

@@ -14,7 +14,6 @@ CProcessPaste::CProcessPaste()
 	m_pOle = new COleClipSource;
 	m_pOle = new COleClipSource;
 	m_bSendPaste = true;
 	m_bSendPaste = true;
 	m_bActivateTarget = true;
 	m_bActivateTarget = true;
-	m_bOnlyPaste_CF_TEXT = false;
 	m_pastedFromGroup = false;
 	m_pastedFromGroup = false;
 }
 }
 
 
@@ -25,7 +24,7 @@ CProcessPaste::~CProcessPaste()
 
 
 BOOL CProcessPaste::DoPaste()
 BOOL CProcessPaste::DoPaste()
 {
 {
-	m_pOle->m_bOnlyPaste_CF_TEXT = m_bOnlyPaste_CF_TEXT;
+	m_pOle->m_pasteOptions = m_pasteOptions;
 
 
 	if(m_pOle->DoImmediateRender())
 	if(m_pOle->DoImmediateRender())
 	{
 	{

+ 2 - 4
ProcessPaste.h

@@ -13,7 +13,7 @@
 #include "Clip.h"
 #include "Clip.h"
 #include "ClipIds.h"
 #include "ClipIds.h"
 #include "OleClipSource.h"
 #include "OleClipSource.h"
-
+#include "SpecialPasteOptions.h"
 
 
 /*------------------------------------------------------------------*\
 /*------------------------------------------------------------------*\
 	CProcessPaste
 	CProcessPaste
@@ -24,7 +24,7 @@ public:
 	COleClipSource*	m_pOle;
 	COleClipSource*	m_pOle;
 	bool m_bSendPaste;
 	bool m_bSendPaste;
 	bool m_bActivateTarget;
 	bool m_bActivateTarget;
-	bool m_bOnlyPaste_CF_TEXT;
+	CSpecialPasteOptions m_pasteOptions;
 	bool m_pastedFromGroup;
 	bool m_pastedFromGroup;
 
 
 	struct MarkAsPastedData 
 	struct MarkAsPastedData 
@@ -43,8 +43,6 @@ public:
 
 
 	void MarkAsPasted();
 	void MarkAsPasted();
 	static UINT MarkAsPastedThread(LPVOID pParam);
 	static UINT MarkAsPastedThread(LPVOID pParam);
-
-	void SetCustomPasteFormats(CClipFormats *pFormats) { m_pOle->m_pCustomPasteFormats = pFormats; }
 };
 };
 
 
 #endif // !defined(AFX_PROCESSPASTE_H__185CBB6F_4B63_4397_8FF9_E18D777DA506__INCLUDED_)
 #endif // !defined(AFX_PROCESSPASTE_H__185CBB6F_4B63_4397_8FF9_E18D777DA506__INCLUDED_)

+ 30 - 36
QPasteWnd.cpp

@@ -662,11 +662,11 @@ bool CQPasteWnd::Add(const CString &csHeader, const CString &csText, int nID)
     return true;
     return true;
 }
 }
 
 
-BOOL CQPasteWnd::OpenID(int id, bool bOnlyLoad_CF_TEXT, CClipFormats *pPasteFormats)
+BOOL CQPasteWnd::OpenID(int id, CSpecialPasteOptions pasteOptions)
 {
 {
-    Log(StrF(_T("Start OpenId, Id: %d, Only CF_TEXT: %d"), id, bOnlyLoad_CF_TEXT));
+	Log(StrF(_T("Start OpenId, Id: %d, Only CF_TEXT: %s"), id, pasteOptions.ToString()));
 
 
-    if(pPasteFormats == NULL)
+    if(pasteOptions.m_pPasteFormats == NULL)
     {
     {
         if(theApp.EnterGroupID(id, FALSE, FALSE))
         if(theApp.EnterGroupID(id, FALSE, FALSE))
         {
         {
@@ -675,27 +675,15 @@ BOOL CQPasteWnd::OpenID(int id, bool bOnlyLoad_CF_TEXT, CClipFormats *pPasteForm
         }
         }
     }
     }
 
 
-    if(GetKeyState(VK_SHIFT) &0x8000)
-    {
-        Log(_T("Shift key is down, pasting CF_TEXT only"));
-        bOnlyLoad_CF_TEXT = true;
-    }
-
     // else, it is a clip, so paste it
     // else, it is a clip, so paste it
     CProcessPaste paste;
     CProcessPaste paste;
 
 
     paste.m_bSendPaste = g_Opt.m_bSendPasteMessageAfterSelection == TRUE ? true : false;
     paste.m_bSendPaste = g_Opt.m_bSendPasteMessageAfterSelection == TRUE ? true : false;
-    paste.m_bOnlyPaste_CF_TEXT = bOnlyLoad_CF_TEXT;
+	paste.m_pasteOptions = pasteOptions;
 	paste.m_pastedFromGroup = (theApp.m_GroupID > 0);
 	paste.m_pastedFromGroup = (theApp.m_GroupID > 0);
 
 
-    if(pPasteFormats != NULL)
-    {
-        paste.SetCustomPasteFormats(pPasteFormats);
-    }
-    else
-    {
-        paste.GetClipIDs().Add(id);
-    }
+    paste.GetClipIDs().Add(id);
+    
     paste.DoPaste();
     paste.DoPaste();
     theApp.OnPasteCompleted();
     theApp.OnPasteCompleted();
 
 
@@ -709,12 +697,12 @@ BOOL CQPasteWnd::OpenID(int id, bool bOnlyLoad_CF_TEXT, CClipFormats *pPasteForm
         MinMaxWindow(FORCE_MIN);
         MinMaxWindow(FORCE_MIN);
     }
     }
 
 
-    Log(StrF(_T("End OpenId, Id: %d, Only CF_TEXT: %d"), id, bOnlyLoad_CF_TEXT));
+	Log(StrF(_T("End OpenId, Id: %d, Only CF_TEXT: %s"), id, pasteOptions.ToString()));
 
 
     return TRUE;
     return TRUE;
 }
 }
 
 
-BOOL CQPasteWnd::OpenSelection(bool bOnlyLoad_CF_TEXT)
+BOOL CQPasteWnd::OpenSelection(CSpecialPasteOptions pasteOptions)
 {
 {
     Log(_T("Start Open Selection"));
     Log(_T("Start Open Selection"));
     ARRAY IDs;
     ARRAY IDs;
@@ -729,18 +717,13 @@ BOOL CQPasteWnd::OpenSelection(bool bOnlyLoad_CF_TEXT)
 
 
     if(count == 1)
     if(count == 1)
     {
     {
-        return OpenID(IDs[0], bOnlyLoad_CF_TEXT);
-    }
-
-    if(GetKeyState(VK_SHIFT) &0x8000)
-    {
-        bOnlyLoad_CF_TEXT = true;
+		return OpenID(IDs[0], pasteOptions);
     }
     }
 
 
     CProcessPaste paste;
     CProcessPaste paste;
 
 
     paste.m_bSendPaste = g_Opt.m_bSendPasteMessageAfterSelection == TRUE ? true : false;
     paste.m_bSendPaste = g_Opt.m_bSendPasteMessageAfterSelection == TRUE ? true : false;
-    paste.m_bOnlyPaste_CF_TEXT = bOnlyLoad_CF_TEXT;
+	paste.m_pasteOptions = pasteOptions;
 	paste.m_pastedFromGroup = (theApp.m_GroupID > 0);
 	paste.m_pastedFromGroup = (theApp.m_GroupID > 0);
 
 
     paste.GetClipIDs().Copy(IDs);
     paste.GetClipIDs().Copy(IDs);
@@ -763,7 +746,8 @@ BOOL CQPasteWnd::OpenSelection(bool bOnlyLoad_CF_TEXT)
 
 
 BOOL CQPasteWnd::OpenIndex(int item)
 BOOL CQPasteWnd::OpenIndex(int item)
 {
 {
-    return OpenID(m_lstHeader.GetItemData(item));
+	CSpecialPasteOptions pasteOptions;
+    return OpenID(m_lstHeader.GetItemData(item), pasteOptions);
 }
 }
 
 
 BOOL CQPasteWnd::NewGroup(bool bGroupSelection)
 BOOL CQPasteWnd::NewGroup(bool bGroupSelection)
@@ -814,7 +798,8 @@ BOOL CQPasteWnd::NewGroup(bool bGroupSelection)
 
 
 LRESULT CQPasteWnd::OnListSelect_DB_ID(WPARAM wParam, LPARAM lParam)
 LRESULT CQPasteWnd::OnListSelect_DB_ID(WPARAM wParam, LPARAM lParam)
 {
 {
-    OpenID((int)wParam);
+	CSpecialPasteOptions pasteOptions;
+	OpenID((int) wParam, pasteOptions);
     return TRUE;
     return TRUE;
 }
 }
 
 
@@ -832,7 +817,8 @@ LRESULT CQPasteWnd::OnListSelect_Index(WPARAM wParam, LPARAM lParam)
 
 
 LRESULT CQPasteWnd::OnListSelect(WPARAM wParam, LPARAM lParam)
 LRESULT CQPasteWnd::OnListSelect(WPARAM wParam, LPARAM lParam)
 {
 {
-    OpenSelection(false);
+	CSpecialPasteOptions pasteOptions;
+    OpenSelection(pasteOptions);
 
 
     return TRUE;
     return TRUE;
 }
 }
@@ -3069,7 +3055,8 @@ bool CQPasteWnd::DoActionPasteSelected()
 {
 {
 	if(::GetFocus() == m_lstHeader.GetSafeHwnd())
 	if(::GetFocus() == m_lstHeader.GetSafeHwnd())
 	{
 	{
-		OpenSelection(false);
+		CSpecialPasteOptions pasteOptions;
+		OpenSelection(pasteOptions);
 		return true;
 		return true;
 	}
 	}
 
 
@@ -3150,7 +3137,8 @@ bool CQPasteWnd::DoActionClipProperties()
 
 
 			if(props.m_lGroupChangedTo >= 0)
 			if(props.m_lGroupChangedTo >= 0)
 			{
 			{
-				OpenID(props.m_lGroupChangedTo);
+				CSpecialPasteOptions pasteOptions;
+				OpenID(props.m_lGroupChangedTo, pasteOptions);
 			}
 			}
 
 
 			m_lstHeader.SetFocus();
 			m_lstHeader.SetFocus();
@@ -3168,7 +3156,9 @@ bool CQPasteWnd::DoActionPasteSelectedPlainText()
 {
 {
 	if(::GetFocus() == m_lstHeader.GetSafeHwnd())
 	if(::GetFocus() == m_lstHeader.GetSafeHwnd())
 	{
 	{
-		OpenSelection(true);
+		CSpecialPasteOptions pasteOptions;
+		pasteOptions.m_pasteAsPlainText = true;			
+		OpenSelection(pasteOptions);
 		return true;
 		return true;
 	}
 	}
 
 
@@ -3949,7 +3939,8 @@ LRESULT CQPasteWnd::OnGroupTreeMessage(WPARAM wParam, LPARAM lParam)
         bool bItWas = theApp.m_bAsynchronousRefreshView;
         bool bItWas = theApp.m_bAsynchronousRefreshView;
         theApp.m_bAsynchronousRefreshView = false;
         theApp.m_bAsynchronousRefreshView = false;
 
 
-        OpenID(id);
+		CSpecialPasteOptions pasteOptions;
+        OpenID(id, pasteOptions);
 
 
         theApp.m_bAsynchronousRefreshView = bItWas;
         theApp.m_bAsynchronousRefreshView = bItWas;
 
 
@@ -4311,7 +4302,8 @@ void CQPasteWnd::OnTimer(UINT_PTR nIDEvent)
         if(m_bModifersMoveActive)
         if(m_bModifersMoveActive)
         {
         {
             Log(_T("Open Selection\n"));
             Log(_T("Open Selection\n"));
-            OpenSelection(false);
+			CSpecialPasteOptions pasteOptions;
+            OpenSelection(pasteOptions);
         }
         }
         else
         else
         {
         {
@@ -4338,7 +4330,9 @@ void CQPasteWnd::OnAddinSelect(UINT idIn)
                 bool bCont = theApp.m_Addins.CallPrePasteFunction(idIn, &clip);
                 bool bCont = theApp.m_Addins.CallPrePasteFunction(idIn, &clip);
                 if(bCont)
                 if(bCont)
                 {
                 {
-                    OpenID(-1, false, &clip.m_Formats);
+					CSpecialPasteOptions pasteOptions;
+					pasteOptions.m_pPasteFormats = &clip.m_Formats;
+                    OpenID(-1, pasteOptions);
                 }
                 }
             }
             }
         }
         }

+ 3 - 2
QPasteWnd.h

@@ -15,6 +15,7 @@
 #include "QPasteWndThread.h"
 #include "QPasteWndThread.h"
 #include "editwithbutton.h"
 #include "editwithbutton.h"
 #include "GdipButton.h"
 #include "GdipButton.h"
+#include "SpecialPasteOptions.h"
 
 
 class CMainTable
 class CMainTable
 {
 {
@@ -169,8 +170,8 @@ public:
 
 
     void DeleteSelectedRows();
     void DeleteSelectedRows();
 
 
-    BOOL OpenID(int id, bool bOnlyLoad_CF_TEXT = false, CClipFormats *pPasteFormats = NULL);
-    BOOL OpenSelection(bool bOnlyLoad_CF_TEXT = false);
+	BOOL OpenID(int id, CSpecialPasteOptions pasteOptions);
+	BOOL OpenSelection(CSpecialPasteOptions pasteOptions);
     BOOL OpenIndex(int item);
     BOOL OpenIndex(int item);
     BOOL NewGroup(bool bGroupSelection = true);
     BOOL NewGroup(bool bGroupSelection = true);
 
 

+ 13 - 14
QRCodeViewer.cpp

@@ -55,9 +55,7 @@ BOOL QRCodeViewer::CreateEx(CWnd *pParentWnd, unsigned char* bitmapData, int ima
 		BOOL r = m_desc.Create(CMainTableFunctions::GetDisplayText(g_Opt.m_nLinesPerRow, desc), WS_CHILD|WS_VISIBLE, CRect(0,0,0,0), this, 2);
 		BOOL r = m_desc.Create(CMainTableFunctions::GetDisplayText(g_Opt.m_nLinesPerRow, desc), WS_CHILD|WS_VISIBLE, CRect(0,0,0,0), this, 2);
 
 
 		m_font.CreateFontIndirect(&logFont);
 		m_font.CreateFontIndirect(&logFont);
-
-		m_desc.SetFont(&m_font);
-	
+		m_desc.SetFont(&m_font);	
 
 
 		m_DittoWindow.DoCreate(this);
 		m_DittoWindow.DoCreate(this);
 		m_DittoWindow.SetCaptionColors(g_Opt.m_Theme.CaptionLeft(), g_Opt.m_Theme.CaptionRight());
 		m_DittoWindow.SetCaptionColors(g_Opt.m_Theme.CaptionLeft(), g_Opt.m_Theme.CaptionRight());
@@ -78,14 +76,13 @@ BOOL QRCodeViewer::CreateEx(CWnd *pParentWnd, unsigned char* bitmapData, int ima
 		rect.left = parentRect.left;
 		rect.left = parentRect.left;
 		rect.top = parentRect.top;
 		rect.top = parentRect.top;
 
 
-		int imageWidthWithExtra = m_qrCodeDrawer.ImageWidth() + (m_qrCodeDrawer.ImageWidth() * CGetSetOptions::GetQRCodeBorderPercent());
-		int imageHeightWithExtra = m_qrCodeDrawer.ImageHeight() + (m_qrCodeDrawer.ImageHeight() * CGetSetOptions::GetQRCodeBorderPercent());
-
-		rect.right = rect.left + imageWidthWithExtra + m_DittoWindow.m_lLeftBorder + m_DittoWindow.m_lRightBorder;
-		rect.bottom = rect.top + imageHeightWithExtra + m_DittoWindow.m_lTopBorder + m_DittoWindow.m_lBottomBorder + rowHeight + 10;	
-
+		rect.right = rect.left + m_DittoWindow.m_lLeftBorder + m_DittoWindow.m_lRightBorder + m_qrCodeDrawer.ImageWidth() + (CGetSetOptions::GetQRCodeBorderPixels() * 2);
+		rect.bottom = rect.top + m_DittoWindow.m_lTopBorder + m_DittoWindow.m_lBottomBorder + rowHeight + 5 + m_qrCodeDrawer.ImageHeight() + (CGetSetOptions::GetQRCodeBorderPixels() * 2);
+		
 		CRect center = CenterRect(rect);
 		CRect center = CenterRect(rect);
 
 
+		EnsureWindowVisible(&center);
+
 		::MoveWindow(m_hWnd, center.left, center.top, center.Width(), center.Height(), TRUE);
 		::MoveWindow(m_hWnd, center.left, center.top, center.Width(), center.Height(), TRUE);
 
 
 		MoveControls();
 		MoveControls();
@@ -130,15 +127,17 @@ void QRCodeViewer::OnPaint()
 
 
 	CRect thisRect;
 	CRect thisRect;
 	GetClientRect(thisRect);
 	GetClientRect(thisRect);
-
-	int width = m_qrCodeDrawer.ImageWidth();
-	int height = m_qrCodeDrawer.ImageHeight();
-
+	thisRect.bottom -= m_descRowHeight - 5;
+	
+	int width = thisRect.Width() - (CGetSetOptions::GetQRCodeBorderPixels() * 2);
+	int height = min(width, (thisRect.Height() - (CGetSetOptions::GetQRCodeBorderPixels() * 2)));
+	width = min(width, height);
+		
 	CRect imageRect(0, 0, width, height);
 	CRect imageRect(0, 0, width, height);
 
 
 	CRect centerRect = CenterRectFromRect(imageRect, thisRect);
 	CRect centerRect = CenterRectFromRect(imageRect, thisRect);
 
 
-	m_qrCodeDrawer.Draw(&dc, this, centerRect.left, centerRect.top, false, false);
+	m_qrCodeDrawer.Draw(&dc, this, centerRect.left, centerRect.top, false, false, width, height);
 }
 }
 
 
 BOOL QRCodeViewer::PreTranslateMessage(MSG *pMsg)
 BOOL QRCodeViewer::PreTranslateMessage(MSG *pMsg)

+ 22 - 0
SpecialPasteOptions.cpp

@@ -0,0 +1,22 @@
+#include "stdafx.h"
+#include "SpecialPasteOptions.h"
+
+
+CSpecialPasteOptions::CSpecialPasteOptions()
+{
+	m_pasteAsPlainText = false;
+	m_pPasteFormats = NULL;
+}
+
+
+CSpecialPasteOptions::~CSpecialPasteOptions()
+{
+}
+
+CString CSpecialPasteOptions::ToString()
+{
+	CString cs;
+	cs.Format(_T("Plain Text: %d"), m_pasteAsPlainText);
+
+	return cs;
+}

+ 15 - 0
SpecialPasteOptions.h

@@ -0,0 +1,15 @@
+#pragma once
+#include "Clip.h"
+
+class CSpecialPasteOptions
+{
+public:
+	CSpecialPasteOptions();
+	~CSpecialPasteOptions();
+
+	bool m_pasteAsPlainText;
+	CClipFormats *m_pPasteFormats;
+
+	CString ToString();
+};
+