Parcourir la source

- fixed crash when displaying receive message when placing onto clipboard
- resize dialog paint fix
- show icon in windows for ctrl-tab
- min size for advanced options
- tooltip timeout of 0 turns off toolips

scott brogden il y a 8 ans
Parent
commit
e1902bee64
8 fichiers modifiés avec 55 ajouts et 20 suppressions
  1. 13 1
      AdvGeneral.cpp
  2. 1 0
      AdvGeneral.h
  3. 1 1
      CP_Main.rc
  4. 2 0
      DialogResizer.cpp
  5. 14 14
      MainFrmThread.cpp
  6. 2 2
      OptionsSheet.cpp
  7. 10 2
      QListCtrl.cpp
  8. 12 0
      QPasteWnd.cpp

+ 13 - 1
AdvGeneral.cpp

@@ -36,6 +36,7 @@ BEGIN_MESSAGE_MAP(CAdvGeneral, CDialogEx)
 	ON_BN_CLICKED(IDC_BT_COMPACT_AND_REPAIR, &CAdvGeneral::OnBnClickedBtCompactAndRepair)
 	ON_BN_CLICKED(IDC_BUTTON_COPY_SCRIPTS, &CAdvGeneral::OnBnClickedButtonCopyScripts)
 	ON_BN_CLICKED(IDC_BUTTON_PASTE_SCRIPTS, &CAdvGeneral::OnBnClickedButtonPasteScripts2)
+	ON_WM_GETMINMAXINFO()
 END_MESSAGE_MAP()
 
 
@@ -110,6 +111,8 @@ BOOL CAdvGeneral::OnInitDialog()
 {
 	CDialogEx::OnInitDialog();
 
+	SetIcon(CTrayNotifyIcon::LoadIcon(IDR_MAINFRAME), FALSE);
+
 	m_propertyGrid.ModifyStyle(0, WS_CLIPCHILDREN);
 
 	CMFCPropertyGridProperty * pGroupTest = new CMFCPropertyGridProperty( _T( "Ditto" ) );
@@ -177,7 +180,7 @@ BOOL CAdvGeneral::OnInitDialog()
 	
 	pGroupTest->AddSubItem(new CMFCPropertyGridProperty(_T("Text Lines per Clip"), CGetSetOptions::GetLinesPerRow(), _T(""), SETTING_LINES_PER_ROW));
 
-	pGroupTest->AddSubItem(new CMFCPropertyGridProperty(_T("Tooltip timeout(ms) max of 32000"), g_Opt.m_tooltipTimeout, _T(""), SETTING_TOOLTIP_TIMEOUT));
+	pGroupTest->AddSubItem(new CMFCPropertyGridProperty(_T("Tooltip display time(ms) max of 32000 (-1 default (5 seconds), 0 to turn off)"), g_Opt.m_tooltipTimeout, _T(""), SETTING_TOOLTIP_TIMEOUT));
 
 	AddTrueFalse(pGroupTest, _T("Transparency Enabled"), CGetSetOptions::GetEnableTransparency(), SETTING_ENABLE_TRANSPARENCY);
 	pGroupTest->AddSubItem(new CMFCPropertyGridProperty(_T("Transparency Percentage"), CGetSetOptions::GetTransparencyPercent(), _T(""), SETTING_TRANSPARENCY));
@@ -674,3 +677,12 @@ void CAdvGeneral::OnBnClickedButtonPasteScripts2()
 		CGetSetOptions::SetPasteScriptsXml(e.m_xml.Save());
 	}
 }
+
+
+void CAdvGeneral::OnGetMinMaxInfo(MINMAXINFO* lpMMI)
+{
+	lpMMI->ptMinTrackSize.x = 450;
+	lpMMI->ptMinTrackSize.y = 450;
+
+	CDialogEx::OnGetMinMaxInfo(lpMMI);
+}

+ 1 - 0
AdvGeneral.h

@@ -29,4 +29,5 @@ public:
 	afx_msg void OnBnClickedBtCompactAndRepair();
 	afx_msg void OnBnClickedButtonCopyScripts();
 	afx_msg void OnBnClickedButtonPasteScripts2();
+	afx_msg void OnGetMinMaxInfo(MINMAXINFO* lpMMI);
 };

+ 1 - 1
CP_Main.rc

@@ -962,7 +962,7 @@ END
 
 IDD_ADV_OPTIONS DIALOGEX 0, 0, 262, 268
 STYLE DS_SETFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
-CAPTION "Dialog"
+CAPTION "Advanced Options"
 FONT 10, "Segoe UI", 400, 0, 0x0
 BEGIN
     DEFPUSHBUTTON   "OK",IDOK,147,250,50,11

+ 2 - 0
DialogResizer.cpp

@@ -107,4 +107,6 @@ void CDialogResizer::MoveControls(CSize csNewSize)
 
 		::SetWindowPos(data.m_hWnd, NULL, rc.left, rc.top, rc.Width(), rc.Height(), SWP_NOACTIVATE | SWP_NOZORDER);
 	}
+
+	::RedrawWindow(m_hWndParent, NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN);
 }

+ 14 - 14
MainFrmThread.cpp

@@ -201,20 +201,6 @@ void CMainFrmThread::OnSaveRemoteClips()
 
 	//are we supposed to add this clip to the clipboard
 	CClip *pLastClip = pLocalClips->GetTail();
-	if(pLastClip && (pLastClip->m_param1 & REMOTE_CLIP_ADD_TO_CLIPBOARD))
-	{
-		LogSendRecieveInfo("---------OnSaveRemoteClips - Before Posting msg to main thread to set clipboard");
-
-		//set the clipboard on the main thread, i was having a problem with setting the clipboard on a thread
-		//guess it needs to be set on the main thread
-		//main window will clear this memory
-		PostMessage(theApp.m_MainhWnd, WM_LOAD_ClIP_ON_CLIPBOARD, (LPARAM)pLastClip, 0);
-
-		LogSendRecieveInfo("---------OnSaveRemoteClips - After Posting msg to main thread to set clipboard");
-
-		pLocalClips->RemoveTail();
-	}
-
 	if (CGetSetOptions::GetShowMsgWhenReceivingManualSentClip())
 	{
 		if (pLastClip && (pLastClip->m_param1 & REMOTE_CLIP_MANUAL_SEND))
@@ -228,6 +214,20 @@ void CMainFrmThread::OnSaveRemoteClips()
 		}
 	}
 
+	if(pLastClip && (pLastClip->m_param1 & REMOTE_CLIP_ADD_TO_CLIPBOARD))
+	{
+		LogSendRecieveInfo("---------OnSaveRemoteClips - Before Posting msg to main thread to set clipboard");
+
+		//set the clipboard on the main thread, i was having a problem with setting the clipboard on a thread
+		//guess it needs to be set on the main thread
+		//main window will clear this memory
+		PostMessage(theApp.m_MainhWnd, WM_LOAD_ClIP_ON_CLIPBOARD, (LPARAM)pLastClip, 0);
+
+		LogSendRecieveInfo("---------OnSaveRemoteClips - After Posting msg to main thread to set clipboard");
+
+		pLocalClips->RemoveTail();
+	}	
+
 	theApp.RefreshView();
 
 	delete pLocalClips;

+ 2 - 2
OptionsSheet.cpp

@@ -115,11 +115,11 @@ BOOL COptionsSheet::OnInitDialog()
 	m_bModeless = FALSE;   
 	m_nFlags |= WF_CONTINUEMODAL;
 
-	
+	SetIcon(CTrayNotifyIcon::LoadIcon(IDR_MAINFRAME), FALSE);	
 
 	BOOL bResult = CPropertySheet::OnInitDialog();
 
-	SetWindowText(_T("Ditto"));
+	SetWindowText(_T("Options"));
 
 	theApp.m_Language.UpdateOptionsSheet(this);
 

+ 10 - 2
QListCtrl.cpp

@@ -659,7 +659,7 @@ BOOL CQListCtrl::OnToolTipText( UINT id, NMHDR * pNMHDR, LRESULT * pResult )
 	
 	::SendMessage(pNMHDR->hwndFrom, TTM_SETMAXTIPWIDTH, 0, 500);
 
-	if (g_Opt.m_tooltipTimeout >= 0)
+	if (g_Opt.m_tooltipTimeout > 0)
 	{
 		::SendMessage(pNMHDR->hwndFrom, TTM_SETDELAYTIME, TTDT_AUTOPOP, MAKELPARAM(g_Opt.m_tooltipTimeout, 0));
 	}
@@ -756,7 +756,15 @@ int CQListCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct)
 	if (CListCtrl::OnCreate(lpCreateStruct) == -1)
 		return -1;
 	
-	EnableToolTips();
+	if (g_Opt.m_tooltipTimeout > 0 ||
+		g_Opt.m_tooltipTimeout == -1)
+	{
+		EnableToolTips();
+	}
+	else
+	{
+		EnableToolTips(FALSE);
+	}
 
 	m_pToolTip = new CToolTipEx;
 	m_pToolTip->Create(this);

+ 12 - 0
QPasteWnd.cpp

@@ -327,6 +327,8 @@ int CQPasteWnd::OnCreate(LPCREATESTRUCT lpCreateStruct)
         return -1;
     }
 
+	SetIcon(CTrayNotifyIcon::LoadIcon(IDR_MAINFRAME), FALSE);
+
 	//BOOL b = this->Register(this);
 
     SetWindowText(_T(QPASTE_TITLE));
@@ -4884,6 +4886,16 @@ LRESULT CQPasteWnd::OnPostOptions(WPARAM wParam, LPARAM lParam)
 
 	SetCurrentTransparency();
 
+	if (g_Opt.m_tooltipTimeout > 0 ||
+		g_Opt.m_tooltipTimeout == -1)
+	{
+		m_lstHeader.EnableToolTips();
+	}
+	else
+	{
+		m_lstHeader.EnableToolTips(FALSE);
+	}
+
 	return 1;
 }