summaryrefslogtreecommitdiff
path: root/plugins/SendScreenshotPlus
diff options
context:
space:
mode:
authorRené Schümann <white06tiger@gmail.com>2013-11-17 03:10:46 +0000
committerRené Schümann <white06tiger@gmail.com>2013-11-17 03:10:46 +0000
commitc50e0d6ea54555bc0e90639bead7585ee326f125 (patch)
treeb087342a9ab69f5fa654022ae6eda9e7d2d197a6 /plugins/SendScreenshotPlus
parent6fa0da6963dbb19d5f3038b6037f4e6da686778d (diff)
Version 0.8.3
+ added basic Hotkey support (only opens SendSS+) * minor speed up for window targeting git-svn-id: http://svn.miranda-ng.org/main/trunk@6928 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/SendScreenshotPlus')
-rw-r--r--plugins/SendScreenshotPlus/src/Main.cpp16
-rw-r--r--plugins/SendScreenshotPlus/src/UMainForm.cpp34
-rw-r--r--plugins/SendScreenshotPlus/src/UMainForm.h63
-rw-r--r--plugins/SendScreenshotPlus/src/version.h2
4 files changed, 70 insertions, 45 deletions
diff --git a/plugins/SendScreenshotPlus/src/Main.cpp b/plugins/SendScreenshotPlus/src/Main.cpp
index 8f075e2af1..4b0a73d45a 100644
--- a/plugins/SendScreenshotPlus/src/Main.cpp
+++ b/plugins/SendScreenshotPlus/src/Main.cpp
@@ -25,6 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "global.h"
+#include <m_hotkeys.h>
// Prototypes ///////////////////////////////////////////////////////////////////////////
//LIST_INTERFACE li;
@@ -106,6 +107,17 @@ extern "C" __declspec(dllexport) int Load(void)
RegisterServices();
AddMenuItems();
+
+ //hotkey's
+ HOTKEYDESC hkd={sizeof(hkd)};
+ hkd.pszName="Open SendSS+";
+ hkd.ptszDescription=LPGENT("Open SendSS+");
+ hkd.ptszSection=L"SendSS+";
+ hkd.pszService=MS_SENDSS_OPENDIALOG;
+ //hkd.DefHotKey=HOTKEYCODE(HOTKEYF_CONTROL, VK_F10) | HKF_MIRANDA_LOCAL;
+ hkd.lParam=0xFFFF;
+ hkd.dwFlags = HKD_TCHAR;
+ Hotkey_Register(&hkd);
HBRUSH brush=CreateSolidBrush(0x0000FF00);//owned by class
WNDCLASS wndclass={CS_HREDRAW|CS_VREDRAW,DefWindowProc,0,0,hInst,NULL,NULL,brush,NULL,L"SendSSHighlighter"};
@@ -140,6 +152,7 @@ int hook_ModulesLoaded(WPARAM, LPARAM)
extern "C" __declspec(dllexport) int Unload(void)
{//as "ghazan" says, it's useless to unregister services or unhook events, let's still do it for now :P
+ CallService(MS_HOTKEY_UNREGISTER,0,(LPARAM)"Open SendSS+");
UnRegisterServices();
if(g_hookModulesLoaded) UnhookEvent(g_hookModulesLoaded),g_hookModulesLoaded=0;
if(g_hookSystemPreShutdown) UnhookEvent(g_hookSystemPreShutdown),g_hookSystemPreShutdown=0;
@@ -226,6 +239,9 @@ INT_PTR service_OpenCaptureDialog(WPARAM wParam, LPARAM lParam){
}
frmMain->Init(pszPath,(HANDLE)wParam);
mir_free(pszPath);
+ if(lParam==0xFFFF){
+ frmMain->SetTargetWindow(NULL);
+ }
frmMain->Show();
return 0;
}
diff --git a/plugins/SendScreenshotPlus/src/UMainForm.cpp b/plugins/SendScreenshotPlus/src/UMainForm.cpp
index 0acb1fd32d..68b72824fb 100644
--- a/plugins/SendScreenshotPlus/src/UMainForm.cpp
+++ b/plugins/SendScreenshotPlus/src/UMainForm.cpp
@@ -467,6 +467,27 @@ void TfrmMain::wmClose(WPARAM wParam, LPARAM lParam) {
//WM_TIMER:
const int g_iTargetBorder=7;
+void TfrmMain::SetTargetWindow(HWND hwnd){
+ if(!hwnd){
+ POINT point; GetCursorPos(&point);
+ hwnd=WindowFromPoint(point);
+// if(!((GetAsyncKeyState(VK_SHIFT)|GetAsyncKeyState(VK_MENU))&0x8000))
+ for(HWND hTMP; (hTMP=GetParent(hwnd)); hwnd=hTMP);
+ }
+ m_hTargetWindow=hwnd;
+ int len=GetWindowTextLength(m_hTargetWindow)+1;
+ LPTSTR lpTitle;
+ if(len>1){
+ lpTitle=(LPTSTR)mir_alloc(len*sizeof(TCHAR));
+ GetWindowText(m_hTargetWindow,lpTitle,len);
+ }else{//no WindowText present, use WindowClass
+ lpTitle=(LPTSTR)mir_alloc(64*sizeof(TCHAR));
+ RealGetWindowClass(m_hTargetWindow,lpTitle,64);
+ }
+ SetDlgItemText(m_hwndTabPage,ID_edtCaption,lpTitle);
+ mir_free(lpTitle);
+ edtSizeUpdate(m_hTargetWindow,m_opt_chkClientArea,m_hwndTabPage,ID_edtSize);
+}
void TfrmMain::wmTimer(WPARAM wParam, LPARAM lParam){
if (wParam == ID_bvlTarget){// Timer for Target selector
static int primarymouse;
@@ -482,6 +503,7 @@ void TfrmMain::wmTimer(WPARAM wParam, LPARAM lParam){
KillTimer(m_hWnd,ID_bvlTarget);
SystemParametersInfo(SPI_SETCURSORS,0,NULL,0);
DestroyWindow(m_hTargetHighlighter),m_hTargetHighlighter=NULL;
+ SetTargetWindow(m_hTargetWindow);
Show();
return;
}
@@ -505,18 +527,6 @@ void TfrmMain::wmTimer(WPARAM wParam, LPARAM lParam){
}else SetWindowRgn(m_hTargetHighlighter,NULL,FALSE);
}
SetWindowPos(m_hTargetHighlighter,HWND_TOPMOST,rect.left,rect.top,width,height,SWP_SHOWWINDOW|SWP_NOACTIVATE);
- width=GetWindowTextLength(m_hTargetWindow)+1;
- LPTSTR lpTitle;
- if(width>1){
- lpTitle=(LPTSTR)mir_alloc(width*sizeof(TCHAR));
- GetWindowText(m_hTargetWindow,lpTitle,width);
- }else{//no WindowText present, use WindowClass
- lpTitle=(LPTSTR)mir_alloc(64*sizeof(TCHAR));
- RealGetWindowClass(m_hTargetWindow,lpTitle,64);
- }
- SetDlgItemText(m_hwndTabPage,ID_edtCaption,lpTitle);
- mir_free(lpTitle);
- edtSizeUpdate(m_hTargetWindow,m_opt_chkClientArea,m_hwndTabPage,ID_edtSize);
}
return;
}
diff --git a/plugins/SendScreenshotPlus/src/UMainForm.h b/plugins/SendScreenshotPlus/src/UMainForm.h
index 258fba5978..a743e81c90 100644
--- a/plugins/SendScreenshotPlus/src/UMainForm.h
+++ b/plugins/SendScreenshotPlus/src/UMainForm.h
@@ -53,12 +53,11 @@ typedef struct MyTabData {
//---------------------------------------------------------------------------
class TfrmMain{
-
public:
// Deklaration Standardkonstruktor/Standarddestructor
TfrmMain();
~TfrmMain();
-
+
BYTE m_opt_tabCapture; //capure tab page
BYTE m_opt_btnDesc; //TCheckBox *chkDesc;
BYTE m_opt_cboxDesktop; //TRadioButton *rbtnDesktop;
@@ -66,15 +65,16 @@ class TfrmMain{
BYTE m_opt_chkTimed; //TCheckBox *chkTimed;
BYTE m_opt_cboxSendBy; //TComboBox *cboxSendBy;
bool m_bOnExitSave;
-
+
static void Unload();
+ void Init(LPTSTR DestFolder, HANDLE Contact);
+ void Close(){SendMessage(m_hWnd,WM_CLOSE,0,0);}
void Show(){ShowWindow(m_hWnd,SW_SHOW);}
void Hide(){ShowWindow(m_hWnd,SW_HIDE);}
- void Close(){SendMessage(m_hWnd,WM_CLOSE,0,0);}
- void Init(LPTSTR DestFolder, HANDLE Contact);
+ void SetTargetWindow(HWND hwnd=NULL);
void btnCaptureClick();
void cboxSendByChange();
-
+
private:
HWND m_hWnd;
HANDLE m_hContact;
@@ -88,24 +88,24 @@ class TfrmMain{
FIBITMAP* m_Screenshot;//Graphics::TBitmap *Screenshot;
RGBQUAD m_AlphaColor;
CSend* m_cSend;
-
- void chkTimedClick();
- void imgTargetMouseUp();
- void btnAboutClick();
- void btnAboutOnCloseWindow(HWND hWnd);
- void btnExploreClick();
- void LoadOptions(void);
- void SaveOptions(void);
- INT_PTR SaveScreenshot(FIBITMAP* dib);
- void FormClose();
- static void edtSizeUpdate(HWND hWnd, BOOL ClientArea, HWND hTarget, UINT Ctrl);
- static void edtSizeUpdate(RECT rect, HWND hTarget, UINT Ctrl);
-
+
+ void chkTimedClick();
+ void imgTargetMouseUp();
+ void btnAboutClick();
+ void btnAboutOnCloseWindow(HWND hWnd);
+ void btnExploreClick();
+ void LoadOptions(void);
+ void SaveOptions(void);
+ INT_PTR SaveScreenshot(FIBITMAP* dib);
+ void FormClose();
+ static void edtSizeUpdate(HWND hWnd, BOOL ClientArea, HWND hTarget, UINT Ctrl);
+ static void edtSizeUpdate(RECT rect, HWND hTarget, UINT Ctrl);
+
protected:
size_t m_MonitorCount;
MONITORINFOEX* m_Monitors;
RECT m_VirtualScreen;
-
+
BYTE m_opt_chkOpenAgain; //TCheckBox *chkOpenAgain;
BYTE m_opt_chkClientArea; //TCheckBox *chkClientArea;
BYTE m_opt_edtQuality; //TLabeledEdit *edtQuality;
@@ -116,24 +116,23 @@ class TfrmMain{
HWND m_hwndTab; //TabControl handle
HWND m_hwndTabPage; //TabControl activ page handle
HIMAGELIST m_himlTab; //TabControl imagelist
-
+
typedef std::map<HWND, TfrmMain *> CHandleMapping;
static CHandleMapping _HandleMapping;
static INT_PTR CALLBACK DlgTfrmMain(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
-
- void wmInitdialog(WPARAM wParam, LPARAM lParam);
- void wmCommand(WPARAM wParam, LPARAM lParam);
- void wmClose(WPARAM wParam, LPARAM lParam);
- void wmNotify(WPARAM wParam, LPARAM lParam);
- void wmTimer(WPARAM wParam, LPARAM lParam);
-
- void UMevent(WPARAM wParam, LPARAM lParam);
- void UMClosing(WPARAM wParam, LPARAM lParam);
-
+
+ void wmInitdialog(WPARAM wParam, LPARAM lParam);
+ void wmCommand(WPARAM wParam, LPARAM lParam);
+ void wmClose(WPARAM wParam, LPARAM lParam);
+ void wmNotify(WPARAM wParam, LPARAM lParam);
+ void wmTimer(WPARAM wParam, LPARAM lParam);
+
+ void UMevent(WPARAM wParam, LPARAM lParam);
+ void UMClosing(WPARAM wParam, LPARAM lParam);
+
static INT_PTR CALLBACK DlgProc_CaptureWindow (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
static INT_PTR CALLBACK DlgProc_CaptureDesktop(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
// LRESULT CALLBACK DlgProc_UseLastFile (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
-
};
//---------------------------------------------------------------------------
diff --git a/plugins/SendScreenshotPlus/src/version.h b/plugins/SendScreenshotPlus/src/version.h
index 24ddf38ced..28a6efe6e4 100644
--- a/plugins/SendScreenshotPlus/src/version.h
+++ b/plugins/SendScreenshotPlus/src/version.h
@@ -1,6 +1,6 @@
#define __MAJOR_VERSION 0
#define __MINOR_VERSION 8
-#define __RELEASE_NUM 2
+#define __RELEASE_NUM 3
#define __BUILD_NUM 0
#define __DEF2STR_(s) #s