From 632700c7828d2b9667c8dc8bc3403f910b51e158 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 13 May 2025 13:16:41 +0300 Subject: fixes #5017 (SendSS: UploadPie not working) + some code formatting --- plugins/SendScreenshotPlus/src/CSend.cpp | 53 +++++++++-------- plugins/SendScreenshotPlus/src/CSendCloudFile.cpp | 10 ++-- plugins/SendScreenshotPlus/src/CSendEmail.cpp | 10 ++-- plugins/SendScreenshotPlus/src/CSendFTPFile.cpp | 12 ++-- plugins/SendScreenshotPlus/src/CSendFile.cpp | 4 +- plugins/SendScreenshotPlus/src/CSendHTTPServer.cpp | 10 ++-- .../src/CSendHost_ImageShack.cpp | 14 ++--- plugins/SendScreenshotPlus/src/CSendHost_imgur.cpp | 10 ++-- .../SendScreenshotPlus/src/CSendHost_uploadpie.cpp | 32 ++++++----- plugins/SendScreenshotPlus/src/Main.cpp | 4 +- plugins/SendScreenshotPlus/src/UMainForm.cpp | 40 ++++++------- plugins/SendScreenshotPlus/src/Utils.cpp | 66 +++++++++++----------- plugins/SendScreenshotPlus/src/ctrl_button.cpp | 28 ++++----- plugins/SendScreenshotPlus/src/dlg_msgbox.cpp | 4 +- plugins/SendScreenshotPlus/src/stdafx.h | 1 + plugins/SendScreenshotPlus/src/version.h | 2 +- 16 files changed, 154 insertions(+), 146 deletions(-) (limited to 'plugins/SendScreenshotPlus/src') diff --git a/plugins/SendScreenshotPlus/src/CSend.cpp b/plugins/SendScreenshotPlus/src/CSend.cpp index c18b247f92..5916a7cd0e 100644 --- a/plugins/SendScreenshotPlus/src/CSend.cpp +++ b/plugins/SendScreenshotPlus/src/CSend.cpp @@ -79,7 +79,7 @@ INT_PTR CALLBACK CSend::ResultDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, TranslateDialogDefault(hwndDlg); Window_SetIcon_IcoLib(hwndDlg, GetIconHandle(ICO_MAIN)); { - CSend *self = (CSend*)lParam; + 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)); @@ -165,7 +165,7 @@ INT_PTR CALLBACK CSend::ResultDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, else len = GetDlgItemText(hwndDlg, edtID, tmp, _countof(tmp)); Utils_ClipboardCopy(MClipUnicode(CMStringW(tmp, (int)len + 1))); - + if (LOWORD(wParam) == IDOK) DestroyWindow(hwndDlg); return TRUE; @@ -174,13 +174,13 @@ INT_PTR CALLBACK CSend::ResultDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, return FALSE; } -void CSend::svcSendMsgExit(const char* szMessage) +void CSend::svcSendMsgExit(const char *szMessage) { if (m_bSilent) { Exit(ACKRESULT_SUCCESS); return; } - + if (!m_hContact) { if (!m_pszFileDesc) m_pszFileDesc = mir_a2u(szMessage); @@ -213,7 +213,7 @@ void CSend::svcSendMsgExit(const char* szMessage) // start PSS_MESSAGE service m_hSend = (HANDLE)ProtoChainSend(m_hContact, PSS_MESSAGE, NULL, ptrA(mir_utf8encode(m_szEventMsg))); - + // check we actually got an ft handle back from the protocol if (!m_hSend) { Unhook(); @@ -230,19 +230,19 @@ void CSend::svcSendFileExit() if (m_bSilent) { Exit(ACKRESULT_SUCCESS); return; } - + if (!m_hContact) { Error(LPGENW("%s requires a valid contact!"), m_pszSendTyp); Exit(ACKRESULT_FAILED); return; } - + m_szEventMsg = _T2A(m_pszFile); if (m_pszFileDesc && m_pszFileDesc[0] != NULL) { m_szEventMsg.AppendChar(0); m_szEventMsg.Append(_T2A(m_pszFileDesc)); } - + m_cbEventMsg = m_szEventMsg.GetLength() + 1; // Сreate a HookEventObj on ME_PROTO_ACK @@ -251,8 +251,8 @@ void CSend::svcSendFileExit() } // Start miranda PSS_FILE based on mir ver (T) - wchar_t* ppFile[2] = { nullptr, nullptr }; - wchar_t* pDesc = mir_wstrdup(m_pszFileDesc); + wchar_t *ppFile[2] = { nullptr, nullptr }; + wchar_t *pDesc = mir_wstrdup(m_pszFileDesc); ppFile[0] = mir_wstrdup(m_pszFile); ppFile[1] = nullptr; m_hSend = (HANDLE)ProtoChainSend(m_hContact, PSS_FILE, (WPARAM)pDesc, (LPARAM)ppFile); @@ -271,8 +271,8 @@ void CSend::svcSendFileExit() int CSend::OnSend(void *obj, WPARAM, LPARAM lParam) { - CSend* self = (CSend*)obj; - ACKDATA *ack = (ACKDATA*)lParam; + CSend *self = (CSend *)obj; + ACKDATA *ack = (ACKDATA *)lParam; if (ack->hProcess != self->m_hSend) return 0; @@ -397,7 +397,7 @@ void CSend::Exit(unsigned int Result) else MsgErr(nullptr, LPGENW("An unknown error has occurred.")); } } - if (m_pszFile && *m_pszFile && m_bDeleteAfterSend && m_EnableItem&SS_DLG_DELETEAFTERSSEND) { + if (m_pszFile && *m_pszFile && m_bDeleteAfterSend && m_EnableItem & SS_DLG_DELETEAFTERSSEND) { DeleteFile(m_pszFile), m_pszFile = nullptr; } if (m_bAsync) @@ -409,20 +409,20 @@ void CSend::Exit(unsigned int Result) #define snprintf _snprintf -const char* CSend::GetHTMLContent(char* str, const char* startTag, const char* endTag) +const char *CSend::GetHTMLContent(char *str, const char *startTag, const char *endTag) { - char* begin = strstr(str, startTag); + char *begin = strstr(str, startTag); if (!begin) return nullptr; begin += mir_strlen(startTag) - 1; for (; *begin != '>' && *begin; ++begin); if (*begin) { - char* end = strstr(++begin, endTag); + char *end = strstr(++begin, endTag); if (end) *end = 0; } return begin; } -int CSend::HTTPFormCreate(MHttpRequest* nlhr, const char* url, HTTPFormData* frm, size_t frmNum) +int CSend::HTTPFormCreate(MHttpRequest *nlhr, const char *url, HTTPFormData *frm, size_t frmNum) { char boundary[16]; strcpy(boundary, "--M461C/"); @@ -447,7 +447,7 @@ int CSend::HTTPFormCreate(MHttpRequest* nlhr, const char* url, HTTPFormData* frm nlhr->AddHeader("Content-Type", CMStringA("multipart/form-data; boundary=") + boundary); nlhr->AddHeader("User-Agent", __USER_AGENT_STRING); nlhr->AddHeader("Accept-Language", "en-us,en;q=0.8"); - for (HTTPFormData* iter = frm, *end = frm + frmNum; iter != end; ++iter) { + for (HTTPFormData *iter = frm, *end = frm + frmNum; iter != end; ++iter) { if (!(iter->flags & HTTPFF_HEADER)) break; nlhr->AddHeader(iter->name, iter->value_str); @@ -457,7 +457,7 @@ int CSend::HTTPFormCreate(MHttpRequest* nlhr, const char* url, HTTPFormData* frm for (HTTPFormData *iter = frm, *end = frm + frmNum; iter != end; ++iter) { if (iter->flags & HTTPFF_HEADER) continue; - + str.AppendFormat("--%s", boundary); str.Append("\r\nContent-Disposition: form-data; name=\""); @@ -489,19 +489,24 @@ int CSend::HTTPFormCreate(MHttpRequest* nlhr, const char* url, HTTPFormData* frm } str.Append(mime); str.Append("\r\n\r\n"); - + /// add file content long filesize = 0; - FILE *fp = fopen(iter->value_str, "rb"); + Utf2T wszFileName(iter->value_str); + FILE *fp = _wfopen(wszFileName, L"rb"); if (fp) { - fseek(fp, 0, SEEK_END); - filesize = ftell(fp); fseek(fp, 0, SEEK_SET); + filesize = _filelength(fileno(fp)); ptrA buf((char *)mir_alloc(filesize)); if (fread(buf, 1, filesize, fp) != filesize) { str.Append(buf, filesize); fclose(fp), fp = nullptr; } - else str.Append(buf, filesize); + else { + int iLen = str.GetLength(); + str.Preallocate(iLen + filesize + 1000); + memcpy(str.GetBuffer() + iLen, buf, filesize); + str.ReleaseBufferSetLength(iLen + filesize); + } } if (!fp) { Error(L"Error occurred when opening local file.\nAborting file upload..."); diff --git a/plugins/SendScreenshotPlus/src/CSendCloudFile.cpp b/plugins/SendScreenshotPlus/src/CSendCloudFile.cpp index 673707b06f..70b1d9a08e 100644 --- a/plugins/SendScreenshotPlus/src/CSendCloudFile.cpp +++ b/plugins/SendScreenshotPlus/src/CSendCloudFile.cpp @@ -30,8 +30,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ///////////////////////////////////////////////////////////////////////////////////////// -CSendCloudFile::CSendCloudFile(HWND Owner, MCONTACT hContact, bool bAsync, const char *service) - : CSend(Owner, hContact, bAsync), m_service(service) +CSendCloudFile::CSendCloudFile(HWND Owner, MCONTACT hContact, bool bAsync, const char *service) : + CSend(Owner, hContact, bAsync), m_service(service) { // @todo : re-enable SS_DLG_DELETEAFTERSSEND with full implemention of Dropbox upload with progress, msg and sounds m_EnableItem = SS_DLG_DESCRIPTION | SS_DLG_AUTOSEND | SS_DLG_DELETEAFTERSSEND; @@ -57,7 +57,7 @@ void CSendCloudFile::SendThread() // @todo : SS_DLG_DESCRIPTION and SS_DLG_DELETEAFTERSSEND are of no use as of now since we don't track upload progress CFUPLOADDATA ud = { m_service, m_pszFile, L"SendSS" }; - CFUPLOADRESULT ur = { }; + CFUPLOADRESULT ur = {}; if (CallService(MS_CLOUDFILE_UPLOAD, (WPARAM)&ud, (LPARAM)&ur)) { Error(LPGENW("%s (%i):\nCould not add a share to the CloudFile plugin."), TranslateW(m_pszSendTyp), 0); @@ -72,7 +72,7 @@ void CSendCloudFile::SendThread() Exit(ACKRESULT_FAILED); } -void CSendCloudFile::SendThreadWrapper(void * Obj) +void CSendCloudFile::SendThreadWrapper(void *Obj) { - reinterpret_cast(Obj)->SendThread(); + reinterpret_cast(Obj)->SendThread(); } diff --git a/plugins/SendScreenshotPlus/src/CSendEmail.cpp b/plugins/SendScreenshotPlus/src/CSendEmail.cpp index 4235fdee4d..44e8628beb 100644 --- a/plugins/SendScreenshotPlus/src/CSendEmail.cpp +++ b/plugins/SendScreenshotPlus/src/CSendEmail.cpp @@ -30,8 +30,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ///////////////////////////////////////////////////////////////////////////////////////// -CSendEmail::CSendEmail(HWND Owner, MCONTACT hContact, bool /*bAsync*/) - : CSend(Owner, hContact, true) +CSendEmail::CSendEmail(HWND Owner, MCONTACT hContact, bool /*bAsync*/) : + CSend(Owner, hContact, true) { m_EnableItem = SS_DLG_DESCRIPTION | SS_DLG_DELETEAFTERSSEND; // SS_DLG_AUTOSEND | ; m_pszSendTyp = LPGENW("Email transfer"); @@ -135,7 +135,7 @@ void CSendEmail::SendThread() int res = lpMAPISendMail(NULL, NULL, &Msg, MAPI_LOGON_UI | MAPI_DIALOG, 0); ::FreeLibrary(hMAPILib); - wchar_t* err; + wchar_t *err; switch (res) { case SUCCESS_SUCCESS: // The call succeeded and the message was sent. @@ -195,7 +195,7 @@ void CSendEmail::SendThread() } } -void CSendEmail::SendThreadWrapper(void * Obj) +void CSendEmail::SendThreadWrapper(void *Obj) { - reinterpret_cast(Obj)->SendThread(); + reinterpret_cast(Obj)->SendThread(); } diff --git a/plugins/SendScreenshotPlus/src/CSendFTPFile.cpp b/plugins/SendScreenshotPlus/src/CSendFTPFile.cpp index f7d78983fb..ecc8cef991 100644 --- a/plugins/SendScreenshotPlus/src/CSendFTPFile.cpp +++ b/plugins/SendScreenshotPlus/src/CSendFTPFile.cpp @@ -30,8 +30,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ///////////////////////////////////////////////////////////////////////////////////////// -CSendFTPFile::CSendFTPFile(HWND Owner, MCONTACT hContact, bool /*bAsync*/) - : CSend(Owner, hContact, true) +CSendFTPFile::CSendFTPFile(HWND Owner, MCONTACT hContact, bool /*bAsync*/) : + CSend(Owner, hContact, true) { m_EnableItem = 0; //SS_DLG_DESCRIPTION | SS_DLG_AUTOSEND | SS_DLG_DELETEAFTERSSEND; m_pszSendTyp = LPGENW("FTPFile transfer"); @@ -60,8 +60,8 @@ int CSendFTPFile::Send() ********************************************************************************************/ mir_free(m_pszFileName); m_pszFileName = GetFileNameA(m_pszFile); - size_t size = sizeof(char)*(mir_strlen(m_pszFileName) + 2); - m_pszFileName = (char*)mir_realloc(m_pszFileName, size); + size_t size = sizeof(char) * (mir_strlen(m_pszFileName) + 2); + m_pszFileName = (char *)mir_realloc(m_pszFileName, size); m_pszFileName[size - 1] = NULL; // start Send thread @@ -87,7 +87,7 @@ void CSendFTPFile::SendThread() Exit(ACKRESULT_FAILED); } -void CSendFTPFile::SendThreadWrapper(void * Obj) +void CSendFTPFile::SendThreadWrapper(void *Obj) { - reinterpret_cast(Obj)->SendThread(); + reinterpret_cast(Obj)->SendThread(); } diff --git a/plugins/SendScreenshotPlus/src/CSendFile.cpp b/plugins/SendScreenshotPlus/src/CSendFile.cpp index 9b23193b26..45fd6a0c64 100644 --- a/plugins/SendScreenshotPlus/src/CSendFile.cpp +++ b/plugins/SendScreenshotPlus/src/CSendFile.cpp @@ -30,8 +30,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ///////////////////////////////////////////////////////////////////////////////////////// -CSendFile::CSendFile(HWND Owner, MCONTACT hContact, bool /*bAsync*/) - : CSend(Owner, hContact, true) +CSendFile::CSendFile(HWND Owner, MCONTACT hContact, bool /*bAsync*/) : + CSend(Owner, hContact, true) { m_EnableItem = SS_DLG_AUTOSEND | SS_DLG_DELETEAFTERSSEND | SS_DLG_DESCRIPTION; m_pszSendTyp = LPGENW("File transfer"); diff --git a/plugins/SendScreenshotPlus/src/CSendHTTPServer.cpp b/plugins/SendScreenshotPlus/src/CSendHTTPServer.cpp index cc7f1908f9..63b1c7519c 100644 --- a/plugins/SendScreenshotPlus/src/CSendHTTPServer.cpp +++ b/plugins/SendScreenshotPlus/src/CSendHTTPServer.cpp @@ -32,8 +32,8 @@ INT_PTR(*g_MirCallService)(const char *, WPARAM, LPARAM) = nullptr; ///////////////////////////////////////////////////////////////////////////////////////// -CSendHTTPServer::CSendHTTPServer(HWND Owner, MCONTACT hContact, bool /*bAsync*/) - : CSend(Owner, hContact, true) +CSendHTTPServer::CSendHTTPServer(HWND Owner, MCONTACT hContact, bool /*bAsync*/) : + CSend(Owner, hContact, true) { m_EnableItem = SS_DLG_DESCRIPTION; //| SS_DLG_AUTOSEND | SS_DLG_DELETEAFTERSSEND; m_pszSendTyp = LPGENW("HTTPServer transfer"); @@ -86,7 +86,7 @@ void CSendHTTPServer::SendThread() // patched plugin version ret = CallService(MS_HTTP_ADD_CHANGE_REMOVE, (WPARAM)m_hContact, (LPARAM)&m_fsi); if (!ret) { - m_URL = ptrA((char*)CallService(MS_HTTP_GET_LINK, (WPARAM)m_fsi.pszSrvPath, 0)); + m_URL = ptrA((char *)CallService(MS_HTTP_GET_LINK, (WPARAM)m_fsi.pszSrvPath, 0)); } } else { @@ -111,7 +111,7 @@ void CSendHTTPServer::SendThread() Exit(ACKRESULT_FAILED); } -void CSendHTTPServer::SendThreadWrapper(void * Obj) +void CSendHTTPServer::SendThreadWrapper(void *Obj) { - reinterpret_cast(Obj)->SendThread(); + reinterpret_cast(Obj)->SendThread(); } diff --git a/plugins/SendScreenshotPlus/src/CSendHost_ImageShack.cpp b/plugins/SendScreenshotPlus/src/CSendHost_ImageShack.cpp index 4842f16429..a54ffdcb7e 100644 --- a/plugins/SendScreenshotPlus/src/CSendHost_ImageShack.cpp +++ b/plugins/SendScreenshotPlus/src/CSendHost_ImageShack.cpp @@ -52,7 +52,7 @@ int CSendHost_ImageShack::Send() } m_pRequest.reset(new MHttpRequest(REQUEST_POST)); - char* tmp; tmp = mir_u2a(m_pszFile); + T2Utf tmp(m_pszFile); HTTPFormData frm[] = { // { "Referer", HTTPFORM_HEADER("http://www.imageshack.us/upload_api.php") }, { "fileupload", HTTPFORM_FILE(tmp) }, @@ -60,8 +60,8 @@ int CSendHost_ImageShack::Send() { "public", "no" }, { "key", HTTPFORM_8BIT(DEVKEY_IMAGESHACK) }, }; + int error = HTTPFormCreate(m_pRequest.get(), "http://imageshack.us/upload_api.php", frm, sizeof(frm) / sizeof(HTTPFormData)); - mir_free(tmp); if (error) return !m_bAsync; // start upload thread @@ -79,7 +79,7 @@ void CSendHost_ImageShack::SendThread() NLHR_PTR reply(Netlib_HttpTransaction(g_hNetlibUser, m_pRequest.get())); if (reply) { if (reply->resultCode >= 200 && reply->resultCode < 300 && reply->body.GetLength()) { - const char* url = nullptr; + const char *url = nullptr; url = GetHTMLContent(reply->body.GetBuffer(), "", ""); if (url && *url) { m_URLthumb = m_URL = url; @@ -87,7 +87,7 @@ void CSendHost_ImageShack::SendThread() int idx = m_URLthumb.ReverseFind('.'); if (idx != -1 && m_URLthumb.GetLength() - idx > 2) m_URLthumb.Insert(idx + 1, "th"); - else + else m_URLthumb.Empty(); svcSendMsgExit(url); @@ -95,7 +95,7 @@ void CSendHost_ImageShack::SendThread() } url = GetHTMLContent(reply->body.GetBuffer(), ""); - wchar_t* err = nullptr; + wchar_t *err = nullptr; if (url) err = mir_a2u(url); if (!err || !*err) { // fallback to server response mess mir_free(err); @@ -111,7 +111,7 @@ void CSendHost_ImageShack::SendThread() Exit(ACKRESULT_FAILED); } -void CSendHost_ImageShack::SendThreadWrapper(void * Obj) +void CSendHost_ImageShack::SendThreadWrapper(void *Obj) { - reinterpret_cast(Obj)->SendThread(); + reinterpret_cast(Obj)->SendThread(); } diff --git a/plugins/SendScreenshotPlus/src/CSendHost_imgur.cpp b/plugins/SendScreenshotPlus/src/CSendHost_imgur.cpp index 02edf18f38..d98a07e194 100644 --- a/plugins/SendScreenshotPlus/src/CSendHost_imgur.cpp +++ b/plugins/SendScreenshotPlus/src/CSendHost_imgur.cpp @@ -35,18 +35,18 @@ int CSendHost_Imgur::Send() Exit(ACKRESULT_FAILED); return !m_bAsync; } - + m_pRequest.reset(new MHttpRequest(REQUEST_POST)); - char* tmp; tmp = mir_u2a(m_pszFile); + T2Utf tmp(m_pszFile); HTTPFormData frm[] = { { "Authorization", HTTPFORM_HEADER("Client-ID 2a7303d78abe041") }, { "image", HTTPFORM_FILE(tmp) }, }; int error = HTTPFormCreate(m_pRequest.get(), "https://api.imgur.com/3/image", frm, _countof(frm)); - mir_free(tmp); if (error) return !m_bAsync; + // start upload thread if (m_bAsync) { mir_forkthread(&CSendHost_Imgur::SendThread, this); @@ -56,9 +56,9 @@ int CSendHost_Imgur::Send() return 1; } -void CSendHost_Imgur::SendThread(void* obj) +void CSendHost_Imgur::SendThread(void *obj) { - CSendHost_Imgur *self = (CSendHost_Imgur*)obj; + CSendHost_Imgur *self = (CSendHost_Imgur *)obj; // send DATA and wait for m_nlreply NLHR_PTR reply(Netlib_HttpTransaction(g_hNetlibUser, self->m_pRequest.get())); if (reply) { diff --git a/plugins/SendScreenshotPlus/src/CSendHost_uploadpie.cpp b/plugins/SendScreenshotPlus/src/CSendHost_uploadpie.cpp index b55e66517c..13bd17aa8d 100644 --- a/plugins/SendScreenshotPlus/src/CSendHost_uploadpie.cpp +++ b/plugins/SendScreenshotPlus/src/CSendHost_uploadpie.cpp @@ -38,9 +38,10 @@ int CSendHost_UploadPie::Send() Exit(ACKRESULT_FAILED); return !m_bAsync; } - + m_pRequest.reset(new MHttpRequest(REQUEST_POST)); - char* tmp; tmp = mir_u2a(m_pszFile); + T2Utf tmp(m_pszFile); + HTTPFormData frm[] = { { "MAX_FILE_SIZE", HTTPFORM_INT(3145728) }, { "upload", HTTPFORM_INT(1) }, @@ -49,10 +50,9 @@ int CSendHost_UploadPie::Send() }; int error = HTTPFormCreate(m_pRequest.get(), kHostURL, frm, _countof(frm)); - mir_free(tmp); if (error) return !m_bAsync; - + // start upload thread if (m_bAsync) { mir_forkthread(&CSendHost_UploadPie::SendThread, this); @@ -62,35 +62,37 @@ int CSendHost_UploadPie::Send() return 1; } -void CSendHost_UploadPie::SendThread(void* obj) +void CSendHost_UploadPie::SendThread(void *obj) { - CSendHost_UploadPie* self = (CSendHost_UploadPie*)obj; + CSendHost_UploadPie *self = (CSendHost_UploadPie *)obj; // send DATA and wait for m_nlreply NLHR_PTR reply(Netlib_HttpTransaction(g_hNetlibUser, self->m_pRequest.get())); if (reply) { if (reply->resultCode >= 200 && reply->resultCode < 300 && reply->body.GetLength()) { - char* url = reply->body.GetBuffer(); + char *url = reply->body.GetBuffer(); do { - char* pos; + char *pos; if ((url = strstr(url, kHostURL))) { - for (pos = url + _countof(kHostURL)-1; (*pos >= '0'&&*pos <= '9') || (*pos >= 'a'&&*pos <= 'z') || (*pos >= 'A'&&*pos <= 'Z') || *pos == '_' || *pos == '-' || *pos == '"' || *pos == '\''; ++pos) { - if (*pos == '"' || *pos == '\'') break; + for (pos = url + _countof(kHostURL) - 1; (*pos >= '0' && *pos <= '9') || (*pos >= 'a' && *pos <= 'z') || (*pos >= 'A' && *pos <= 'Z') || *pos == '_' || *pos == '-' || *pos == '"' || *pos == '\''; ++pos) { + if (*pos == '"' || *pos == '\'') + break; } - if (url + _countof(kHostURL)-1 != pos && (*pos == '"' || *pos == '\'')) { + if (url + _countof(kHostURL) - 1 != pos && (*pos == '"' || *pos == '\'')) { *pos = '\0'; break; } ++url; } } while (url); - + if (url) { self->m_URL = url; - self->svcSendMsgExit(url); return; + self->svcSendMsgExit(url); + return; } else { // check error mess from server - const char* err = GetHTMLContent(reply->body.GetBuffer(), "

"); - wchar_t* werr; + const char *err = GetHTMLContent(reply->body.GetBuffer(), "

"); + wchar_t *werr; if (err) werr = mir_a2u(err); else werr = mir_a2u(reply->body); self->Error(L"%s", werr); diff --git a/plugins/SendScreenshotPlus/src/Main.cpp b/plugins/SendScreenshotPlus/src/Main.cpp index e082cce873..307b135394 100644 --- a/plugins/SendScreenshotPlus/src/Main.cpp +++ b/plugins/SendScreenshotPlus/src/Main.cpp @@ -67,7 +67,7 @@ IconItem ICONS_BTN[ICO_BTN_END_] = }; static HANDLE m_hFolderScreenshot = nullptr; -wchar_t* GetCustomPath() +wchar_t *GetCustomPath() { wchar_t *pszPath = Utils_ReplaceVarsW(L"%miranda_userdata%\\Screenshots"); if (m_hFolderScreenshot) { @@ -280,7 +280,7 @@ int CMPlugin::Load() g_plugin.registerIcon(MODULENAME "/" LPGEN("Buttons"), ICONS_BTN, MODULENAME); // services -#define srv_reg(name) CreateServiceFunction(MODULENAME "/" #name, service_##name); + #define srv_reg(name) CreateServiceFunction(MODULENAME "/" #name, service_##name); srv_reg(OpenCaptureDialog); srv_reg(SendDesktop); srv_reg(Send2ImageShack); diff --git a/plugins/SendScreenshotPlus/src/UMainForm.cpp b/plugins/SendScreenshotPlus/src/UMainForm.cpp index 2637fae731..16a1ed45e6 100644 --- a/plugins/SendScreenshotPlus/src/UMainForm.cpp +++ b/plugins/SendScreenshotPlus/src/UMainForm.cpp @@ -118,7 +118,7 @@ INT_PTR CALLBACK TfrmMain::DlgTfrmMain(HWND hWnd, UINT msg, WPARAM wParam, LPARA CHandleMapping::iterator wnd; if (msg == WM_INITDIALOG) { - wnd = _HandleMapping.insert(CHandleMapping::value_type(hWnd, reinterpret_cast(lParam))).first; + wnd = _HandleMapping.insert(CHandleMapping::value_type(hWnd, reinterpret_cast(lParam))).first; wnd->second->m_hWnd = hWnd; wnd->second->wmInitdialog(wParam, lParam); return 0; @@ -177,7 +177,7 @@ INT_PTR CALLBACK TfrmMain::DlgTfrmMain(HWND hWnd, UINT msg, WPARAM wParam, LPARA int EnumCloudFileServices(const CFSERVICEINFO *serviceInfo, void *param) { HWND hCtrl = (HWND)param; - ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, serviceInfo->userName), new UPLOAD_INFO(SS_CLOUDFILE, (void*)serviceInfo->accountName)); + ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, serviceInfo->userName), new UPLOAD_INFO(SS_CLOUDFILE, (void *)serviceInfo->accountName)); return 0; } @@ -231,7 +231,7 @@ void TfrmMain::wmInitdialog(WPARAM, LPARAM) // get tab boundaries (required after 1st tab) GetClientRect(m_hwndTab, &rcTab); - MapWindowPoints(m_hwndTab, m_hWnd, (POINT*)&rcTab, 2); + MapWindowPoints(m_hwndTab, m_hWnd, (POINT *)&rcTab, 2); TabCtrl_AdjustRect(m_hwndTab, 0, &rcTab); rcTab.bottom -= rcTab.top; rcTab.right -= rcTab.left; @@ -331,13 +331,13 @@ void TfrmMain::wmInitdialog(WPARAM, LPARAM) m_opt_cboxSendBy = SS_IMAGESHACK; } ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, L"ImageShack"), new UPLOAD_INFO(SS_IMAGESHACK)); - ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateT("Upload Pie (30m)")), new UPLOAD_INFO(SS_UPLOADPIE, (void*)1)); - ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateT("Upload Pie (1d)")), new UPLOAD_INFO(SS_UPLOADPIE, (void*)4)); - ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateT("Upload Pie (1w)")), new UPLOAD_INFO(SS_UPLOADPIE, (void*)5)); + ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateT("Upload Pie (30m)")), new UPLOAD_INFO(SS_UPLOADPIE, (void *)1)); + ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateT("Upload Pie (1d)")), new UPLOAD_INFO(SS_UPLOADPIE, (void *)4)); + ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateT("Upload Pie (1w)")), new UPLOAD_INFO(SS_UPLOADPIE, (void *)5)); ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, L"Imgur"), new UPLOAD_INFO(SS_IMGUR)); for (int i = 0; i < ComboBox_GetCount(hCtrl); i++) { - UPLOAD_INFO *p = (UPLOAD_INFO*)ComboBox_GetItemData(hCtrl, i); + UPLOAD_INFO *p = (UPLOAD_INFO *)ComboBox_GetItemData(hCtrl, i); if (p && p->sendBy == m_opt_cboxSendBy) { pDefault = p; ComboBox_SetCurSel(hCtrl, i); @@ -458,7 +458,7 @@ void TfrmMain::wmCommand(WPARAM wParam, LPARAM lParam) break; case ID_cboxSendBy: { - UPLOAD_INFO *upload = (UPLOAD_INFO*)ComboBox_GetItemData((HWND)lParam, ComboBox_GetCurSel((HWND)lParam)); + UPLOAD_INFO *upload = (UPLOAD_INFO *)ComboBox_GetItemData((HWND)lParam, ComboBox_GetCurSel((HWND)lParam)); m_opt_cboxSendBy = upload->sendBy; cboxSendByChange(upload->param); } @@ -496,7 +496,7 @@ void TfrmMain::wmClose(WPARAM, LPARAM) HWND hCtrl = GetDlgItem(m_hWnd, ID_cboxSendBy); size_t count = ComboBox_GetCount(hCtrl); for (size_t i = 0; i < count; i++) { - UPLOAD_INFO *ui = (UPLOAD_INFO*)ComboBox_GetItemData(hCtrl, i); + UPLOAD_INFO *ui = (UPLOAD_INFO *)ComboBox_GetItemData(hCtrl, i); delete ui; } DestroyWindow(m_hWnd); @@ -517,11 +517,11 @@ void TfrmMain::SetTargetWindow(HWND hwnd) int len = GetWindowTextLength(m_hTargetWindow) + 1; wchar_t *lpTitle; if (len > 1) { - lpTitle = (wchar_t*)mir_alloc(len*sizeof(wchar_t)); + lpTitle = (wchar_t *)mir_alloc(len * sizeof(wchar_t)); GetWindowText(m_hTargetWindow, lpTitle, len); } else { // no WindowText present, use WindowClass - lpTitle = (wchar_t*)mir_alloc(64 * sizeof(wchar_t)); + lpTitle = (wchar_t *)mir_alloc(64 * sizeof(wchar_t)); RealGetWindowClass(m_hTargetWindow, lpTitle, 64); } SetDlgItemText(m_hwndTabPage, ID_edtCaption, lpTitle); @@ -535,7 +535,7 @@ void TfrmMain::wmTimer(WPARAM wParam, LPARAM) static int primarymouse; if (!m_hTargetHighlighter) { primarymouse = GetSystemMetrics(SM_SWAPBUTTON) ? VK_RBUTTON : VK_LBUTTON; - m_hTargetHighlighter = CreateWindowEx(WS_EX_LAYERED | WS_EX_TRANSPARENT | WS_EX_TOOLWINDOW, (wchar_t*)g_clsTargetHighlighter, nullptr, WS_POPUP, 0, 0, 0, 0, nullptr, nullptr, g_plugin.getInst(), nullptr); + m_hTargetHighlighter = CreateWindowEx(WS_EX_LAYERED | WS_EX_TRANSPARENT | WS_EX_TOOLWINDOW, (wchar_t *)g_clsTargetHighlighter, nullptr, WS_POPUP, 0, 0, 0, 0, nullptr, nullptr, g_plugin.getInst(), nullptr); if (!m_hTargetHighlighter) return; SetLayeredWindowAttributes(m_hTargetHighlighter, 0, 123, LWA_ALPHA); SetSystemCursor(CopyCursor(GetIcon(ICO_TARGET)), OCR_IBEAM); // text cursor @@ -565,7 +565,7 @@ void TfrmMain::wmTimer(WPARAM wParam, LPARAM) RECT rect; if (m_opt_chkClientArea) { GetClientRect(hwnd, &rect); - ClientToScreen(hwnd, (POINT*)&rect); + ClientToScreen(hwnd, (POINT *)&rect); rect.right = rect.left + rect.right; rect.bottom = rect.top + rect.bottom; } @@ -589,9 +589,9 @@ void TfrmMain::wmTimer(WPARAM wParam, LPARAM) return; } if (wParam == ID_chkTimed) { // Timer for Screenshot -#ifdef _DEBUG + #ifdef _DEBUG OutputDebugStringA("SS Bitmap Timer Start\r\n"); -#endif + #endif if (!m_bCapture) { // only start once if (m_Screenshot) { FreeImage_Unload(m_Screenshot); @@ -607,17 +607,17 @@ void TfrmMain::wmTimer(WPARAM wParam, LPARAM) break; case 2: // edge case, existing local file break; -#ifdef _DEBUG + #ifdef _DEBUG default: OutputDebugStringA("SS Bitmap Timer Stop (no tabCapture)\r\n"); -#endif + #endif } m_bCapture = false; if (m_Screenshot || m_opt_tabCapture == 2) { // @note : test without "if" KillTimer(m_hWnd, ID_chkTimed); -#ifdef _DEBUG + #ifdef _DEBUG OutputDebugStringA("SS Bitmap Timer Stop (CaptureDone)\r\n"); -#endif + #endif SendMessage(m_hWnd, UM_EVENT, 0, (LPARAM)EVT_CaptureDone); } } @@ -869,7 +869,7 @@ void TfrmMain::cboxSendByChange(void *param) m_cSend = new CSendFTPFile(m_hWnd, m_hContact, true); break; case SS_CLOUDFILE: // "CloudFile" - m_cSend = new CSendCloudFile(m_hWnd, m_hContact, false, (char*)param); + m_cSend = new CSendCloudFile(m_hWnd, m_hContact, false, (char *)param); break; case SS_IMAGESHACK: // "ImageShack" m_cSend = new CSendHost_ImageShack(m_hWnd, m_hContact, true); diff --git a/plugins/SendScreenshotPlus/src/Utils.cpp b/plugins/SendScreenshotPlus/src/Utils.cpp index 5aa3f06a2a..c594dea6c0 100644 --- a/plugins/SendScreenshotPlus/src/Utils.cpp +++ b/plugins/SendScreenshotPlus/src/Utils.cpp @@ -44,9 +44,9 @@ void ComboBox_SelectItem(HWND hCombo, LPARAM data) static BOOL CALLBACK MonitorInfoEnumProc(HMONITOR hMonitor, HDC, LPRECT, LPARAM dwData) { - MONITORS* monitors = (MONITORS*)dwData; + MONITORS *monitors = (MONITORS *)dwData; ++monitors->count; - monitors->info = (MONITORINFOEX*)mir_realloc(monitors->info, sizeof(MONITORINFOEX)*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 @@ -54,7 +54,7 @@ static BOOL CALLBACK MonitorInfoEnumProc(HMONITOR hMonitor, HDC, LPRECT, LPARAM return TRUE; } -size_t MonitorInfoEnum(MONITORINFOEX* &myMonitors, RECT &virtualScreen) +size_t MonitorInfoEnum(MONITORINFOEX *&myMonitors, RECT &virtualScreen) { MONITORS tmp = { 0, nullptr }; if (EnumDisplayMonitors(nullptr, nullptr, MonitorInfoEnumProc, (LPARAM)&tmp)) { @@ -65,29 +65,29 @@ size_t MonitorInfoEnum(MONITORINFOEX* &myMonitors, RECT &virtualScreen) } return tmp.count; } - + mir_free(tmp.info); return 0; } -FIBITMAP* CreateDIBFromDC(HDC hDC, const RECT* rect, HWND hCapture = nullptr); +FIBITMAP *CreateDIBFromDC(HDC hDC, const RECT *rect, HWND hCapture = nullptr); ///////////////////////////////////////////////////////////////////////////////////////// // capture window as FIBITMAP - caller must FreeImage_Unload(dib) -FIBITMAP* CaptureWindow(HWND hCapture, BOOL bClientArea, BOOL bIndirectCapture) +FIBITMAP *CaptureWindow(HWND hCapture, BOOL bClientArea, BOOL bIndirectCapture) { - FIBITMAP* dib; + FIBITMAP *dib; HWND hForegroundWin; RECT rect; // cropping rect if (!hCapture || !IsWindow(hCapture)) return nullptr; - + hForegroundWin = GetForegroundWindow(); // old foreground window SetForegroundWindow(hCapture); // force target foreground BringWindowToTop(hCapture); // bring it to top as well - + // redraw window to prevent runtime artifacts in picture UpdateWindow(hCapture); @@ -95,12 +95,12 @@ FIBITMAP* CaptureWindow(HWND hCapture, BOOL bClientArea, BOOL bIndirectCapture) if (hParent && !IsChild(hParent, hCapture)) hParent = nullptr; if (bIndirectCapture) { - intptr_t wastopmost = GetWindowLongPtr(hCapture, GWL_EXSTYLE)&WS_EX_TOPMOST; + intptr_t wastopmost = GetWindowLongPtr(hCapture, GWL_EXSTYLE) & WS_EX_TOPMOST; if (!wastopmost) SetWindowPos(hCapture, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); if (bClientArea) { GetClientRect(hCapture, &rect); - ClientToScreen(hCapture, (POINT*)&rect); + ClientToScreen(hCapture, (POINT *)&rect); rect.right += rect.left; rect.bottom += rect.top; } else @@ -127,18 +127,18 @@ FIBITMAP* CaptureWindow(HWND hCapture, BOOL bClientArea, BOOL bIndirectCapture) if (bClientArea) { GetWindowRect(hCapture, &rect); RECT rectCA; GetClientRect(hCapture, &rectCA); - ClientToScreen(hCapture, (POINT*)&rectCA); + ClientToScreen(hCapture, (POINT *)&rectCA); rectCA.left = ABS(rectCA.left - rect.left); rectCA.top = ABS(rectCA.top - rect.top); rectCA.right += rectCA.left; rectCA.bottom += rectCA.top; - + // crop the window to ClientArea - FIBITMAP* dibClient = FreeImage_Copy(dib, rectCA.left, rectCA.top, rectCA.right, rectCA.bottom); + FIBITMAP *dibClient = FreeImage_Copy(dib, rectCA.left, rectCA.top, rectCA.right, rectCA.bottom); FreeImage_Unload(dib); dib = dibClient; } } - + // restore previous foreground window if (hForegroundWin) { SetForegroundWindow(hForegroundWin); @@ -147,11 +147,11 @@ FIBITMAP* CaptureWindow(HWND hCapture, BOOL bClientArea, BOOL bIndirectCapture) return dib; } -FIBITMAP* CaptureMonitor(const wchar_t* szDevice, const RECT* cropRect/*=NULL*/) +FIBITMAP *CaptureMonitor(const wchar_t *szDevice, const RECT *cropRect/*=NULL*/) { HDC hScrDC; RECT rect; - + // get screen resolution if (!szDevice) { hScrDC = CreateDC(L"DISPLAY", nullptr, nullptr, nullptr); @@ -172,13 +172,13 @@ 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; } - + FIBITMAP *dib = CreateDIBFromDC(hScrDC, &rect); ReleaseDC(nullptr, hScrDC); return dib; } -FIBITMAP* CreateDIBFromDC(HDC hDC, const RECT* rect, HWND hCapture/*=NULL*/) +FIBITMAP *CreateDIBFromDC(HDC hDC, const RECT *rect, HWND hCapture/*=NULL*/) { long width = rect->right - rect->left; long height = rect->bottom - rect->top; @@ -212,18 +212,18 @@ FIBITMAP* CreateDIBFromDC(HDC hDC, const RECT* rect, HWND hCapture/*=NULL*/) SelectBitmap(hMaskDC, hMask); HRGN hRgn = CreateRectRgn(0, 0, 0, 0); if (hCapture && GetWindowRgn(hCapture, hRgn) == ERROR) { - if ((GetWindowLongPtr(hCapture, GWL_EXSTYLE)&WS_EX_LAYERED)) { + if ((GetWindowLongPtr(hCapture, GWL_EXSTYLE) & WS_EX_LAYERED)) { uint8_t bAlpha = 0; COLORREF crKey = 0x00000000; DWORD dwFlags = 0; if (GetLayeredWindowAttributes(hCapture, &crKey, &bAlpha, &dwFlags)) { // per window transparency (like fading in a whole window) - if ((dwFlags&LWA_COLORKEY)) { + if ((dwFlags & LWA_COLORKEY)) { SetBkColor(hMemDC, crKey); BitBlt(hMaskDC, 0, 0, width, height, hMemDC, rect->left, rect->top, SRCCOPY); bInvert = true; } - else if ((dwFlags&LWA_ALPHA)) { + else if ((dwFlags & LWA_ALPHA)) { bFixAlpha = false; } } @@ -242,9 +242,9 @@ FIBITMAP* CreateDIBFromDC(HDC hDC, const RECT* rect, HWND hCapture/*=NULL*/) } DeleteObject(hRgn); if (bFixAlpha) { - FIBITMAP* dibMask = FreeImage_CreateDIBFromHBITMAP(hMask); + FIBITMAP *dibMask = FreeImage_CreateDIBFromHBITMAP(hMask); if (bInvert) FreeImage_Invert(dibMask); - FIBITMAP* dib8 = FreeImage_ConvertTo8Bits(dibMask); + FIBITMAP *dib8 = FreeImage_ConvertTo8Bits(dibMask); // copy the dib8 alpha mask to dib32 main bitmap FreeImage_SetChannel(dib, dib8, FICC_ALPHA); FreeImage_Unload(dibMask); @@ -253,14 +253,14 @@ FIBITMAP* CreateDIBFromDC(HDC hDC, const RECT* rect, HWND hCapture/*=NULL*/) DeleteDC(hMaskDC); DeleteObject(hMask); DeleteObject(hBr); - + // clean up DeleteDC(hMemDC); DeleteObject(hBitmap); if (!hDC) ReleaseDC(nullptr, hScrDC); -#ifdef _DEBUG + #ifdef _DEBUG switch (FreeImage_GetImageType(dib)) { case FIT_UNKNOWN: OutputDebugStringA("FIBITMAP Type: FIT_UNKNOWN\r\n"); @@ -307,15 +307,15 @@ FIBITMAP* CreateDIBFromDC(HDC hDC, const RECT* rect, HWND hCapture/*=NULL*/) } BOOL inf = FreeImage_IsTransparent(dib); OutputDebugStringA(inf ? "FIBITMAP Transparent: true\r\n" : "FIBITMAP Transparent: false\r\n"); -#endif + #endif return dib; } ///////////////////////////////////////////////////////////////////////////////////////// -char* GetFileNameA(const wchar_t* pszPath) +char *GetFileNameA(const wchar_t *pszPath) { - const wchar_t* slash = wcsrchr(pszPath, '\\'); + const wchar_t *slash = wcsrchr(pszPath, '\\'); if (!slash) slash = wcsrchr(pszPath, '/'); if (slash) return mir_u2a(slash + 1); @@ -332,7 +332,7 @@ BOOL GetEncoderClsid(wchar_t *wchMimeType, CLSID &clsidEncoder) BOOL bOk = FALSE; Gdiplus::GetImageEncodersSize(&uiNum, &uiSize); if (uiSize > 0) { - Gdiplus::ImageCodecInfo* pImageCodecInfo = (Gdiplus::ImageCodecInfo*)mir_alloc(uiSize); + Gdiplus::ImageCodecInfo *pImageCodecInfo = (Gdiplus::ImageCodecInfo *)mir_alloc(uiSize); if (pImageCodecInfo) { Gdiplus::GetImageEncoders(uiNum, uiSize, pImageCodecInfo); for (UINT i = 0; i < uiNum; ++i) { @@ -361,7 +361,7 @@ void SaveGIF(HBITMAP hBmp, const wchar_t *szFilename) CLSID clsidEncoder; if (GetEncoderClsid(L"image/gif", clsidEncoder)) { LPWSTR pswFile = mir_wstrdup(szFilename); - pBitmap->Save((const wchar_t*)pswFile, &clsidEncoder, nullptr); + pBitmap->Save((const wchar_t *)pswFile, &clsidEncoder, nullptr); mir_free(pswFile); } delete pBitmap; @@ -385,7 +385,7 @@ void SaveTIF(HBITMAP hBmp, const wchar_t *szFilename) CLSID EncCLSID; if (GetEncoderClsid(L"image/tiff", EncCLSID)) { //--- Create a 2-parameter array, for Compression and for Color Bit depth - Gdiplus::EncoderParameters* EncParams = (Gdiplus::EncoderParameters*) malloc(sizeof(Gdiplus::EncoderParameters) + 1 * sizeof(Gdiplus::EncoderParameter)); + Gdiplus::EncoderParameters *EncParams = (Gdiplus::EncoderParameters *)malloc(sizeof(Gdiplus::EncoderParameters) + 1 * sizeof(Gdiplus::EncoderParameter)); // Gdiplus::EncoderParameters pEncoderParameters; //--- Use LZW Compression instead of Group 4, since it works for color and G4 doesn't ULONG ulCompression = Gdiplus::EncoderValueCompressionLZW; @@ -402,7 +402,7 @@ void SaveTIF(HBITMAP hBmp, const wchar_t *szFilename) EncParams->Parameter[1].Value = &ulColorDepth; LPWSTR pswFile = mir_wstrdup(szFilename); - stat = pBitmap->Save((const wchar_t*)pswFile, &EncCLSID, EncParams); + stat = pBitmap->Save((const wchar_t *)pswFile, &EncCLSID, EncParams); mir_free(pswFile); free(EncParams); } diff --git a/plugins/SendScreenshotPlus/src/ctrl_button.cpp b/plugins/SendScreenshotPlus/src/ctrl_button.cpp index e3d29d71b0..510f38fc40 100644 --- a/plugins/SendScreenshotPlus/src/ctrl_button.cpp +++ b/plugins/SendScreenshotPlus/src/ctrl_button.cpp @@ -166,8 +166,8 @@ static void __fastcall PaintThemeButton(BTNCTRL *ctl, HDC hdcMem, LPRECT rcClien if ((ctl->dwStyle & MBS_FLAT) && ctl->hThemeToolbar) { int state = IsWindowEnabled(ctl->hwnd) ? (ctl->stateId == PBS_NORMAL && ctl->defbutton - ? PBS_DEFAULTED - : ctl->stateId) + ? PBS_DEFAULTED + : ctl->stateId) : PBS_DISABLED; if (IsThemeBackgroundPartiallyTransparent(ctl->hThemeToolbar, TP_BUTTON, TBStateConvert2Flat(state))) { if (SUCCEEDED(DrawThemeParentBackground(ctl->hwnd, hdcMem, rcClient))) @@ -180,8 +180,8 @@ static void __fastcall PaintThemeButton(BTNCTRL *ctl, HDC hdcMem, LPRECT rcClien if (ctl->hThemeButton) { int state = IsWindowEnabled(ctl->hwnd) ? (ctl->stateId == PBS_NORMAL && ctl->defbutton - ? PBS_DEFAULTED - : ctl->stateId) + ? PBS_DEFAULTED + : ctl->stateId) : PBS_DISABLED; if (IsThemeBackgroundPartiallyTransparent(ctl->hThemeButton, BP_PUSHBUTTON, state)) { if (SUCCEEDED(DrawThemeParentBackground(ctl->hwnd, hdcMem, rcClient))) @@ -291,7 +291,7 @@ static void __fastcall PaintButton(BTNCTRL *ctl, HDC hdcMem, LPRECT rcClient) } else { UINT uState = DFCS_BUTTONPUSH | ((ctl->stateId == PBS_HOT) ? DFCS_HOT : 0) | ((ctl->stateId == PBS_PRESSED) ? DFCS_PUSHED : 0); - if (ctl->defbutton&&ctl->stateId == PBS_NORMAL) uState |= DLGC_DEFPUSHBUTTON; + if (ctl->defbutton && ctl->stateId == PBS_NORMAL) uState |= DLGC_DEFPUSHBUTTON; DrawFrameControl(hdcMem, rcClient, DFC_BUTTON, uState); // Draw focus rectangle if button has focus if (ctl->bFocus) { @@ -568,40 +568,40 @@ static LRESULT CALLBACK Button_WndProc(HWND hwndBtn, UINT uMsg, WPARAM wParam, L GetWindowText(bct->hwnd, szButton, _countof(szButton)); SetWindowText(bct->hwnd, TranslateW(szButton)); break; - + case WM_SETFOCUS: // set keybord bFocus and redraw bct->bFocus = 1; InvalidateRect(bct->hwnd, nullptr, TRUE); break; - + case WM_KILLFOCUS: // kill bFocus and redraw bct->bFocus = 0; InvalidateRect(bct->hwnd, nullptr, TRUE); break; - + case WM_WINDOWPOSCHANGED: InvalidateRect(bct->hwnd, nullptr, TRUE); break; - + case WM_ENABLE: // windows tells us to enable/disable bct->stateId = wParam ? PBS_NORMAL : PBS_DISABLED; InvalidateRect(bct->hwnd, nullptr, TRUE); break; - + case WM_MOUSELEAVE: // faked by the WM_TIMER if (bct->stateId != PBS_DISABLED) { // don't change states if disabled bct->stateId = PBS_NORMAL; InvalidateRect(bct->hwnd, nullptr, TRUE); } break; - + case WM_LBUTTONDOWN: if (bct->stateId != PBS_DISABLED) { // don't change states if disabled bct->stateId = PBS_PRESSED; InvalidateRect(bct->hwnd, nullptr, TRUE); } break; - + case WM_LBUTTONUP: if (bct->stateId != PBS_DISABLED) { // don't change states if disabled uint8_t bPressed = bct->stateId == PBS_PRESSED; @@ -618,7 +618,7 @@ static LRESULT CALLBACK Button_WndProc(HWND hwndBtn, UINT uMsg, WPARAM wParam, L InvalidateRect(bct->hwnd, nullptr, TRUE); } break; - + case WM_MOUSEMOVE: if (bct->stateId == PBS_NORMAL) { bct->stateId = PBS_HOT; @@ -627,7 +627,7 @@ static LRESULT CALLBACK Button_WndProc(HWND hwndBtn, UINT uMsg, WPARAM wParam, L // Call timer, used to start cheesy TrackMouseEvent faker SetTimer(hwndBtn, BUTTON_POLLID, BUTTON_POLLDELAY, nullptr); break; - + case WM_TIMER: // use a timer to check if they have did a mouseout if (wParam == BUTTON_POLLID) { RECT rc; diff --git a/plugins/SendScreenshotPlus/src/dlg_msgbox.cpp b/plugins/SendScreenshotPlus/src/dlg_msgbox.cpp index afa6cf88db..dd87397c62 100644 --- a/plugins/SendScreenshotPlus/src/dlg_msgbox.cpp +++ b/plugins/SendScreenshotPlus/src/dlg_msgbox.cpp @@ -30,7 +30,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. HICON Skin_GetIcon_SendSS(unsigned short id) { - if(id==0xFFFF) + if (id == 0xFFFF) return GetIcon(ICO_MAIN); return GetIconBtn(id); } @@ -260,7 +260,7 @@ static INT_PTR CALLBACK MsgBoxProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM l } } // increase width if info text requires more - if ((pMsgBox->uType&MB_INFOBAR) && pMsgBox->ptszInfoText && *pMsgBox->ptszInfoText) { + if ((pMsgBox->uType & MB_INFOBAR) && pMsgBox->ptszInfoText && *pMsgBox->ptszInfoText) { int multiline = 0; RECT rcico; GetClientRect(GetDlgItem(hDlg, ICO_DLGLOGO), &rcico); rcico.right = rcico.right * 100 / 66; // padding diff --git a/plugins/SendScreenshotPlus/src/stdafx.h b/plugins/SendScreenshotPlus/src/stdafx.h index e8218b35f9..f56407477d 100644 --- a/plugins/SendScreenshotPlus/src/stdafx.h +++ b/plugins/SendScreenshotPlus/src/stdafx.h @@ -38,6 +38,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include #include +#include #include #include diff --git a/plugins/SendScreenshotPlus/src/version.h b/plugins/SendScreenshotPlus/src/version.h index dd8c6ef385..1f0e6a2fa9 100644 --- a/plugins/SendScreenshotPlus/src/version.h +++ b/plugins/SendScreenshotPlus/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0 #define __MINOR_VERSION 9 #define __RELEASE_NUM 0 -#define __BUILD_NUM 3 +#define __BUILD_NUM 4 #include -- cgit v1.2.3