summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/SendScreenshotPlus/src/CSend.cpp83
-rw-r--r--plugins/SendScreenshotPlus/src/CSend.h12
-rw-r--r--plugins/SendScreenshotPlus/src/CSendDropbox.cpp8
-rw-r--r--plugins/SendScreenshotPlus/src/CSendDropbox.h27
-rw-r--r--plugins/SendScreenshotPlus/src/CSendEmail.cpp7
-rw-r--r--plugins/SendScreenshotPlus/src/CSendEmail.h38
-rw-r--r--plugins/SendScreenshotPlus/src/CSendFTPFile.cpp8
-rw-r--r--plugins/SendScreenshotPlus/src/CSendFTPFile.h29
-rw-r--r--plugins/SendScreenshotPlus/src/CSendFile.cpp9
-rw-r--r--plugins/SendScreenshotPlus/src/CSendFile.h17
-rw-r--r--plugins/SendScreenshotPlus/src/CSendHTTPServer.cpp7
-rw-r--r--plugins/SendScreenshotPlus/src/CSendHTTPServer.h36
-rw-r--r--plugins/SendScreenshotPlus/src/CSendHost_ImageShack.cpp11
-rw-r--r--plugins/SendScreenshotPlus/src/CSendHost_ImageShack.h24
-rw-r--r--plugins/SendScreenshotPlus/src/CSendHost_imgur.cpp3
-rw-r--r--plugins/SendScreenshotPlus/src/CSendHost_uploadpie.cpp10
-rw-r--r--plugins/SendScreenshotPlus/src/Main.cpp16
-rw-r--r--plugins/SendScreenshotPlus/src/UAboutForm.cpp37
-rw-r--r--plugins/SendScreenshotPlus/src/UAboutForm.h46
-rw-r--r--plugins/SendScreenshotPlus/src/UMainForm.cpp257
-rw-r--r--plugins/SendScreenshotPlus/src/UMainForm.h170
-rw-r--r--plugins/SendScreenshotPlus/src/Utils.cpp160
-rw-r--r--plugins/SendScreenshotPlus/src/Utils.h58
-rw-r--r--plugins/SendScreenshotPlus/src/mir_string.cpp3
-rw-r--r--plugins/SendScreenshotPlus/src/mir_string.h1
-rw-r--r--plugins/SendScreenshotPlus/src/stdafx.h3
-rw-r--r--plugins/SendScreenshotPlus/src/version.h2
27 files changed, 476 insertions, 606 deletions
diff --git a/plugins/SendScreenshotPlus/src/CSend.cpp b/plugins/SendScreenshotPlus/src/CSend.cpp
index a8d0a19496..7dad3c0af7 100644
--- a/plugins/SendScreenshotPlus/src/CSend.cpp
+++ b/plugins/SendScreenshotPlus/src/CSend.cpp
@@ -29,27 +29,28 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "stdafx.h"
#define CSEND_DIALOG 8800
-//---------------------------------------------------------------------------
+/////////////////////////////////////////////////////////////////////////////////////////
+
CSend::CSend(HWND /*Owner*/, MCONTACT hContact, bool bAsync, bool bSilent) :
-m_bDeleteAfterSend(false),
-m_bAsync(bAsync),
-m_bSilent(bSilent),
-m_pszFile(NULL),
-m_pszFileDesc(NULL),
-m_URL(NULL),
-m_URLthumb(NULL),
-m_pszSendTyp(NULL),
-m_pszProto(NULL),
-// m_hContact(hContact), // initialized below
-m_EnableItem(0),
-m_ChatRoom(0),
-// m_PFflag(0),
-m_cbEventMsg(0),
-m_szEventMsg(NULL),
-m_hSend(0),
-m_hOnSend(0),
-m_ErrorMsg(NULL),
-m_ErrorTitle(NULL)
+ m_bDeleteAfterSend(false),
+ m_bAsync(bAsync),
+ m_bSilent(bSilent),
+ m_pszFile(NULL),
+ m_pszFileDesc(NULL),
+ m_URL(NULL),
+ m_URLthumb(NULL),
+ m_pszSendTyp(NULL),
+ m_pszProto(NULL),
+ // m_hContact(hContact), // initialized below
+ m_EnableItem(0),
+ m_ChatRoom(0),
+ // m_PFflag(0),
+ m_cbEventMsg(0),
+ m_szEventMsg(NULL),
+ m_hSend(0),
+ m_hOnSend(0),
+ m_ErrorMsg(NULL),
+ m_ErrorTitle(NULL)
{
SetContact(hContact);
}
@@ -66,7 +67,8 @@ CSend::~CSend()
if (m_hOnSend) UnhookEvent(m_hOnSend);
}
-//---------------------------------------------------------------------------
+/////////////////////////////////////////////////////////////////////////////////////////
+
void CSend::SetContact(MCONTACT hContact)
{
m_hContact = hContact;
@@ -80,12 +82,8 @@ void CSend::SetContact(MCONTACT hContact)
}
}
-//---------------------------------------------------------------------------
-/*bool CSend::hasCap(unsigned int Flag) {
- return (Flag & ProtoChainSend(m_hContact, PS_GETCAPS, PFLAGNUM_1, NULL)) == Flag;
- }// */
+/////////////////////////////////////////////////////////////////////////////////////////
-//---------------------------------------------------------------------------
INT_PTR CALLBACK CSend::ResultDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg) {
@@ -93,11 +91,9 @@ INT_PTR CALLBACK CSend::ResultDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,
TranslateDialogDefault(hwndDlg);
Window_SetIcon_IcoLib(hwndDlg, GetIconHandle(ICO_MAIN));
{
- CSend* self = (CSend*)lParam;
- wchar_t* tmp = mir_wstrdup(TranslateT("Resulting URL from\n"));
- mir_tstradd(tmp, self->m_pszSendTyp);
- SetDlgItemText(hwndDlg, IDC_HEADERBAR, tmp);
- mir_free(tmp);
+ CSend *self = (CSend*)lParam;
+ SetDlgItemText(hwndDlg, IDC_HEADERBAR, CMStringW(TranslateT("Resulting URL from\n")) + self->m_pszSendTyp);
+
SendDlgItemMessage(hwndDlg, IDC_HEADERBAR, WM_SETICON, ICON_BIG, (LPARAM)GetIconBtn(ICO_BTN_ARROWR));
SetDlgItemTextA(hwndDlg, ID_edtURL, self->m_URL);
if (self->m_URLthumb) {
@@ -215,16 +211,17 @@ void CSend::svcSendMsgExit(const char* szMessage)
Exit(CSEND_DIALOG); return;
}
if (m_ChatRoom) {
- wchar_t* tmp = mir_a2u(szMessage);
+ CMStringW tmp(szMessage);
if (m_pszFileDesc) {
- mir_tstradd(tmp, L"\r\n");
- mir_tstradd(tmp, m_pszFileDesc);
+ tmp.Append(L"\r\n");
+ tmp.Append(m_pszFileDesc);
}
- GC_INFO gci = { 0 };
+
int res = GC_RESULT_NOSESSION;
int cnt = pci->SM_GetCount(m_pszProto);
- //loop on all gc session to get the right (save) ptszID for the chatroom from m_hContact
+ // loop on all gc session to get the right (save) ptszID for the chatroom from m_hContact
+ GC_INFO gci = { 0 };
gci.pszModule = m_pszProto;
for (int i = 0; i < cnt; i++) {
gci.iItem = i;
@@ -316,7 +313,8 @@ void CSend::svcSendFileExit()
}
}
-//---------------------------------------------------------------------------
+/////////////////////////////////////////////////////////////////////////////////////////
+
int CSend::OnSend(void *obj, WPARAM, LPARAM lParam)
{
CSend* self = (CSend*)obj;
@@ -387,7 +385,8 @@ void CSend::DB_EventAdd(WORD EventType)
db_event_add(m_hContact, &dbei);
}
-//---------------------------------------------------------------------------
+/////////////////////////////////////////////////////////////////////////////////////////
+
void CSend::Error(LPCTSTR pszFormat, ...)
{
wchar_t tszMsg[MAX_SECONDLINE];
@@ -411,7 +410,8 @@ void CSend::Error(LPCTSTR pszFormat, ...)
m_box.uType = MB_OK | MB_ICON_ERROR;
}
-//---------------------------------------------------------------------------
+/////////////////////////////////////////////////////////////////////////////////////////
+
void CSend::Exit(unsigned int Result)
{
if (!m_bSilent) {
@@ -459,8 +459,9 @@ void CSend::Exit(unsigned int Result)
delete this;/// deletes derived class since destructor is virtual (which also auto-calls base dtor)
}
-/// helper functions used for HTTP uploads
-//---------------------------------------------------------------------------
+/////////////////////////////////////////////////////////////////////////////////////////
+// helper functions used for HTTP uploads
+
#define snprintf _snprintf
const char* CSend::GetHTMLContent(char* str, const char* startTag, const char* endTag)
diff --git a/plugins/SendScreenshotPlus/src/CSend.h b/plugins/SendScreenshotPlus/src/CSend.h
index 512555ce49..55168c191b 100644
--- a/plugins/SendScreenshotPlus/src/CSend.h
+++ b/plugins/SendScreenshotPlus/src/CSend.h
@@ -29,7 +29,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef _CSEND_H
#define _CSEND_H
-//---------------------------------------------------------------------------
+/////////////////////////////////////////////////////////////////////////////////////////
+
#define SS_AUTOSEND 1
#define SS_DELETEAFTERSSEND 2
@@ -47,7 +48,8 @@ const wchar_t SS_ERR_MAPI[] =LPGENW("MAPI error (%i):\n%s.");
const wchar_t SS_ERR_RESPONSE[] =LPGENW("Unknown response from %s (%i)");
const wchar_t SS_ERR_NORESPONSE[] =LPGENW("Got no response from %s (%i)");
-//---------------------------------------------------------------------------
+/////////////////////////////////////////////////////////////////////////////////////////
+
class CSend {
public:
CSend(HWND Owner, MCONTACT hContact, bool bAsync, bool bSilent=false); // oder (TfrmMain & Owner)
@@ -56,9 +58,9 @@ class CSend {
virtual int Send() = NULL; // returns 1 if sent (you must delete class) and 0 when still sending (class deletes itself)
int SendSilent() {m_bAsync=m_bSilent=true; return Send();};
- void SetFile(wchar_t* file){mir_free(m_pszFile), m_pszFile=mir_wstrdup(file);};
- void SetFile(char* file){mir_free(m_pszFile), m_pszFile=mir_a2u(file);};
- void SetDescription(wchar_t* descr){mir_free(m_pszFileDesc), m_pszFileDesc=mir_wstrdup(descr);};
+ void SetFile(const wchar_t* file) { replaceStrW(m_pszFile, file); }
+ void SetFile(const char* file) { mir_free(m_pszFile), m_pszFile=mir_a2u(file); }
+ void SetDescription(const wchar_t* descr){ replaceStrW(m_pszFileDesc, descr); }
void SetContact(MCONTACT hContact);
char* GetURL(){return m_URL;};
char* GetURLthumbnail(){return m_URLthumb;};
diff --git a/plugins/SendScreenshotPlus/src/CSendDropbox.cpp b/plugins/SendScreenshotPlus/src/CSendDropbox.cpp
index 449a091b25..c286bdf4be 100644
--- a/plugins/SendScreenshotPlus/src/CSendDropbox.cpp
+++ b/plugins/SendScreenshotPlus/src/CSendDropbox.cpp
@@ -26,10 +26,10 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-//---------------------------------------------------------------------------
#include "stdafx.h"
-//---------------------------------------------------------------------------
+/////////////////////////////////////////////////////////////////////////////////////////
+
CSendDropbox::CSendDropbox(HWND Owner, MCONTACT hContact, bool bAsync)
: CSend(Owner, hContact, bAsync)
{
@@ -42,7 +42,7 @@ CSendDropbox::~CSendDropbox()
{
}
-//---------------------------------------------------------------------------
+/////////////////////////////////////////////////////////////////////////////////////////
int CSendDropbox::Send()
{
@@ -50,7 +50,7 @@ int CSendDropbox::Send()
return 0;
}
-//---------------------------------------------------------------------------
+/////////////////////////////////////////////////////////////////////////////////////////
void CSendDropbox::SendThread()
{
diff --git a/plugins/SendScreenshotPlus/src/CSendDropbox.h b/plugins/SendScreenshotPlus/src/CSendDropbox.h
index a083ab0a83..ccbc5bea59 100644
--- a/plugins/SendScreenshotPlus/src/CSendDropbox.h
+++ b/plugins/SendScreenshotPlus/src/CSendDropbox.h
@@ -31,20 +31,19 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "Utils.h"
-//---------------------------------------------------------------------------
-class CSendDropbox : public CSend {
- public:
- CSendDropbox(HWND Owner, MCONTACT hContact, bool bAsync);
- ~CSendDropbox();
-
- int Send();
-
- protected:
- void SendThread();
- static void SendThreadWrapper(void *Obj);
- static int OnDropAck(void*, WPARAM, LPARAM);
-};
+class CSendDropbox : public CSend
+{
+
+public:
+ CSendDropbox(HWND Owner, MCONTACT hContact, bool bAsync);
+ ~CSendDropbox();
-//---------------------------------------------------------------------------
+ int Send();
+
+protected:
+ void SendThread();
+ static void SendThreadWrapper(void *Obj);
+ static int OnDropAck(void*, WPARAM, LPARAM);
+};
#endif
diff --git a/plugins/SendScreenshotPlus/src/CSendEmail.cpp b/plugins/SendScreenshotPlus/src/CSendEmail.cpp
index b12d6d1383..1a8b73d9d1 100644
--- a/plugins/SendScreenshotPlus/src/CSendEmail.cpp
+++ b/plugins/SendScreenshotPlus/src/CSendEmail.cpp
@@ -26,10 +26,9 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-//---------------------------------------------------------------------------
#include "stdafx.h"
-//---------------------------------------------------------------------------
+/////////////////////////////////////////////////////////////////////////////////////////
CSendEmail::CSendEmail(HWND Owner, MCONTACT hContact, bool /*bAsync*/)
: CSend(Owner, hContact, true)
@@ -52,7 +51,7 @@ CSendEmail::~CSendEmail()
mir_free(m_Subject);
}
-//---------------------------------------------------------------------------
+/////////////////////////////////////////////////////////////////////////////////////////
int CSendEmail::Send()
{
@@ -200,5 +199,3 @@ void CSendEmail::SendThreadWrapper(void * Obj)
{
reinterpret_cast<CSendEmail*>(Obj)->SendThread();
}
-
-//---------------------------------------------------------------------------
diff --git a/plugins/SendScreenshotPlus/src/CSendEmail.h b/plugins/SendScreenshotPlus/src/CSendEmail.h
index 162f7a389f..4de244f8f8 100644
--- a/plugins/SendScreenshotPlus/src/CSendEmail.h
+++ b/plugins/SendScreenshotPlus/src/CSendEmail.h
@@ -29,25 +29,25 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef _CSEND_EMAIL_H
#define _CSEND_EMAIL_H
-//---------------------------------------------------------------------------
-class CSendEmail : public CSend {
- public:
- // Deklaration Standardkonstruktor/Standarddestructor
- CSendEmail(HWND Owner, MCONTACT hContact, bool bAsync);
- ~CSendEmail();
-
- int Send();
-
- protected:
- char* m_pszFileA;
- char* m_pszFileName;
- char* m_Email;
- char* m_FriendlyName;
- char* m_Subject;
- void SendThread();
- static void SendThreadWrapper(void * Obj);
+class CSendEmail : public CSend
+{
+
+public:
+ // Deklaration Standardkonstruktor/Standarddestructor
+ CSendEmail(HWND Owner, MCONTACT hContact, bool bAsync);
+ ~CSendEmail();
+
+ int Send();
+
+protected:
+ char* m_pszFileA;
+ char* m_pszFileName;
+ char* m_Email;
+ char* m_FriendlyName;
+ char* m_Subject;
+
+ void SendThread();
+ static void SendThreadWrapper(void * Obj);
};
-//---------------------------------------------------------------------------
-
#endif
diff --git a/plugins/SendScreenshotPlus/src/CSendFTPFile.cpp b/plugins/SendScreenshotPlus/src/CSendFTPFile.cpp
index d1dc23a62e..3c52e2bc09 100644
--- a/plugins/SendScreenshotPlus/src/CSendFTPFile.cpp
+++ b/plugins/SendScreenshotPlus/src/CSendFTPFile.cpp
@@ -26,10 +26,9 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-//---------------------------------------------------------------------------
#include "stdafx.h"
-//---------------------------------------------------------------------------
+/////////////////////////////////////////////////////////////////////////////////////////
CSendFTPFile::CSendFTPFile(HWND Owner, MCONTACT hContact, bool /*bAsync*/)
: CSend(Owner, hContact, true)
@@ -44,7 +43,8 @@ CSendFTPFile::~CSendFTPFile()
mir_free(m_pszFileName);
}
-//---------------------------------------------------------------------------
+/////////////////////////////////////////////////////////////////////////////////////////
+
int CSendFTPFile::Send()
{
if (!m_hContact) return 1;
@@ -91,5 +91,3 @@ void CSendFTPFile::SendThreadWrapper(void * Obj)
{
reinterpret_cast<CSendFTPFile*>(Obj)->SendThread();
}
-
-//---------------------------------------------------------------------------
diff --git a/plugins/SendScreenshotPlus/src/CSendFTPFile.h b/plugins/SendScreenshotPlus/src/CSendFTPFile.h
index 67d8115a87..dc710fe4ad 100644
--- a/plugins/SendScreenshotPlus/src/CSendFTPFile.h
+++ b/plugins/SendScreenshotPlus/src/CSendFTPFile.h
@@ -29,21 +29,20 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef _CSEND_FTP_FILE_H
#define _CSEND_FTP_FILE_H
-//---------------------------------------------------------------------------
-class CSendFTPFile : public CSend {
- public:
- // Deklaration Standardkonstruktor/Standarddestructor
- CSendFTPFile(HWND Owner, MCONTACT hContact, bool bAsync);
- ~CSendFTPFile();
-
- int Send();
-
- protected:
- char* m_pszFileName;
- void SendThread();
- static void SendThreadWrapper(void * Obj);
-};
+class CSendFTPFile : public CSend
+{
+
+public:
+ // Deklaration Standardkonstruktor/Standarddestructor
+ CSendFTPFile(HWND Owner, MCONTACT hContact, bool bAsync);
+ ~CSendFTPFile();
-//---------------------------------------------------------------------------
+ int Send();
+
+protected:
+ char* m_pszFileName;
+ void SendThread();
+ static void SendThreadWrapper(void * Obj);
+};
#endif
diff --git a/plugins/SendScreenshotPlus/src/CSendFile.cpp b/plugins/SendScreenshotPlus/src/CSendFile.cpp
index 79005f4db8..d6e8b2962d 100644
--- a/plugins/SendScreenshotPlus/src/CSendFile.cpp
+++ b/plugins/SendScreenshotPlus/src/CSendFile.cpp
@@ -26,10 +26,10 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-//---------------------------------------------------------------------------
#include "stdafx.h"
-//---------------------------------------------------------------------------
+/////////////////////////////////////////////////////////////////////////////////////////
+
CSendFile::CSendFile(HWND Owner, MCONTACT hContact, bool /*bAsync*/)
: CSend(Owner, hContact, true)
{
@@ -41,11 +41,10 @@ CSendFile::~CSendFile()
{
}
-//---------------------------------------------------------------------------
+/////////////////////////////////////////////////////////////////////////////////////////
+
int CSendFile::Send()
{
svcSendFileExit();
return 0;
}
-
-//---------------------------------------------------------------------------
diff --git a/plugins/SendScreenshotPlus/src/CSendFile.h b/plugins/SendScreenshotPlus/src/CSendFile.h
index 0c36ad3724..0fd3426b0e 100644
--- a/plugins/SendScreenshotPlus/src/CSendFile.h
+++ b/plugins/SendScreenshotPlus/src/CSendFile.h
@@ -29,18 +29,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef _CSEND_FILE_H
#define _CSEND_FILE_H
-//---------------------------------------------------------------------------
-class CSendFile : public CSend {
- public:
- // Deklaration Standardkonstruktor/Standarddestructor
- CSendFile(HWND Owner, MCONTACT hContact, bool bAsync);
- ~CSendFile();
+class CSendFile : public CSend
+{
- int Send();
+public:
+ // Deklaration Standardkonstruktor/Standarddestructor
+ CSendFile(HWND Owner, MCONTACT hContact, bool bAsync);
+ ~CSendFile();
- protected:
+ int Send();
};
-//---------------------------------------------------------------------------*/
-
#endif
diff --git a/plugins/SendScreenshotPlus/src/CSendHTTPServer.cpp b/plugins/SendScreenshotPlus/src/CSendHTTPServer.cpp
index 73d8af4f7c..cde1bc2b00 100644
--- a/plugins/SendScreenshotPlus/src/CSendHTTPServer.cpp
+++ b/plugins/SendScreenshotPlus/src/CSendHTTPServer.cpp
@@ -26,14 +26,12 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-//---------------------------------------------------------------------------
#include "stdafx.h"
INT_PTR(*g_MirCallService)(const char *, WPARAM, LPARAM) = NULL;
-//INT_PTR (*CallService)(const char *,WPARAM,LPARAM);
+/////////////////////////////////////////////////////////////////////////////////////////
-//---------------------------------------------------------------------------
CSendHTTPServer::CSendHTTPServer(HWND Owner, MCONTACT hContact, bool /*bAsync*/)
: CSend(Owner, hContact, true)
{
@@ -51,7 +49,8 @@ CSendHTTPServer::~CSendHTTPServer()
mir_free(m_fsi_pszRealPath);
}
-//---------------------------------------------------------------------------
+/////////////////////////////////////////////////////////////////////////////////////////
+
int CSendHTTPServer::Send()
{
if (!m_hContact) return 1;
diff --git a/plugins/SendScreenshotPlus/src/CSendHTTPServer.h b/plugins/SendScreenshotPlus/src/CSendHTTPServer.h
index 258e17df27..3df6d84a36 100644
--- a/plugins/SendScreenshotPlus/src/CSendHTTPServer.h
+++ b/plugins/SendScreenshotPlus/src/CSendHTTPServer.h
@@ -29,31 +29,27 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef _CSEND_HTTP_SERVER_H
#define _CSEND_HTTP_SERVER_H
-//---------------------------------------------------------------------------
-class CSendHTTPServer : public CSend {
- public:
- // Deklaration Standardkonstruktor/Standarddestructor
- CSendHTTPServer(HWND Owner, MCONTACT hContact, bool bAsync);
- ~CSendHTTPServer();
+class CSendHTTPServer : public CSend
+{
+public:
+ // Deklaration Standardkonstruktor/Standarddestructor
+ CSendHTTPServer(HWND Owner, MCONTACT hContact, bool bAsync);
+ ~CSendHTTPServer();
- int Send();
+ int Send();
- protected:
- char* m_pszFileName;
- char* m_fsi_pszSrvPath;
- char* m_fsi_pszRealPath;
+protected:
+ char* m_pszFileName;
+ char* m_fsi_pszSrvPath;
+ char* m_fsi_pszRealPath;
- STFileShareInfo m_fsi;
+ STFileShareInfo m_fsi;
- void SendThread();
- static void SendThreadWrapper(void * Obj);
+ void SendThread();
+ static void SendThreadWrapper(void * Obj);
- typedef std::map<HANDLE, CSendHTTPServer *> CContactMapping;
- static CContactMapping _CContactMapping;
-
-// static INT_PTR MyCallService(const char *name, WPARAM wParam, LPARAM lParam);
+ typedef std::map<HANDLE, CSendHTTPServer *> CContactMapping;
+ static CContactMapping _CContactMapping;
};
-//---------------------------------------------------------------------------
-
#endif
diff --git a/plugins/SendScreenshotPlus/src/CSendHost_ImageShack.cpp b/plugins/SendScreenshotPlus/src/CSendHost_ImageShack.cpp
index 143606a096..e8d0f73444 100644
--- a/plugins/SendScreenshotPlus/src/CSendHost_ImageShack.cpp
+++ b/plugins/SendScreenshotPlus/src/CSendHost_ImageShack.cpp
@@ -26,10 +26,10 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-//---------------------------------------------------------------------------
#include "stdafx.h"
-//---------------------------------------------------------------------------
+/////////////////////////////////////////////////////////////////////////////////////////
+
CSendHost_ImageShack::CSendHost_ImageShack(HWND Owner, MCONTACT hContact, bool bAsync)
: CSend(Owner, hContact, bAsync)
{
@@ -39,9 +39,10 @@ CSendHost_ImageShack::CSendHost_ImageShack(HWND Owner, MCONTACT hContact, bool b
CSendHost_ImageShack::~CSendHost_ImageShack()
{
-};
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
-//---------------------------------------------------------------------------
int CSendHost_ImageShack::Send()
{
if (!g_hNetlibUser) { /// check Netlib
@@ -52,9 +53,7 @@ int CSendHost_ImageShack::Send()
memset(&m_nlhr, 0, sizeof(m_nlhr));
char* tmp; tmp = mir_u2a(m_pszFile);
HTTPFormData frm[] = {
- // {"Referer",HTTPFORM_HEADER("http://www.imageshack.us/upload_api.php")},
{ "fileupload", HTTPFORM_FILE(tmp) },
- //{"rembar","yes"},// no info bar on thumb
{ "public", "no" },
{ "key", HTTPFORM_8BIT(DEVKEY_IMAGESHACK) },
};
diff --git a/plugins/SendScreenshotPlus/src/CSendHost_ImageShack.h b/plugins/SendScreenshotPlus/src/CSendHost_ImageShack.h
index c56f1d8ef7..46976396db 100644
--- a/plugins/SendScreenshotPlus/src/CSendHost_ImageShack.h
+++ b/plugins/SendScreenshotPlus/src/CSendHost_ImageShack.h
@@ -29,23 +29,21 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef _CSEND_IMAGESHACK_H
#define _CSEND_IMAGESHACK_H
-//---------------------------------------------------------------------------
-class CSendHost_ImageShack : public CSend {
- public:
- // Deklaration Standardkonstruktor/Standarddestructor
- CSendHost_ImageShack(HWND Owner, MCONTACT hContact, bool bAsync);
- ~CSendHost_ImageShack();
+class CSendHost_ImageShack : public CSend
+{
- int Send();
+public:
+ // Deklaration Standardkonstruktor/Standarddestructor
+ CSendHost_ImageShack(HWND Owner, MCONTACT hContact, bool bAsync);
+ ~CSendHost_ImageShack();
- protected:
- NETLIBHTTPREQUEST m_nlhr;
+ int Send();
- void SendThread();
- static void SendThreadWrapper(void * Obj);
+protected:
+ NETLIBHTTPREQUEST m_nlhr;
+ void SendThread();
+ static void SendThreadWrapper(void * Obj);
};
-//---------------------------------------------------------------------------
-
#endif
diff --git a/plugins/SendScreenshotPlus/src/CSendHost_imgur.cpp b/plugins/SendScreenshotPlus/src/CSendHost_imgur.cpp
index b9738687e3..bba9923a6c 100644
--- a/plugins/SendScreenshotPlus/src/CSendHost_imgur.cpp
+++ b/plugins/SendScreenshotPlus/src/CSendHost_imgur.cpp
@@ -26,7 +26,8 @@ CSendHost_Imgur::~CSendHost_Imgur()
{
}
-//---------------------------------------------------------------------------
+/////////////////////////////////////////////////////////////////////////////////////////
+
int CSendHost_Imgur::Send()
{
if (!g_hNetlibUser) { /// check Netlib
diff --git a/plugins/SendScreenshotPlus/src/CSendHost_uploadpie.cpp b/plugins/SendScreenshotPlus/src/CSendHost_uploadpie.cpp
index eeaf4a9b89..d3fc4914d9 100644
--- a/plugins/SendScreenshotPlus/src/CSendHost_uploadpie.cpp
+++ b/plugins/SendScreenshotPlus/src/CSendHost_uploadpie.cpp
@@ -26,8 +26,10 @@ CSendHost_UploadPie::~CSendHost_UploadPie()
{
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
static const char kHostURL[] = "https://uploadpie.com/";
-//---------------------------------------------------------------------------
+
int CSendHost_UploadPie::Send()
{
if (!g_hNetlibUser) { /// check Netlib
@@ -42,12 +44,6 @@ int CSendHost_UploadPie::Send()
{ "upload", HTTPFORM_INT(1) },// ??
{ "uploadedfile", HTTPFORM_FILE(tmp) },
{ "expire", HTTPFORM_INT(m_expire) },// 30m
- //{"expire",HTTPFORM_INT(2,},// 1h
- //{"expire",HTTPFORM_INT(3)},// 6h
- //{"expire",HTTPFORM_INT(4)},// 1d
- //{"expire",HTTPFORM_INT(5)},// 1w
- //{"x",HTTPFORM_INT(130)},// relative X coordinate of "BAKE FILE" button (unused?)
- //{"y",HTTPFORM_INT(17)},// relative Y coordinate of "BAKE FILE" button (unused?)
};
int error = HTTPFormCreate(&m_nlhr, REQUEST_POST, kHostURL, frm, sizeof(frm) / sizeof(HTTPFormData));
mir_free(tmp);
diff --git a/plugins/SendScreenshotPlus/src/Main.cpp b/plugins/SendScreenshotPlus/src/Main.cpp
index 9b9645c8f9..1e10b5b0e5 100644
--- a/plugins/SendScreenshotPlus/src/Main.cpp
+++ b/plugins/SendScreenshotPlus/src/Main.cpp
@@ -97,10 +97,12 @@ static HANDLE m_hOpenCaptureDialog = 0;
static HANDLE m_hSendDesktop = 0;
static HANDLE m_hEditBitmap = 0;
static HANDLE m_hSend2ImageShack = 0;
-//---------------------------------------------------------------------------
+
+/////////////////////////////////////////////////////////////////////////////////////////
// Callback function of service for contact menu and main menu
// wParam = contact handle
// lParam = 0 (or 0xFFFF to preselect window under cursor)
+
INT_PTR service_OpenCaptureDialog(WPARAM wParam, LPARAM lParam)
{
TfrmMain* frmMain = new TfrmMain();
@@ -121,7 +123,8 @@ INT_PTR service_OpenCaptureDialog(WPARAM wParam, LPARAM lParam)
frmMain->Show();
return 0;
}
-//---------------------------------------------------------------------------
+
+/////////////////////////////////////////////////////////////////////////////////////////
// Callback function of service
// 1. Send a screenshot of the desktop to the selected contact
// wParam = contact handle
@@ -129,6 +132,7 @@ INT_PTR service_OpenCaptureDialog(WPARAM wParam, LPARAM lParam)
// 2. Open the capture dialog in take screenshot only mode (it will not be sent)
// wParam = 0
// lParam = anything but 0
+
INT_PTR service_SendDesktop(WPARAM wParam, LPARAM)
{
TfrmMain* frmMain = new TfrmMain();
@@ -154,11 +158,13 @@ INT_PTR service_SendDesktop(WPARAM wParam, LPARAM)
frmMain->btnCaptureClick(); // this method will call Close()
return 0;
}
-//---------------------------------------------------------------------------
+
+/////////////////////////////////////////////////////////////////////////////////////////
// Edit a in-memory bitmap on the edit window
// wParam = (SENDSSCB) callback function address to call when editing is done
// lParam = (HBITMAP) bitmap handle, a copy is made so the calling function can free this handle after the service function returns
// Returns:
+
INT_PTR service_EditBitmap(WPARAM, LPARAM)
{
/* TfrmEdit *frmEdit=new TfrmEdit(NULL);
@@ -176,10 +182,12 @@ INT_PTR service_EditBitmap(WPARAM, LPARAM)
*/
return 0;
}
-//---------------------------------------------------------------------------
+
+/////////////////////////////////////////////////////////////////////////////////////////
// Callback function of service for sending image to imageshack.us
// wParam = (char*)filename
// lParam = (HANDLE)contact (can be null)
+
INT_PTR service_Send2ImageShack(WPARAM wParam, LPARAM lParam)
{
char* result = NULL;
diff --git a/plugins/SendScreenshotPlus/src/UAboutForm.cpp b/plugins/SendScreenshotPlus/src/UAboutForm.cpp
index f05738281e..e12b5a72d8 100644
--- a/plugins/SendScreenshotPlus/src/UAboutForm.cpp
+++ b/plugins/SendScreenshotPlus/src/UAboutForm.cpp
@@ -41,7 +41,8 @@ void TfrmAbout::Unload()
}
}
-//---------------------------------------------------------------------------
+/////////////////////////////////////////////////////////////////////////////////////////
+
TfrmAbout::CHandleMapping TfrmAbout::_HandleMapping;
INT_PTR CALLBACK TfrmAbout::DlgTfrmAbout(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -84,33 +85,30 @@ INT_PTR CALLBACK TfrmAbout::DlgTfrmAbout(HWND hWnd, UINT msg, WPARAM wParam, LPA
return FALSE;
}
-//---------------------------------------------------------------------------
-//WM_INITDIALOG:
+/////////////////////////////////////////////////////////////////////////////////////////
+// WM_INITDIALOG:
+
LRESULT TfrmAbout::wmInitdialog(WPARAM, LPARAM)
{
// Headerbar
SendDlgItemMessage(m_hWnd, IDC_HEADERBAR, WM_SETICON, ICON_BIG, (LPARAM)GetIcon(ICO_MAIN));
- //License
+ // License
{
- wchar_t* pszText = NULL;
- mir_tstradd(pszText, _A2W(__COPYRIGHT));
- mir_tstradd(pszText, L"\r\n\r\n");
+ CMStringW pszText(_A2W(__COPYRIGHT));
+ pszText.Append(L"\r\n\r\n");
HRSRC hRes = FindResource(g_hSendSS, MAKEINTRESOURCE(IDR_LICENSE), L"TEXT");
DWORD size = SizeofResource(g_hSendSS, hRes);
char* data = (char*)mir_alloc(size + 1);
memcpy(data, LockResource(LoadResource(g_hSendSS, hRes)), size);
data[size] = '\0';
- wchar_t* pszCopyright = mir_a2u(data);
+ pszText.AppendFormat(L"%S", data);
mir_free(data);
- mir_tstradd(pszText, pszCopyright);
- mir_free(pszCopyright);
SetDlgItemText(m_hWnd, IDC_LICENSE, pszText);
- mir_free(pszText);
}
- //Credit
+ // Credit
{
HRSRC hRes = FindResource(g_hSendSS, MAKEINTRESOURCE(IDR_CREDIT), L"TEXT");
DWORD size = SizeofResource(g_hSendSS, hRes);
@@ -132,10 +130,11 @@ LRESULT TfrmAbout::wmInitdialog(WPARAM, LPARAM)
return FALSE;
}
-//WM_COMMAND:
+/////////////////////////////////////////////////////////////////////////////////////////
+// WM_COMMAND:
+
LRESULT TfrmAbout::wmCommand(WPARAM wParam, LPARAM)
{
- //---------------------------------------------------------------------------
if (HIWORD(wParam) == BN_CLICKED) {
switch (LOWORD(wParam)) {
case IDCANCEL: // ESC pressed
@@ -155,7 +154,9 @@ LRESULT TfrmAbout::wmCommand(WPARAM wParam, LPARAM)
return FALSE;
}
-//WM_CLOSE:
+/////////////////////////////////////////////////////////////////////////////////////////
+// WM_CLOSE:
+
LRESULT TfrmAbout::wmClose(WPARAM, LPARAM)
{
SendMessage(m_hWndOwner, UM_CLOSING, (WPARAM)m_hWnd, (LPARAM)IDD_UAboutForm);
@@ -163,7 +164,8 @@ LRESULT TfrmAbout::wmClose(WPARAM, LPARAM)
return FALSE;
}
-//---------------------------------------------------------------------------
+/////////////////////////////////////////////////////////////////////////////////////////
+
TfrmAbout::TfrmAbout(HWND Owner)
{
m_hWndOwner = Owner;
@@ -179,7 +181,8 @@ TfrmAbout::~TfrmAbout()
_HandleMapping.erase(m_hWnd);
}
-//---------------------------------------------------------------------------
+/////////////////////////////////////////////////////////////////////////////////////////
+
void TfrmAbout::btnPageClick()
{
HWND hCtrl = GetDlgItem(m_hWnd, IDA_CONTRIBLINK);
diff --git a/plugins/SendScreenshotPlus/src/UAboutForm.h b/plugins/SendScreenshotPlus/src/UAboutForm.h
index 19c6743d7c..8236094b49 100644
--- a/plugins/SendScreenshotPlus/src/UAboutForm.h
+++ b/plugins/SendScreenshotPlus/src/UAboutForm.h
@@ -29,37 +29,35 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef UAboutFormH
#define UAboutFormH
-//---------------------------------------------------------------------------
-class TfrmAbout{
+class TfrmAbout
+{
- public:
- // Deklaration Standardkonstruktor/Standarddestructor
- TfrmAbout(HWND Owner);
- ~TfrmAbout();
+public:
+ // Deklaration Standardkonstruktor/Standarddestructor
+ TfrmAbout(HWND Owner);
+ ~TfrmAbout();
- HWND m_hWndOwner;
+ HWND m_hWndOwner;
- static void Unload();
- void Show(){ShowWindow(m_hWnd,SW_SHOW);}
- void Hide(){ShowWindow(m_hWnd,SW_HIDE);}
- void Close(){SendMessage(m_hWnd,WM_CLOSE,0,0);}
+ static void Unload();
+ void Show(){ ShowWindow(m_hWnd, SW_SHOW); }
+ void Hide(){ ShowWindow(m_hWnd, SW_HIDE); }
+ void Close(){ SendMessage(m_hWnd, WM_CLOSE, 0, 0); }
- private:
- HWND m_hWnd;
+private:
+ HWND m_hWnd;
- protected:
- UINT m_Page;
- typedef std::map<HWND, TfrmAbout *> CHandleMapping;
- static CHandleMapping _HandleMapping;
- static INT_PTR CALLBACK DlgTfrmAbout(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
+protected:
+ UINT m_Page;
+ typedef std::map<HWND, TfrmAbout *> CHandleMapping;
+ static CHandleMapping _HandleMapping;
+ static INT_PTR CALLBACK DlgTfrmAbout(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
- LRESULT wmInitdialog(WPARAM wParam, LPARAM lParam);
- LRESULT wmCommand(WPARAM wParam, LPARAM lParam);
- LRESULT wmClose(WPARAM wParam, LPARAM lParam);
-
- void btnPageClick();
+ LRESULT wmInitdialog(WPARAM wParam, LPARAM lParam);
+ LRESULT wmCommand(WPARAM wParam, LPARAM lParam);
+ LRESULT wmClose(WPARAM wParam, LPARAM lParam);
+ void btnPageClick();
};
-//---------------------------------------------------------------------------
#endif
diff --git a/plugins/SendScreenshotPlus/src/UMainForm.cpp b/plugins/SendScreenshotPlus/src/UMainForm.cpp
index ae1203aaee..62da365e15 100644
--- a/plugins/SendScreenshotPlus/src/UMainForm.cpp
+++ b/plugins/SendScreenshotPlus/src/UMainForm.cpp
@@ -41,7 +41,8 @@ void TfrmMain::Unload()
}
}
-//---------------------------------------------------------------------------
+/////////////////////////////////////////////////////////////////////////////////////////
+
INT_PTR CALLBACK TfrmMain::DlgProc_CaptureTabPage(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
// main message handling is done inside TfrmMain::DlgTfrmMain
@@ -97,7 +98,7 @@ INT_PTR CALLBACK TfrmMain::DlgProc_CaptureTabPage(HWND hDlg, UINT uMsg, WPARAM w
return FALSE;
}
-//---------------------------------------------------------------------------
+/////////////////////////////////////////////////////////////////////////////////////////
TfrmMain::CHandleMapping TfrmMain::_HandleMapping;
@@ -167,8 +168,9 @@ INT_PTR CALLBACK TfrmMain::DlgTfrmMain(HWND hWnd, UINT msg, WPARAM wParam, LPARA
return 0;
}
-//---------------------------------------------------------------------------
-//WM_INITDIALOG:
+/////////////////////////////////////////////////////////////////////////////////////////
+// WM_INITDIALOG:
+
void TfrmMain::wmInitdialog(WPARAM, LPARAM)
{
HWND hCtrl;
@@ -375,10 +377,11 @@ void TfrmMain::wmInitdialog(WPARAM, LPARAM)
TranslateDialogDefault(m_hWnd);
}
-//WM_COMMAND:
+/////////////////////////////////////////////////////////////////////////////////////////
+// WM_COMMAND:
+
void TfrmMain::wmCommand(WPARAM wParam, LPARAM lParam)
{
- //---------------------------------------------------------------------------
int IDControl = LOWORD(wParam);
switch (HIWORD(wParam)) {
case BN_CLICKED: //Button controls
@@ -685,8 +688,9 @@ void TfrmMain::UMevent(WPARAM, LPARAM lParam)
}
}
-//---------------------------------------------------------------------------
+/////////////////////////////////////////////////////////////////////////////////////////
// Standard konstruktor/destruktor
+
TfrmMain::TfrmMain()
{
/* m_opt_XXX */
@@ -697,7 +701,7 @@ TfrmMain::TfrmMain()
m_bFormAbout = false;
m_hTargetWindow = m_hLastWin = NULL;
m_hTargetHighlighter = NULL;
- m_FDestFolder = m_pszFile = m_pszFileDesc = NULL;
+ m_FDestFolder = m_pszFile = NULL;
m_Screenshot = NULL;
/* m_AlphaColor */
m_cSend = NULL;
@@ -715,7 +719,6 @@ TfrmMain::~TfrmMain()
_HandleMapping.erase(m_hWnd);
mir_free(m_pszFile);
mir_free(m_FDestFolder);
- mir_free(m_pszFileDesc);
mir_free(m_Monitors);
if (m_Screenshot) FIP->FI_Unload(m_Screenshot);
if (m_cSend) delete m_cSend;
@@ -725,8 +728,9 @@ TfrmMain::~TfrmMain()
}
}
-//---------------------------------------------------------------------------
+/////////////////////////////////////////////////////////////////////////////////////////
// Load / Saving options from miranda's database
+
void TfrmMain::LoadOptions(void)
{
DWORD rgb = db_get_dw(NULL, SZ_SENDSS, "AlphaColor", 16777215);
@@ -780,7 +784,8 @@ void TfrmMain::SaveOptions(void)
}
}
-//---------------------------------------------------------------------------
+/////////////////////////////////////////////////////////////////////////////////////////
+
void TfrmMain::Init(wchar_t* DestFolder, MCONTACT Contact)
{
m_FDestFolder = mir_wstrdup(DestFolder);
@@ -796,7 +801,8 @@ void TfrmMain::Init(wchar_t* DestFolder, MCONTACT Contact)
m_cSend->SetContact(Contact);
}
-//---------------------------------------------------------------------------
+/////////////////////////////////////////////////////////////////////////////////////////
+
void TfrmMain::btnCaptureClick()
{
if (m_opt_tabCapture == 1) m_hTargetWindow = GetDesktopWindow();
@@ -833,7 +839,8 @@ void TfrmMain::btnCaptureClick()
SendMessage(m_hWnd, UM_EVENT, 0, (LPARAM)EVT_CaptureDone);
}
-//---------------------------------------------------------------------------
+/////////////////////////////////////////////////////////////////////////////////////////
+
void TfrmMain::chkTimedClick()
{
Button_Enable(GetDlgItem(m_hWnd, ID_edtTimedLabel), (BOOL)m_opt_chkTimed);
@@ -841,7 +848,8 @@ void TfrmMain::chkTimedClick()
Button_Enable(GetDlgItem(m_hWnd, ID_upTimed), (BOOL)m_opt_chkTimed);
}
-//---------------------------------------------------------------------------
+/////////////////////////////////////////////////////////////////////////////////////////
+
void TfrmMain::cboxSendByChange()
{
BOOL bState;
@@ -899,7 +907,8 @@ void TfrmMain::cboxSendByChange()
Button_Enable(GetDlgItem(m_hWnd, ID_chkDesc), bState);
}
-//---------------------------------------------------------------------------
+/////////////////////////////////////////////////////////////////////////////////////////
+
void TfrmMain::btnAboutClick()
{
if (m_bFormAbout) return;
@@ -909,20 +918,24 @@ void TfrmMain::btnAboutClick()
m_bFormAbout = true;
}
+/////////////////////////////////////////////////////////////////////////////////////////
// Edit window call this event before it closes
+
void TfrmMain::btnAboutOnCloseWindow(HWND)
{
m_bFormAbout = false;
}
-//---------------------------------------------------------------------------
+/////////////////////////////////////////////////////////////////////////////////////////
+
void TfrmMain::btnExploreClick()
{
if (m_FDestFolder)
ShellExecute(NULL, L"explore", m_FDestFolder, NULL, NULL, SW_SHOW);
}
-//---------------------------------------------------------------------------
+/////////////////////////////////////////////////////////////////////////////////////////
+
void TfrmMain::edtSizeUpdate(HWND hWnd, BOOL ClientArea, HWND hTarget, UINT Ctrl)
{
// get window dimensions
@@ -961,189 +974,117 @@ void TfrmMain::edtSizeUpdate(RECT rect, HWND hTarget, UINT Ctrl)
SetDlgItemText(hTarget, Ctrl, B);
}
-//---------------------------------------------------------------------------
-INT_PTR TfrmMain::SaveScreenshot(FIBITMAP* dib)
+/////////////////////////////////////////////////////////////////////////////////////////
+
+INT_PTR TfrmMain::SaveScreenshot(FIBITMAP *dib)
{
- //generate File name
- FREE_IMAGE_FORMAT fif = FIF_UNKNOWN;
- wchar_t* ret;
- wchar_t* path = NULL;
- wchar_t* pszFilename = NULL;
- wchar_t* pszFileDesc = NULL;
- if (!dib) return 1; //error
- unsigned FileNumber = db_get_dw(NULL, SZ_SENDSS, "FileNumber", 0) + 1;
- if (FileNumber > 99999) FileNumber = 1;
- //Generate FileName
- mir_tstradd(path, m_FDestFolder);
- if (path[mir_wstrlen(path) - 1] != '\\') mir_tstradd(path, L"\\");
- mir_tstradd(path, L"shot%.5u");//on format change, adapt "len" below
- size_t len = mir_wstrlen(path) + 2;
- pszFilename = (wchar_t*)mir_alloc(sizeof(wchar_t)*(len));
- mir_snwprintf(pszFilename, len, path, FileNumber);
- mir_free(path);
-
- //Generate a description according to the screenshot
+ if (!dib)
+ return 1; //error
+ // generate file name
+ unsigned FileNumber = db_get_dw(NULL, SZ_SENDSS, "FileNumber", 0) + 1;
+ if (FileNumber > 99999)
+ FileNumber = 1;
+
+ CMStringW wszFileName(m_FDestFolder);
+ if (wszFileName.Right(1) != L"\\")
+ wszFileName.Append(L"\\");
+ wszFileName.AppendFormat(L"shot%.5u", FileNumber);
+
+ // generate a description according to the screenshot
wchar_t winText[1024];
GetDlgItemText(m_hwndTabPage, ID_edtCaption, winText, _countof(winText));
-
- CMStringW tszFileDesc;
-
+ CMStringW wszFileDesc;
if (m_opt_tabCapture)
- tszFileDesc.Format(TranslateT("Screenshot of \"%s\""), winText);
- else
- {
+ wszFileDesc.Format(TranslateT("Screenshot of \"%s\""), winText);
+ else {
if (m_opt_chkClientArea)
- tszFileDesc.Format(TranslateT("Screenshot for client area of \"%s\" window"), winText);
+ wszFileDesc.Format(TranslateT("Screenshot for client area of \"%s\" window"), winText);
else
- tszFileDesc.Format(TranslateT("Screenshot of \"%s\" window"), winText);
+ wszFileDesc.Format(TranslateT("Screenshot of \"%s\" window"), winText);
}
- pszFileDesc = tszFileDesc.Detach();
-
- // convert to 32Bits (make shure it is 32bit)
+ // convert to 32Bits (make sure it is 32bit)
FIBITMAP *dib_new = FIP->FI_ConvertTo32Bits(dib);
- //RGBQUAD appColor = { 245, 0, 254, 0 }; //bgr0 schwarz
- //FIP->FI_SetBackgroundColor(dib_new, &appColor);
FIP->FI_SetTransparent(dib_new, TRUE);
- // Investigates the color type of the bitmap (test for RGB or CMYK colour space)
- switch (FREE_IMAGE_COLOR_TYPE ColTye = FIP->FI_GetColorType(dib_new)) {
- case FIC_MINISBLACK:
- //Monochrome bitmap (1-bit) : first palette entry is black.
- //Palletised bitmap (4 or 8-bit) and single channel non standard bitmap: the bitmap has a greyscale palette
- case FIC_MINISWHITE:
- //Monochrome bitmap (1-bit) : first palette entry is white.
- //Palletised bitmap (4 or 8-bit) : the bitmap has an inverted greyscale palette
- case FIC_PALETTE:
- //Palettized bitmap (1, 4 or 8 bit)
- case FIC_RGB:
- //High-color bitmap (16, 24 or 32 bit), RGB16 or RGBF
- case FIC_RGBALPHA:
- //High-color bitmap with an alpha channel (32 bit bitmap, RGBA16 or RGBAF)
- case FIC_CMYK:
- //CMYK bitmap (32 bit only)
- default:
- break;
- }
-
- // bool bDummy = !(FIP->FI_GetICCProfile(dib_new)->flags & FIICC_COLOR_IS_CMYK);
-
- FIBITMAP *dib32, *dib24;
+ BOOL ret = FALSE;
HWND hwndCombo = GetDlgItem(m_hWnd, ID_cboxFormat);
switch (ComboBox_GetItemData(hwndCombo, ComboBox_GetCurSel(hwndCombo))) {
- case 0: //PNG
- ret = SaveImage(fif, dib_new, pszFilename, L"png");
+ case 0: // PNG
+ wszFileName.Append(L".png");
+ ret = FIP->FI_SaveU(FIF_PNG, dib_new, wszFileName, 0);
break;
- case 1: //JPG
- /*
- #define JPEG_QUALITYSUPERB 0x80 // save with superb quality (100:1)
- #define JPEG_QUALITYGOOD 0x0100 // save with good quality (75:1)
- #define JPEG_QUALITYNORMAL 0x0200 // save with normal quality (50:1)
- #define JPEG_QUALITYAVERAGE 0x0400 // save with average quality (25:1)
- #define JPEG_QUALITYBAD 0x0800 // save with bad quality (10:1)
- #define JPEG_PROGRESSIVE 0x2000 // save as a progressive-JPEG (use | to combine with other save flags)
- */
- dib32 = FIP->FI_Composite(dib_new, FALSE, &m_AlphaColor, NULL);
- dib24 = FIP->FI_ConvertTo24Bits(dib32);
- FIP->FI_Unload(dib32);
- ret = SaveImage(fif, dib24, pszFilename, L"jpg");
- FIP->FI_Unload(dib24);
+ case 1: // JPG
+ wszFileName.Append(L".jpg");
+ {
+ FIBITMAP *dib32 = FIP->FI_Composite(dib_new, FALSE, &m_AlphaColor, NULL);
+ FIBITMAP *dib24 = FIP->FI_ConvertTo24Bits(dib32);
+ FIP->FI_Unload(dib32);
+ ret = FIP->FI_SaveU(FIF_JPEG, dib24, wszFileName, 0);
+ FIP->FI_Unload(dib24);
+ }
break;
- case 2: //BMP
- // ret = SaveImage(FIF_BMP,dib_new, pszFilename, L"bmp"); //32bit alpha BMP
- dib32 = FIP->FI_Composite(dib_new, FALSE, &m_AlphaColor, NULL);
- dib24 = FIP->FI_ConvertTo24Bits(dib32);
- FIP->FI_Unload(dib32);
- ret = SaveImage(FIF_BMP, dib24, pszFilename, L"bmp");
- FIP->FI_Unload(dib24);
+ case 2: // BMP
+ wszFileName.Append(L".bmp");
+ {
+ FIBITMAP *dib32 = FIP->FI_Composite(dib_new, FALSE, &m_AlphaColor, NULL);
+ FIBITMAP *dib24 = FIP->FI_ConvertTo24Bits(dib32);
+ FIP->FI_Unload(dib32);
+ ret = FIP->FI_SaveU(FIF_BMP, dib24, wszFileName, 0);
+ FIP->FI_Unload(dib24);
+ }
break;
case 3: //TIFF (miranda freeimage interface do not support save tiff, we udse GDI+)
+ wszFileName.Append(L".tif");
{
- wchar_t* pszFile = NULL;
- mir_tstradd(pszFile, pszFilename);
- mir_tstradd(pszFile, L".tif");
-
- dib32 = FIP->FI_Composite(dib_new, FALSE, &m_AlphaColor, NULL);
- dib24 = FIP->FI_ConvertTo24Bits(dib32);
+ FIBITMAP *dib32 = FIP->FI_Composite(dib_new, FALSE, &m_AlphaColor, NULL);
+ FIBITMAP *dib24 = FIP->FI_ConvertTo24Bits(dib32);
FIP->FI_Unload(dib32);
-
+
HBITMAP hBmp = FIP->FI_CreateHBITMAPFromDIB(dib24);
FIP->FI_Unload(dib24);
- SaveTIF(hBmp, pszFile);
- ret = pszFile;
+ SaveTIF(hBmp, wszFileName);
DeleteObject(hBmp);
}
+ ret = TRUE;
break;
case 4: //GIF
+ wszFileName.Append(L".gif");
{
- //dib24 = FIP->FI_ConvertTo8Bits(dib_new);
- //ret = SaveImage(FIF_GIF,dib24, pszFilename, L"gif");
- //FIP->FI_Unload(dib24);
- wchar_t* pszFile = NULL;
- mir_tstradd(pszFile, pszFilename);
- mir_tstradd(pszFile, L".gif");
HBITMAP hBmp = FIP->FI_CreateHBITMAPFromDIB(dib_new);
- SaveGIF(hBmp, pszFile);
- ret = pszFile;
+ SaveGIF(hBmp, wszFileName);
DeleteObject(hBmp);
}
+ ret = TRUE;
break;
-
- default:
- ret = NULL;
}
- /* //load PNG and save file in user format (if differ)
- //this get better result for transparent aereas
- //wchar_t* pszFormat = (wchar_t*)ComboBox_GetItemData(hwndCombo, ComboBox_GetCurSel(hwndCombo));
- wchar_t pszFormat[6];
- ComboBox_GetText(hwndCombo, pszFormat, 6);
- if(ret && (mir_wstrcmpi (pszFormat,L"png") != 0)) {
-
- fif = FIP->FI_GetFIFFromFilenameU(ret);
- dib_new = FIP->FI_LoadU(fif, ret,0);
-
-
- if(dib_new) {
- DeleteFile(ret);
- mir_free(ret);
- FIBITMAP *dib_save = FIP->FI_ConvertTo24Bits(dib_new);
- ret = SaveImage(FIF_UNKNOWN,dib_save, pszFilename, pszFormat);
- FIP->FI_Unload(dib_new); dib_new = NULL;
- FIP->FI_Unload(dib_save); dib_save = NULL;
- }
- }*/
+
FIP->FI_Unload(dib_new);
- mir_free(pszFilename);
-
- if (ret) {
- db_set_dw(NULL, SZ_SENDSS, "FileNumber", FileNumber);
- mir_free(m_pszFile); m_pszFile = ret;
- mir_free(m_pszFileDesc);
- if (IsWindowEnabled(GetDlgItem(m_hWnd, ID_chkDesc)) && m_opt_btnDesc) {
- m_pszFileDesc = pszFileDesc;
- }
- else {
- mir_free(pszFileDesc);
- m_pszFileDesc = mir_wstrdup(L"");
- }
- if (m_cSend) {
- m_cSend->SetFile(m_pszFile);
- m_cSend->SetDescription(m_pszFileDesc);
- }
- return 0;//OK
+ if (!ret)
+ return 1; // error
+
+ db_set_dw(NULL, SZ_SENDSS, "FileNumber", FileNumber);
+ replaceStrW(m_pszFile, wszFileName);
+
+ if (!IsWindowEnabled(GetDlgItem(m_hWnd, ID_chkDesc)) || !m_opt_btnDesc)
+ wszFileDesc.Empty();
+
+ if (m_cSend) {
+ m_cSend->SetFile(m_pszFile);
+ m_cSend->SetDescription(wszFileDesc);
}
- mir_free(pszFileDesc);
- return 1;//error
+ return 0; // OK
}
-//---------------------------------------------------------------------------
+/////////////////////////////////////////////////////////////////////////////////////////
+
void TfrmMain::FormClose()
{
bool bCanDelete = m_opt_btnDeleteAfterSend;
diff --git a/plugins/SendScreenshotPlus/src/UMainForm.h b/plugins/SendScreenshotPlus/src/UMainForm.h
index 03ac33b7df..79b4107cad 100644
--- a/plugins/SendScreenshotPlus/src/UMainForm.h
+++ b/plugins/SendScreenshotPlus/src/UMainForm.h
@@ -51,96 +51,96 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
extern FI_INTERFACE *FIP;
-typedef struct MyTabData {
+struct TAB_INFO
+{
TCITEMHEADER tcih;
HWND hwndMain; //main window
HWND hwndTab; //tab control
HWND hwndTabPage; //current child dialog box
-}TAB_INFO;
-
-//---------------------------------------------------------------------------
-class TfrmMain{
- public:
- // Deklaration Standardkonstruktor/Standarddestructor
- TfrmMain();
- ~TfrmMain();
-
- BYTE m_opt_tabCapture; //capure tab page
- BYTE m_opt_cboxDesktop; //TRadioButton *rbtnDesktop;
- BYTE m_opt_chkTimed; //TCheckBox *chkTimed;
- BYTE m_opt_cboxSendBy; //TComboBox *cboxSendBy;
- BYTE m_opt_btnDesc; //TCheckBox *chkDesc;
- BYTE m_opt_chkEditor; //TCheckBox *chkEditor;
- bool m_bOnExitSave;
-
- static void Unload();
- void Init(wchar_t* DestFolder, MCONTACT 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 SetTargetWindow(HWND hwnd=NULL);
- void btnCaptureClick();
- void cboxSendByChange();
-
- private:
- HWND m_hWnd;
- MCONTACT m_hContact;
- bool m_bFormAbout;
- HWND m_hTargetWindow, m_hLastWin;
- HWND m_hTargetHighlighter;
- wchar_t* m_FDestFolder;
- wchar_t* m_pszFile;
- wchar_t* m_pszFileDesc;
- 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);
-
- protected:
- MONITORINFOEX* m_Monitors;
- size_t m_MonitorCount;
- RECT m_VirtualScreen;
-
- BYTE m_opt_chkOpenAgain; //TCheckBox *chkOpenAgain;
- BYTE m_opt_chkIndirectCapture; //TCheckBox *chkIndirectCapture;
- BYTE m_opt_chkClientArea; //TCheckBox *chkClientArea;
- BYTE m_opt_edtQuality; //TLabeledEdit *edtQuality;
- bool m_opt_btnDeleteAfterSend; //TCheckBox *chkDeleteAfterSend;
- BYTE m_opt_cboxFormat; //TComboBox *cboxFormat;
- BYTE m_opt_edtTimed; //TLabeledEdit *edtTimed;
- bool m_bCapture; //is capture active
- 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);
-
- static INT_PTR CALLBACK DlgProc_CaptureTabPage(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
-// LRESULT CALLBACK DlgProc_UseLastFile (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
};
-//---------------------------------------------------------------------------
+/////////////////////////////////////////////////////////////////////////////////////////
+
+class TfrmMain
+{
+
+public:
+ // Deklaration Standardkonstruktor/Standarddestructor
+ TfrmMain();
+ ~TfrmMain();
+
+ BYTE m_opt_tabCapture; //capure tab page
+ BYTE m_opt_cboxDesktop; //TRadioButton *rbtnDesktop;
+ BYTE m_opt_chkTimed; //TCheckBox *chkTimed;
+ BYTE m_opt_cboxSendBy; //TComboBox *cboxSendBy;
+ BYTE m_opt_btnDesc; //TCheckBox *chkDesc;
+ BYTE m_opt_chkEditor; //TCheckBox *chkEditor;
+ bool m_bOnExitSave;
+
+ static void Unload();
+ void Init(wchar_t* DestFolder, MCONTACT 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 SetTargetWindow(HWND hwnd = NULL);
+ void btnCaptureClick();
+ void cboxSendByChange();
+
+private:
+ HWND m_hWnd;
+ MCONTACT m_hContact;
+ bool m_bFormAbout;
+ HWND m_hTargetWindow, m_hLastWin;
+ HWND m_hTargetHighlighter;
+ wchar_t* m_FDestFolder;
+ wchar_t* m_pszFile;
+ 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);
+
+protected:
+ MONITORINFOEX* m_Monitors;
+ size_t m_MonitorCount;
+ RECT m_VirtualScreen;
+
+ BYTE m_opt_chkOpenAgain; //TCheckBox *chkOpenAgain;
+ BYTE m_opt_chkIndirectCapture; //TCheckBox *chkIndirectCapture;
+ BYTE m_opt_chkClientArea; //TCheckBox *chkClientArea;
+ BYTE m_opt_edtQuality; //TLabeledEdit *edtQuality;
+ bool m_opt_btnDeleteAfterSend; //TCheckBox *chkDeleteAfterSend;
+ BYTE m_opt_cboxFormat; //TComboBox *cboxFormat;
+ BYTE m_opt_edtTimed; //TLabeledEdit *edtTimed;
+ bool m_bCapture; //is capture active
+ 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);
+
+ static INT_PTR CALLBACK DlgProc_CaptureTabPage(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
+};
#endif
diff --git a/plugins/SendScreenshotPlus/src/Utils.cpp b/plugins/SendScreenshotPlus/src/Utils.cpp
index b7a41fda0b..86aed88090 100644
--- a/plugins/SendScreenshotPlus/src/Utils.cpp
+++ b/plugins/SendScreenshotPlus/src/Utils.cpp
@@ -28,8 +28,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "stdafx.h"
-//---------------------------------------------------------------------------
-//Workaround for MS bug ComboBox_SelectItemData
+/////////////////////////////////////////////////////////////////////////////////////////
+// Workaround for MS bug ComboBox_SelectItemData
+
int ComboBox_SelectItemData(HWND hwndCtl, LPARAM data)
{
int i = 0;
@@ -42,9 +43,22 @@ int ComboBox_SelectItemData(HWND hwndCtl, LPARAM data)
return CB_ERR;
}
-//---------------------------------------------------------------------------
+/////////////////////////////////////////////////////////////////////////////////////////
// MonitorInfoEnum
-size_t MonitorInfoEnum(MONITORINFOEX* & myMonitors, RECT & virtualScreen)
+
+static BOOL CALLBACK MonitorInfoEnumProc(HMONITOR hMonitor, HDC, LPRECT, LPARAM dwData)
+{
+ MONITORS* monitors = (MONITORS*)dwData;
+ ++monitors->count;
+ monitors->info = (MONITORINFOEX*)mir_realloc(monitors->info, sizeof(MONITORINFOEX)*monitors->count);
+ monitors->info[monitors->count - 1].cbSize = sizeof(MONITORINFOEX);
+ if (!GetMonitorInfo(hMonitor, (LPMONITORINFO)(monitors->info + monitors->count - 1)))
+ return FALSE; // stop enumeration if error
+
+ return TRUE;
+}
+
+size_t MonitorInfoEnum(MONITORINFOEX* &myMonitors, RECT &virtualScreen)
{
MONITORS tmp = { 0, 0 };
if (EnumDisplayMonitors(NULL, NULL, MonitorInfoEnumProc, (LPARAM)&tmp)) {
@@ -55,28 +69,16 @@ size_t MonitorInfoEnum(MONITORINFOEX* & myMonitors, RECT & virtualScreen)
}
return tmp.count;
}
- else {
- if (tmp.info) mir_free(tmp.info);
- }
+
+ mir_free(tmp.info);
return 0;
}
-// MonitorInfoEnumProc - CALLBACK for MonitorInfoEnum
-BOOL CALLBACK MonitorInfoEnumProc(HMONITOR hMonitor, HDC, LPRECT, LPARAM dwData)
-{
- MONITORS* monitors = (MONITORS*)dwData;
- ++monitors->count;
- monitors->info = (MONITORINFOEX*)mir_realloc(monitors->info, sizeof(MONITORINFOEX)*monitors->count);
- monitors->info[monitors->count - 1].cbSize = sizeof(MONITORINFOEX);
- if (!GetMonitorInfo(hMonitor, (LPMONITORINFO)(monitors->info + monitors->count - 1))) {
- return FALSE; // stop enumeration if error
- }
- return TRUE;
-}
-
FIBITMAP* CreateDIBFromDC(HDC hDC, const RECT* rect, HWND hCapture = 0);
-//---------------------------------------------------------------------------
+
+/////////////////////////////////////////////////////////////////////////////////////////
// capture window as FIBITMAP - caller must FIP->FI_Unload(dib)
+
FIBITMAP* CaptureWindow(HWND hCapture, BOOL bClientArea, BOOL bIndirectCapture)
{
FIBITMAP* dib;
@@ -119,7 +121,7 @@ FIBITMAP* CaptureWindow(HWND hCapture, BOOL bClientArea, BOOL bIndirectCapture)
rect.right = ABS(rect.right - rect.left);
rect.bottom = ABS(rect.bottom - rect.top);
rect.left = rect.top = 0;
- /// capture window and get FIBITMAP
+ // capture window and get FIBITMAP
dib = CreateDIBFromDC(hDCsrc, &rect, hCapture);
ReleaseDC(hCapture, hDCsrc);
if (bClientArea) {//we could capture directly, but doing so breaks GetWindowRgn() and also includes artifacts...
@@ -146,7 +148,7 @@ FIBITMAP* CaptureMonitor(const wchar_t* szDevice, const RECT* cropRect/*=NULL*/)
{
HDC hScrDC;
RECT rect;
- FIBITMAP* dib;
+
/// get screen resolution
if (!szDevice) {
hScrDC = CreateDC(L"DISPLAY", NULL, NULL, NULL);
@@ -167,42 +169,38 @@ FIBITMAP* CaptureMonitor(const wchar_t* szDevice, const RECT* cropRect/*=NULL*/)
if (cropRect->right < rect.right) rect.right = cropRect->right;
if (cropRect->bottom < rect.bottom) rect.bottom = cropRect->bottom;
}
- dib = CreateDIBFromDC(hScrDC, &rect);
+
+ FIBITMAP *dib = CreateDIBFromDC(hScrDC, &rect);
ReleaseDC(NULL, hScrDC);
return dib;
}
FIBITMAP* CreateDIBFromDC(HDC hDC, const RECT* rect, HWND hCapture/*=NULL*/)
{
- ///HDC GetDC (NULL) entire desktp
- ///HDC GetDC (HWND hWnd) client area of the specified window. (may include artifacts)
- ///HDC GetWindowDC (HWND hWnd) entire window.
- FIBITMAP* dib;// return value
- HBITMAP hBitmap; // handles to device-dependent bitmaps
- HDC hScrDC, hMemDC; // screen DC and memory DC
long width = rect->right - rect->left;
long height = rect->bottom - rect->top;
// create a DC for the screen and create
// a memory DC compatible to screen DC
- if (!(hScrDC = hDC)) hScrDC = GetDC(hCapture);
- hMemDC = CreateCompatibleDC(hScrDC);
+ HDC hScrDC = hDC;
+ if (!hScrDC)
+ hScrDC = GetDC(hCapture);
+ HDC hMemDC = CreateCompatibleDC(hScrDC);
// create a bitmap compatible with the screen DC
- hBitmap = CreateCompatibleBitmap(hScrDC, width, height);//width,height
+ HBITMAP hBitmap = CreateCompatibleBitmap(hScrDC, width, height);//width,height
// select new bitmap into memory DC
SelectObject(hMemDC, hBitmap);
- if (hCapture && hDC) {
+ if (hCapture && hDC)
PrintWindow(hCapture, hMemDC, 0);
- }
- else {// bitblt screen DC to memory DC
+ else // bitblt screen DC to memory DC
BitBlt(hMemDC, 0, 0, width, height, hScrDC, rect->left, rect->top, CAPTUREBLT | SRCCOPY);
- }
- dib = FIP->FI_CreateDIBFromHBITMAP(hBitmap);
- //alpha channel from window is always wrong and sometimes even for desktop (Win7, no aero)
- //coz GDI do not draw all in alpha mode.
- //we have to create our own new alpha channel.
+ FIBITMAP *dib = FIP->FI_CreateDIBFromHBITMAP(hBitmap);
+
+ // alpha channel from window is always wrong and sometimes even for desktop (Win7, no aero)
+ // coz GDI do not draw all in alpha mode.
+ // we have to create our own new alpha channel.
bool bFixAlpha = true;
bool bInvert = false;
HBRUSH hBr = CreateSolidBrush(RGB(255, 255, 255));//Create a SolidBrush object for non transparent area
@@ -216,7 +214,7 @@ FIBITMAP* CreateDIBFromDC(HDC hDC, const RECT* rect, HWND hCapture/*=NULL*/)
COLORREF crKey = 0x00000000;
DWORD dwFlags = 0;
if (GetLayeredWindowAttributes(hCapture, &crKey, &bAlpha, &dwFlags)) {
- /// per window transparency (like fading in a whole window)
+ // per window transparency (like fading in a whole window)
if ((dwFlags&LWA_COLORKEY)) {
SetBkColor(hMemDC, crKey);
BitBlt(hMaskDC, 0, 0, width, height, hMemDC, rect->left, rect->top, SRCCOPY);
@@ -226,11 +224,11 @@ FIBITMAP* CreateDIBFromDC(HDC hDC, const RECT* rect, HWND hCapture/*=NULL*/)
bFixAlpha = false;
}
}
- else {//per-pixel transparency (won't use the WM_PAINT)
+ else { // per-pixel transparency (won't use the WM_PAINT)
bFixAlpha = false;
}
}
- else {//not layered - fill the window region
+ else { // not layered - fill the window region
SetRectRgn(hRgn, 0, 0, width, height);
FillRgn(hMaskDC, hRgn, hBr);
}
@@ -244,7 +242,7 @@ FIBITMAP* CreateDIBFromDC(HDC hDC, const RECT* rect, HWND hCapture/*=NULL*/)
FIBITMAP* dibMask = FIP->FI_CreateDIBFromHBITMAP(hMask);
if (bInvert) FIP->FI_Invert(dibMask);
FIBITMAP* dib8 = FIP->FI_ConvertTo8Bits(dibMask);
- //copy the dib8 alpha mask to dib32 main bitmap
+ // copy the dib8 alpha mask to dib32 main bitmap
FIP->FI_SetChannel(dib, dib8, FICC_ALPHA);
FIP->FI_Unload(dibMask);
FIP->FI_Unload(dib8);
@@ -252,10 +250,11 @@ FIBITMAP* CreateDIBFromDC(HDC hDC, const RECT* rect, HWND hCapture/*=NULL*/)
DeleteDC(hMaskDC);
DeleteObject(hMask);
DeleteObject(hBr);
- //clean up
+ // clean up
DeleteDC(hMemDC);
DeleteObject(hBitmap);
- if (!hDC) ReleaseDC(NULL, hScrDC);
+ if (!hDC)
+ ReleaseDC(NULL, hScrDC);
#ifdef _DEBUG
switch (FIP->FI_GetImageType(dib)) {
@@ -308,52 +307,7 @@ FIBITMAP* CreateDIBFromDC(HDC hDC, const RECT* rect, HWND hCapture/*=NULL*/)
return dib;
}
-wchar_t* SaveImage(FREE_IMAGE_FORMAT fif, FIBITMAP* dib, const wchar_t* pszFilename, const wchar_t* pszExt, int flag)
-{
- int ret = 0;
- wchar_t* pszFile = NULL;
- wchar_t* FileExt = GetFileExt(pszFilename);
- if (!FileExt) {
- if (!pszExt) return NULL;
- mir_tstradd(pszFile, pszFilename);
- mir_tstradd(pszFile, L".");
- mir_tstradd(pszFile, pszExt);
- }
- else {
- mir_tstradd(pszFile, pszFilename);
- }
-
- if (fif == FIF_UNKNOWN) {
- fif = FIP->FI_GetFIFFromFilenameU(pszFile);
- }
-
- ret = FIP->FI_SaveU(fif, dib, pszFile, flag);
-
-
- mir_free(FileExt);
-
- if (ret) return pszFile;
- mir_free(pszFile);
- return NULL;
-}
-
-//---------------------------------------------------------------------------
-wchar_t* GetFileNameW(const wchar_t* pszPath)
-{
- const wchar_t* slash = wcsrchr(pszPath, '\\');
- if (!slash) slash = wcsrchr(pszPath, '/');
- if (slash)
- return mir_wstrdup(slash + 1);
- else
- return mir_wstrdup(pszPath);
-}
-wchar_t* GetFileExtW(const wchar_t* pszPath)
-{
- const wchar_t* slash = wcsrchr(pszPath, '.');
- if (slash)
- return mir_wstrdup(slash);
- return NULL;
-}
+/////////////////////////////////////////////////////////////////////////////////////////
char* GetFileNameA(const wchar_t* pszPath)
{
@@ -364,16 +318,10 @@ char* GetFileNameA(const wchar_t* pszPath)
else
return mir_u2a(pszPath);
}
-char* GetFileExtA(const wchar_t* pszPath)
-{
- const wchar_t* slash = wcsrchr(pszPath, '.');
- if (slash)
- return mir_u2a(slash);
- return NULL;
-}
-//---------------------------------------------------------------------------
-BOOL GetEncoderClsid(wchar_t *wchMimeType, CLSID& clsidEncoder)
+/////////////////////////////////////////////////////////////////////////////////////////
+
+BOOL GetEncoderClsid(wchar_t *wchMimeType, CLSID &clsidEncoder)
{
UINT uiNum = 0;
UINT uiSize = 0;
@@ -395,7 +343,9 @@ BOOL GetEncoderClsid(wchar_t *wchMimeType, CLSID& clsidEncoder)
return bOk;
}
-void SaveGIF(HBITMAP hBmp, wchar_t* szFilename)
+/////////////////////////////////////////////////////////////////////////////////////////
+
+void SaveGIF(HBITMAP hBmp, const wchar_t *szFilename)
{
Gdiplus::GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
@@ -415,7 +365,9 @@ void SaveGIF(HBITMAP hBmp, wchar_t* szFilename)
Gdiplus::GdiplusShutdown(gdiplusToken);
}
-void SaveTIF(HBITMAP hBmp, wchar_t* szFilename)
+/////////////////////////////////////////////////////////////////////////////////////////
+
+void SaveTIF(HBITMAP hBmp, const wchar_t *szFilename)
{
//http://www.codeproject.com/Messages/1406708/How-to-reduce-the-size-of-an-Image-using-GDIplus.aspx
ULONG_PTR gdiplusToken;
diff --git a/plugins/SendScreenshotPlus/src/Utils.h b/plugins/SendScreenshotPlus/src/Utils.h
index f4d58f0d00..9b69a41dd9 100644
--- a/plugins/SendScreenshotPlus/src/Utils.h
+++ b/plugins/SendScreenshotPlus/src/Utils.h
@@ -31,50 +31,36 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define SPP_USERPANE 1
-extern FI_INTERFACE *FIP;
+extern FI_INTERFACE* FIP;
#define ABS(x) ((x)<0?-(x):(x))
-typedef struct TEnumDataTemp {
-size_t count;
-MONITORINFOEX* info;
-}MONITORS;
+struct MONITORS
+{
+ size_t count;
+ MONITORINFOEX* info;
+};
extern HWND g_hCapture;
extern HBITMAP g_hBitmap, g_hbmMask;
-//---------------------------------------------------------------------------
-int ComboBox_SelectItemData(HWND hwndCtl, LPARAM data);
-
-size_t MonitorInfoEnum(MONITORINFOEX* & myMonitors, RECT & virtualScreen);
-BOOL CALLBACK MonitorInfoEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData);
-
-FIBITMAP* CaptureWindow(HWND hCapture, BOOL bClientArea, BOOL bIndirectCapture);
-FIBITMAP* CaptureMonitor(const wchar_t* szDevice,const RECT* cropRect=NULL);
-wchar_t* SaveImage(FREE_IMAGE_FORMAT fif, FIBITMAP* dib, const wchar_t* pszFilename, const wchar_t* pszExt, int flag=0);
-
-wchar_t* GetFileNameW(const wchar_t* pszPath);
-wchar_t* GetFileExtW (const wchar_t* pszPath);
-char* GetFileNameA(const wchar_t* pszPath);
-char* GetFileExtA (const wchar_t* pszPath);
-#ifdef _UNICODE
-# define GetFileName GetFileNameW
-# define GetFileExt GetFileExtW
-#else
-# define GetFileName GetFileNameA
-# define GetFileExt GetFileExtA
-#endif // _UNICODE
-
-BOOL GetEncoderClsid(wchar_t *wchMimeType, CLSID& clsidEncoder);
-//void SavePNG(HBITMAP hBmp, wchar_t* szFilename);
-void SaveGIF(HBITMAP hBmp, wchar_t* szFilename);
-void SaveTIF(HBITMAP hBmp, wchar_t* szFilename);
-
-//---------------------------------------------------------------------------
-/* Old stuff from Borland C++
-//void ShowPopup(char *title, char *text);
+/////////////////////////////////////////////////////////////////////////////////////////
-*/
+int ComboBox_SelectItemData(HWND hwndCtl, LPARAM data);
+
+size_t MonitorInfoEnum(MONITORINFOEX* &myMonitors, RECT &virtualScreen);
+
+FIBITMAP* CaptureWindow(HWND hCapture, BOOL bClientArea, BOOL bIndirectCapture);
+FIBITMAP* CaptureMonitor(const wchar_t *pwszDevice, const RECT *cropRect = NULL);
+
+char* GetFileNameA(const wchar_t *pwszPath);
+
+BOOL GetEncoderClsid(wchar_t *wchMimeType, CLSID &clsidEncoder);
+
+void SaveGIF(HBITMAP hBmp, const wchar_t *pwszFilename);
+void SaveTIF(HBITMAP hBmp, const wchar_t *pwszFilename);
+
+/////////////////////////////////////////////////////////////////////////////////////////
class EventHandle
{
diff --git a/plugins/SendScreenshotPlus/src/mir_string.cpp b/plugins/SendScreenshotPlus/src/mir_string.cpp
index f7028a1e3c..3906ccece4 100644
--- a/plugins/SendScreenshotPlus/src/mir_string.cpp
+++ b/plugins/SendScreenshotPlus/src/mir_string.cpp
@@ -27,7 +27,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "stdafx.h"
-//---------------------------------------------------------------------------
+/////////////////////////////////////////////////////////////////////////////////////////
+
void mir_stradd(char* &pszDest, const char* pszSrc)
{
if (!pszSrc)
diff --git a/plugins/SendScreenshotPlus/src/mir_string.h b/plugins/SendScreenshotPlus/src/mir_string.h
index 470c6fc7b3..3b3d6d3a29 100644
--- a/plugins/SendScreenshotPlus/src/mir_string.h
+++ b/plugins/SendScreenshotPlus/src/mir_string.h
@@ -31,6 +31,5 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define mir_freeAndNil(ptr) mir_free(ptr),ptr=NULL
void mir_stradd(char* &pszDest, const char* pszSrc);
void mir_wstradd(wchar_t* &pszDest, const wchar_t* pszSrc);
-#define mir_tstradd mir_wstradd
#endif /* _MIR_STRING_H_INCLUDED_ */
diff --git a/plugins/SendScreenshotPlus/src/stdafx.h b/plugins/SendScreenshotPlus/src/stdafx.h
index a9f907c99d..f657db5e51 100644
--- a/plugins/SendScreenshotPlus/src/stdafx.h
+++ b/plugins/SendScreenshotPlus/src/stdafx.h
@@ -110,7 +110,8 @@ typedef struct _MGLOBAL {
} MGLOBAL, *LPMGLOBAL;
-//---------------------------------------------------------------------------
+/////////////////////////////////////////////////////////////////////////////////////////
+
#define ERROR_TITLE TranslateT("SendScreenshot - Error")
// Miranda Database Key
diff --git a/plugins/SendScreenshotPlus/src/version.h b/plugins/SendScreenshotPlus/src/version.h
index 48e45d8caf..c25efc650c 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 9
+#define __RELEASE_NUM 10
#define __BUILD_NUM 1
#include <stdver.h>