diff options
Diffstat (limited to 'plugins/SendScreenshotPlus/src')
-rw-r--r-- | plugins/SendScreenshotPlus/src/Main.cpp | 1 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/UAboutForm.cpp | 216 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/UAboutForm.h | 63 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/UMainForm.cpp | 51 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/UMainForm.h | 5 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/resource.h | 2 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/stdafx.h | 1 |
7 files changed, 1 insertions, 338 deletions
diff --git a/plugins/SendScreenshotPlus/src/Main.cpp b/plugins/SendScreenshotPlus/src/Main.cpp index 437eaaeb1b..c0752b1eb8 100644 --- a/plugins/SendScreenshotPlus/src/Main.cpp +++ b/plugins/SendScreenshotPlus/src/Main.cpp @@ -251,7 +251,6 @@ int hook_ModulesLoaded(WPARAM, LPARAM) int hook_SystemPreShutdown(WPARAM, LPARAM) { - TfrmAbout::Unload();//crashes if done from "Unload" because of dependencies TfrmMain::Unload();// " // Netlib unregister Netlib_CloseHandle(g_hNetlibUser); diff --git a/plugins/SendScreenshotPlus/src/UAboutForm.cpp b/plugins/SendScreenshotPlus/src/UAboutForm.cpp deleted file mode 100644 index eda56157eb..0000000000 --- a/plugins/SendScreenshotPlus/src/UAboutForm.cpp +++ /dev/null @@ -1,216 +0,0 @@ -/* - -Miranda NG: the free IM client for Microsoft* Windows* - -Copyright (c) 2012-18 Miranda NG team (https://miranda-ng.org), -Copyright (c) 2000-09 Miranda ICQ/IM project, - -This file is part of Send Screenshot Plus, a Miranda IM plugin. -Copyright (c) 2010 Ing.U.Horn - -Parts of this file based on original sorce code -(c) 2004-2006 Sérgio Vieira Rolanski (portet from Borland C++) - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -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" - -#include <list> -void TfrmAbout::Unload() -{ - std::list<TfrmAbout*> lst; - for (CHandleMapping::iterator iter = _HandleMapping.begin(); iter != _HandleMapping.end(); ++iter) { - lst.push_back(iter->second);//we can't delete inside loop.. not MT compatible - } - while (!lst.empty()) { - DestroyWindow(lst.front()->m_hWnd);//deletes class - lst.pop_front(); - } -} - -///////////////////////////////////////////////////////////////////////////////////////// - -TfrmAbout::CHandleMapping TfrmAbout::_HandleMapping; - -INT_PTR CALLBACK TfrmAbout::DlgTfrmAbout(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - if (msg == WM_CTLCOLOREDIT || msg == WM_CTLCOLORSTATIC) { - switch (GetWindowLongPtr((HWND)lParam, GWL_ID)) { - case IDC_CREDIT: - case IDC_LICENSE: - SetTextColor((HDC)wParam, GetSysColor(COLOR_WINDOWTEXT)); - break; - default: - return FALSE; - } - return (INT_PTR)GetStockObject(WHITE_BRUSH); //GetSysColorBrush(COLOR_WINDOW); - } - - CHandleMapping::iterator wnd(_HandleMapping.end()); - if (msg == WM_INITDIALOG) { - wnd = _HandleMapping.insert(CHandleMapping::value_type(hWnd, reinterpret_cast<TfrmAbout*>(lParam))).first; - reinterpret_cast<TfrmAbout*>(lParam)->m_hWnd = hWnd; - return wnd->second->wmInitdialog(wParam, lParam); - } - wnd = _HandleMapping.find(hWnd); - if (wnd == _HandleMapping.end()) { // something screwed up - return FALSE; //dialog! do not use ::DefWindowProc(hWnd, msg, wParam, lParam); - } - - switch (msg) { - // case WM_INITDIALOG: done on top - case WM_COMMAND: - return wnd->second->wmCommand(wParam, lParam); - break; - case WM_CLOSE: - return wnd->second->wmClose(wParam, lParam); - break; - case WM_DESTROY: - delete wnd->second; - break; - } - return FALSE; -} - -///////////////////////////////////////////////////////////////////////////////////////// -// WM_INITDIALOG: - -LRESULT TfrmAbout::wmInitdialog(WPARAM, LPARAM) -{ - // Headerbar - SendDlgItemMessage(m_hWnd, IDC_HEADERBAR, WM_SETICON, ICON_BIG, (LPARAM)GetIcon(ICO_MAIN)); - - // License - { - CMStringW pszText(_A2W(__COPYRIGHT)); - pszText.Append(L"\r\n\r\n"); - - HRSRC hRes = FindResource(g_plugin.getInst(), MAKEINTRESOURCE(IDR_LICENSE), L"TEXT"); - DWORD size = SizeofResource(g_plugin.getInst(), hRes); - char* data = (char*)mir_alloc(size + 1); - memcpy(data, LockResource(LoadResource(g_plugin.getInst(), hRes)), size); - data[size] = '\0'; - pszText.AppendFormat(L"%S", data); - mir_free(data); - SetDlgItemText(m_hWnd, IDC_LICENSE, pszText); - } - - // Credit - { - HRSRC hRes = FindResource(g_plugin.getInst(), MAKEINTRESOURCE(IDR_CREDIT), L"TEXT"); - DWORD size = SizeofResource(g_plugin.getInst(), hRes); - char* data = (char*)mir_alloc(size + 1); - memcpy(data, LockResource(LoadResource(g_plugin.getInst(), hRes)), size); - data[size] = '\0'; - wchar_t* pszText = mir_a2u(data); - mir_free(data); - SetDlgItemText(m_hWnd, IDC_CREDIT, pszText); - mir_free(pszText); - } - - Window_SetIcon_IcoLib(m_hWnd, GetIconHandle(ICO_MAIN)); - - //init controls - btnPageClick(); - - TranslateDialogDefault(m_hWnd); - return FALSE; -} - -///////////////////////////////////////////////////////////////////////////////////////// -// WM_COMMAND: - -LRESULT TfrmAbout::wmCommand(WPARAM wParam, LPARAM) -{ - if (HIWORD(wParam) == BN_CLICKED) { - switch (LOWORD(wParam)) { - case IDCANCEL: // ESC pressed - this->Close(); - break; - case IDA_btnClose: - Close(); - break; - case IDA_CONTRIBLINK: - m_Page = !m_Page; - btnPageClick(); - break; - default: - break; - } - } - return FALSE; -} - -///////////////////////////////////////////////////////////////////////////////////////// -// WM_CLOSE: - -LRESULT TfrmAbout::wmClose(WPARAM, LPARAM) -{ - SendMessage(m_hWndOwner, UM_CLOSING, (WPARAM)m_hWnd, (LPARAM)IDD_UAboutForm); - DestroyWindow(m_hWnd); - return FALSE; -} - -///////////////////////////////////////////////////////////////////////////////////////// - -TfrmAbout::TfrmAbout(HWND Owner) -{ - m_hWndOwner = Owner; - m_Page = 1; - // create window - m_hWnd = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_UAboutForm), nullptr, DlgTfrmAbout, (LPARAM)this); - //register object - _HandleMapping.insert(CHandleMapping::value_type(m_hWnd, this)); -} - -TfrmAbout::~TfrmAbout() -{ - _HandleMapping.erase(m_hWnd); -} - -///////////////////////////////////////////////////////////////////////////////////////// - -void TfrmAbout::btnPageClick() -{ - HWND hCtrl = GetDlgItem(m_hWnd, IDA_CONTRIBLINK); - const wchar_t* credits = TranslateT("Credits"); - const wchar_t* copyright = TranslateT("Copyright"); - const wchar_t* title; - const wchar_t* button; - if (!m_Page) { - ShowWindow(GetDlgItem(m_hWnd, IDC_CREDIT), SW_HIDE); - ShowWindow(GetDlgItem(m_hWnd, IDC_LICENSE), SW_SHOW); - SendMessage(hCtrl, BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetIconBtn(ICO_BTN_ARROWR)); - title = copyright; - button = credits; - } - else { - ShowWindow(GetDlgItem(m_hWnd, IDC_CREDIT), SW_SHOW); - ShowWindow(GetDlgItem(m_hWnd, IDC_LICENSE), SW_HIDE); - SendMessage(hCtrl, BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetIconBtn(ICO_BTN_ARROWL)); - title = credits; - button = copyright; - } - SetWindowText(hCtrl, button); - wchar_t newTitle[128]; - wchar_t* pszPlug = mir_a2u(__PLUGIN_NAME); - wchar_t* pszVer = mir_a2u(__VERSION_STRING_DOTS); - mir_snwprintf(newTitle, L"%s - %s\nv%s", pszPlug, title, pszVer); - mir_free(pszPlug); - mir_free(pszVer); - SetDlgItemText(m_hWnd, IDC_HEADERBAR, newTitle); - InvalidateRect(GetDlgItem(m_hWnd, IDC_HEADERBAR), nullptr, 1); -} diff --git a/plugins/SendScreenshotPlus/src/UAboutForm.h b/plugins/SendScreenshotPlus/src/UAboutForm.h deleted file mode 100644 index b5e997d469..0000000000 --- a/plugins/SendScreenshotPlus/src/UAboutForm.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - -Miranda NG: the free IM client for Microsoft* Windows* - -Copyright (c) 2012-18 Miranda NG team (https://miranda-ng.org), -Copyright (c) 2000-09 Miranda ICQ/IM project, - -This file is part of Send Screenshot Plus, a Miranda IM plugin. -Copyright (c) 2010 Ing.U.Horn - -Parts of this file based on original sorce code -(c) 2004-2006 Sérgio Vieira Rolanski (portet from Borland C++) - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -#ifndef UAboutFormH -#define UAboutFormH - -class TfrmAbout -{ - -public: - // Deklaration Standardkonstruktor/Standarddestructor - TfrmAbout(HWND Owner); - ~TfrmAbout(); - - 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); } - -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); - - 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 398458cd85..25bce13651 100644 --- a/plugins/SendScreenshotPlus/src/UMainForm.cpp +++ b/plugins/SendScreenshotPlus/src/UMainForm.cpp @@ -158,9 +158,6 @@ INT_PTR CALLBACK TfrmMain::DlgTfrmMain(HWND hWnd, UINT msg, WPARAM wParam, LPARA case WM_TIMER: wnd->second->wmTimer(wParam, lParam); break; - case UM_CLOSING: - wnd->second->UMClosing(wParam, lParam); - break; case UM_EVENT: wnd->second->UMevent(wParam, lParam); break; @@ -334,13 +331,6 @@ void TfrmMain::wmInitdialog(WPARAM, LPARAM) /// init footer options CheckDlgButton(m_hWnd, ID_chkOpenAgain, m_opt_chkOpenAgain ? BST_CHECKED : BST_UNCHECKED); - if (hCtrl = GetDlgItem(m_hWnd, ID_btnAbout)) { - SendDlgItemMessage(m_hWnd, ID_btnAbout, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Information"), MBBF_TCHAR); - HICON hIcon = GetIconBtn(ICO_BTN_HELP); - SendMessage(hCtrl, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon); - SetWindowText(hCtrl, hIcon ? L"" : L"?"); - } - if (hCtrl = GetDlgItem(m_hWnd, ID_btnExplore)) { SendDlgItemMessage(m_hWnd, ID_btnExplore, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Open Folder"), MBBF_TCHAR); HICON hIcon = GetIconBtn(ICO_BTN_FOLDER); @@ -413,9 +403,6 @@ void TfrmMain::wmCommand(WPARAM wParam, LPARAM lParam) m_hLastWin = nullptr; SetTimer(m_hWnd, ID_imgTarget, BUTTON_POLLDELAY, nullptr); break; - case ID_btnAbout: - TfrmMain::btnAboutClick(); - break; case ID_btnExplore: TfrmMain::btnExploreClick(); break; @@ -654,22 +641,6 @@ void TfrmMain::wmNotify(WPARAM, LPARAM lParam) } } -//UM_CLOSING: -void TfrmMain::UMClosing(WPARAM wParam, LPARAM lParam) -{ - HWND hWnd = (HWND)wParam; - switch (lParam) { - case IDD_UAboutForm: - btnAboutOnCloseWindow(hWnd); - break; - case IDD_UEditForm: - ; - break; - default: - break; - } -} - //UM_EVENT: void TfrmMain::UMevent(WPARAM, LPARAM lParam) { @@ -714,7 +685,6 @@ TfrmMain::TfrmMain() m_hWnd = nullptr; m_hContact = NULL; - m_bFormAbout = false; m_hTargetWindow = m_hLastWin = nullptr; m_hTargetHighlighter = nullptr; m_FDestFolder = m_pszFile = nullptr; @@ -893,7 +863,7 @@ void TfrmMain::cboxSendByChange(void *param) m_cSend = new CSendHost_ImageShack(m_hWnd, m_hContact, true); break; case SS_UPLOADPIE: //"Upload Pie" - m_cSend = new CSendHost_UploadPie(m_hWnd, m_hContact, true, (int)param); + m_cSend = new CSendHost_UploadPie(m_hWnd, m_hContact, true, (INT_PTR)param); break; case SS_IMGUR: m_cSend = new CSendHost_Imgur(m_hWnd, m_hContact, true); @@ -919,25 +889,6 @@ void TfrmMain::cboxSendByChange(void *param) ///////////////////////////////////////////////////////////////////////////////////////// -void TfrmMain::btnAboutClick() -{ - if (m_bFormAbout) return; - - TfrmAbout *frmAbout = new TfrmAbout(m_hWnd); - frmAbout->Show(); - m_bFormAbout = true; -} - -///////////////////////////////////////////////////////////////////////////////////////// -// Edit window call this event before it closes - -void TfrmMain::btnAboutOnCloseWindow(HWND) -{ - m_bFormAbout = false; -} - -///////////////////////////////////////////////////////////////////////////////////////// - void TfrmMain::btnExploreClick() { if (m_FDestFolder) diff --git a/plugins/SendScreenshotPlus/src/UMainForm.h b/plugins/SendScreenshotPlus/src/UMainForm.h index 995a56b4dd..971ce85a61 100644 --- a/plugins/SendScreenshotPlus/src/UMainForm.h +++ b/plugins/SendScreenshotPlus/src/UMainForm.h @@ -94,7 +94,6 @@ public: private: HWND m_hWnd; MCONTACT m_hContact; - bool m_bFormAbout; HWND m_hTargetWindow, m_hLastWin; HWND m_hTargetHighlighter; wchar_t* m_FDestFolder; @@ -104,9 +103,6 @@ private: CSend* m_cSend; void chkTimedClick(); - void imgTargetMouseUp(); - void btnAboutClick(); - void btnAboutOnCloseWindow(HWND hWnd); void btnExploreClick(); void LoadOptions(void); void SaveOptions(void); @@ -143,7 +139,6 @@ protected: 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); }; diff --git a/plugins/SendScreenshotPlus/src/resource.h b/plugins/SendScreenshotPlus/src/resource.h index 80fcdff47a..e91be463d1 100644 --- a/plugins/SendScreenshotPlus/src/resource.h +++ b/plugins/SendScreenshotPlus/src/resource.h @@ -27,7 +27,6 @@ #define IDD_MSGBOX 110 #define IDD_MSGBOXDUMMI 111 #define IDR_LICENSE 120 -#define IDR_CREDIT 121 #define IDI_MAIN 190 #define IDI_TARGET 191 #define IDI_MONITOR 192 @@ -89,7 +88,6 @@ #define ID_chkTimed 1708 #define ID_chkOpenAgain 1710 #define IDC_HEADERBAR 1734 -#define ID_btnAbout 2001 #define ID_btnExplore 2002 #define ID_chkDesc 2003 #define ID_chkDeleteAfterSend 2004 diff --git a/plugins/SendScreenshotPlus/src/stdafx.h b/plugins/SendScreenshotPlus/src/stdafx.h index 4460d41220..f9627ae6ce 100644 --- a/plugins/SendScreenshotPlus/src/stdafx.h +++ b/plugins/SendScreenshotPlus/src/stdafx.h @@ -91,7 +91,6 @@ using namespace std; #include "CSendHost_imgur.h" #include "DevKey.h" #include "UMainForm.h" -#include "UAboutForm.h" #include "Utils.h" #define UM_CLOSING WM_USER+1 |