From 7a8e3055b162b2572152ed951ebcefd60182edbc Mon Sep 17 00:00:00 2001 From: Vadim Dashevskiy Date: Mon, 23 Jul 2012 12:21:37 +0000 Subject: PasteIt, PopUp, ProfileManager: changed folder structure git-svn-id: http://svn.miranda-ng.org/main/trunk@1117 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/PasteIt/Options.cpp | 979 --------------------- plugins/PasteIt/Options.h | 72 -- plugins/PasteIt/PasteIt.cpp | 564 ------------ plugins/PasteIt/PasteIt.rc | 140 --- plugins/PasteIt/PasteIt.vcxproj | 47 +- plugins/PasteIt/PasteIt.vcxproj.filters | 50 +- plugins/PasteIt/PasteIt.vcxproj.user | 3 + plugins/PasteIt/PasteToWeb.cpp | 577 ------------ plugins/PasteIt/PasteToWeb.h | 47 - plugins/PasteIt/PasteToWeb1.cpp | 393 --------- plugins/PasteIt/PasteToWeb1.h | 40 - plugins/PasteIt/PasteToWeb2.cpp | 247 ------ plugins/PasteIt/PasteToWeb2.h | 38 - plugins/PasteIt/icons/Paste.ico | Bin 2550 -> 0 bytes plugins/PasteIt/res/Paste.ico | Bin 0 -> 2550 bytes plugins/PasteIt/res/PasteIt.rc | 140 +++ plugins/PasteIt/res/version.rc | 40 + plugins/PasteIt/resource.h | 50 -- plugins/PasteIt/src/Options.cpp | 979 +++++++++++++++++++++ plugins/PasteIt/src/Options.h | 72 ++ plugins/PasteIt/src/PasteIt.cpp | 564 ++++++++++++ plugins/PasteIt/src/PasteToWeb.cpp | 577 ++++++++++++ plugins/PasteIt/src/PasteToWeb.h | 47 + plugins/PasteIt/src/PasteToWeb1.cpp | 393 +++++++++ plugins/PasteIt/src/PasteToWeb1.h | 40 + plugins/PasteIt/src/PasteToWeb2.cpp | 247 ++++++ plugins/PasteIt/src/PasteToWeb2.h | 38 + plugins/PasteIt/src/resource.h | 50 ++ plugins/PasteIt/src/stdafx.h | 42 + plugins/PasteIt/src/targetver.h | 8 + plugins/PasteIt/src/version.h | 20 + plugins/PasteIt/stdafx.h | 42 - plugins/PasteIt/targetver.h | 8 - plugins/PasteIt/version.h | 20 - plugins/PasteIt/version.rc | 40 - plugins/Popup/PopUp_10.vcxproj | 51 +- plugins/Popup/PopUp_10.vcxproj.filters | 116 +-- plugins/Popup/PopUp_10.vcxproj.user | 3 + plugins/Popup/docs/popup-translation.txt | 187 ++++ plugins/Popup/docs/whatsnew.txt | 15 + plugins/Popup/popup-translation.txt | 187 ---- plugins/Popup/res/img.ico | Bin 1406 -> 0 bytes plugins/Popup/res/popup_plus.ico | Bin 1782 -> 0 bytes plugins/Popup/res/resource.rc | 418 +++++++++ plugins/Popup/res/version.rc | 44 + plugins/Popup/res/whatsnew.txt | 15 - plugins/Popup/resource.h | 196 ----- plugins/Popup/resource.rc | 425 --------- plugins/Popup/src/headers.h | 4 +- plugins/Popup/src/resource.h | 196 +++++ plugins/Popup/src/version.h | 70 ++ plugins/Popup/version.h | 70 -- plugins/Popup/version.rc | 44 - .../docs/profilemanager-translation.txt | 2 + plugins/ProfileManager/pmanagerEx.cpp | 106 --- plugins/ProfileManager/pmanagerEx.vcxproj | 14 +- plugins/ProfileManager/pmanagerEx.vcxproj.filters | 6 +- plugins/ProfileManager/pmanagerEx.vcxproj.user | 3 + .../ProfileManager/profilemanager-translation.txt | 2 - plugins/ProfileManager/res/resource.rc | 46 + plugins/ProfileManager/resource.h | 17 - plugins/ProfileManager/resource.rc | 46 - plugins/ProfileManager/src/pmanagerEx.cpp | 106 +++ plugins/ProfileManager/src/resource.h | 17 + 64 files changed, 4425 insertions(+), 4595 deletions(-) delete mode 100644 plugins/PasteIt/Options.cpp delete mode 100644 plugins/PasteIt/Options.h delete mode 100644 plugins/PasteIt/PasteIt.cpp delete mode 100644 plugins/PasteIt/PasteIt.rc create mode 100644 plugins/PasteIt/PasteIt.vcxproj.user delete mode 100644 plugins/PasteIt/PasteToWeb.cpp delete mode 100644 plugins/PasteIt/PasteToWeb.h delete mode 100644 plugins/PasteIt/PasteToWeb1.cpp delete mode 100644 plugins/PasteIt/PasteToWeb1.h delete mode 100644 plugins/PasteIt/PasteToWeb2.cpp delete mode 100644 plugins/PasteIt/PasteToWeb2.h delete mode 100644 plugins/PasteIt/icons/Paste.ico create mode 100644 plugins/PasteIt/res/Paste.ico create mode 100644 plugins/PasteIt/res/PasteIt.rc create mode 100644 plugins/PasteIt/res/version.rc delete mode 100644 plugins/PasteIt/resource.h create mode 100644 plugins/PasteIt/src/Options.cpp create mode 100644 plugins/PasteIt/src/Options.h create mode 100644 plugins/PasteIt/src/PasteIt.cpp create mode 100644 plugins/PasteIt/src/PasteToWeb.cpp create mode 100644 plugins/PasteIt/src/PasteToWeb.h create mode 100644 plugins/PasteIt/src/PasteToWeb1.cpp create mode 100644 plugins/PasteIt/src/PasteToWeb1.h create mode 100644 plugins/PasteIt/src/PasteToWeb2.cpp create mode 100644 plugins/PasteIt/src/PasteToWeb2.h create mode 100644 plugins/PasteIt/src/resource.h create mode 100644 plugins/PasteIt/src/stdafx.h create mode 100644 plugins/PasteIt/src/targetver.h create mode 100644 plugins/PasteIt/src/version.h delete mode 100644 plugins/PasteIt/stdafx.h delete mode 100644 plugins/PasteIt/targetver.h delete mode 100644 plugins/PasteIt/version.h delete mode 100644 plugins/PasteIt/version.rc create mode 100644 plugins/Popup/PopUp_10.vcxproj.user create mode 100644 plugins/Popup/docs/popup-translation.txt create mode 100644 plugins/Popup/docs/whatsnew.txt delete mode 100644 plugins/Popup/popup-translation.txt delete mode 100644 plugins/Popup/res/img.ico delete mode 100644 plugins/Popup/res/popup_plus.ico create mode 100644 plugins/Popup/res/resource.rc create mode 100644 plugins/Popup/res/version.rc delete mode 100644 plugins/Popup/res/whatsnew.txt delete mode 100644 plugins/Popup/resource.h delete mode 100644 plugins/Popup/resource.rc create mode 100644 plugins/Popup/src/resource.h create mode 100644 plugins/Popup/src/version.h delete mode 100644 plugins/Popup/version.h delete mode 100644 plugins/Popup/version.rc create mode 100644 plugins/ProfileManager/docs/profilemanager-translation.txt delete mode 100644 plugins/ProfileManager/pmanagerEx.cpp create mode 100644 plugins/ProfileManager/pmanagerEx.vcxproj.user delete mode 100644 plugins/ProfileManager/profilemanager-translation.txt create mode 100644 plugins/ProfileManager/res/resource.rc delete mode 100644 plugins/ProfileManager/resource.h delete mode 100644 plugins/ProfileManager/resource.rc create mode 100644 plugins/ProfileManager/src/pmanagerEx.cpp create mode 100644 plugins/ProfileManager/src/resource.h (limited to 'plugins') diff --git a/plugins/PasteIt/Options.cpp b/plugins/PasteIt/Options.cpp deleted file mode 100644 index 49309bc580..0000000000 --- a/plugins/PasteIt/Options.cpp +++ /dev/null @@ -1,979 +0,0 @@ -/* -Paste It plugin -Copyright (C) 2011 Krzysztof Kral - -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 version 2 -of the License. - -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, see . -*/ - -#include "StdAfx.h" -#include "Options.h" -#include "resource.h" -#include "PasteToWeb.h" -#include "PasteToWeb1.h" - -extern HINSTANCE hInst; - -#define MODULE "PasteIt" - -Options *Options::instance; -extern PasteToWeb* pasteToWebs[PasteToWeb::pages]; - -struct TCpTable { - UINT cpId; - TCHAR *cpName; -} -cpTable[] = { - { CP_ACP, _T("Use default codepage") }, - { CP_UTF8, _T("UTF-8") }, - { 874, _T("Thai") }, - { 932, _T("Japanese") }, - { 936, _T("Simplified Chinese") }, - { 949, _T("Korean") }, - { 950, _T("Traditional Chinese") }, - { 1250, _T("Central European") }, - { 1251, _T("Cyrillic") }, - { 20866, _T("Cyrillic KOI8-R") }, - { 1252, _T("Latin I") }, - { 1253, _T("Greek") }, - { 1254, _T("Turkish") }, - { 1255, _T("Hebrew") }, - { 1256, _T("Arabic") }, - { 1257, _T("Baltic") }, - { 1258, _T("Vietnamese") }, - { 1361, _T("Korean (Johab)") }, - { CP_UTF7, _T("UTF-7") }, - { 1200, _T("UTF-16") }, - { 1201, _T("UTF-16BE") } -}; - -Options::Options() -{ - defWeb = 0; - codepage = CP_ACP; - autoUTF = true; - confDlg = true; - autoSend = false; - for(int i = 0 ; i < PasteToWeb::pages; ++i) - { - webOptions[i] = new WebOptions(i); - } -} - - -Options::~Options() -{ - for(int i = 0 ; i < PasteToWeb::pages; ++i) - { - delete webOptions[i]; - webOptions[i] = NULL; - } -} - -void DefWebPageChanged(); - -INT_PTR CALLBACK Options::DlgProcOptsMain(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) -{ - switch(msg) - { - case WM_INITDIALOG: - { - TranslateDialogDefault(hwndDlg); - CheckDlgButton(hwndDlg, IDC_AUTOUTF, instance->autoUTF ? 1 : 0); - CheckDlgButton(hwndDlg, IDC_CONFDLG, instance->confDlg ? 1 : 0); - CheckDlgButton(hwndDlg, IDC_AUTOSEND, instance->autoSend ? 1 : 0); - - for(int i = 0; i < PasteToWeb::pages; ++i) - { - ComboBox_AddString(GetDlgItem(hwndDlg, IDC_WEBLIST), pasteToWebs[i]->GetName()); - } - - ComboBox_SetCurSel(GetDlgItem(hwndDlg, IDC_WEBLIST), instance->defWeb); - - InitCodepageCB(GetDlgItem(hwndDlg, IDC_CODEPAGE), instance->codepage); - return TRUE; - } - case WM_COMMAND: - { - if(LOWORD(wParam) == IDC_CODEPAGE) - { - if(HIWORD(wParam) == CBN_KILLFOCUS) - { - GetCodepageCB(GetDlgItem(hwndDlg, IDC_CODEPAGE), true, instance->codepage); - } - } - - if (HIWORD(wParam) == BN_CLICKED || HIWORD(wParam)==CBN_SELCHANGE || HIWORD(wParam)==CBN_EDITCHANGE) - SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); - return TRUE; - } - case WM_NOTIFY: - { - if(((LPNMHDR)lParam)->code == PSN_APPLY) - { - instance->codepage = GetCodepageCB(GetDlgItem(hwndDlg, IDC_CODEPAGE), false, instance->codepage); - instance->autoUTF = IsDlgButtonChecked(hwndDlg, IDC_AUTOUTF) ? true : false; - instance->confDlg = IsDlgButtonChecked(hwndDlg, IDC_CONFDLG) ? true : false; - instance->autoSend = IsDlgButtonChecked(hwndDlg, IDC_AUTOSEND) ? true : false; - instance->defWeb = ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_WEBLIST)); - - DefWebPageChanged(); - - Options::instance->Save(); - } - return TRUE; - } - } - - return FALSE; -} - -class OptsPagesData -{ -public: - OptsPagesData() - : lastPage(0) - { - init = false; - for(int i = 0 ; i < PasteToWeb::pages; ++i) - { - webOptions[i] = Options::instance->webOptions[i]->Copy(); - } - } - - ~OptsPagesData() - { - for(int i = 0 ; i < PasteToWeb::pages; ++i) - { - delete webOptions[i]; - webOptions[i] = NULL; - } - } - - WebOptions* webOptions[PasteToWeb::pages]; - int lastPage; - bool init; -}; - -struct OptsConfigureData -{ - int page; - std::list tempFormats; -}; - -struct OptsLoginData -{ - std::wstring user; - std::wstring password; -}; - -void ReloadFormatsCombo(HWND hWnd, WebOptions* wo) -{ - while(ComboBox_DeleteString(hWnd, 0) > 0); - int sel = 0; - int i = 0; - for(std::list::iterator it = wo->formats.begin(); it != wo->formats.end(); ++it) - { - ComboBox_AddString(hWnd, it->name.c_str()); - if(it->id == wo->defFormatId) - sel = i; - ++i; - } - if(!wo->formats.empty()) - { - ComboBox_SetCurSel(hWnd, sel); - } -} - -void GetPagesSettings(HWND hwndDlg, OptsPagesData* optsPagesData) -{ - int selected = optsPagesData->lastPage; - int format = ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_DEFFORMAT)); - if(format >= 0 && format < (int)optsPagesData->webOptions[selected]->formats.size()) - { - for(std::list::iterator it = optsPagesData->webOptions[selected]->formats.begin(); it != optsPagesData->webOptions[selected]->formats.end(); ++it) - { - if(format-- <= 0) - { - optsPagesData->webOptions[selected]->defFormatId = it->id; - break; - } - } - } - - if(optsPagesData->webOptions[selected]->isSendFileName) - optsPagesData->webOptions[selected]->sendFileName = IsDlgButtonChecked(hwndDlg, IDC_AUTOFORMAT) ? true : false; - if(optsPagesData->webOptions[selected]->isPublicPaste) - optsPagesData->webOptions[selected]->publicPaste = IsDlgButtonChecked(hwndDlg, IDC_PUBLICPASTE) ? true : false; - if(optsPagesData->webOptions[selected]->isCombo1) - { - int sel = ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_COMBO1)); - if(sel >= 0 && sel < (int)optsPagesData->webOptions[selected]->combo1Values.size()) - { - for(std::list::iterator it = optsPagesData->webOptions[selected]->combo1Values.begin(); it != optsPagesData->webOptions[selected]->combo1Values.end(); ++it) - { - if(sel-- <= 0) - { - optsPagesData->webOptions[selected]->combo1 = it->id; - break; - } - } - } - } - if(optsPagesData->webOptions[selected]->isPublicPaste) - { - if(IsDlgButtonChecked(hwndDlg, IDC_GUEST)) - { - optsPagesData->webOptions[selected]->pastebinUserKey = _T(""); - } - else - { - TCHAR buf[100]; - Edit_GetText(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY), buf, 100); - optsPagesData->webOptions[selected]->pastebinUserKey = buf; - } - } -} - -INT_PTR CALLBACK Options::DlgProcOptsPages(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) -{ - switch(msg) - { - case WM_INITDIALOG: - { - TranslateDialogDefault(hwndDlg); - OptsPagesData* optsPagesData = new OptsPagesData(); - SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)optsPagesData); - - HWND btnhwnd = GetDlgItem(hwndDlg, IDC_PASTEBIN_LOGIN); - int btSize = Button_GetTextLength(btnhwnd); - if(btSize > 20) - { - SetWindowPos(btnhwnd, NULL, 0, 0, 115, 34, SWP_NOZORDER | SWP_NOMOVE | SWP_NOREPOSITION | SWP_NOACTIVATE | SWP_NOREDRAW); - } - - for(int i = 0; i < PasteToWeb::pages; ++i) - { - ComboBox_AddString(GetDlgItem(hwndDlg, IDC_WEBPAGE), pasteToWebs[i]->GetName()); - } - - ComboBox_SetCurSel(GetDlgItem(hwndDlg, IDC_WEBPAGE), 0); - ReloadFormatsCombo(GetDlgItem(hwndDlg, IDC_DEFFORMAT), optsPagesData->webOptions[0]); - if(optsPagesData->webOptions[0]->isSendFileName) - CheckDlgButton(hwndDlg, IDC_AUTOFORMAT, optsPagesData->webOptions[0]->sendFileName ? 1 : 0); - else - ShowWindow(GetDlgItem(hwndDlg,IDC_AUTOFORMAT),SW_HIDE); - - if(Options::instance->webOptions[0]->isPublicPaste) - CheckDlgButton(hwndDlg, IDC_PUBLICPASTE, Options::instance->webOptions[0]->publicPaste ? 1 : 0); - else - ShowWindow(GetDlgItem(hwndDlg,IDC_PUBLICPASTE),SW_HIDE); - - if(Options::instance->webOptions[0]->isCombo1) - { - int sel = 0; - int i = 0; - std::wstring &val = Options::instance->webOptions[0]->combo1; - HWND cb = GetDlgItem(hwndDlg, IDC_COMBO1); - for(std::list::iterator it = Options::instance->webOptions[0]->combo1Values.begin(); it != Options::instance->webOptions[0]->combo1Values.end(); ++it) - { - ComboBox_AddString(cb, it->name.c_str()); - if(val == it->id) - sel = i; - ++i; - } - ComboBox_SetCurSel(cb, sel); - Static_SetText(GetDlgItem(hwndDlg,IDC_COMBO1_DESC), Options::instance->webOptions[0]->combo1Desc.c_str()); - } - else - { - ShowWindow(GetDlgItem(hwndDlg,IDC_COMBO1),SW_HIDE); - ShowWindow(GetDlgItem(hwndDlg,IDC_COMBO1_DESC),SW_HIDE); - } - - Edit_LimitText(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY), 99); - if(Options::instance->webOptions[0]->isPastebin) - { - std::wstring pastebinUserKey = Options::instance->webOptions[0]->pastebinUserKey; - if(pastebinUserKey.empty()) - { - CheckDlgButton(hwndDlg, IDC_GUEST, TRUE); - Edit_Enable(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY), FALSE); - Static_Enable(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY_DESC), FALSE); - Button_Enable(GetDlgItem(hwndDlg, IDC_PASTEBIN_LOGIN), FALSE); - } - else - { - Edit_SetText(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY), pastebinUserKey.c_str()); - } - } - else - { - ShowWindow(GetDlgItem(hwndDlg, IDC_GUEST), SW_HIDE); - ShowWindow(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY), SW_HIDE); - ShowWindow(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY_DESC), SW_HIDE); - ShowWindow(GetDlgItem(hwndDlg, IDC_PASTEBIN_LOGIN), SW_HIDE); - } - - optsPagesData->init = true; - return TRUE; - } - case WM_COMMAND: - { - OptsPagesData* optsPagesData = (OptsPagesData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - if(HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_CONFIGURE) - { - GetPagesSettings(hwndDlg, optsPagesData); - OptsConfigureData d; - d.page = ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_WEBPAGE)); - WebOptions* wo = optsPagesData->webOptions[d.page]; - d.tempFormats = wo->formats; - if(DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_DLG_CONFIGURE), hwndDlg, DlgProcOptsConfigure, (LPARAM)&d) == IDOK) - { - wo->formats = d.tempFormats; - ReloadFormatsCombo(GetDlgItem(hwndDlg, IDC_DEFFORMAT), wo); - SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); - } - } - else if(HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_PASTEBIN_LOGIN) - { - OptsLoginData d; - if(DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_DLG_PASTEBIN_LOGIN), hwndDlg, DlgProcOptsLogin, (LPARAM)&d) == IDOK) - { - PasteToWeb1 *web = (PasteToWeb1*)pasteToWebs[optsPagesData->lastPage]; - Edit_SetText(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY), web->GetUserKey(d.user, d.password).c_str()); - } - } - else if(HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_GUEST) - { - BOOL enabled = IsDlgButtonChecked(hwndDlg, IDC_GUEST) ? FALSE : TRUE; - Edit_Enable(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY), enabled); - Static_Enable(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY_DESC), enabled); - Button_Enable(GetDlgItem(hwndDlg, IDC_PASTEBIN_LOGIN), enabled); - } - else if(HIWORD(wParam) == CBN_SELCHANGE && LOWORD(wParam) == IDC_WEBPAGE) - { - GetPagesSettings(hwndDlg, optsPagesData); - optsPagesData->init = false; - optsPagesData->lastPage = ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_WEBPAGE)); - ReloadFormatsCombo(GetDlgItem(hwndDlg, IDC_DEFFORMAT), optsPagesData->webOptions[optsPagesData->lastPage]); - if(optsPagesData->webOptions[optsPagesData->lastPage]->isSendFileName) - { - ShowWindow(GetDlgItem(hwndDlg,IDC_AUTOFORMAT),SW_SHOW); - CheckDlgButton(hwndDlg, IDC_AUTOFORMAT, optsPagesData->webOptions[optsPagesData->lastPage]->sendFileName ? 1 : 0); - } - else - ShowWindow(GetDlgItem(hwndDlg,IDC_AUTOFORMAT),SW_HIDE); - - if(optsPagesData->webOptions[optsPagesData->lastPage]->isPublicPaste) - { - ShowWindow(GetDlgItem(hwndDlg,IDC_PUBLICPASTE),SW_SHOW); - CheckDlgButton(hwndDlg, IDC_PUBLICPASTE, optsPagesData->webOptions[optsPagesData->lastPage]->publicPaste ? 1 : 0); - } - else - ShowWindow(GetDlgItem(hwndDlg,IDC_PUBLICPASTE),SW_HIDE); - - if(optsPagesData->webOptions[optsPagesData->lastPage]->isCombo1) - { - ShowWindow(GetDlgItem(hwndDlg,IDC_COMBO1),SW_SHOW); - ShowWindow(GetDlgItem(hwndDlg,IDC_COMBO1_DESC),SW_SHOW); - int sel = 0; - int i = 0; - std::wstring &val = optsPagesData->webOptions[optsPagesData->lastPage]->combo1; - HWND cb = GetDlgItem(hwndDlg, IDC_COMBO1); - while(ComboBox_DeleteString(cb, 0) > 0); - for(std::list::iterator it = optsPagesData->webOptions[optsPagesData->lastPage]->combo1Values.begin(); it != optsPagesData->webOptions[optsPagesData->lastPage]->combo1Values.end(); ++it) - { - ComboBox_AddString(cb, it->name.c_str()); - if(val == it->id) - sel = i; - ++i; - } - ComboBox_SetCurSel(cb, sel); - SetWindowText(GetDlgItem(hwndDlg,IDC_COMBO1_DESC), optsPagesData->webOptions[optsPagesData->lastPage]->combo1Desc.c_str()); - } - else - { - ShowWindow(GetDlgItem(hwndDlg,IDC_COMBO1),SW_HIDE); - ShowWindow(GetDlgItem(hwndDlg,IDC_COMBO1_DESC),SW_HIDE); - } - - - if(optsPagesData->webOptions[optsPagesData->lastPage]->isPastebin) - { - ShowWindow(GetDlgItem(hwndDlg, IDC_GUEST), SW_SHOW); - ShowWindow(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY), SW_SHOW); - ShowWindow(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY_DESC), SW_SHOW); - ShowWindow(GetDlgItem(hwndDlg, IDC_PASTEBIN_LOGIN), SW_SHOW); - std::wstring pastebinUserKey = optsPagesData->webOptions[optsPagesData->lastPage]->pastebinUserKey; - if(pastebinUserKey.empty()) - { - CheckDlgButton(hwndDlg, IDC_GUEST, TRUE); - Edit_Enable(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY), FALSE); - Static_Enable(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY_DESC), FALSE); - Button_Enable(GetDlgItem(hwndDlg, IDC_PASTEBIN_LOGIN), FALSE); - } - else - { - CheckDlgButton(hwndDlg, IDC_GUEST, FALSE); - Edit_Enable(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY), TRUE); - Static_Enable(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY_DESC), TRUE); - Button_Enable(GetDlgItem(hwndDlg, IDC_PASTEBIN_LOGIN), TRUE); - } - - Edit_SetText(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY), pastebinUserKey.c_str()); - } - else - { - ShowWindow(GetDlgItem(hwndDlg, IDC_GUEST), SW_HIDE); - ShowWindow(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY), SW_HIDE); - ShowWindow(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY_DESC), SW_HIDE); - ShowWindow(GetDlgItem(hwndDlg, IDC_PASTEBIN_LOGIN), SW_HIDE); - } - - optsPagesData->init = true; - } - - if (optsPagesData->init && ((HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) != IDC_CONFIGURE && LOWORD(wParam) != IDC_PASTEBIN_LOGIN) || (HIWORD(wParam)==CBN_SELCHANGE && LOWORD(wParam) != IDC_WEBPAGE) || HIWORD(wParam) == EN_CHANGE)) - SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); - return TRUE; - } - case WM_NOTIFY: - { - if(((LPNMHDR)lParam)->code == PSN_APPLY) - { - OptsPagesData* optsPagesData = (OptsPagesData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - GetPagesSettings(hwndDlg, optsPagesData); - for(int i = 0 ; i < PasteToWeb::pages; ++i) - { - *Options::instance->webOptions[i] = *optsPagesData->webOptions[i]; - } - - Options::instance->Save(); - } - return TRUE; - } - case WM_CLOSE: - { - OptsPagesData* optsPagesData = (OptsPagesData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - delete optsPagesData; - SetWindowLongPtr(hwndDlg, GWLP_USERDATA, NULL); - break; - } - } - - return FALSE; -} - -void SelectLbConfigure(HWND hwndDlg, int sel, OptsConfigureData* optsConfigureData) -{ - if(sel >= 0 && sel < (int)optsConfigureData->tempFormats.size()) - { - Button_Enable(GetDlgItem(hwndDlg, IDC_DELETE), TRUE); - if(sel == 0) - Button_Enable(GetDlgItem(hwndDlg, IDC_UP), FALSE); - else - Button_Enable(GetDlgItem(hwndDlg, IDC_UP), TRUE); - if(sel + 1 == optsConfigureData->tempFormats.size()) - Button_Enable(GetDlgItem(hwndDlg, IDC_DOWN), FALSE); - else - Button_Enable(GetDlgItem(hwndDlg, IDC_DOWN), TRUE); - } - else - { - Button_Enable(GetDlgItem(hwndDlg, IDC_DELETE), FALSE); - Button_Enable(GetDlgItem(hwndDlg, IDC_UP), FALSE); - Button_Enable(GetDlgItem(hwndDlg, IDC_DOWN), FALSE); - } -} - -INT_PTR CALLBACK Options::DlgProcOptsConfigure(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) -{ - switch(msg) - { - case WM_INITDIALOG: - { - TranslateDialogDefault(hwndDlg); - OptsConfigureData* optsConfigureData = (OptsConfigureData*)lParam; - SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam); - - HWND lb = GetDlgItem(hwndDlg, IDC_FORMATTING); - for(std::list::iterator it = optsConfigureData->tempFormats.begin(); it != optsConfigureData->tempFormats.end(); ++it) - { - ListBox_AddString(lb, it->name.c_str()); - } - - SelectLbConfigure(hwndDlg, -1, optsConfigureData); - return TRUE; - } - case WM_COMMAND: - { - if (HIWORD(wParam) == BN_CLICKED) - { - if (LOWORD(wParam) == IDOK) - { - EndDialog(hwndDlg, IDOK); - } - else if (LOWORD(wParam) == IDCANCEL) - { - EndDialog(hwndDlg, IDCANCEL); - } - else if (LOWORD(wParam) == IDC_DELETE) - { - HWND lb = GetDlgItem(hwndDlg, IDC_FORMATTING); - OptsConfigureData* optsConfigureData = (OptsConfigureData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - int sel = ListBox_GetCurSel(lb); - if(sel >= 0) - { - ListBox_DeleteString(lb, sel); - int i = sel; - for(std::list::iterator it = optsConfigureData->tempFormats.begin(); it != optsConfigureData->tempFormats.end(); ++it) - { - if(i-- <= 0) - { - optsConfigureData->tempFormats.erase(it); - ListBox_SetCurSel(lb, sel); - SelectLbConfigure(hwndDlg, sel, optsConfigureData); - break; - } - } - } - } - else if (LOWORD(wParam) == IDC_UP) - { - HWND lb = GetDlgItem(hwndDlg, IDC_FORMATTING); - OptsConfigureData* optsConfigureData = (OptsConfigureData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - int sel = ListBox_GetCurSel(lb); - if(sel > 0) - { - int i = sel; - for(std::list::iterator it = optsConfigureData->tempFormats.begin(); it != optsConfigureData->tempFormats.end(); ++it) - { - if(i-- <= 0) - { - PasteFormat pf = *it; - std::list::iterator prevIt = it; - --prevIt; - optsConfigureData->tempFormats.erase(it); - optsConfigureData->tempFormats.insert(prevIt, pf); - ListBox_DeleteString(lb, sel--); - ListBox_InsertString(lb, sel, pf.name.c_str()); - ListBox_SetCurSel(lb, sel); - SelectLbConfigure(hwndDlg, sel, optsConfigureData); - break; - } - } - } - } - else if (LOWORD(wParam) == IDC_DOWN) - { - HWND lb = GetDlgItem(hwndDlg, IDC_FORMATTING); - OptsConfigureData* optsConfigureData = (OptsConfigureData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - int sel = ListBox_GetCurSel(lb); - if(sel >= 0 && sel + 1 < (int)optsConfigureData->tempFormats.size()) - { - int i = sel; - for(std::list::iterator it = optsConfigureData->tempFormats.begin(); it != optsConfigureData->tempFormats.end(); ++it) - { - if(i-- <= 0) - { - PasteFormat pf = *it; - std::list::iterator nextIt = it; - ++(++nextIt); - optsConfigureData->tempFormats.erase(it); - optsConfigureData->tempFormats.insert(nextIt, pf); - ListBox_DeleteString(lb, sel++); - ListBox_InsertString(lb, sel, pf.name.c_str()); - ListBox_SetCurSel(lb, sel); - SelectLbConfigure(hwndDlg, sel, optsConfigureData); - break; - } - } - } - } - else if(LOWORD(wParam) == IDC_DOWNLOAD) - { - OptsConfigureData* optsConfigureData = (OptsConfigureData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - HWND lb = GetDlgItem(hwndDlg, IDC_FORMATTING); - while(ListBox_DeleteString(lb, 0) > 0); - SelectLbConfigure(hwndDlg, -1, optsConfigureData); - optsConfigureData->tempFormats = pasteToWebs[optsConfigureData->page]->GetFormats(); - for(std::list::iterator it = optsConfigureData->tempFormats.begin(); it != optsConfigureData->tempFormats.end(); ++it) - { - ListBox_AddString(lb, it->name.c_str()); - } - } - else if(LOWORD(wParam) == IDC_RESTORE) - { - OptsConfigureData* optsConfigureData = (OptsConfigureData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - HWND lb = GetDlgItem(hwndDlg, IDC_FORMATTING); - while(ListBox_DeleteString(lb, 0) > 0); - SelectLbConfigure(hwndDlg, -1, optsConfigureData); - optsConfigureData->tempFormats = pasteToWebs[optsConfigureData->page]->GetDefFormats(); - for(std::list::iterator it = optsConfigureData->tempFormats.begin(); it != optsConfigureData->tempFormats.end(); ++it) - { - ListBox_AddString(lb, it->name.c_str()); - } - } - } - else if(HIWORD(wParam) == LBN_SELCHANGE && LOWORD(wParam) == IDC_FORMATTING) - { - OptsConfigureData* optsConfigureData = (OptsConfigureData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - int sel = ListBox_GetCurSel(GetDlgItem(hwndDlg, IDC_FORMATTING)); - SelectLbConfigure(hwndDlg, sel, optsConfigureData); - } - return TRUE; - } - case WM_VKEYTOITEM: - if(LOWORD(wParam) == VK_DELETE && (HWND)lParam == GetDlgItem(hwndDlg, IDC_FORMATTING)) - { - DlgProcOptsConfigure(hwndDlg, WM_COMMAND, MAKELONG(IDC_DELETE, BN_CLICKED), NULL); - return -2; - } - return -1; - case WM_NOTIFY: - { - return TRUE; - } - } - - return FALSE; -} - -INT_PTR CALLBACK Options::DlgProcOptsLogin(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) -{ - switch(msg) - { - case WM_INITDIALOG: - { - TranslateDialogDefault(hwndDlg); - SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam); - Edit_LimitText(GetDlgItem(hwndDlg, IDC_PASTEBIN_USER), 99); - Edit_LimitText(GetDlgItem(hwndDlg, IDC_PASTEBIN_PASSWORD), 99); - return TRUE; - } - case WM_COMMAND: - { - if (HIWORD(wParam) == BN_CLICKED) - { - if (LOWORD(wParam) == IDOK) - { - TCHAR buf[100]; - OptsLoginData* optsLoginData = (OptsLoginData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - Edit_GetText(GetDlgItem(hwndDlg, IDC_PASTEBIN_USER), buf, 100); - optsLoginData->user = buf; - Edit_GetText(GetDlgItem(hwndDlg, IDC_PASTEBIN_PASSWORD), buf, 100); - optsLoginData->password = buf; - EndDialog(hwndDlg, IDOK); - } - else if (LOWORD(wParam) == IDCANCEL) - { - EndDialog(hwndDlg, IDCANCEL); - } - } - return TRUE; - } - case WM_NOTIFY: - { - return TRUE; - } - } - - return FALSE; -} - -unsigned int Options::GetCodepageCB(HWND hwndCB, bool errorReport, unsigned int defCp) -{ - int selCpIdx = ComboBox_GetCurSel(hwndCB); - if(selCpIdx < 0) - { - TCHAR text[128]; - ComboBox_GetText(hwndCB, text, 128); - TCHAR * stopOn = NULL; - long cp = _tcstol(text, &stopOn, 10); - if(errorReport && (stopOn == text || *stopOn != '\0' || cp < 0 || cp > 0xffff)) - { - MessageBox(GetParent(hwndCB), TranslateT("You've entered invalid codepage. Select codepage from combo box or enter correct number."), TranslateT("Invalid codepage"), MB_OK | MB_ICONERROR); - SetFocus(hwndCB); - SetCodepageCB(hwndCB, defCp); - return defCp; - } - - return cp; - } - else return cpTable[selCpIdx].cpId; -} - -void Options::SetDefWeb(int web) -{ - defWeb = web; - DBWriteContactSettingWString(0, MODULE, "defWeb", pasteToWebs[web]->GetName()); - DefWebPageChanged(); -} - -void Options::InitCodepageCB(HWND hwndCB, unsigned int codepage) -{ - int cpCount = sizeof(cpTable) / sizeof(cpTable[0]); - int selCpIdx = -1; - for(int i = 0; i < cpCount; ++i) - { - ComboBox_AddString(hwndCB, TranslateTS(cpTable[i].cpName)); - if(cpTable[i].cpId == codepage) - selCpIdx = i; - } - - if(selCpIdx == -1) - { - TCHAR buf[10]; - _stprintf_s(buf, 10, _T("%d"), codepage); - ComboBox_SetText(hwndCB, buf); - } - else - { - ComboBox_SetCurSel(hwndCB, selCpIdx); - } - - ComboBox_LimitText(hwndCB, 127); -} - -void Options::SetCodepageCB(HWND hwndCB, unsigned int codepage) -{ - int cpCount = sizeof(cpTable) / sizeof(cpTable[0]); - int selCpIdx = -1; - for(int i = 0; i < cpCount; ++i) - { - if(cpTable[i].cpId == codepage) - selCpIdx = i; - } - - if(selCpIdx == -1) - { - TCHAR buf[10]; - _stprintf_s(buf, 10, _T("%d"), codepage); - ComboBox_SetText(hwndCB, buf); - } - else - { - ComboBox_SetCurSel(hwndCB, selCpIdx); - } -} - -int Options::InitOptions(WPARAM wParam, LPARAM lParam) -{ - OPTIONSDIALOGPAGE odp = {0}; - - odp.cbSize = sizeof(odp); - odp.position = 100000000; - odp.hInstance = hInst; - odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR; - odp.ptszTitle = LPGENT("Paste It"); - odp.ptszGroup = LPGENT("Services"); - - odp.ptszTab = LPGENT("Main"); - odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_MAIN); - odp.pfnDlgProc = Options::DlgProcOptsMain; - Options_AddPage(wParam, &odp); - - odp.ptszTab = LPGENT("Web page"); - odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_PAGES); - odp.pfnDlgProc = Options::DlgProcOptsPages; - Options_AddPage(wParam, &odp); - - return 0; -} - -void Options::Save() -{ - DBWriteContactSettingWString(0, MODULE, "defWeb", pasteToWebs[defWeb]->GetName()); - DBWriteContactSettingDword(0, MODULE, "codepage", codepage); - DBWriteContactSettingByte(0, MODULE, "autoUTF", autoUTF ? 1 : 0); - DBWriteContactSettingByte(0, MODULE, "confDlg", confDlg ? 1 : 0); - DBWriteContactSettingByte(0, MODULE, "autoSend", autoSend ? 1 : 0); - for(int i = 0 ; i < PasteToWeb::pages; ++i) - { - char buf[256]; - TCHAR* name = pasteToWebs[i]->GetName(); - int j = 0; - while(name[j]) - { - buf[j] = (char)name[j]; - ++j; - } - buf[j++] = '_'; - - strcpy_s(buf + j, 256 - j, "formats"); - std::wstring forms; - for(std::list::iterator it = webOptions[i]->formats.begin(); it != webOptions[i]->formats.end(); ++it) - { - forms += it->id + L'=' + it->name + L';'; - } - - DBWriteContactSettingWString(0, MODULE, buf, forms.c_str()); - - strcpy_s(buf + j, 256 - j, "defFormatId"); - DBWriteContactSettingWString(0, MODULE, buf, webOptions[i]->defFormatId.c_str()); - - if(webOptions[i]->isSendFileName) - { - strcpy_s(buf + j, 256 - j, "sendFileName"); - DBWriteContactSettingByte(0, MODULE, buf, webOptions[i]->sendFileName ? 1 : 0); - } - - if(webOptions[i]->isPublicPaste) - { - strcpy_s(buf + j, 256 - j, "publicPaste"); - DBWriteContactSettingByte(0, MODULE, buf, webOptions[i]->publicPaste ? 1 : 0); - } - - if(webOptions[i]->isCombo1) - { - strcpy_s(buf + j, 256 - j, "combo1"); - DBWriteContactSettingWString(0, MODULE, buf, webOptions[i]->combo1.c_str()); - } - - if(webOptions[i]->isPastebin) - { - strcpy_s(buf + j, 256 - j, "pastebinUserKey"); - DBWriteContactSettingWString(0, MODULE, buf, webOptions[i]->pastebinUserKey.c_str()); - } - } -} - -void Options::Load() -{ - DBVARIANT defWebV; - if(!DBGetContactSettingWString(0, MODULE, "defWeb", &defWebV)) - { - for(int i = 0; i < PasteToWeb::pages; ++i) - { - if(!wcscmp(pasteToWebs[i]->GetName(), defWebV.pwszVal)) - { - defWeb = i; - break; - } - } - DBFreeVariant(&defWebV); - } - codepage = DBGetContactSettingDword(0, MODULE, "codepage", CP_ACP); - autoUTF = DBGetContactSettingByte(0, MODULE, "autoUTF", 1) ? true : false; - confDlg = DBGetContactSettingByte(0, MODULE, "confDlg", 1) ? true : false; - autoSend = DBGetContactSettingByte(0, MODULE, "autoSend", 0) ? true : false; - for(int i = 0 ; i < PasteToWeb::pages; ++i) - { - char buf[256]; - TCHAR* name = pasteToWebs[i]->GetName(); - int j = 0; - while(name[j]) - { - buf[j] = (char)name[j]; - ++j; - } - buf[j++] = '_'; - - strcpy_s(buf + j, 256 - j, "formats"); - DBVARIANT forms; - if(!DBGetContactSettingWString(0, MODULE, buf, &forms)) - { - webOptions[i]->formats.clear(); - int k = 0; - wchar_t * id = forms.pwszVal; - wchar_t * name = NULL; - while(forms.pwszVal[k]) - { - if(forms.pwszVal[k] == L'=') - { - forms.pwszVal[k] = 0; - name = forms.pwszVal + k + 1; - } - else if(forms.pwszVal[k] == L';') - { - forms.pwszVal[k] = 0; - PasteFormat pf; - pf.id = id; - pf.name = name; - webOptions[i]->formats.push_back(pf); - id = forms.pwszVal + k + 1; - } - - ++k; - } - - DBFreeVariant(&forms); - } - - strcpy_s(buf + j, 256 - j, "defFormatId"); - DBVARIANT defForm; - if(!DBGetContactSettingWString(0, MODULE, buf, &defForm)) - { - webOptions[i]->defFormatId = defForm.pwszVal; - DBFreeVariant(&defForm); - } - - if(webOptions[i]->isSendFileName) - { - strcpy_s(buf + j, 256 - j, "sendFileName"); - webOptions[i]->sendFileName = DBGetContactSettingByte(0, MODULE, buf, 1) ? true : false; - } - - if(webOptions[i]->isPublicPaste) - { - strcpy_s(buf + j, 256 - j, "publicPaste"); - webOptions[i]->publicPaste = DBGetContactSettingByte(0, MODULE, buf, 0) ? true : false; - } - - if(webOptions[i]->isCombo1) - { - strcpy_s(buf + j, 256 - j, "combo1"); - DBVARIANT combo1; - if(!DBGetContactSettingWString(0, MODULE, buf, &combo1)) - { - webOptions[i]->combo1 = combo1.pwszVal; - DBFreeVariant(&combo1); - } - } - - if(webOptions[i]->isPastebin) - { - strcpy_s(buf + j, 256 - j, "pastebinUserKey"); - DBVARIANT pastebinUserKey; - if(!DBGetContactSettingWString(0, MODULE, buf, &pastebinUserKey)) - { - webOptions[i]->pastebinUserKey = pastebinUserKey.pwszVal; - DBFreeVariant(&pastebinUserKey); - } - } - } -} - -WebOptions::WebOptions(int serv) - :server(serv), - formats(pasteToWebs[serv]->GetDefFormats()), - sendFileName(true), - isSendFileName(true), - publicPaste(false), - isPublicPaste(false), - isCombo1(false), - isPastebin(false) -{ - defFormatId = formats.front().id; -} - - -WebOptions::~WebOptions() -{ -} - -WebOptions* WebOptions::Copy() -{ - return new WebOptions(*this); -} diff --git a/plugins/PasteIt/Options.h b/plugins/PasteIt/Options.h deleted file mode 100644 index 9e58e44d7f..0000000000 --- a/plugins/PasteIt/Options.h +++ /dev/null @@ -1,72 +0,0 @@ -/* -Paste It plugin -Copyright (C) 2011 Krzysztof Kral - -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 version 2 -of the License. - -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, see . -*/ - -#pragma once -#include "PasteToWeb.h" - -class WebOptions -{ -public: - WebOptions(int serv); - virtual ~WebOptions(); - virtual WebOptions* Copy(); - int server; - bool isSendFileName; - bool isPublicPaste; - bool isCombo1; - std::list combo1Values; - std::wstring combo1Desc; - bool isPastebin; - - std::list formats; - std::wstring defFormatId; - bool sendFileName; - bool publicPaste; - std::wstring combo1; - std::wstring pastebinUserKey; -}; - -class Options -{ -public: - Options(); - ~Options(); - static int InitOptions(WPARAM wParam, LPARAM lParam); - - static INT_PTR CALLBACK DlgProcOptsMain(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); - static INT_PTR CALLBACK DlgProcOptsPages(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); - static INT_PTR CALLBACK DlgProcOptsConfigure(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); - static INT_PTR CALLBACK DlgProcOptsLogin(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); - - static void InitCodepageCB(HWND hwndCB, unsigned int codepage); - static void SetCodepageCB(HWND hwndCB, unsigned int codepage); - static unsigned int GetCodepageCB(HWND hwndCB, bool errorReport, unsigned int defCp); - - static Options *instance; - void Save(); - void Load(); - - int defWeb; - unsigned int codepage; - bool autoUTF; - bool confDlg; - bool autoSend; - void SetDefWeb(int web); - WebOptions* webOptions[PasteToWeb::pages]; -}; - diff --git a/plugins/PasteIt/PasteIt.cpp b/plugins/PasteIt/PasteIt.cpp deleted file mode 100644 index ce38743f68..0000000000 --- a/plugins/PasteIt/PasteIt.cpp +++ /dev/null @@ -1,564 +0,0 @@ -/* -Paste It plugin -Copyright (C) 2011 Krzysztof Kral - -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 version 2 -of the License. - -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, see . -*/ - -#include "stdafx.h" -#include "PasteToWeb1.h" -#include "PasteToWeb2.h" -#include "version.h" -#include "resource.h" -#include "Options.h" - -// {1AAC15E8-DCEC-4050-B66F-2AA0E6120C22} -#define MIID_PASTEIT { 0x1aac15e8, 0xdcec, 0x4050, { 0xb6, 0x6f, 0x2a, 0xa0, 0xe6, 0x12, 0xc, 0x22 } } - - -PasteToWeb* pasteToWebs[PasteToWeb::pages]; -std::map* contactWindows; -DWORD gMirandaVersion; - -extern HINSTANCE hInst; -HANDLE hModulesLoaded, hTabsrmmButtonPressed; -HANDLE g_hNetlibUser; -HANDLE hPrebuildContactMenu; -HANDLE hServiceContactMenu; -HGENMENU hContactMenu; -HGENMENU hWebPageMenus[PasteToWeb::pages]; -HANDLE hMainIcon; -HANDLE hOptionsInit; -HANDLE hWindowEvent = NULL; -HINSTANCE hInst; - -#define MODULE "PasteIt" -#define FROM_CLIPBOARD 10 -#define FROM_FILE 11 -#define DEF_PAGES_START 20 -#define MS_PASTEIT_CONTACTMENU "PasteIt/ContactMenu" - -PLUGININFOEX pluginInfo={ - sizeof(PLUGININFOEX), - __PLUGIN_NAME, - PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM), - __DESCRIPTION, - __AUTHOR, - __AUTHOREMAIL, - __COPYRIGHT, - __AUTHORWEB, - UNICODE_AWARE, - MIID_PASTEIT -}; - -XML_API xi = {0}; -int hLangpack = 0; - -BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) -{ - hInst = hModule; - return TRUE; -} - -extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion) -{ - gMirandaVersion = mirandaVersion; - if (mirandaVersion < PLUGIN_MAKE_VERSION(0, 8, 0, 0)) - return NULL; - - return &pluginInfo; -} - -extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_PASTEIT, MIID_LAST}; - -std::wstring GetFile() -{ - TCHAR filter[512]; - _tcscpy_s(filter, 512, TranslateT("All Files (*.*)")); - memcpy(filter + _tcslen(filter), _T("\0*.*\0"), 6 * sizeof(TCHAR)); - TCHAR stzFilePath[1024]; - stzFilePath[0] = 0; - stzFilePath[1] = 0; - OPENFILENAME ofn = {0}; - ofn.lStructSize = sizeof(ofn); - ofn.hwndOwner = 0; - ofn.lpstrFilter = filter; - ofn.nFilterIndex = 1; - ofn.lpstrFile = stzFilePath; - ofn.lpstrTitle = TranslateT("Paste It - Select file"); - ofn.nMaxFile = 1024; - ofn.Flags = OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_EXPLORER | OFN_NOCHANGEDIR; - if(GetOpenFileName(&ofn)) - { - return stzFilePath; - } - - return L""; -} - -void PasteIt(HANDLE hContact, int mode) -{ - PasteToWeb* pasteToWeb = pasteToWebs[Options::instance->defWeb]; - if(mode == FROM_CLIPBOARD) - { - pasteToWeb->FromClipboard(); - } - else if(mode == FROM_FILE) - { - std::wstring file = GetFile(); - if(file.length() > 0) - { - pasteToWeb->FromFile(file); - } - else return; - } - else return; - - if(pasteToWeb->szFileLink[0] == 0 && pasteToWeb->error != NULL) - { - MessageBox(NULL, pasteToWeb->error, TranslateT("Error"), MB_OK | MB_ICONERROR); - } - else if(hContact != NULL && pasteToWeb->szFileLink[0] != 0) - { - char *szProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); - if (szProto && (INT_PTR)szProto != CALLSERVICE_NOTFOUND) - { - BOOL isChat = DBGetContactSettingByte(hContact, szProto, "ChatRoom", 0); - if(Options::instance->autoSend) - { - if(!isChat) - { - DBEVENTINFO dbei = {0}; - dbei.cbSize = sizeof(dbei); - dbei.eventType = EVENTTYPE_MESSAGE; - dbei.flags = DBEF_SENT; - dbei.szModule = szProto; - dbei.timestamp = (DWORD)time(NULL); - dbei.cbBlob = (DWORD)strlen(pasteToWeb->szFileLink) + 1; - dbei.pBlob = (PBYTE)pasteToWeb->szFileLink; - CallService(MS_DB_EVENT_ADD, (WPARAM)hContact, (LPARAM)&dbei); - CallContactService(hContact, PSS_MESSAGE, 0, (LPARAM)pasteToWeb->szFileLink); - } - else - { - // PSS_MESSAGE is not compatible with chat rooms - // there are no simple method to send text to all users - // in chat room. - // First I check if protocol is unicode or ascii. - BOOL isUnicodePlugin = TRUE; - PROTOACCOUNT* protoAc = ProtoGetAccount(szProto); - if(protoAc != NULL) - { - // protoAc->ppro is abstract class, that contains - // methods implemented in protocol ddl`s segment. - // Method address in vptr table must be converted - // to hInstance of protocol dll. - PROTO_INTERFACE* protoInt = protoAc->ppro; - MEMORY_BASIC_INFORMATION mb; - INT_PTR *vptr = *(INT_PTR**)&protoAc->ppro; - INT_PTR *vtable = (INT_PTR *)*vptr; - if(VirtualQuery((void*)vtable[0], &mb, sizeof(MEMORY_BASIC_INFORMATION))) - { - typedef PLUGININFOEX * (__cdecl * Miranda_Plugin_InfoEx) ( DWORD mirandaVersion ); - HINSTANCE hInst = (HINSTANCE)mb.AllocationBase; - // Now I can get PLUGININFOEX from protocol - Miranda_Plugin_InfoEx infoEx = (Miranda_Plugin_InfoEx) GetProcAddress(hInst, "MirandaPluginInfoEx"); - PLUGININFOEX* pi = NULL; - if(infoEx != NULL) - { - pi = infoEx(gMirandaVersion); - } - // If PLUGININFOEX flags contains UNICODE_AWARE, - // this mean that protocol is unicode. - if(pi != NULL && pi->cbSize == sizeof(PLUGININFOEX)) - { - isUnicodePlugin = pi->flags & UNICODE_AWARE; - } - } - } - - // Next step is to get all protocol sessions and find - // one with correct hContact - GC_INFO gci = {0}; - GCDEST gcd = {0}; - GCEVENT gce = {0}; - int cnt = (int)CallService(MS_GC_GETSESSIONCOUNT, 0, (LPARAM)szProto); - for (int i = 0; i < cnt ; i++ ) - { - gci.iItem = i; - gci.pszModule = szProto; - gci.Flags = BYINDEX | HCONTACT | ID; - CallService(MS_GC_GETINFO, 0, (LPARAM)(GC_INFO *) &gci); - if (gci.hContact == hContact) - { - // In this place session was finded, gci.pszID contains - // session ID, but it is in unicode or ascii format, - // depends on protocol wersion - gcd.pszModule = szProto; - gcd.iType = GC_EVENT_SENDMESSAGE; - gcd.ptszID = gci.pszID; - gce.cbSize = sizeof(GCEVENT); - gce.pDest = &gcd; - gce.bIsMe = TRUE; - gce.dwFlags = isUnicodePlugin ? (GCEF_ADDTOLOG | GC_UNICODE) : GCEF_ADDTOLOG; - wchar_t* s = NULL; - if(isUnicodePlugin) - { - // If session ID is in unicode, text must be too in unicode - s = mir_a2u_cp(pasteToWeb->szFileLink, CP_ACP); - gce.ptszText = s; - } - else - { - // If session ID is in ascii, text must be too in ascii - gce.pszText = pasteToWeb->szFileLink; - } - gce.time = time(NULL); - CallService(MS_GC_EVENT, 0, (LPARAM)(GCEVENT *) &gce); - if(s != NULL) - mir_free(s); - break; - } - } - } - - // Send message to focus window - CallServiceSync(MS_MSG_SENDMESSAGE, (WPARAM)hContact, 0); - } - else - { - if(isChat) - { - // MS_MSG_SENDMESSAGE in incompatible with chat rooms, - // because it sends text to IDC_MESSAGE window, - // but in chat rooms is only IDC_CHAT_MESSAGE window. - // contactWindows map contains all opened hContact - // with assaigned to them chat windows. - // This map is prepared in ME_MSG_WINDOWEVENT event. - std::map::iterator it = contactWindows->find(hContact); - if(it != contactWindows->end()) - { - // it->second is imput window, so now I can send to them - // new text. Afterr all is sended MS_MSG_SENDMESSAGE - // to focus window. - SendMessage(it->second, EM_SETSEL, -1, SendMessage(it->second, WM_GETTEXTLENGTH, 0, 0)); - SendMessageA(it->second, EM_REPLACESEL, FALSE, (LPARAM)pasteToWeb->szFileLink); - CallServiceSync(MS_MSG_SENDMESSAGE, (WPARAM)hContact, NULL); - } - else - { - // If window do not exist, maybe it is not chat - CallServiceSync(MS_MSG_SENDMESSAGE, (WPARAM)hContact, (LPARAM)pasteToWeb->szFileLink); - } - } - else - { - CallServiceSync(MS_MSG_SENDMESSAGE, (WPARAM)hContact, (LPARAM)pasteToWeb->szFileLink); - } - } - } - } -} - -int TabsrmmButtonPressed(WPARAM wParam, LPARAM lParam) -{ - CustomButtonClickData *cbc = (CustomButtonClickData *)lParam; - HANDLE hContact = (HANDLE)wParam; - - if (!strcmp(cbc->pszModule, MODULE) && cbc->dwButtonId == 1 && hContact) - { - if (cbc->flags == BBCF_ARROWCLICKED) - { - HMENU hMenu = CreatePopupMenu(); - if (hMenu) - { - AppendMenu(hMenu, MF_STRING, FROM_CLIPBOARD, TranslateT("Paste from clipboard")); - AppendMenu(hMenu, MF_STRING, FROM_FILE, TranslateT("Paste from file")); - HMENU hDefMenu = CreatePopupMenu(); - for(int i = 0 ; i < PasteToWeb::pages; ++i) - { - UINT flags = MF_STRING; - if(Options::instance->defWeb == i) - flags |= MF_CHECKED; - - AppendMenu(hDefMenu, flags, DEF_PAGES_START + i, pasteToWebs[i]->GetName()); - } - - AppendMenu(hMenu, MF_STRING | MF_POPUP, (UINT_PTR)hDefMenu, TranslateT("Default web page")); - - POINT pt; - GetCursorPos(&pt); - HWND hwndBtn = WindowFromPoint(pt); - if (hwndBtn) - { - RECT rc; - GetWindowRect(hwndBtn, &rc); - SetForegroundWindow(cbc->hwndFrom); - int selected = TrackPopupMenu(hMenu, TPM_RETURNCMD, rc.left, rc.bottom, 0, cbc->hwndFrom, 0); - if (selected != 0) - { - if(selected >= DEF_PAGES_START) - { - Options::instance->SetDefWeb(selected - DEF_PAGES_START); - } - else - { - PasteIt(hContact, selected); - } - } - } - - DestroyMenu(hDefMenu); - DestroyMenu(hMenu); - } - } - else - { - PasteIt(hContact, FROM_CLIPBOARD); - } - } - - return 0; -} - -int PrebuildContactMenu(WPARAM wParam, LPARAM lParam) -{ - bool bIsContact = false; - - char *szProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0); - if (szProto && (INT_PTR)szProto != CALLSERVICE_NOTFOUND) bIsContact = (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IM) ? true : false; - - CLISTMENUITEM mi = {0}; - mi.cbSize = sizeof(mi); - mi.flags = CMIM_FLAGS; - - if (!bIsContact) mi.flags |= CMIF_HIDDEN; - else mi.flags &= ~CMIF_HIDDEN; - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hContactMenu, (LPARAM)&mi); - - return 0; -} - -INT_PTR ContactMenuService(WPARAM wParam, LPARAM lParam) -{ - if(lParam >= DEF_PAGES_START) - { - Options::instance->SetDefWeb(lParam - DEF_PAGES_START); - } - else - { - HANDLE hContact = (HANDLE)wParam; - PasteIt(hContact, lParam); - } - return 0; -} - -void InitIcolib() -{ - TCHAR stzFile[MAX_PATH]; - - SKINICONDESC sid = {0}; - sid.cbSize = sizeof(sid); - sid.cx = sid.cy = 16; - sid.ptszDefaultFile = stzFile; - sid.ptszSection = LPGENT("Paste It"); - sid.flags = SIDF_ALL_TCHAR; - - GetModuleFileName(hInst, stzFile, MAX_PATH); - - sid.pszName = "PasteIt_main"; - sid.ptszDescription = LPGENT("Paste It"); - sid.iDefaultIndex = -IDI_MENU; - hMainIcon = Skin_AddIcon(&sid); -} - -void InitMenuItems() -{ - CLISTMENUITEM mi = {0}; - CLISTMENUITEM mi2 = {0}; - - mi.cbSize = sizeof(mi); - mi.flags = CMIF_ROOTPOPUP | CMIF_ICONFROMICOLIB | CMIF_TCHAR; - mi.icolibItem = hMainIcon; - mi.position = 3000090005; - mi.ptszName = _T("Paste It"); - - hContactMenu = Menu_AddContactMenuItem(&mi); - - memset(&mi, 0, sizeof(mi)); - mi.cbSize = sizeof(mi); - mi.flags = CMIF_CHILDPOPUP | CMIF_ROOTHANDLE | CMIF_TCHAR; - mi.pszService = MS_PASTEIT_CONTACTMENU; - mi.hParentMenu = hContactMenu; - mi.popupPosition = FROM_CLIPBOARD; - mi.ptszName = _T("Paste from clipboard"); - Menu_AddContactMenuItem(&mi); - - mi.popupPosition = FROM_FILE; - mi.ptszName = _T("Paste from file"); - Menu_AddContactMenuItem(&mi); - - mi.popupPosition = DEF_PAGES_START - 1; - mi.ptszName = _T("Default web page"); - HGENMENU hDefWebMenu = Menu_AddContactMenuItem(&mi); - - mi2.cbSize = sizeof(mi2); - mi2.pszService = MS_PASTEIT_CONTACTMENU; - mi2.hParentMenu = hDefWebMenu; - for(int i = 0 ; i < PasteToWeb::pages; ++i) - { - mi2.flags = CMIF_CHILDPOPUP | CMIF_ROOTHANDLE | CMIF_TCHAR; - if(Options::instance->defWeb == i) - mi2.flags |= CMIF_CHECKED; - mi2.ptszName = pasteToWebs[i]->GetName(); - mi2.popupPosition = mi2.position = DEF_PAGES_START + i; - hWebPageMenus[i] = Menu_AddContactMenuItem(&mi2); - } - - hPrebuildContactMenu = HookEvent(ME_CLIST_PREBUILDCONTACTMENU, PrebuildContactMenu); -} - -void DefWebPageChanged() -{ - CLISTMENUITEM mi = {0}; - mi.cbSize = sizeof(mi); - - for (int i = 0; i < PasteToWeb::pages; i++) - { - mi.flags = CMIM_FLAGS; - if (Options::instance->defWeb == i) - { - mi.flags |= CMIF_CHECKED; - } - - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hWebPageMenus[i], (LPARAM)&mi); - } -} - -void InitTabsrmmButton() -{ - if (ServiceExists(MS_BB_ADDBUTTON)) - { - BBButton btn = {0}; - btn.cbSize = sizeof(btn); - btn.dwButtonID = 1; - btn.pszModuleName = MODULE; - btn.dwDefPos = 110; - btn.hIcon = hMainIcon; - btn.bbbFlags = BBBF_ISARROWBUTTON | BBBF_ISIMBUTTON | BBBF_ISLSIDEBUTTON | BBBF_CANBEHIDDEN | BBBF_ISCHATBUTTON; - btn.ptszTooltip = TranslateT("Paste It"); - CallService(MS_BB_ADDBUTTON, 0, (LPARAM)&btn); - if(hTabsrmmButtonPressed != NULL) - { - UnhookEvent(hTabsrmmButtonPressed); - } - - hTabsrmmButtonPressed = HookEvent(ME_MSG_BUTTONPRESSED, TabsrmmButtonPressed); - } -} - -int WindowEvent(WPARAM wParam, MessageWindowEventData* lParam) -{ - if(lParam->uType == MSG_WINDOW_EVT_OPEN) - { - char *szProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)lParam->hContact, 0); - if (szProto && (INT_PTR)szProto != CALLSERVICE_NOTFOUND) - { - if(DBGetContactSettingByte(lParam->hContact, szProto, "ChatRoom", 0)) - { - (*contactWindows)[lParam->hContact] = lParam->hwndInput; - } - } - } - else if(lParam->uType == MSG_WINDOW_EVT_CLOSE) - { - std::map::iterator it = contactWindows->find(lParam->hContact); - if(it != contactWindows->end()) - { - contactWindows->erase(it); - } - } - - return 0; -} - -int ModulesLoaded(WPARAM wParam, LPARAM lParam) -{ - InitIcolib(); - InitMenuItems(); - InitTabsrmmButton(); - hWindowEvent = HookEvent(ME_MSG_WINDOWEVENT, (MIRANDAHOOK)WindowEvent); - - return 0; -} - -extern "C" int __declspec(dllexport) Load(void) -{ - mir_getXI(&xi); - mir_getLP(&pluginInfo); - NETLIBUSER nlu = {0}; - nlu.cbSize = sizeof(nlu); - nlu.flags = NUF_TCHAR | NUF_OUTGOING | NUF_HTTPCONNS; - nlu.szSettingsModule = MODULE; - nlu.ptszDescriptiveName = TranslateT("Paste It HTTP connections"); - g_hNetlibUser = ( HANDLE )CallService( MS_NETLIB_REGISTERUSER, 0, ( LPARAM )&nlu ); - - pasteToWebs[0] = new PasteToWeb1(); - pasteToWebs[0]->pageIndex = 0; - pasteToWebs[1] = new PasteToWeb2(); - pasteToWebs[1]->pageIndex = 1; - Options::instance = new Options(); - pasteToWebs[0]->ConfigureSettings(); - pasteToWebs[1]->ConfigureSettings(); - Options::instance->Load(); - hModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded); - hOptionsInit = HookEvent(ME_OPT_INITIALISE, Options::InitOptions); - hTabsrmmButtonPressed = NULL; - hServiceContactMenu = CreateServiceFunction(MS_PASTEIT_CONTACTMENU, ContactMenuService); - contactWindows = new std::map(); - return 0; -} - -extern "C" int __declspec(dllexport) Unload(void) -{ - UnhookEvent(hModulesLoaded); - UnhookEvent(hPrebuildContactMenu); - UnhookEvent(hOptionsInit); - if(hWindowEvent != NULL) - { - UnhookEvent(hWindowEvent); - } - DestroyServiceFunction(hServiceContactMenu); - Netlib_CloseHandle(g_hNetlibUser); - if(hTabsrmmButtonPressed != NULL) - { - UnhookEvent(hTabsrmmButtonPressed); - } - for(int i=0; i < PasteToWeb::pages; ++i) - { - if(pasteToWebs[i] != NULL) - { - delete pasteToWebs[i]; - pasteToWebs[i] = NULL; - } - } - if(Options::instance != NULL) - { - delete Options::instance; - Options::instance = NULL; - } - - delete contactWindows; - return 0; -} diff --git a/plugins/PasteIt/PasteIt.rc b/plugins/PasteIt/PasteIt.rc deleted file mode 100644 index e428a849ab..0000000000 --- a/plugins/PasteIt/PasteIt.rc +++ /dev/null @@ -1,140 +0,0 @@ -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -//#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -#include -#include - -///////////////////////////////////////////////////////////////////////////// -// Neutral resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU) -#ifdef _WIN32 -LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL -#pragma code_page(1250) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_OPT_MAIN DIALOGEX 0, 0, 285, 225 -STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD -EXSTYLE WS_EX_CONTROLPARENT -FONT 8, "MS Shell Dlg", 400, 0, 0x1 -BEGIN - GROUPBOX "Settings",IDC_STATIC,7,5,274,220 - COMBOBOX IDC_WEBLIST,134,20,135,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Default web page",IDC_STATIC,14,23,117,8 - COMBOBOX IDC_CODEPAGE,134,43,135,30,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP - LTEXT "Default file encoding",IDC_STATIC,14,45,114,8 - CONTROL "Auto-detect UTF-8",IDC_AUTOUTF, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,66,236,10 - CONTROL "Show confirmation dialog box",IDC_CONFDLG, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,80,236,10 - CONTROL "Autosend download link to contact",IDC_AUTOSEND, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,94,236,10 -END - -IDD_OPT_PAGES DIALOGEX 0, 0, 285, 225 -STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD -EXSTYLE WS_EX_CONTROLPARENT -FONT 8, "MS Shell Dlg", 400, 0, 0x1 -BEGIN - GROUPBOX "Web page settings",IDC_STATIC,7,30,274,195 - COMBOBOX IDC_WEBPAGE,145,7,135,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Web page to configure",IDC_STATIC,14,10,125,8 - COMBOBOX IDC_DEFFORMAT,138,43,80,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "Configure",IDC_CONFIGURE,223,43,50,14 - LTEXT "Default formatting",IDC_STATIC,14,45,120,8 - CONTROL "Auto-detect format from file extension",IDC_AUTOFORMAT, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,66,236,10 - CONTROL "Public paste",IDC_PUBLICPASTE, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,66,236,10 - COMBOBOX IDC_COMBO1,138,83,135,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "",IDC_COMBO1_DESC,14,86,120,8 - CONTROL "Login as guest",IDC_GUEST, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,106,236,10 - EDITTEXT IDC_PASTEBIN_KEY,138,123,135,12,WS_TABSTOP|ES_AUTOHSCROLL - LTEXT "User key",IDC_PASTEBIN_KEY_DESC,14,126,90,8 - PUSHBUTTON "Get user key",IDC_PASTEBIN_LOGIN,14,143,80,14, BS_MULTILINE -END - -IDD_DLG_CONFIGURE DIALOGEX 0, 0, 214, 178 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Configure formatting" -FONT 8, "MS Shell Dlg", 400, 0, 0x1 -BEGIN - DEFPUSHBUTTON "OK",IDOK,120,159,40,14 - PUSHBUTTON "Cancel",IDCANCEL,164,159,40,14 - LISTBOX IDC_FORMATTING,10,10,150,144, WS_VSCROLL | LBS_WANTKEYBOARDINPUT - PUSHBUTTON "Up",IDC_UP,164,10,40,14 - PUSHBUTTON "Down",IDC_DOWN,164,26,40,14 - PUSHBUTTON "Delete",IDC_DELETE,164,42,40,14 - PUSHBUTTON "Restore defaults",IDC_RESTORE,164,90,40,28, BS_MULTILINE - PUSHBUTTON "Download more",IDC_DOWNLOAD,164,120,40,28, BS_MULTILINE -END - -IDD_DLG_PASTEBIN_LOGIN DIALOGEX 0, 0, 154, 60 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Login to pastebin.com" -FONT 8, "MS Shell Dlg", 400, 0, 0x1 -BEGIN - EDITTEXT IDC_PASTEBIN_USER,70,10,75,12,WS_TABSTOP|ES_AUTOHSCROLL - LTEXT "User name",IDC_STATIC,10,13,55,8 - EDITTEXT IDC_PASTEBIN_PASSWORD,70,25,75,12,WS_TABSTOP|ES_PASSWORD|ES_AUTOHSCROLL - LTEXT "Password",IDC_STATIC,10,28,55,8 - DEFPUSHBUTTON "OK",IDOK,60,40,40,14 - PUSHBUTTON "Cancel",IDCANCEL,104,40,40,14 -END - -IDD_DLG_FROM_CLIPBOARD DIALOGEX 0, 0, 214, 178 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Paste It" -FONT 8, "MS Shell Dlg", 400, 0, 0x1 -BEGIN - DEFPUSHBUTTON "OK",IDOK,120,159,40,14 - PUSHBUTTON "Cancel",IDCANCEL,164,159,40,14 - EDITTEXT IDC_CLIPBOARD_DATA,10,10,194,129,WS_HSCROLL | WS_VSCROLL | ES_READONLY | ES_MULTILINE - COMBOBOX IDC_FORMAT,65,142,139,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Format",IDC_STATIC,10,144,50,8 -END - -IDD_DLG_FROM_FILE DIALOGEX 0, 0, 214, 208 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Paste It" -FONT 8, "MS Shell Dlg", 400, 0, 0x1 -BEGIN - DEFPUSHBUTTON "OK",IDOK,120,189,40,14 - PUSHBUTTON "Cancel",IDCANCEL,164,189,40,14 - EDITTEXT IDC_FILE_PATH,10,10,194,12,ES_READONLY | ES_AUTOHSCROLL - EDITTEXT IDC_FILE_DATA,10,27,194,112,WS_HSCROLL | WS_VSCROLL | ES_READONLY | ES_MULTILINE - COMBOBOX IDC_CODEPAGE,65,142,139,30,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP - LTEXT "Encoding",IDC_STATIC,10,144,50,8 - CONTROL "Auto-detect format from file extension",IDC_AUTOFORMAT, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,159,180,10 - COMBOBOX IDC_FORMAT,65,172,139,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Format",IDC_FORMATTEXT,10,174,50,8 - PUSHBUTTON "Recode",IDC_RECODE,10,189,60,14 -END - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDI_MENU ICON "icons\\Paste.ico" -#endif // Neutral resources -///////////////////////////////////////////////////////////////////////////// - diff --git a/plugins/PasteIt/PasteIt.vcxproj b/plugins/PasteIt/PasteIt.vcxproj index b0f5cae238..68f324aa64 100644 --- a/plugins/PasteIt/PasteIt.vcxproj +++ b/plugins/PasteIt/PasteIt.vcxproj @@ -77,7 +77,7 @@ Use Level3 Disabled - WIN32;_DEBUG;_WINDOWS;_USRDLL;PASTEIT_EXPORTS;%(PreprocessorDefinitions) + WIN32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) @@ -97,7 +97,7 @@ Use Level3 Disabled - WIN64;_DEBUG;_WINDOWS;_USRDLL;PASTEIT_EXPORTS;%(PreprocessorDefinitions) + WIN64;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) @@ -119,7 +119,7 @@ Full true true - WIN32;NDEBUG;_WINDOWS;_USRDLL;PASTEIT_EXPORTS;%(PreprocessorDefinitions) + WIN32;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) Size @@ -144,7 +144,7 @@ Full true true - WIN64;NDEBUG;_WINDOWS;_USRDLL;PASTEIT_EXPORTS;%(PreprocessorDefinitions) + WIN64;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) Size @@ -163,36 +163,27 @@ - - - - - - - - + + + + + + + + - - + + Create - - - + + + - - - - - - - - - false - - + + diff --git a/plugins/PasteIt/PasteIt.vcxproj.filters b/plugins/PasteIt/PasteIt.vcxproj.filters index 494819693d..ff39f578c7 100644 --- a/plugins/PasteIt/PasteIt.vcxproj.filters +++ b/plugins/PasteIt/PasteIt.vcxproj.filters @@ -13,76 +13,56 @@ {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - {e6bd3d70-0d30-4cf4-a284-c0fd38c83fa5} - - + Header Files - + Header Files - + Header Files - + Header Files - + Header Files - + Header Files - + Header Files - + Header Files - + Source Files - + Source Files - + Source Files - + Source Files - + Source Files - + Resource Files - + Resource Files - - - Resource Files - - - Resource Files\Docs - - - Resource Files\Docs - - - Resource Files\Docs - - - Resource Files\Docs - - \ No newline at end of file diff --git a/plugins/PasteIt/PasteIt.vcxproj.user b/plugins/PasteIt/PasteIt.vcxproj.user new file mode 100644 index 0000000000..695b5c78b9 --- /dev/null +++ b/plugins/PasteIt/PasteIt.vcxproj.user @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/plugins/PasteIt/PasteToWeb.cpp b/plugins/PasteIt/PasteToWeb.cpp deleted file mode 100644 index a7cc9a3b5f..0000000000 --- a/plugins/PasteIt/PasteToWeb.cpp +++ /dev/null @@ -1,577 +0,0 @@ -/* -Paste It plugin -Copyright (C) 2011 Krzysztof Kral - -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 version 2 -of the License. - -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, see . -*/ - -#include "StdAfx.h" -#include "PasteToWeb.h" -#include "Options.h" -#include "resource.h" - -extern HINSTANCE hInst; - -PasteToWeb::PasteToWeb() -{ -} - - -PasteToWeb::~PasteToWeb() -{ -} - -struct FromClipboardData -{ - std::wstring content; - int page; - std::wstring format; -}; - -struct FromFileData -{ - char* content; - int contentLen; - wchar_t* contentW; - UINT codepage; - std::wstring *fileName; - int page; - std::wstring format; - bool sendFileName; -}; - -INT_PTR CALLBACK DlgProcFromClipboard(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) -{ - switch (msg) - { - case WM_INITDIALOG: - { - TranslateDialogDefault(hwndDlg); - FromClipboardData* data = (FromClipboardData*)lParam; - SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam); - int ts = 4; - Edit_SetTabStops(GetDlgItem(hwndDlg, IDC_CLIPBOARD_DATA), 1, &ts); - SetDlgItemText(hwndDlg, IDC_CLIPBOARD_DATA, data->content.c_str()); - int sel = 0; - int i = 0; - std::wstring &defFormat = Options::instance->webOptions[data->page]->defFormatId; - HWND cb = GetDlgItem(hwndDlg, IDC_FORMAT); - for(std::list::iterator it = Options::instance->webOptions[data->page]->formats.begin(); it != Options::instance->webOptions[data->page]->formats.end(); ++it) - { - ComboBox_AddString(cb, it->name.c_str()); - if(it->id == defFormat) - sel = i; - ++i; - } - if(!Options::instance->webOptions[data->page]->formats.empty()) - { - ComboBox_SetCurSel(cb, sel); - } - return TRUE; - } - case WM_COMMAND: - { - if (HIWORD(wParam) == BN_CLICKED) - { - if (LOWORD(wParam) == IDOK) - { - FromClipboardData *clipboardData = (FromClipboardData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - int sel = ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_FORMAT)); - for(std::list::iterator it = Options::instance->webOptions[clipboardData->page]->formats.begin(); it != Options::instance->webOptions[clipboardData->page]->formats.end(); ++it) - { - if(sel-- <= 0) - { - clipboardData->format = it->id; - break; - } - } - - EndDialog(hwndDlg, IDC_BTN_OK); - } - else if (LOWORD(wParam) == IDCANCEL) - { - EndDialog(hwndDlg, IDCANCEL); - } - } - - break; - } - } - - return FALSE; -} - -void RecodeDlg(HWND hwndDlg) -{ - ShowWindow(GetDlgItem(hwndDlg,IDC_RECODE),SW_HIDE); - FromFileData *fromFileData = (FromFileData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - unsigned int cp = Options::GetCodepageCB(GetDlgItem(hwndDlg, IDC_CODEPAGE), false, fromFileData->codepage); - mir_free(fromFileData->contentW); - int cbLen = 0; - if(cp == 1200 || cp == 1201) - { - // UTF-16 - cbLen = fromFileData->contentLen / 2; - } - else - { - cbLen = MultiByteToWideChar( cp, 0, fromFileData->content, fromFileData->contentLen, NULL, 0 ); - } - - fromFileData->contentW = ( wchar_t* )mir_alloc( sizeof( wchar_t )*(cbLen+1)); - if ( fromFileData->contentW != NULL ) - { - if(cp == 1200) - { - memcpy_s(fromFileData->contentW, sizeof( wchar_t )*(cbLen+1), fromFileData->content, sizeof( wchar_t )*cbLen); - } - else if(cp == 1201) - { - for(int i = 0 ; i < cbLen; ++i) - { - fromFileData->contentW[i] = ((unsigned char)fromFileData->content[i*2] << 8) | (unsigned char)fromFileData->content[i*2 + 1]; - } - } - else - { - MultiByteToWideChar( cp, 0, fromFileData->content, fromFileData->contentLen, fromFileData->contentW, cbLen ); - } - - fromFileData->contentW[ cbLen ] = 0; - SetDlgItemText(hwndDlg, IDC_FILE_DATA, fromFileData->contentW); - } - else - { - SetDlgItemText(hwndDlg, IDC_FILE_DATA, _T("")); - } - - fromFileData->codepage = cp; -} - -INT_PTR CALLBACK DlgProcFromFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) -{ - switch (msg) - { - case WM_INITDIALOG: - { - TranslateDialogDefault(hwndDlg); - FromFileData *fromFileData = (FromFileData*)lParam; - int ts = 4; - Edit_SetTabStops(GetDlgItem(hwndDlg, IDC_FILE_DATA), 1, &ts); - SetDlgItemText(hwndDlg, IDC_FILE_DATA, fromFileData->contentW); - SetDlgItemText(hwndDlg, IDC_FILE_PATH, fromFileData->fileName->c_str()); - Options::InitCodepageCB(GetDlgItem(hwndDlg, IDC_CODEPAGE), fromFileData->codepage); - SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam); - ShowWindow(GetDlgItem(hwndDlg,IDC_RECODE),SW_HIDE); - - int sel = 0; - int i = 0; - std::wstring &defFormat = Options::instance->webOptions[fromFileData->page]->defFormatId; - HWND cb = GetDlgItem(hwndDlg, IDC_FORMAT); - for(std::list::iterator it = Options::instance->webOptions[fromFileData->page]->formats.begin(); it != Options::instance->webOptions[fromFileData->page]->formats.end(); ++it) - { - ComboBox_AddString(cb, it->name.c_str()); - if(it->id == defFormat) - sel = i; - ++i; - } - if(!Options::instance->webOptions[fromFileData->page]->formats.empty()) - { - ComboBox_SetCurSel(cb, sel); - } - - if(Options::instance->webOptions[fromFileData->page]->isSendFileName) - { - bool sendFileName = Options::instance->webOptions[fromFileData->page]->sendFileName; - CheckDlgButton(hwndDlg, IDC_AUTOFORMAT, sendFileName ? 1 : 0); - Button_Enable(GetDlgItem(hwndDlg, IDC_FORMAT), sendFileName ? 0 : 1); - Button_Enable(GetDlgItem(hwndDlg, IDC_FORMATTEXT), sendFileName ? 0 : 1); - } - else - Button_Enable(GetDlgItem(hwndDlg, IDC_AUTOFORMAT), FALSE); - return TRUE; - } - case WM_COMMAND: - { - if (HIWORD(wParam) == BN_CLICKED) - { - if (LOWORD(wParam) == IDOK) - { - FromFileData *fromFileData = (FromFileData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - int sel = ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_FORMAT)); - for(std::list::iterator it = Options::instance->webOptions[fromFileData->page]->formats.begin(); it != Options::instance->webOptions[fromFileData->page]->formats.end(); ++it) - { - if(sel-- <= 0) - { - fromFileData->format = it->id; - break; - } - } - - if(Options::instance->webOptions[fromFileData->page]->isSendFileName) - fromFileData->sendFileName = IsDlgButtonChecked(hwndDlg, IDC_AUTOFORMAT) ? true : false; - else - fromFileData->sendFileName = false; - - EndDialog(hwndDlg, IDC_BTN_OK); - } - else if (LOWORD(wParam) == IDCANCEL) - { - EndDialog(hwndDlg, IDCANCEL); - } - else if(LOWORD(wParam) == IDC_RECODE) - { - RecodeDlg(hwndDlg); - } - else if(LOWORD(wParam) == IDC_AUTOFORMAT) - { - UINT sendFileName = IsDlgButtonChecked(hwndDlg, IDC_AUTOFORMAT); - Button_Enable(GetDlgItem(hwndDlg, IDC_FORMAT), sendFileName ? 0 : 1); - Button_Enable(GetDlgItem(hwndDlg, IDC_FORMATTEXT), sendFileName ? 0 : 1); - } - } - else if(LOWORD(wParam) == IDC_CODEPAGE) - { - if(HIWORD(wParam) == CBN_SELCHANGE) - { - RecodeDlg(hwndDlg); - } - else if(HIWORD(wParam) == CBN_EDITCHANGE) - { - ShowWindow(GetDlgItem(hwndDlg,IDC_RECODE),SW_SHOW); - } - else if(HIWORD(wParam) == CBN_KILLFOCUS) - { - FromFileData *fromFileData = (FromFileData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - Options::GetCodepageCB(GetDlgItem(hwndDlg, IDC_CODEPAGE), true, fromFileData->codepage); - } - } - - break; - } - } - - return FALSE; -} - -void PasteToWeb::FromClipboard() -{ - szFileLink[0] = 0; - error = NULL; - std::wstring str; - BOOL isFile = 0; - if(OpenClipboard(NULL)) - { - HANDLE obj = GetClipboardData(CF_UNICODETEXT); - if(obj != NULL) - { - LPCWSTR wStr = (LPCWSTR)GlobalLock(obj); - str.append(wStr, wStr + wcslen(wStr)); - GlobalUnlock(obj); - // Sometimes clipboard CF_UNICODETEXT format returns only 2 characters, - // to fix this I check if CF_TEXT contains more characters, - // if this is true, this mean that CF_UNICODETEXT is invalid. - obj = GetClipboardData(CF_TEXT); - if(obj != NULL) - { - LPCSTR cStr = (LPCSTR)GlobalLock(obj); - if(strlen(cStr) > str.length()) - { - str = L""; - LPWSTR wStr = mir_a2u_cp(cStr, CP_ACP); - str.append(wStr, wStr + wcslen(wStr)); - mir_free(wStr); - } - GlobalUnlock(obj); - } - } - else - { - obj = GetClipboardData(CF_TEXT); - if(obj != NULL) - { - LPCSTR cStr = (LPCSTR)GlobalLock(obj); - LPWSTR wStr = mir_a2u_cp(cStr, CP_ACP); - str.append(wStr, wStr + wcslen(wStr)); - mir_free(wStr); - GlobalUnlock(obj); - } - else - { - obj = GetClipboardData(CF_HDROP); - if(obj != NULL) - { - LPDROPFILES df = (LPDROPFILES) GlobalLock(obj); - isFile = 1; - if(df->fWide) - { - // Unicode - WCHAR* file = (WCHAR*)((BYTE*)obj + df->pFiles); - size_t len = wcslen(file); - if(*(file + len + 1) == L'\0') - { - str.append(file, file + len); - } - else - { - error = TranslateT("You can only paste 1 file"); - } - } - else - { - // ANSI - char* file = (char*)obj + df->pFiles; - size_t len = strlen(file); - if(*(file + len + 1) == '\0') - { - LPWSTR wStr = mir_a2u_cp(file, CP_ACP); - str.append(wStr, wStr + wcslen(wStr)); - mir_free(wStr); - } - else - { - error = TranslateT("You can only paste 1 file"); - } - } - GlobalUnlock(obj); - } - } - } - - CloseClipboard(); - } - - if(str.length() > 0) - { - if(isFile) - FromFile(str); - else - { - FromClipboardData data; - data.content = str; - data.page = pageIndex; - if (Options::instance->confDlg && DialogBoxParam (hInst, MAKEINTRESOURCE(IDD_DLG_FROM_CLIPBOARD), 0, DlgProcFromClipboard, (LPARAM)&data) != IDC_BTN_OK) - return; - - SendToServer(str, L"", data.format); - } - } - else if(error == NULL) - { - error = TranslateT("Cannot get data from clipboard"); - } -} - -void PasteToWeb::FromFile(std::wstring file) -{ - error = NULL; - szFileLink[0] = 0; - HANDLE hFile = CreateFile(file.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); - FromFileData fromFileData; - fromFileData.content = NULL; - fromFileData.contentLen = 0; - fromFileData.fileName = &file; - if(hFile != INVALID_HANDLE_VALUE) - { - LARGE_INTEGER fileSize; - if(GetFileSizeEx(hFile, &fileSize)) - { - if(fileSize.QuadPart <= 10485760LL) - { - if(fileSize.QuadPart > 512000LL) - { - _stprintf_s(bufErr, 1024, TranslateT("File size is %dKB, do you realy want to paste such large file?"), fileSize.LowPart / 1024); - if(MessageBox(NULL, bufErr, TranslateT("Are You sure?"), MB_YESNO | MB_ICONQUESTION) != IDYES) - { - CloseHandle(hFile); - return; - } - } - DWORD readed; - fromFileData.contentLen = fileSize.LowPart; - fromFileData.content = (char*)mir_alloc(fromFileData.contentLen); - if(!ReadFile(hFile, fromFileData.content, fromFileData.contentLen, &readed, NULL)) - { - mir_free(fromFileData.content); - fromFileData.content = NULL; - fromFileData.contentLen = 0; - _stprintf_s(bufErr, 1024, TranslateT("Cannot read file '%s'"), file.c_str()); - error = bufErr; - } - } - else - { - error = TranslateT("File size is larger then 10MB, cannot be send"); - } - } - - CloseHandle(hFile); - } - else - { - _stprintf_s(bufErr, 1024, TranslateT("Cannot open file '%s'"), file.c_str()); - error = bufErr; - } - - if(fromFileData.content != NULL) - { - int cbLen = 0; - bool isDefTranslation = true; - if(Options::instance->autoUTF) - { - isDefTranslation = false; - fromFileData.codepage = CP_UTF8; - cbLen = MultiByteToWideChar( fromFileData.codepage, MB_ERR_INVALID_CHARS, fromFileData.content, fromFileData.contentLen, NULL, 0 ); - if(cbLen == 0) - { - int errorN = GetLastError(); - if(errorN == ERROR_NO_UNICODE_TRANSLATION) - { - isDefTranslation = true; - } - } - } - - if(isDefTranslation) - { - fromFileData.codepage = Options::instance->codepage; - if(fromFileData.codepage == 1200 || fromFileData.codepage == 1201) - { - // UTF-16 - cbLen = fromFileData.contentLen / 2; - } - else - { - cbLen = MultiByteToWideChar( fromFileData.codepage, 0, fromFileData.content, fromFileData.contentLen, NULL, 0 ); - } - } - - if(cbLen > 0) - { - fromFileData.contentW = ( wchar_t* )mir_alloc( sizeof( wchar_t )*(cbLen+1)); - if ( fromFileData.contentW != NULL ) - { - if(fromFileData.codepage == 1200) - { - memcpy_s(fromFileData.contentW, sizeof( wchar_t )*(cbLen+1), fromFileData.content, sizeof( wchar_t )*cbLen); - } - else if(fromFileData.codepage == 1201) - { - for(int i = 0 ; i < cbLen; ++i) - { - fromFileData.contentW[i] = (fromFileData.content[i*2] << 8) | fromFileData.content[i*2 + 1]; - } - } - else - { - MultiByteToWideChar( fromFileData.codepage, 0, fromFileData.content, fromFileData.contentLen, fromFileData.contentW, cbLen ); - } - - fromFileData.contentW[ cbLen ] = 0; - fromFileData.page = pageIndex; - if (!Options::instance->confDlg || DialogBoxParam (hInst, MAKEINTRESOURCE(IDD_DLG_FROM_FILE), 0, DlgProcFromFile, (LPARAM)&fromFileData) == IDC_BTN_OK) - { - std::wstring fileName; - std::wstring::size_type pos1 = file.find_last_of(L'\\'); - std::wstring::size_type pos2 = file.find_last_of(L'/'); - if(pos2 > pos1 && pos2 < file.length()) - pos1 = pos2; - if(pos1 >= 0 && pos1 + 1 < file.length()) - fileName = file.substr(pos1 + 1); - else - fileName = file; - SendToServer(fromFileData.contentW, fromFileData.sendFileName ? fileName : L"", fromFileData.format); - } - mir_free(fromFileData.contentW); - } - } - else - { - _stprintf_s(bufErr, 1024, TranslateT("File '%s' is empty"), file.c_str()); - error = bufErr; - } - mir_free(fromFileData.content); - } -} - -extern HANDLE g_hNetlibUser; - -wchar_t* PasteToWeb::SendToWeb(char* url, std::map& headers, std::wstring content) -{ - wchar_t* resCont = NULL; - int cbLen = WideCharToMultiByte( CP_UTF8, 0, content.c_str(), -1, NULL, 0, NULL, NULL ); - char* contentBytes = ( char* )mir_alloc(cbLen); - if ( contentBytes == NULL ) - return resCont; - - WideCharToMultiByte( CP_UTF8, 0, content.c_str(), -1, contentBytes, cbLen, NULL, NULL ); - --cbLen; - - int nHeaders = 0; - for(std::map::iterator it = headers.begin(); it != headers.end(); ++it) - { - ++nHeaders; - } - - NETLIBHTTPREQUEST nlhr={0}; - NETLIBHTTPHEADER* httpHeaders = new NETLIBHTTPHEADER[nHeaders]; - nlhr.cbSize=sizeof(nlhr); - nlhr.requestType=REQUEST_POST; - nlhr.flags=NLHRF_NODUMPSEND|NLHRF_DUMPASTEXT|NLHPIF_HTTP11; - nlhr.szUrl=url; - nlhr.headers = httpHeaders; - nlhr.pData = contentBytes; - nlhr.dataLength = cbLen; - nHeaders = 0; - std::list mallBuf; - for(std::map::iterator it = headers.begin(); it != headers.end(); ++it) - { - char* b1 = new char[it->first.length() + 1]; - char* b2 = new char[it->second.length() + 1]; - strcpy_s(b1, it->first.length() + 1, it->first.c_str()); - strcpy_s(b2, it->second.length() + 1, it->second.c_str()); - httpHeaders[nHeaders].szName = b1; - httpHeaders[nHeaders].szValue = b2; - mallBuf.push_back(b1); - mallBuf.push_back(b2); - ++nHeaders; - } - - nlhr.headersCount = nHeaders; - NETLIBHTTPREQUEST* nlhrReply = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION,(WPARAM)g_hNetlibUser,(LPARAM)&nlhr); - if(nlhrReply != NULL) - { - if(nlhrReply->resultCode == 200) - { - int resLen = MultiByteToWideChar(CP_UTF8, 0, nlhrReply->pData, nlhrReply->dataLength, NULL, 0); - ++resLen; - resCont = ( wchar_t* )mir_alloc(resLen * sizeof(wchar_t)); - if ( resCont != NULL ) - { - resLen = MultiByteToWideChar( CP_UTF8, 0, nlhrReply->pData, nlhrReply->dataLength, resCont, resLen); - resCont[resLen] = 0; - } - } - - CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT,0,(LPARAM)nlhrReply); - } - delete httpHeaders; - for(std::list::iterator it = mallBuf.begin(); it != mallBuf.end(); ++it) - { - delete *it; - } - - mir_free(contentBytes); - return resCont; -} diff --git a/plugins/PasteIt/PasteToWeb.h b/plugins/PasteIt/PasteToWeb.h deleted file mode 100644 index 51e2141790..0000000000 --- a/plugins/PasteIt/PasteToWeb.h +++ /dev/null @@ -1,47 +0,0 @@ -/* -Paste It plugin -Copyright (C) 2011 Krzysztof Kral - -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 version 2 -of the License. - -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, see . -*/ - -#pragma once - -struct PasteFormat -{ - std::wstring id; - std::wstring name; -}; - -class PasteToWeb -{ -protected: - virtual void SendToServer(std::wstring str, std::wstring fileName, std::wstring format) = 0; - wchar_t* SendToWeb(char* url, std::map& headers, std::wstring content); - PasteToWeb(); - TCHAR bufErr[1024]; -public: - virtual ~PasteToWeb(); - char szFileLink[256]; - TCHAR* error; - void FromClipboard(); - void FromFile(std::wstring file); - virtual TCHAR* GetName() = 0; - virtual void ConfigureSettings() = 0; - int pageIndex; - virtual std::list GetFormats() = 0; - virtual std::list GetDefFormats() = 0; - static const int pages = 2; -}; - diff --git a/plugins/PasteIt/PasteToWeb1.cpp b/plugins/PasteIt/PasteToWeb1.cpp deleted file mode 100644 index bbdc2e1ba5..0000000000 --- a/plugins/PasteIt/PasteToWeb1.cpp +++ /dev/null @@ -1,393 +0,0 @@ -/* -Paste It plugin -Copyright (C) 2011 Krzysztof Kral - -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 version 2 -of the License. - -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, see . -*/ - -#include "StdAfx.h" -#include "PasteToWeb1.h" -#include "Options.h" - -PasteFormat PasteToWeb1::formats[] = -{ - {L"4cs", L"4CS"}, - {L"6502acme", L"6502 ACME Cross Assembler"}, - {L"6502kickass", L"6502 Kick Assembler"}, - {L"6502tasm", L"6502 TASM/64TASS"}, - {L"abap", L"ABAP"}, - {L"actionscript", L"ActionScript"}, - {L"actionscript3", L"ActionScript 3"}, - {L"ada", L"Ada"}, - {L"algol68", L"ALGOL 68"}, - {L"apache", L"Apache Log"}, - {L"applescript", L"AppleScript"}, - {L"apt_sources", L"APT Sources"}, - {L"asm", L"ASM (NASM)"}, - {L"asp", L"ASP"}, - {L"autoconf", L"autoconf"}, - {L"autohotkey", L"Autohotkey"}, - {L"autoit", L"AutoIt"}, - {L"avisynth", L"Avisynth"}, - {L"awk", L"Awk"}, - {L"bascomavr", L"BASCOM AVR"}, - {L"bash", L"Bash"}, - {L"basic4gl", L"Basic4GL"}, - {L"bibtex", L"BibTeX"}, - {L"blitzbasic", L"Blitz Basic"}, - {L"bnf", L"BNF"}, - {L"boo", L"BOO"}, - {L"bf", L"BrainFuck"}, - {L"c", L"C"}, - {L"c_mac", L"C for Macs"}, - {L"cil", L"C Intermediate Language"}, - {L"csharp", L"C#"}, - {L"cpp", L"C++"}, - {L"cpp-qt", L"C++ (with QT extensions)"}, - {L"c_loadrunner", L"C: Loadrunner"}, - {L"caddcl", L"CAD DCL"}, - {L"cadlisp", L"CAD Lisp"}, - {L"cfdg", L"CFDG"}, - {L"chaiscript", L"ChaiScript"}, - {L"clojure", L"Clojure"}, - {L"klonec", L"Clone C"}, - {L"klonecpp", L"Clone C++"}, - {L"cmake", L"CMake"}, - {L"cobol", L"COBOL"}, - {L"coffeescript", L"CoffeeScript"}, - {L"cfm", L"ColdFusion"}, - {L"css", L"CSS"}, - {L"cuesheet", L"Cuesheet"}, - {L"d", L"D"}, - {L"dcs", L"DCS"}, - {L"delphi", L"Delphi"}, - {L"oxygene", L"Delphi Prism (Oxygene)"}, - {L"diff", L"Diff"}, - {L"div", L"DIV"}, - {L"dos", L"DOS"}, - {L"dot", L"DOT"}, - {L"e", L"E"}, - {L"ecmascript", L"ECMAScript"}, - {L"eiffel", L"Eiffel"}, - {L"email", L"Email"}, - {L"epc", L"EPC"}, - {L"erlang", L"Erlang"}, - {L"fsharp", L"F#"}, - {L"falcon", L"Falcon"}, - {L"fo", L"FO Language"}, - {L"f1", L"Formula One"}, - {L"fortran", L"Fortran"}, - {L"freebasic", L"FreeBasic"}, - {L"gambas", L"GAMBAS"}, - {L"gml", L"Game Maker"}, - {L"gdb", L"GDB"}, - {L"genero", L"Genero"}, - {L"genie", L"Genie"}, - {L"gettext", L"GetText"}, - {L"go", L"Go"}, - {L"groovy", L"Groovy"}, - {L"gwbasic", L"GwBasic"}, - {L"haskell", L"Haskell"}, - {L"hicest", L"HicEst"}, - {L"hq9plus", L"HQ9 Plus"}, - {L"html4strict", L"HTML"}, - {L"html5", L"HTML 5"}, - {L"icon", L"Icon"}, - {L"idl", L"IDL"}, - {L"ini", L"INI file"}, - {L"inno", L"Inno Script"}, - {L"intercal", L"INTERCAL"}, - {L"io", L"IO"}, - {L"j", L"J"}, - {L"java", L"Java"}, - {L"java5", L"Java 5"}, - {L"javascript", L"JavaScript"}, - {L"jquery", L"jQuery"}, - {L"kixtart", L"KiXtart"}, - {L"latex", L"Latex"}, - {L"lb", L"Liberty BASIC"}, - {L"lsl2", L"Linden Scripting"}, - {L"lisp", L"Lisp"}, - {L"llvm", L"LLVM"}, - {L"locobasic", L"Loco Basic"}, - {L"logtalk", L"Logtalk"}, - {L"lolcode", L"LOL Code"}, - {L"lotusformulas", L"Lotus Formulas"}, - {L"lotusscript", L"Lotus Script"}, - {L"lscript", L"LScript"}, - {L"lua", L"Lua"}, - {L"m68k", L"M68000 Assembler"}, - {L"magiksf", L"MagikSF"}, - {L"make", L"Make"}, - {L"mapbasic", L"MapBasic"}, - {L"matlab", L"MatLab"}, - {L"mirc", L"mIRC"}, - {L"mmix", L"MIX Assembler"}, - {L"modula2", L"Modula 2"}, - {L"modula3", L"Modula 3"}, - {L"68000devpac", L"Motorola 68000 HiSoft Dev"}, - {L"mpasm", L"MPASM"}, - {L"mxml", L"MXML"}, - {L"mysql", L"MySQL"}, - {L"newlisp", L"newLISP"}, - {L"text", L"None"}, - {L"nsis", L"NullSoft Installer"}, - {L"oberon2", L"Oberon 2"}, - {L"objeck", L"Objeck Programming Langua"}, - {L"objc", L"Objective C"}, - {L"ocaml-brief", L"OCalm Brief"}, - {L"ocaml", L"OCaml"}, - {L"pf", L"OpenBSD PACKET FILTER"}, - {L"glsl", L"OpenGL Shading"}, - {L"oobas", L"Openoffice BASIC"}, - {L"oracle11", L"Oracle 11"}, - {L"oracle8", L"Oracle 8"}, - {L"oz", L"Oz"}, - {L"pascal", L"Pascal"}, - {L"pawn", L"PAWN"}, - {L"pcre", L"PCRE"}, - {L"per", L"Per"}, - {L"perl", L"Perl"}, - {L"perl6", L"Perl 6"}, - {L"php", L"PHP"}, - {L"php-brief", L"PHP Brief"}, - {L"pic16", L"Pic 16"}, - {L"pike", L"Pike"}, - {L"pixelbender", L"Pixel Bender"}, - {L"plsql", L"PL/SQL"}, - {L"postgresql", L"PostgreSQL"}, - {L"povray", L"POV-Ray"}, - {L"powershell", L"Power Shell"}, - {L"powerbuilder", L"PowerBuilder"}, - {L"proftpd", L"ProFTPd"}, - {L"progress", L"Progress"}, - {L"prolog", L"Prolog"}, - {L"properties", L"Properties"}, - {L"providex", L"ProvideX"}, - {L"purebasic", L"PureBasic"}, - {L"pycon", L"PyCon"}, - {L"python", L"Python"}, - {L"q", L"q/kdb+"}, - {L"qbasic", L"QBasic"}, - {L"rsplus", L"R"}, - {L"rails", L"Rails"}, - {L"rebol", L"REBOL"}, - {L"reg", L"REG"}, - {L"robots", L"Robots"}, - {L"rpmspec", L"RPM Spec"}, - {L"ruby", L"Ruby"}, - {L"gnuplot", L"Ruby Gnuplot"}, - {L"sas", L"SAS"}, - {L"scala", L"Scala"}, - {L"scheme", L"Scheme"}, - {L"scilab", L"Scilab"}, - {L"sdlbasic", L"SdlBasic"}, - {L"smalltalk", L"Smalltalk"}, - {L"smarty", L"Smarty"}, - {L"sql", L"SQL"}, - {L"systemverilog", L"SystemVerilog"}, - {L"tsql", L"T-SQL"}, - {L"tcl", L"TCL"}, - {L"teraterm", L"Tera Term"}, - {L"thinbasic", L"thinBasic"}, - {L"typoscript", L"TypoScript"}, - {L"unicon", L"Unicon"}, - {L"uscript", L"UnrealScript"}, - {L"vala", L"Vala"}, - {L"vbnet", L"VB.NET"}, - {L"verilog", L"VeriLog"}, - {L"vhdl", L"VHDL"}, - {L"vim", L"VIM"}, - {L"visualprolog", L"Visual Pro Log"}, - {L"vb", L"VisualBasic"}, - {L"visualfoxpro", L"VisualFoxPro"}, - {L"whitespace", L"WhiteSpace"}, - {L"whois", L"WHOIS"}, - {L"winbatch", L"Win Batch"}, - {L"xbasic", L"XBasic"}, - {L"xml", L"XML"}, - {L"xorg_conf", L"Xorg Config"}, - {L"xpp", L"XPP"}, - {L"yaml", L"YAML"}, - {L"z80", L"Z80 Assembler"}, - {L"zxbasic", L"ZXBasic"}, -}; - -PasteFormat PasteToWeb1::defFormats[] = -{ - {L"text", L"None"}, - {L"xml", L"XML"}, - {L"html4strict", L"HTML"}, - {L"html5", L"HTML 5"}, - {L"javascript", L"JavaScript"}, - {L"php", L"PHP"}, - {L"c", L"C"}, - {L"csharp", L"C#"}, - {L"cpp", L"C++"}, - {L"java", L"Java"}, - {L"java5", L"Java 5"}, - {L"ini", L"INI file"}, - {L"css", L"CSS"}, - {L"sql", L"SQL"}, - {L"asm", L"ASM (NASM)"}, - {L"asp", L"ASP"}, - {L"caddcl", L"CAD DCL"}, - {L"cadlisp", L"CAD Lisp"}, - {L"delphi", L"Delphi"}, - {L"diff", L"Diff"}, - {L"jquery", L"jQuery"}, - {L"latex", L"Latex"}, - {L"pascal", L"Pascal"}, - {L"perl", L"Perl"}, - {L"perl6", L"Perl 6"}, - {L"python", L"Python"}, - {L"vbnet", L"VB.NET"}, - {L"vb", L"VisualBasic"}, -}; - -PasteToWeb1::PasteToWeb1() -{ -} - - -PasteToWeb1::~PasteToWeb1() -{ -} - -void PasteToWeb1::SendToServer(std::wstring str, std::wstring fileName, std::wstring format) -{ - std::map headers; - headers["Content-Type"] = "application/x-www-form-urlencoded"; - std::wstring content = _T("api_option=paste&api_paste_private="); - content += Options::instance->webOptions[pageIndex]->publicPaste ? _T("0") : _T("1"); - content += _T("&api_paste_expire_date="); - content += Options::instance->webOptions[pageIndex]->combo1.empty() ? _T("1M") : Options::instance->webOptions[pageIndex]->combo1; - content += _T("&api_dev_key=dcba056bf9cc71729fdad76dddcb0dcd&api_paste_format="); - content += format; - if(!Options::instance->webOptions[pageIndex]->pastebinUserKey.empty()) - { - content += _T("&api_user_key="); - content += Options::instance->webOptions[pageIndex]->pastebinUserKey; - } - content += _T("&api_paste_code="); - for(std::wstring::iterator it = str.begin(); it != str.end(); ++it) - { - if(*it == L'%') - { - content += L"%25"; - } - else if(*it ==L'&') - { - content += L"%26"; - } - else if(*it ==L'=') - { - content += L"%3D"; - } - else - { - content += *it; - } - } - - wchar_t* resCont = SendToWeb("http://pastebin.com/api/api_post.php", headers, content); - if(resCont != NULL) - { - if(memcmp(L"Bad API request, ", resCont, 17 * sizeof(wchar_t)) == 0) - { - _stprintf_s(bufErr, 1024, TranslateT("Error during sending text to web page: %s"), resCont + 17); - error = bufErr; - } - else - { - char* s = mir_u2a_cp(resCont, CP_ACP); - strcpy_s(szFileLink, 256, s); - mir_free(s); - } - mir_free(resCont); - } - else - { - error = TranslateT("Error during sending text to web page"); - } -} - -std::wstring PasteToWeb1::GetUserKey(std::wstring& user, std::wstring& password) -{ - std::map headers; - headers["Content-Type"] = "application/x-www-form-urlencoded"; - std::wstring content = _T("api_user_name="); - content += user; - content += _T("&api_user_password="); - content += password; - content += _T("&api_dev_key=dcba056bf9cc71729fdad76dddcb0dcd"); - wchar_t* resCont = SendToWeb("http://pastebin.com/api/api_login.php", headers, content); - std::wstring toRet; - if(resCont != NULL) - { - if(memcmp(L"Bad API request, ", resCont, 17 * sizeof(wchar_t)) == 0) - { - _stprintf_s(bufErr, 1024, TranslateT("Error during getting user key from web page: %s"), resCont + 17); - MessageBox(NULL, bufErr, TranslateT("Error"), MB_OK | MB_ICONERROR); - } - else - toRet = resCont; - mir_free(resCont); - } - - return toRet; -} - -std::list PasteToWeb1::GetFormats() -{ - int count = sizeof(formats) / sizeof(formats[0]); - std::list ret(formats, formats + count); - - return ret; -} - -std::list PasteToWeb1::GetDefFormats() -{ - int count = sizeof(defFormats) / sizeof(defFormats[0]); - std::list ret(defFormats, defFormats + count); - - return ret; -} - -void PasteToWeb1::ConfigureSettings() -{ - Options::instance->webOptions[pageIndex]->isSendFileName = false; - Options::instance->webOptions[pageIndex]->isPublicPaste = true; - Options::instance->webOptions[pageIndex]->isCombo1 = true; - Options::instance->webOptions[pageIndex]->combo1Desc = TranslateT("Paste expire date"); - PasteFormat pf; - pf.id = L"N"; - pf.name = TranslateT("Never"); - Options::instance->webOptions[pageIndex]->combo1Values.push_back(pf); - pf.id = L"10M"; - pf.name = TranslateT("10 minutes"); - Options::instance->webOptions[pageIndex]->combo1Values.push_back(pf); - pf.id = L"1H"; - pf.name = TranslateT("1 hour"); - Options::instance->webOptions[pageIndex]->combo1Values.push_back(pf); - pf.id = L"1D"; - pf.name = TranslateT("1 day"); - Options::instance->webOptions[pageIndex]->combo1Values.push_back(pf); - pf.id = L"1M"; - pf.name = TranslateT("1 month"); - Options::instance->webOptions[pageIndex]->combo1Values.push_back(pf); - Options::instance->webOptions[pageIndex]->combo1 = L"1M"; - Options::instance->webOptions[pageIndex]->isPastebin = true; -} - diff --git a/plugins/PasteIt/PasteToWeb1.h b/plugins/PasteIt/PasteToWeb1.h deleted file mode 100644 index b1611855d6..0000000000 --- a/plugins/PasteIt/PasteToWeb1.h +++ /dev/null @@ -1,40 +0,0 @@ -/* -Paste It plugin -Copyright (C) 2011 Krzysztof Kral - -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 version 2 -of the License. - -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, see . -*/ - -#pragma once -#include "pastetoweb.h" -class PasteToWeb1 : - public PasteToWeb -{ -protected: - virtual void SendToServer(std::wstring str, std::wstring fileName, std::wstring format); - static PasteFormat formats[]; - static PasteFormat defFormats[]; -public: - PasteToWeb1(); - virtual ~PasteToWeb1(); - virtual TCHAR* GetName() - { - return _T("pastebin.com"); - } - virtual void ConfigureSettings(); - virtual std::list GetFormats(); - virtual std::list GetDefFormats(); - std::wstring GetUserKey(std::wstring& user, std::wstring& password); -}; - diff --git a/plugins/PasteIt/PasteToWeb2.cpp b/plugins/PasteIt/PasteToWeb2.cpp deleted file mode 100644 index c2edbddeef..0000000000 --- a/plugins/PasteIt/PasteToWeb2.cpp +++ /dev/null @@ -1,247 +0,0 @@ -/* -Paste It plugin -Copyright (C) 2011 Krzysztof Kral - -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 version 2 -of the License. - -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, see . -*/ - -#include "StdAfx.h" -#include "PasteToWeb2.h" - -PasteFormat PasteToWeb2::defFormats[] = -{ - {L"text", L"Text"}, - {L"xml", L"XML"}, - {L"html", L"HTML"}, - {L"js", L"JavaScript"}, - {L"php", L"PHP"}, - {L"c", L"C"}, - {L"csharp", L"C#"}, - {L"cpp", L"C++"}, - {L"java", L"Java"}, - {L"ini", L"INI"}, - {L"css", L"CSS"}, - {L"sql", L"SQL"}, - {L"nasm", L"NASM"}, - {L"delphi", L"Delphi"}, - {L"diff", L"Diff"}, - {L"tex", L"TeX"}, - {L"perl", L"Perl"}, - {L"python", L"Python"}, - {L"vb.net", L"VB.net"} -}; - -PasteToWeb2::PasteToWeb2() -{ -} - - -PasteToWeb2::~PasteToWeb2() -{ -} - -void PasteToWeb2::SendToServer(std::wstring str, std::wstring fileName, std::wstring format) -{ - std::map headers; - headers["Content-Type"] = "text/xml"; - std::wstring content = _T("\r\ncreate_paste"); - if(fileName == L"") - { - content += format; - content += _T(""); - } - else - { - content += _T(""); - } - for(std::wstring::iterator it = str.begin(); it != str.end(); ++it) - { - if(*it == L'&') - { - content += L"&"; - } - else if(*it ==L'<') - { - content += L"<"; - } - else - { - content += *it; - } - } - - content += _T(""); - if(fileName != L"") - { - for(std::wstring::iterator it = fileName.begin(); it != fileName.end(); ++it) - { - if(*it == L'&') - { - content += L"&"; - } - else if(*it ==L'<') - { - content += L"<"; - } - else - { - content += *it; - } - } - } - content += _T("1.5"); - - wchar_t* resCont = SendToWeb("http://wklej.to/api/", headers, content); - error = TranslateT("Error during sending text to web page"); - if(resCont != NULL) - { - HXML hXml = xi.parseString(resCont, NULL, _T("methodResponse")); - if(hXml != NULL) - { - HXML node = xi.getChildByPath(hXml, _T("params/param/value/array/data/value/int"), 0); - if(node != NULL && !_tcscmp(xi.getText(node), _T("1"))) - { - node = xi.getChildByPath(hXml, _T("params/param/value/array/data"), 0); - if(node != NULL) - { - node = xi.getNthChild(node, _T("value"), 1); - if(node != NULL) - { - node = xi.getChildByPath(node, _T("string"), 0); - if(node != NULL) - { - char* s = mir_t2a_cp(xi.getText(node), CP_ACP); - strcpy_s(szFileLink, 256, s); - mir_free(s); - error = NULL; - } - } - } - } - xi.destroyNode(hXml); - } - mir_free(resCont); - } -} - -std::list PasteToWeb2::GetFormats() -{ - std::list ret; - - std::map headers; - headers["Content-Type"] = "text/xml"; - std::wstring content = _T("\r\ntypes"); - - wchar_t* resCont = SendToWeb("http://wklej.to/api/", headers, content); - if(resCont != NULL) - { - HXML hXml = xi.parseString(resCont, NULL, _T("methodResponse")); - if(hXml != NULL) - { - HXML node = xi.getChildByPath(hXml, _T("params/param/value/array/data/value/int"), 0); - if(node != NULL && !_tcscmp(xi.getText(node), _T("1"))) - { - node = xi.getChildByPath(hXml, _T("params/param/value/array/data"), 0); - if(node != NULL) - { - node = xi.getNthChild(node, _T("value"), 1); - if(node != NULL) - { - node = xi.getChildByPath(node, _T("string"), 0); - if(node != NULL) - { - std::wstring str = xi.getText(node); - std::wstring::size_type pos = str.find(L'\n'); - if(pos < str.length()) - { - str = str.substr(pos + 1); - } - pos = str.find(L'\n'); - if(pos < str.length()) - { - str = str.substr(pos + 1); - } - pos = str.find(L'\n'); - while(pos < str.length()) - { - std::wstring line = str.substr(0, pos); - std::wstring::size_type sep = line.find(L':'); - if(sep < line.length()) - { - PasteFormat pf; - pf.name = line.substr(0, sep); - std::wstring::size_type sep2 = line.find(L','); - if(sep2 < line.length()) - { - pf.id = line.substr(sep + 2, sep2 - sep - 2); - } - else - { - pf.id = line.substr(sep + 2); - } - ret.push_back(pf); - } - - if(pos < str.length() - 1) - { - str = str.substr(pos + 1); - } - else - { - str = L""; - } - pos = str.find(L'\n'); - } - { - std::wstring line = str; - std::wstring::size_type sep = line.find(L':'); - if(sep < line.length()) - { - PasteFormat pf; - pf.name = line.substr(0, sep); - std::wstring::size_type sep2 = line.find(L','); - if(sep2 < line.length()) - { - pf.id = line.substr(sep + 2, sep2 - sep - 2); - } - else - { - pf.id = line.substr(sep + 2); - } - ret.push_back(pf); - } - } - } - } - } - } - xi.destroyNode(hXml); - } - mir_free(resCont); - } - - return ret; -} - -std::list PasteToWeb2::GetDefFormats() -{ - int count = sizeof(defFormats) / sizeof(defFormats[0]); - std::list ret(defFormats, defFormats + count); - - return ret; -} - -void PasteToWeb2::ConfigureSettings() -{ -} diff --git a/plugins/PasteIt/PasteToWeb2.h b/plugins/PasteIt/PasteToWeb2.h deleted file mode 100644 index 364c6eb4e4..0000000000 --- a/plugins/PasteIt/PasteToWeb2.h +++ /dev/null @@ -1,38 +0,0 @@ -/* -Paste It plugin -Copyright (C) 2011 Krzysztof Kral - -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 version 2 -of the License. - -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, see . -*/ - -#pragma once -#include "pastetoweb.h" -class PasteToWeb2 : - public PasteToWeb -{ -protected: - virtual void SendToServer(std::wstring str, std::wstring fileName, std::wstring format); - static PasteFormat defFormats[]; -public: - PasteToWeb2(); - virtual ~PasteToWeb2(); - virtual TCHAR* GetName() - { - return _T("wklej.to"); - } - virtual void ConfigureSettings(); - virtual std::list GetFormats(); - virtual std::list GetDefFormats(); -}; - diff --git a/plugins/PasteIt/icons/Paste.ico b/plugins/PasteIt/icons/Paste.ico deleted file mode 100644 index 54e8087326..0000000000 Binary files a/plugins/PasteIt/icons/Paste.ico and /dev/null differ diff --git a/plugins/PasteIt/res/Paste.ico b/plugins/PasteIt/res/Paste.ico new file mode 100644 index 0000000000..54e8087326 Binary files /dev/null and b/plugins/PasteIt/res/Paste.ico differ diff --git a/plugins/PasteIt/res/PasteIt.rc b/plugins/PasteIt/res/PasteIt.rc new file mode 100644 index 0000000000..69ec37137e --- /dev/null +++ b/plugins/PasteIt/res/PasteIt.rc @@ -0,0 +1,140 @@ +#include "..\src\resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +//#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +#include +#include + +///////////////////////////////////////////////////////////////////////////// +// Neutral resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU) +#ifdef _WIN32 +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +#pragma code_page(1250) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_OPT_MAIN DIALOGEX 0, 0, 285, 225 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD +EXSTYLE WS_EX_CONTROLPARENT +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + GROUPBOX "Settings",IDC_STATIC,7,5,274,220 + COMBOBOX IDC_WEBLIST,134,20,135,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "Default web page",IDC_STATIC,14,23,117,8 + COMBOBOX IDC_CODEPAGE,134,43,135,30,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP + LTEXT "Default file encoding",IDC_STATIC,14,45,114,8 + CONTROL "Auto-detect UTF-8",IDC_AUTOUTF, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,66,236,10 + CONTROL "Show confirmation dialog box",IDC_CONFDLG, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,80,236,10 + CONTROL "Autosend download link to contact",IDC_AUTOSEND, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,94,236,10 +END + +IDD_OPT_PAGES DIALOGEX 0, 0, 285, 225 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD +EXSTYLE WS_EX_CONTROLPARENT +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + GROUPBOX "Web page settings",IDC_STATIC,7,30,274,195 + COMBOBOX IDC_WEBPAGE,145,7,135,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "Web page to configure",IDC_STATIC,14,10,125,8 + COMBOBOX IDC_DEFFORMAT,138,43,80,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "Configure",IDC_CONFIGURE,223,43,50,14 + LTEXT "Default formatting",IDC_STATIC,14,45,120,8 + CONTROL "Auto-detect format from file extension",IDC_AUTOFORMAT, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,66,236,10 + CONTROL "Public paste",IDC_PUBLICPASTE, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,66,236,10 + COMBOBOX IDC_COMBO1,138,83,135,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "",IDC_COMBO1_DESC,14,86,120,8 + CONTROL "Login as guest",IDC_GUEST, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,106,236,10 + EDITTEXT IDC_PASTEBIN_KEY,138,123,135,12,WS_TABSTOP|ES_AUTOHSCROLL + LTEXT "User key",IDC_PASTEBIN_KEY_DESC,14,126,90,8 + PUSHBUTTON "Get user key",IDC_PASTEBIN_LOGIN,14,143,80,14, BS_MULTILINE +END + +IDD_DLG_CONFIGURE DIALOGEX 0, 0, 214, 178 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Configure formatting" +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + DEFPUSHBUTTON "OK",IDOK,120,159,40,14 + PUSHBUTTON "Cancel",IDCANCEL,164,159,40,14 + LISTBOX IDC_FORMATTING,10,10,150,144, WS_VSCROLL | LBS_WANTKEYBOARDINPUT + PUSHBUTTON "Up",IDC_UP,164,10,40,14 + PUSHBUTTON "Down",IDC_DOWN,164,26,40,14 + PUSHBUTTON "Delete",IDC_DELETE,164,42,40,14 + PUSHBUTTON "Restore defaults",IDC_RESTORE,164,90,40,28, BS_MULTILINE + PUSHBUTTON "Download more",IDC_DOWNLOAD,164,120,40,28, BS_MULTILINE +END + +IDD_DLG_PASTEBIN_LOGIN DIALOGEX 0, 0, 154, 60 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Login to pastebin.com" +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + EDITTEXT IDC_PASTEBIN_USER,70,10,75,12,WS_TABSTOP|ES_AUTOHSCROLL + LTEXT "User name",IDC_STATIC,10,13,55,8 + EDITTEXT IDC_PASTEBIN_PASSWORD,70,25,75,12,WS_TABSTOP|ES_PASSWORD|ES_AUTOHSCROLL + LTEXT "Password",IDC_STATIC,10,28,55,8 + DEFPUSHBUTTON "OK",IDOK,60,40,40,14 + PUSHBUTTON "Cancel",IDCANCEL,104,40,40,14 +END + +IDD_DLG_FROM_CLIPBOARD DIALOGEX 0, 0, 214, 178 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Paste It" +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + DEFPUSHBUTTON "OK",IDOK,120,159,40,14 + PUSHBUTTON "Cancel",IDCANCEL,164,159,40,14 + EDITTEXT IDC_CLIPBOARD_DATA,10,10,194,129,WS_HSCROLL | WS_VSCROLL | ES_READONLY | ES_MULTILINE + COMBOBOX IDC_FORMAT,65,142,139,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "Format",IDC_STATIC,10,144,50,8 +END + +IDD_DLG_FROM_FILE DIALOGEX 0, 0, 214, 208 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Paste It" +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + DEFPUSHBUTTON "OK",IDOK,120,189,40,14 + PUSHBUTTON "Cancel",IDCANCEL,164,189,40,14 + EDITTEXT IDC_FILE_PATH,10,10,194,12,ES_READONLY | ES_AUTOHSCROLL + EDITTEXT IDC_FILE_DATA,10,27,194,112,WS_HSCROLL | WS_VSCROLL | ES_READONLY | ES_MULTILINE + COMBOBOX IDC_CODEPAGE,65,142,139,30,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP + LTEXT "Encoding",IDC_STATIC,10,144,50,8 + CONTROL "Auto-detect format from file extension",IDC_AUTOFORMAT, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,159,180,10 + COMBOBOX IDC_FORMAT,65,172,139,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "Format",IDC_FORMATTEXT,10,174,50,8 + PUSHBUTTON "Recode",IDC_RECODE,10,189,60,14 +END + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_MENU ICON "Paste.ico" +#endif // Neutral resources +///////////////////////////////////////////////////////////////////////////// + diff --git a/plugins/PasteIt/res/version.rc b/plugins/PasteIt/res/version.rc new file mode 100644 index 0000000000..afa2d43620 --- /dev/null +++ b/plugins/PasteIt/res/version.rc @@ -0,0 +1,40 @@ +#ifdef APSTUDIO_INVOKED +#error this file is not editable by Microsoft Visual C++ +#endif //APSTUDIO_INVOKED + +#include +#include "..\src\version.h" + +VS_VERSION_INFO VERSIONINFO + FILEVERSION __FILEVERSION_STRING + PRODUCTVERSION __FILEVERSION_STRING + FILEFLAGSMASK VS_FFI_FILEFLAGSMASK +#ifdef _DEBUG + FILEFLAGS VS_FF_DEBUG +#else + FILEFLAGS 0x0L +#endif + FILEOS VOS_NT_WINDOWS32 + FILETYPE VFT_DLL + FILESUBTYPE VFT2_UNKNOWN +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "000004b0" + BEGIN + VALUE "Author", "Krzysztof Kral" + VALUE "CompanyName", "Krzysztof Kral" + VALUE "FileDescription", __DESCRIPTION + VALUE "FileVersion", __VERSION_STRING + VALUE "InternalName", __INTERNAL_NAME + VALUE "LegalCopyright", __COPYRIGHT + VALUE "OriginalFilename", __FILENAME + VALUE "ProductName", __PLUGIN_NAME + VALUE "ProductVersion", __VERSION_STRING + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0, 1200 + END +END diff --git a/plugins/PasteIt/resource.h b/plugins/PasteIt/resource.h deleted file mode 100644 index cbfa566679..0000000000 --- a/plugins/PasteIt/resource.h +++ /dev/null @@ -1,50 +0,0 @@ - -#define IDD_OPT_MAIN 101 -#define IDD_DLG_FROM_CLIPBOARD 102 -#define IDD_DLG_FROM_FILE 103 -#define IDD_OPT_PAGES 104 -#define IDD_DLG_CONFIGURE 105 -#define IDD_DLG_PASTEBIN_LOGIN 106 -#define IDC_WEBLIST 1001 -#define IDC_CONFDLG 1002 -#define IDC_AUTOSEND 1003 -#define IDC_CODEPAGE 1004 -#define IDC_AUTOUTF 1005 -#define IDC_CLIPBOARD_DATA 1006 -#define IDC_BTN_OK 1007 -#define IDC_FILE_DATA 1008 -#define IDC_FILE_PATH 1009 -#define IDC_RECODE 1010 -#define IDC_WEBPAGE 1011 -#define IDC_DEFFORMAT 1012 -#define IDC_AUTOFORMAT 1013 -#define IDC_CONFIGURE 1014 -#define IDC_FORMATTING 1015 -#define IDC_RESTORE 1016 -#define IDC_DOWNLOAD 1017 -#define IDC_DELETE 1018 -#define IDC_UP 1019 -#define IDC_DOWN 1020 -#define IDC_FORMAT 1021 -#define IDC_FORMATTEXT 1022 -#define IDC_PUBLICPASTE 1023 -#define IDC_COMBO1 1024 -#define IDC_COMBO1_DESC 1025 -#define IDC_GUEST 1026 -#define IDC_PASTEBIN_KEY 1027 -#define IDC_PASTEBIN_KEY_DESC 1028 -#define IDC_PASTEBIN_LOGIN 1029 -#define IDC_PASTEBIN_USER 1031 -#define IDC_PASTEBIN_PASSWORD 1032 -#define IDI_MENU 20000 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 107 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1033 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/plugins/PasteIt/src/Options.cpp b/plugins/PasteIt/src/Options.cpp new file mode 100644 index 0000000000..49309bc580 --- /dev/null +++ b/plugins/PasteIt/src/Options.cpp @@ -0,0 +1,979 @@ +/* +Paste It plugin +Copyright (C) 2011 Krzysztof Kral + +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 version 2 +of the License. + +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, see . +*/ + +#include "StdAfx.h" +#include "Options.h" +#include "resource.h" +#include "PasteToWeb.h" +#include "PasteToWeb1.h" + +extern HINSTANCE hInst; + +#define MODULE "PasteIt" + +Options *Options::instance; +extern PasteToWeb* pasteToWebs[PasteToWeb::pages]; + +struct TCpTable { + UINT cpId; + TCHAR *cpName; +} +cpTable[] = { + { CP_ACP, _T("Use default codepage") }, + { CP_UTF8, _T("UTF-8") }, + { 874, _T("Thai") }, + { 932, _T("Japanese") }, + { 936, _T("Simplified Chinese") }, + { 949, _T("Korean") }, + { 950, _T("Traditional Chinese") }, + { 1250, _T("Central European") }, + { 1251, _T("Cyrillic") }, + { 20866, _T("Cyrillic KOI8-R") }, + { 1252, _T("Latin I") }, + { 1253, _T("Greek") }, + { 1254, _T("Turkish") }, + { 1255, _T("Hebrew") }, + { 1256, _T("Arabic") }, + { 1257, _T("Baltic") }, + { 1258, _T("Vietnamese") }, + { 1361, _T("Korean (Johab)") }, + { CP_UTF7, _T("UTF-7") }, + { 1200, _T("UTF-16") }, + { 1201, _T("UTF-16BE") } +}; + +Options::Options() +{ + defWeb = 0; + codepage = CP_ACP; + autoUTF = true; + confDlg = true; + autoSend = false; + for(int i = 0 ; i < PasteToWeb::pages; ++i) + { + webOptions[i] = new WebOptions(i); + } +} + + +Options::~Options() +{ + for(int i = 0 ; i < PasteToWeb::pages; ++i) + { + delete webOptions[i]; + webOptions[i] = NULL; + } +} + +void DefWebPageChanged(); + +INT_PTR CALLBACK Options::DlgProcOptsMain(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch(msg) + { + case WM_INITDIALOG: + { + TranslateDialogDefault(hwndDlg); + CheckDlgButton(hwndDlg, IDC_AUTOUTF, instance->autoUTF ? 1 : 0); + CheckDlgButton(hwndDlg, IDC_CONFDLG, instance->confDlg ? 1 : 0); + CheckDlgButton(hwndDlg, IDC_AUTOSEND, instance->autoSend ? 1 : 0); + + for(int i = 0; i < PasteToWeb::pages; ++i) + { + ComboBox_AddString(GetDlgItem(hwndDlg, IDC_WEBLIST), pasteToWebs[i]->GetName()); + } + + ComboBox_SetCurSel(GetDlgItem(hwndDlg, IDC_WEBLIST), instance->defWeb); + + InitCodepageCB(GetDlgItem(hwndDlg, IDC_CODEPAGE), instance->codepage); + return TRUE; + } + case WM_COMMAND: + { + if(LOWORD(wParam) == IDC_CODEPAGE) + { + if(HIWORD(wParam) == CBN_KILLFOCUS) + { + GetCodepageCB(GetDlgItem(hwndDlg, IDC_CODEPAGE), true, instance->codepage); + } + } + + if (HIWORD(wParam) == BN_CLICKED || HIWORD(wParam)==CBN_SELCHANGE || HIWORD(wParam)==CBN_EDITCHANGE) + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + return TRUE; + } + case WM_NOTIFY: + { + if(((LPNMHDR)lParam)->code == PSN_APPLY) + { + instance->codepage = GetCodepageCB(GetDlgItem(hwndDlg, IDC_CODEPAGE), false, instance->codepage); + instance->autoUTF = IsDlgButtonChecked(hwndDlg, IDC_AUTOUTF) ? true : false; + instance->confDlg = IsDlgButtonChecked(hwndDlg, IDC_CONFDLG) ? true : false; + instance->autoSend = IsDlgButtonChecked(hwndDlg, IDC_AUTOSEND) ? true : false; + instance->defWeb = ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_WEBLIST)); + + DefWebPageChanged(); + + Options::instance->Save(); + } + return TRUE; + } + } + + return FALSE; +} + +class OptsPagesData +{ +public: + OptsPagesData() + : lastPage(0) + { + init = false; + for(int i = 0 ; i < PasteToWeb::pages; ++i) + { + webOptions[i] = Options::instance->webOptions[i]->Copy(); + } + } + + ~OptsPagesData() + { + for(int i = 0 ; i < PasteToWeb::pages; ++i) + { + delete webOptions[i]; + webOptions[i] = NULL; + } + } + + WebOptions* webOptions[PasteToWeb::pages]; + int lastPage; + bool init; +}; + +struct OptsConfigureData +{ + int page; + std::list tempFormats; +}; + +struct OptsLoginData +{ + std::wstring user; + std::wstring password; +}; + +void ReloadFormatsCombo(HWND hWnd, WebOptions* wo) +{ + while(ComboBox_DeleteString(hWnd, 0) > 0); + int sel = 0; + int i = 0; + for(std::list::iterator it = wo->formats.begin(); it != wo->formats.end(); ++it) + { + ComboBox_AddString(hWnd, it->name.c_str()); + if(it->id == wo->defFormatId) + sel = i; + ++i; + } + if(!wo->formats.empty()) + { + ComboBox_SetCurSel(hWnd, sel); + } +} + +void GetPagesSettings(HWND hwndDlg, OptsPagesData* optsPagesData) +{ + int selected = optsPagesData->lastPage; + int format = ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_DEFFORMAT)); + if(format >= 0 && format < (int)optsPagesData->webOptions[selected]->formats.size()) + { + for(std::list::iterator it = optsPagesData->webOptions[selected]->formats.begin(); it != optsPagesData->webOptions[selected]->formats.end(); ++it) + { + if(format-- <= 0) + { + optsPagesData->webOptions[selected]->defFormatId = it->id; + break; + } + } + } + + if(optsPagesData->webOptions[selected]->isSendFileName) + optsPagesData->webOptions[selected]->sendFileName = IsDlgButtonChecked(hwndDlg, IDC_AUTOFORMAT) ? true : false; + if(optsPagesData->webOptions[selected]->isPublicPaste) + optsPagesData->webOptions[selected]->publicPaste = IsDlgButtonChecked(hwndDlg, IDC_PUBLICPASTE) ? true : false; + if(optsPagesData->webOptions[selected]->isCombo1) + { + int sel = ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_COMBO1)); + if(sel >= 0 && sel < (int)optsPagesData->webOptions[selected]->combo1Values.size()) + { + for(std::list::iterator it = optsPagesData->webOptions[selected]->combo1Values.begin(); it != optsPagesData->webOptions[selected]->combo1Values.end(); ++it) + { + if(sel-- <= 0) + { + optsPagesData->webOptions[selected]->combo1 = it->id; + break; + } + } + } + } + if(optsPagesData->webOptions[selected]->isPublicPaste) + { + if(IsDlgButtonChecked(hwndDlg, IDC_GUEST)) + { + optsPagesData->webOptions[selected]->pastebinUserKey = _T(""); + } + else + { + TCHAR buf[100]; + Edit_GetText(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY), buf, 100); + optsPagesData->webOptions[selected]->pastebinUserKey = buf; + } + } +} + +INT_PTR CALLBACK Options::DlgProcOptsPages(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch(msg) + { + case WM_INITDIALOG: + { + TranslateDialogDefault(hwndDlg); + OptsPagesData* optsPagesData = new OptsPagesData(); + SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)optsPagesData); + + HWND btnhwnd = GetDlgItem(hwndDlg, IDC_PASTEBIN_LOGIN); + int btSize = Button_GetTextLength(btnhwnd); + if(btSize > 20) + { + SetWindowPos(btnhwnd, NULL, 0, 0, 115, 34, SWP_NOZORDER | SWP_NOMOVE | SWP_NOREPOSITION | SWP_NOACTIVATE | SWP_NOREDRAW); + } + + for(int i = 0; i < PasteToWeb::pages; ++i) + { + ComboBox_AddString(GetDlgItem(hwndDlg, IDC_WEBPAGE), pasteToWebs[i]->GetName()); + } + + ComboBox_SetCurSel(GetDlgItem(hwndDlg, IDC_WEBPAGE), 0); + ReloadFormatsCombo(GetDlgItem(hwndDlg, IDC_DEFFORMAT), optsPagesData->webOptions[0]); + if(optsPagesData->webOptions[0]->isSendFileName) + CheckDlgButton(hwndDlg, IDC_AUTOFORMAT, optsPagesData->webOptions[0]->sendFileName ? 1 : 0); + else + ShowWindow(GetDlgItem(hwndDlg,IDC_AUTOFORMAT),SW_HIDE); + + if(Options::instance->webOptions[0]->isPublicPaste) + CheckDlgButton(hwndDlg, IDC_PUBLICPASTE, Options::instance->webOptions[0]->publicPaste ? 1 : 0); + else + ShowWindow(GetDlgItem(hwndDlg,IDC_PUBLICPASTE),SW_HIDE); + + if(Options::instance->webOptions[0]->isCombo1) + { + int sel = 0; + int i = 0; + std::wstring &val = Options::instance->webOptions[0]->combo1; + HWND cb = GetDlgItem(hwndDlg, IDC_COMBO1); + for(std::list::iterator it = Options::instance->webOptions[0]->combo1Values.begin(); it != Options::instance->webOptions[0]->combo1Values.end(); ++it) + { + ComboBox_AddString(cb, it->name.c_str()); + if(val == it->id) + sel = i; + ++i; + } + ComboBox_SetCurSel(cb, sel); + Static_SetText(GetDlgItem(hwndDlg,IDC_COMBO1_DESC), Options::instance->webOptions[0]->combo1Desc.c_str()); + } + else + { + ShowWindow(GetDlgItem(hwndDlg,IDC_COMBO1),SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg,IDC_COMBO1_DESC),SW_HIDE); + } + + Edit_LimitText(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY), 99); + if(Options::instance->webOptions[0]->isPastebin) + { + std::wstring pastebinUserKey = Options::instance->webOptions[0]->pastebinUserKey; + if(pastebinUserKey.empty()) + { + CheckDlgButton(hwndDlg, IDC_GUEST, TRUE); + Edit_Enable(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY), FALSE); + Static_Enable(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY_DESC), FALSE); + Button_Enable(GetDlgItem(hwndDlg, IDC_PASTEBIN_LOGIN), FALSE); + } + else + { + Edit_SetText(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY), pastebinUserKey.c_str()); + } + } + else + { + ShowWindow(GetDlgItem(hwndDlg, IDC_GUEST), SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY), SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY_DESC), SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg, IDC_PASTEBIN_LOGIN), SW_HIDE); + } + + optsPagesData->init = true; + return TRUE; + } + case WM_COMMAND: + { + OptsPagesData* optsPagesData = (OptsPagesData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + if(HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_CONFIGURE) + { + GetPagesSettings(hwndDlg, optsPagesData); + OptsConfigureData d; + d.page = ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_WEBPAGE)); + WebOptions* wo = optsPagesData->webOptions[d.page]; + d.tempFormats = wo->formats; + if(DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_DLG_CONFIGURE), hwndDlg, DlgProcOptsConfigure, (LPARAM)&d) == IDOK) + { + wo->formats = d.tempFormats; + ReloadFormatsCombo(GetDlgItem(hwndDlg, IDC_DEFFORMAT), wo); + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + } + } + else if(HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_PASTEBIN_LOGIN) + { + OptsLoginData d; + if(DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_DLG_PASTEBIN_LOGIN), hwndDlg, DlgProcOptsLogin, (LPARAM)&d) == IDOK) + { + PasteToWeb1 *web = (PasteToWeb1*)pasteToWebs[optsPagesData->lastPage]; + Edit_SetText(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY), web->GetUserKey(d.user, d.password).c_str()); + } + } + else if(HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_GUEST) + { + BOOL enabled = IsDlgButtonChecked(hwndDlg, IDC_GUEST) ? FALSE : TRUE; + Edit_Enable(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY), enabled); + Static_Enable(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY_DESC), enabled); + Button_Enable(GetDlgItem(hwndDlg, IDC_PASTEBIN_LOGIN), enabled); + } + else if(HIWORD(wParam) == CBN_SELCHANGE && LOWORD(wParam) == IDC_WEBPAGE) + { + GetPagesSettings(hwndDlg, optsPagesData); + optsPagesData->init = false; + optsPagesData->lastPage = ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_WEBPAGE)); + ReloadFormatsCombo(GetDlgItem(hwndDlg, IDC_DEFFORMAT), optsPagesData->webOptions[optsPagesData->lastPage]); + if(optsPagesData->webOptions[optsPagesData->lastPage]->isSendFileName) + { + ShowWindow(GetDlgItem(hwndDlg,IDC_AUTOFORMAT),SW_SHOW); + CheckDlgButton(hwndDlg, IDC_AUTOFORMAT, optsPagesData->webOptions[optsPagesData->lastPage]->sendFileName ? 1 : 0); + } + else + ShowWindow(GetDlgItem(hwndDlg,IDC_AUTOFORMAT),SW_HIDE); + + if(optsPagesData->webOptions[optsPagesData->lastPage]->isPublicPaste) + { + ShowWindow(GetDlgItem(hwndDlg,IDC_PUBLICPASTE),SW_SHOW); + CheckDlgButton(hwndDlg, IDC_PUBLICPASTE, optsPagesData->webOptions[optsPagesData->lastPage]->publicPaste ? 1 : 0); + } + else + ShowWindow(GetDlgItem(hwndDlg,IDC_PUBLICPASTE),SW_HIDE); + + if(optsPagesData->webOptions[optsPagesData->lastPage]->isCombo1) + { + ShowWindow(GetDlgItem(hwndDlg,IDC_COMBO1),SW_SHOW); + ShowWindow(GetDlgItem(hwndDlg,IDC_COMBO1_DESC),SW_SHOW); + int sel = 0; + int i = 0; + std::wstring &val = optsPagesData->webOptions[optsPagesData->lastPage]->combo1; + HWND cb = GetDlgItem(hwndDlg, IDC_COMBO1); + while(ComboBox_DeleteString(cb, 0) > 0); + for(std::list::iterator it = optsPagesData->webOptions[optsPagesData->lastPage]->combo1Values.begin(); it != optsPagesData->webOptions[optsPagesData->lastPage]->combo1Values.end(); ++it) + { + ComboBox_AddString(cb, it->name.c_str()); + if(val == it->id) + sel = i; + ++i; + } + ComboBox_SetCurSel(cb, sel); + SetWindowText(GetDlgItem(hwndDlg,IDC_COMBO1_DESC), optsPagesData->webOptions[optsPagesData->lastPage]->combo1Desc.c_str()); + } + else + { + ShowWindow(GetDlgItem(hwndDlg,IDC_COMBO1),SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg,IDC_COMBO1_DESC),SW_HIDE); + } + + + if(optsPagesData->webOptions[optsPagesData->lastPage]->isPastebin) + { + ShowWindow(GetDlgItem(hwndDlg, IDC_GUEST), SW_SHOW); + ShowWindow(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY), SW_SHOW); + ShowWindow(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY_DESC), SW_SHOW); + ShowWindow(GetDlgItem(hwndDlg, IDC_PASTEBIN_LOGIN), SW_SHOW); + std::wstring pastebinUserKey = optsPagesData->webOptions[optsPagesData->lastPage]->pastebinUserKey; + if(pastebinUserKey.empty()) + { + CheckDlgButton(hwndDlg, IDC_GUEST, TRUE); + Edit_Enable(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY), FALSE); + Static_Enable(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY_DESC), FALSE); + Button_Enable(GetDlgItem(hwndDlg, IDC_PASTEBIN_LOGIN), FALSE); + } + else + { + CheckDlgButton(hwndDlg, IDC_GUEST, FALSE); + Edit_Enable(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY), TRUE); + Static_Enable(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY_DESC), TRUE); + Button_Enable(GetDlgItem(hwndDlg, IDC_PASTEBIN_LOGIN), TRUE); + } + + Edit_SetText(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY), pastebinUserKey.c_str()); + } + else + { + ShowWindow(GetDlgItem(hwndDlg, IDC_GUEST), SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY), SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY_DESC), SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg, IDC_PASTEBIN_LOGIN), SW_HIDE); + } + + optsPagesData->init = true; + } + + if (optsPagesData->init && ((HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) != IDC_CONFIGURE && LOWORD(wParam) != IDC_PASTEBIN_LOGIN) || (HIWORD(wParam)==CBN_SELCHANGE && LOWORD(wParam) != IDC_WEBPAGE) || HIWORD(wParam) == EN_CHANGE)) + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + return TRUE; + } + case WM_NOTIFY: + { + if(((LPNMHDR)lParam)->code == PSN_APPLY) + { + OptsPagesData* optsPagesData = (OptsPagesData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + GetPagesSettings(hwndDlg, optsPagesData); + for(int i = 0 ; i < PasteToWeb::pages; ++i) + { + *Options::instance->webOptions[i] = *optsPagesData->webOptions[i]; + } + + Options::instance->Save(); + } + return TRUE; + } + case WM_CLOSE: + { + OptsPagesData* optsPagesData = (OptsPagesData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + delete optsPagesData; + SetWindowLongPtr(hwndDlg, GWLP_USERDATA, NULL); + break; + } + } + + return FALSE; +} + +void SelectLbConfigure(HWND hwndDlg, int sel, OptsConfigureData* optsConfigureData) +{ + if(sel >= 0 && sel < (int)optsConfigureData->tempFormats.size()) + { + Button_Enable(GetDlgItem(hwndDlg, IDC_DELETE), TRUE); + if(sel == 0) + Button_Enable(GetDlgItem(hwndDlg, IDC_UP), FALSE); + else + Button_Enable(GetDlgItem(hwndDlg, IDC_UP), TRUE); + if(sel + 1 == optsConfigureData->tempFormats.size()) + Button_Enable(GetDlgItem(hwndDlg, IDC_DOWN), FALSE); + else + Button_Enable(GetDlgItem(hwndDlg, IDC_DOWN), TRUE); + } + else + { + Button_Enable(GetDlgItem(hwndDlg, IDC_DELETE), FALSE); + Button_Enable(GetDlgItem(hwndDlg, IDC_UP), FALSE); + Button_Enable(GetDlgItem(hwndDlg, IDC_DOWN), FALSE); + } +} + +INT_PTR CALLBACK Options::DlgProcOptsConfigure(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch(msg) + { + case WM_INITDIALOG: + { + TranslateDialogDefault(hwndDlg); + OptsConfigureData* optsConfigureData = (OptsConfigureData*)lParam; + SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam); + + HWND lb = GetDlgItem(hwndDlg, IDC_FORMATTING); + for(std::list::iterator it = optsConfigureData->tempFormats.begin(); it != optsConfigureData->tempFormats.end(); ++it) + { + ListBox_AddString(lb, it->name.c_str()); + } + + SelectLbConfigure(hwndDlg, -1, optsConfigureData); + return TRUE; + } + case WM_COMMAND: + { + if (HIWORD(wParam) == BN_CLICKED) + { + if (LOWORD(wParam) == IDOK) + { + EndDialog(hwndDlg, IDOK); + } + else if (LOWORD(wParam) == IDCANCEL) + { + EndDialog(hwndDlg, IDCANCEL); + } + else if (LOWORD(wParam) == IDC_DELETE) + { + HWND lb = GetDlgItem(hwndDlg, IDC_FORMATTING); + OptsConfigureData* optsConfigureData = (OptsConfigureData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + int sel = ListBox_GetCurSel(lb); + if(sel >= 0) + { + ListBox_DeleteString(lb, sel); + int i = sel; + for(std::list::iterator it = optsConfigureData->tempFormats.begin(); it != optsConfigureData->tempFormats.end(); ++it) + { + if(i-- <= 0) + { + optsConfigureData->tempFormats.erase(it); + ListBox_SetCurSel(lb, sel); + SelectLbConfigure(hwndDlg, sel, optsConfigureData); + break; + } + } + } + } + else if (LOWORD(wParam) == IDC_UP) + { + HWND lb = GetDlgItem(hwndDlg, IDC_FORMATTING); + OptsConfigureData* optsConfigureData = (OptsConfigureData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + int sel = ListBox_GetCurSel(lb); + if(sel > 0) + { + int i = sel; + for(std::list::iterator it = optsConfigureData->tempFormats.begin(); it != optsConfigureData->tempFormats.end(); ++it) + { + if(i-- <= 0) + { + PasteFormat pf = *it; + std::list::iterator prevIt = it; + --prevIt; + optsConfigureData->tempFormats.erase(it); + optsConfigureData->tempFormats.insert(prevIt, pf); + ListBox_DeleteString(lb, sel--); + ListBox_InsertString(lb, sel, pf.name.c_str()); + ListBox_SetCurSel(lb, sel); + SelectLbConfigure(hwndDlg, sel, optsConfigureData); + break; + } + } + } + } + else if (LOWORD(wParam) == IDC_DOWN) + { + HWND lb = GetDlgItem(hwndDlg, IDC_FORMATTING); + OptsConfigureData* optsConfigureData = (OptsConfigureData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + int sel = ListBox_GetCurSel(lb); + if(sel >= 0 && sel + 1 < (int)optsConfigureData->tempFormats.size()) + { + int i = sel; + for(std::list::iterator it = optsConfigureData->tempFormats.begin(); it != optsConfigureData->tempFormats.end(); ++it) + { + if(i-- <= 0) + { + PasteFormat pf = *it; + std::list::iterator nextIt = it; + ++(++nextIt); + optsConfigureData->tempFormats.erase(it); + optsConfigureData->tempFormats.insert(nextIt, pf); + ListBox_DeleteString(lb, sel++); + ListBox_InsertString(lb, sel, pf.name.c_str()); + ListBox_SetCurSel(lb, sel); + SelectLbConfigure(hwndDlg, sel, optsConfigureData); + break; + } + } + } + } + else if(LOWORD(wParam) == IDC_DOWNLOAD) + { + OptsConfigureData* optsConfigureData = (OptsConfigureData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + HWND lb = GetDlgItem(hwndDlg, IDC_FORMATTING); + while(ListBox_DeleteString(lb, 0) > 0); + SelectLbConfigure(hwndDlg, -1, optsConfigureData); + optsConfigureData->tempFormats = pasteToWebs[optsConfigureData->page]->GetFormats(); + for(std::list::iterator it = optsConfigureData->tempFormats.begin(); it != optsConfigureData->tempFormats.end(); ++it) + { + ListBox_AddString(lb, it->name.c_str()); + } + } + else if(LOWORD(wParam) == IDC_RESTORE) + { + OptsConfigureData* optsConfigureData = (OptsConfigureData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + HWND lb = GetDlgItem(hwndDlg, IDC_FORMATTING); + while(ListBox_DeleteString(lb, 0) > 0); + SelectLbConfigure(hwndDlg, -1, optsConfigureData); + optsConfigureData->tempFormats = pasteToWebs[optsConfigureData->page]->GetDefFormats(); + for(std::list::iterator it = optsConfigureData->tempFormats.begin(); it != optsConfigureData->tempFormats.end(); ++it) + { + ListBox_AddString(lb, it->name.c_str()); + } + } + } + else if(HIWORD(wParam) == LBN_SELCHANGE && LOWORD(wParam) == IDC_FORMATTING) + { + OptsConfigureData* optsConfigureData = (OptsConfigureData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + int sel = ListBox_GetCurSel(GetDlgItem(hwndDlg, IDC_FORMATTING)); + SelectLbConfigure(hwndDlg, sel, optsConfigureData); + } + return TRUE; + } + case WM_VKEYTOITEM: + if(LOWORD(wParam) == VK_DELETE && (HWND)lParam == GetDlgItem(hwndDlg, IDC_FORMATTING)) + { + DlgProcOptsConfigure(hwndDlg, WM_COMMAND, MAKELONG(IDC_DELETE, BN_CLICKED), NULL); + return -2; + } + return -1; + case WM_NOTIFY: + { + return TRUE; + } + } + + return FALSE; +} + +INT_PTR CALLBACK Options::DlgProcOptsLogin(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch(msg) + { + case WM_INITDIALOG: + { + TranslateDialogDefault(hwndDlg); + SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam); + Edit_LimitText(GetDlgItem(hwndDlg, IDC_PASTEBIN_USER), 99); + Edit_LimitText(GetDlgItem(hwndDlg, IDC_PASTEBIN_PASSWORD), 99); + return TRUE; + } + case WM_COMMAND: + { + if (HIWORD(wParam) == BN_CLICKED) + { + if (LOWORD(wParam) == IDOK) + { + TCHAR buf[100]; + OptsLoginData* optsLoginData = (OptsLoginData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + Edit_GetText(GetDlgItem(hwndDlg, IDC_PASTEBIN_USER), buf, 100); + optsLoginData->user = buf; + Edit_GetText(GetDlgItem(hwndDlg, IDC_PASTEBIN_PASSWORD), buf, 100); + optsLoginData->password = buf; + EndDialog(hwndDlg, IDOK); + } + else if (LOWORD(wParam) == IDCANCEL) + { + EndDialog(hwndDlg, IDCANCEL); + } + } + return TRUE; + } + case WM_NOTIFY: + { + return TRUE; + } + } + + return FALSE; +} + +unsigned int Options::GetCodepageCB(HWND hwndCB, bool errorReport, unsigned int defCp) +{ + int selCpIdx = ComboBox_GetCurSel(hwndCB); + if(selCpIdx < 0) + { + TCHAR text[128]; + ComboBox_GetText(hwndCB, text, 128); + TCHAR * stopOn = NULL; + long cp = _tcstol(text, &stopOn, 10); + if(errorReport && (stopOn == text || *stopOn != '\0' || cp < 0 || cp > 0xffff)) + { + MessageBox(GetParent(hwndCB), TranslateT("You've entered invalid codepage. Select codepage from combo box or enter correct number."), TranslateT("Invalid codepage"), MB_OK | MB_ICONERROR); + SetFocus(hwndCB); + SetCodepageCB(hwndCB, defCp); + return defCp; + } + + return cp; + } + else return cpTable[selCpIdx].cpId; +} + +void Options::SetDefWeb(int web) +{ + defWeb = web; + DBWriteContactSettingWString(0, MODULE, "defWeb", pasteToWebs[web]->GetName()); + DefWebPageChanged(); +} + +void Options::InitCodepageCB(HWND hwndCB, unsigned int codepage) +{ + int cpCount = sizeof(cpTable) / sizeof(cpTable[0]); + int selCpIdx = -1; + for(int i = 0; i < cpCount; ++i) + { + ComboBox_AddString(hwndCB, TranslateTS(cpTable[i].cpName)); + if(cpTable[i].cpId == codepage) + selCpIdx = i; + } + + if(selCpIdx == -1) + { + TCHAR buf[10]; + _stprintf_s(buf, 10, _T("%d"), codepage); + ComboBox_SetText(hwndCB, buf); + } + else + { + ComboBox_SetCurSel(hwndCB, selCpIdx); + } + + ComboBox_LimitText(hwndCB, 127); +} + +void Options::SetCodepageCB(HWND hwndCB, unsigned int codepage) +{ + int cpCount = sizeof(cpTable) / sizeof(cpTable[0]); + int selCpIdx = -1; + for(int i = 0; i < cpCount; ++i) + { + if(cpTable[i].cpId == codepage) + selCpIdx = i; + } + + if(selCpIdx == -1) + { + TCHAR buf[10]; + _stprintf_s(buf, 10, _T("%d"), codepage); + ComboBox_SetText(hwndCB, buf); + } + else + { + ComboBox_SetCurSel(hwndCB, selCpIdx); + } +} + +int Options::InitOptions(WPARAM wParam, LPARAM lParam) +{ + OPTIONSDIALOGPAGE odp = {0}; + + odp.cbSize = sizeof(odp); + odp.position = 100000000; + odp.hInstance = hInst; + odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR; + odp.ptszTitle = LPGENT("Paste It"); + odp.ptszGroup = LPGENT("Services"); + + odp.ptszTab = LPGENT("Main"); + odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_MAIN); + odp.pfnDlgProc = Options::DlgProcOptsMain; + Options_AddPage(wParam, &odp); + + odp.ptszTab = LPGENT("Web page"); + odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_PAGES); + odp.pfnDlgProc = Options::DlgProcOptsPages; + Options_AddPage(wParam, &odp); + + return 0; +} + +void Options::Save() +{ + DBWriteContactSettingWString(0, MODULE, "defWeb", pasteToWebs[defWeb]->GetName()); + DBWriteContactSettingDword(0, MODULE, "codepage", codepage); + DBWriteContactSettingByte(0, MODULE, "autoUTF", autoUTF ? 1 : 0); + DBWriteContactSettingByte(0, MODULE, "confDlg", confDlg ? 1 : 0); + DBWriteContactSettingByte(0, MODULE, "autoSend", autoSend ? 1 : 0); + for(int i = 0 ; i < PasteToWeb::pages; ++i) + { + char buf[256]; + TCHAR* name = pasteToWebs[i]->GetName(); + int j = 0; + while(name[j]) + { + buf[j] = (char)name[j]; + ++j; + } + buf[j++] = '_'; + + strcpy_s(buf + j, 256 - j, "formats"); + std::wstring forms; + for(std::list::iterator it = webOptions[i]->formats.begin(); it != webOptions[i]->formats.end(); ++it) + { + forms += it->id + L'=' + it->name + L';'; + } + + DBWriteContactSettingWString(0, MODULE, buf, forms.c_str()); + + strcpy_s(buf + j, 256 - j, "defFormatId"); + DBWriteContactSettingWString(0, MODULE, buf, webOptions[i]->defFormatId.c_str()); + + if(webOptions[i]->isSendFileName) + { + strcpy_s(buf + j, 256 - j, "sendFileName"); + DBWriteContactSettingByte(0, MODULE, buf, webOptions[i]->sendFileName ? 1 : 0); + } + + if(webOptions[i]->isPublicPaste) + { + strcpy_s(buf + j, 256 - j, "publicPaste"); + DBWriteContactSettingByte(0, MODULE, buf, webOptions[i]->publicPaste ? 1 : 0); + } + + if(webOptions[i]->isCombo1) + { + strcpy_s(buf + j, 256 - j, "combo1"); + DBWriteContactSettingWString(0, MODULE, buf, webOptions[i]->combo1.c_str()); + } + + if(webOptions[i]->isPastebin) + { + strcpy_s(buf + j, 256 - j, "pastebinUserKey"); + DBWriteContactSettingWString(0, MODULE, buf, webOptions[i]->pastebinUserKey.c_str()); + } + } +} + +void Options::Load() +{ + DBVARIANT defWebV; + if(!DBGetContactSettingWString(0, MODULE, "defWeb", &defWebV)) + { + for(int i = 0; i < PasteToWeb::pages; ++i) + { + if(!wcscmp(pasteToWebs[i]->GetName(), defWebV.pwszVal)) + { + defWeb = i; + break; + } + } + DBFreeVariant(&defWebV); + } + codepage = DBGetContactSettingDword(0, MODULE, "codepage", CP_ACP); + autoUTF = DBGetContactSettingByte(0, MODULE, "autoUTF", 1) ? true : false; + confDlg = DBGetContactSettingByte(0, MODULE, "confDlg", 1) ? true : false; + autoSend = DBGetContactSettingByte(0, MODULE, "autoSend", 0) ? true : false; + for(int i = 0 ; i < PasteToWeb::pages; ++i) + { + char buf[256]; + TCHAR* name = pasteToWebs[i]->GetName(); + int j = 0; + while(name[j]) + { + buf[j] = (char)name[j]; + ++j; + } + buf[j++] = '_'; + + strcpy_s(buf + j, 256 - j, "formats"); + DBVARIANT forms; + if(!DBGetContactSettingWString(0, MODULE, buf, &forms)) + { + webOptions[i]->formats.clear(); + int k = 0; + wchar_t * id = forms.pwszVal; + wchar_t * name = NULL; + while(forms.pwszVal[k]) + { + if(forms.pwszVal[k] == L'=') + { + forms.pwszVal[k] = 0; + name = forms.pwszVal + k + 1; + } + else if(forms.pwszVal[k] == L';') + { + forms.pwszVal[k] = 0; + PasteFormat pf; + pf.id = id; + pf.name = name; + webOptions[i]->formats.push_back(pf); + id = forms.pwszVal + k + 1; + } + + ++k; + } + + DBFreeVariant(&forms); + } + + strcpy_s(buf + j, 256 - j, "defFormatId"); + DBVARIANT defForm; + if(!DBGetContactSettingWString(0, MODULE, buf, &defForm)) + { + webOptions[i]->defFormatId = defForm.pwszVal; + DBFreeVariant(&defForm); + } + + if(webOptions[i]->isSendFileName) + { + strcpy_s(buf + j, 256 - j, "sendFileName"); + webOptions[i]->sendFileName = DBGetContactSettingByte(0, MODULE, buf, 1) ? true : false; + } + + if(webOptions[i]->isPublicPaste) + { + strcpy_s(buf + j, 256 - j, "publicPaste"); + webOptions[i]->publicPaste = DBGetContactSettingByte(0, MODULE, buf, 0) ? true : false; + } + + if(webOptions[i]->isCombo1) + { + strcpy_s(buf + j, 256 - j, "combo1"); + DBVARIANT combo1; + if(!DBGetContactSettingWString(0, MODULE, buf, &combo1)) + { + webOptions[i]->combo1 = combo1.pwszVal; + DBFreeVariant(&combo1); + } + } + + if(webOptions[i]->isPastebin) + { + strcpy_s(buf + j, 256 - j, "pastebinUserKey"); + DBVARIANT pastebinUserKey; + if(!DBGetContactSettingWString(0, MODULE, buf, &pastebinUserKey)) + { + webOptions[i]->pastebinUserKey = pastebinUserKey.pwszVal; + DBFreeVariant(&pastebinUserKey); + } + } + } +} + +WebOptions::WebOptions(int serv) + :server(serv), + formats(pasteToWebs[serv]->GetDefFormats()), + sendFileName(true), + isSendFileName(true), + publicPaste(false), + isPublicPaste(false), + isCombo1(false), + isPastebin(false) +{ + defFormatId = formats.front().id; +} + + +WebOptions::~WebOptions() +{ +} + +WebOptions* WebOptions::Copy() +{ + return new WebOptions(*this); +} diff --git a/plugins/PasteIt/src/Options.h b/plugins/PasteIt/src/Options.h new file mode 100644 index 0000000000..9e58e44d7f --- /dev/null +++ b/plugins/PasteIt/src/Options.h @@ -0,0 +1,72 @@ +/* +Paste It plugin +Copyright (C) 2011 Krzysztof Kral + +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 version 2 +of the License. + +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, see . +*/ + +#pragma once +#include "PasteToWeb.h" + +class WebOptions +{ +public: + WebOptions(int serv); + virtual ~WebOptions(); + virtual WebOptions* Copy(); + int server; + bool isSendFileName; + bool isPublicPaste; + bool isCombo1; + std::list combo1Values; + std::wstring combo1Desc; + bool isPastebin; + + std::list formats; + std::wstring defFormatId; + bool sendFileName; + bool publicPaste; + std::wstring combo1; + std::wstring pastebinUserKey; +}; + +class Options +{ +public: + Options(); + ~Options(); + static int InitOptions(WPARAM wParam, LPARAM lParam); + + static INT_PTR CALLBACK DlgProcOptsMain(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); + static INT_PTR CALLBACK DlgProcOptsPages(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); + static INT_PTR CALLBACK DlgProcOptsConfigure(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); + static INT_PTR CALLBACK DlgProcOptsLogin(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); + + static void InitCodepageCB(HWND hwndCB, unsigned int codepage); + static void SetCodepageCB(HWND hwndCB, unsigned int codepage); + static unsigned int GetCodepageCB(HWND hwndCB, bool errorReport, unsigned int defCp); + + static Options *instance; + void Save(); + void Load(); + + int defWeb; + unsigned int codepage; + bool autoUTF; + bool confDlg; + bool autoSend; + void SetDefWeb(int web); + WebOptions* webOptions[PasteToWeb::pages]; +}; + diff --git a/plugins/PasteIt/src/PasteIt.cpp b/plugins/PasteIt/src/PasteIt.cpp new file mode 100644 index 0000000000..ce38743f68 --- /dev/null +++ b/plugins/PasteIt/src/PasteIt.cpp @@ -0,0 +1,564 @@ +/* +Paste It plugin +Copyright (C) 2011 Krzysztof Kral + +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 version 2 +of the License. + +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, see . +*/ + +#include "stdafx.h" +#include "PasteToWeb1.h" +#include "PasteToWeb2.h" +#include "version.h" +#include "resource.h" +#include "Options.h" + +// {1AAC15E8-DCEC-4050-B66F-2AA0E6120C22} +#define MIID_PASTEIT { 0x1aac15e8, 0xdcec, 0x4050, { 0xb6, 0x6f, 0x2a, 0xa0, 0xe6, 0x12, 0xc, 0x22 } } + + +PasteToWeb* pasteToWebs[PasteToWeb::pages]; +std::map* contactWindows; +DWORD gMirandaVersion; + +extern HINSTANCE hInst; +HANDLE hModulesLoaded, hTabsrmmButtonPressed; +HANDLE g_hNetlibUser; +HANDLE hPrebuildContactMenu; +HANDLE hServiceContactMenu; +HGENMENU hContactMenu; +HGENMENU hWebPageMenus[PasteToWeb::pages]; +HANDLE hMainIcon; +HANDLE hOptionsInit; +HANDLE hWindowEvent = NULL; +HINSTANCE hInst; + +#define MODULE "PasteIt" +#define FROM_CLIPBOARD 10 +#define FROM_FILE 11 +#define DEF_PAGES_START 20 +#define MS_PASTEIT_CONTACTMENU "PasteIt/ContactMenu" + +PLUGININFOEX pluginInfo={ + sizeof(PLUGININFOEX), + __PLUGIN_NAME, + PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM), + __DESCRIPTION, + __AUTHOR, + __AUTHOREMAIL, + __COPYRIGHT, + __AUTHORWEB, + UNICODE_AWARE, + MIID_PASTEIT +}; + +XML_API xi = {0}; +int hLangpack = 0; + +BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) +{ + hInst = hModule; + return TRUE; +} + +extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion) +{ + gMirandaVersion = mirandaVersion; + if (mirandaVersion < PLUGIN_MAKE_VERSION(0, 8, 0, 0)) + return NULL; + + return &pluginInfo; +} + +extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_PASTEIT, MIID_LAST}; + +std::wstring GetFile() +{ + TCHAR filter[512]; + _tcscpy_s(filter, 512, TranslateT("All Files (*.*)")); + memcpy(filter + _tcslen(filter), _T("\0*.*\0"), 6 * sizeof(TCHAR)); + TCHAR stzFilePath[1024]; + stzFilePath[0] = 0; + stzFilePath[1] = 0; + OPENFILENAME ofn = {0}; + ofn.lStructSize = sizeof(ofn); + ofn.hwndOwner = 0; + ofn.lpstrFilter = filter; + ofn.nFilterIndex = 1; + ofn.lpstrFile = stzFilePath; + ofn.lpstrTitle = TranslateT("Paste It - Select file"); + ofn.nMaxFile = 1024; + ofn.Flags = OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_EXPLORER | OFN_NOCHANGEDIR; + if(GetOpenFileName(&ofn)) + { + return stzFilePath; + } + + return L""; +} + +void PasteIt(HANDLE hContact, int mode) +{ + PasteToWeb* pasteToWeb = pasteToWebs[Options::instance->defWeb]; + if(mode == FROM_CLIPBOARD) + { + pasteToWeb->FromClipboard(); + } + else if(mode == FROM_FILE) + { + std::wstring file = GetFile(); + if(file.length() > 0) + { + pasteToWeb->FromFile(file); + } + else return; + } + else return; + + if(pasteToWeb->szFileLink[0] == 0 && pasteToWeb->error != NULL) + { + MessageBox(NULL, pasteToWeb->error, TranslateT("Error"), MB_OK | MB_ICONERROR); + } + else if(hContact != NULL && pasteToWeb->szFileLink[0] != 0) + { + char *szProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); + if (szProto && (INT_PTR)szProto != CALLSERVICE_NOTFOUND) + { + BOOL isChat = DBGetContactSettingByte(hContact, szProto, "ChatRoom", 0); + if(Options::instance->autoSend) + { + if(!isChat) + { + DBEVENTINFO dbei = {0}; + dbei.cbSize = sizeof(dbei); + dbei.eventType = EVENTTYPE_MESSAGE; + dbei.flags = DBEF_SENT; + dbei.szModule = szProto; + dbei.timestamp = (DWORD)time(NULL); + dbei.cbBlob = (DWORD)strlen(pasteToWeb->szFileLink) + 1; + dbei.pBlob = (PBYTE)pasteToWeb->szFileLink; + CallService(MS_DB_EVENT_ADD, (WPARAM)hContact, (LPARAM)&dbei); + CallContactService(hContact, PSS_MESSAGE, 0, (LPARAM)pasteToWeb->szFileLink); + } + else + { + // PSS_MESSAGE is not compatible with chat rooms + // there are no simple method to send text to all users + // in chat room. + // First I check if protocol is unicode or ascii. + BOOL isUnicodePlugin = TRUE; + PROTOACCOUNT* protoAc = ProtoGetAccount(szProto); + if(protoAc != NULL) + { + // protoAc->ppro is abstract class, that contains + // methods implemented in protocol ddl`s segment. + // Method address in vptr table must be converted + // to hInstance of protocol dll. + PROTO_INTERFACE* protoInt = protoAc->ppro; + MEMORY_BASIC_INFORMATION mb; + INT_PTR *vptr = *(INT_PTR**)&protoAc->ppro; + INT_PTR *vtable = (INT_PTR *)*vptr; + if(VirtualQuery((void*)vtable[0], &mb, sizeof(MEMORY_BASIC_INFORMATION))) + { + typedef PLUGININFOEX * (__cdecl * Miranda_Plugin_InfoEx) ( DWORD mirandaVersion ); + HINSTANCE hInst = (HINSTANCE)mb.AllocationBase; + // Now I can get PLUGININFOEX from protocol + Miranda_Plugin_InfoEx infoEx = (Miranda_Plugin_InfoEx) GetProcAddress(hInst, "MirandaPluginInfoEx"); + PLUGININFOEX* pi = NULL; + if(infoEx != NULL) + { + pi = infoEx(gMirandaVersion); + } + // If PLUGININFOEX flags contains UNICODE_AWARE, + // this mean that protocol is unicode. + if(pi != NULL && pi->cbSize == sizeof(PLUGININFOEX)) + { + isUnicodePlugin = pi->flags & UNICODE_AWARE; + } + } + } + + // Next step is to get all protocol sessions and find + // one with correct hContact + GC_INFO gci = {0}; + GCDEST gcd = {0}; + GCEVENT gce = {0}; + int cnt = (int)CallService(MS_GC_GETSESSIONCOUNT, 0, (LPARAM)szProto); + for (int i = 0; i < cnt ; i++ ) + { + gci.iItem = i; + gci.pszModule = szProto; + gci.Flags = BYINDEX | HCONTACT | ID; + CallService(MS_GC_GETINFO, 0, (LPARAM)(GC_INFO *) &gci); + if (gci.hContact == hContact) + { + // In this place session was finded, gci.pszID contains + // session ID, but it is in unicode or ascii format, + // depends on protocol wersion + gcd.pszModule = szProto; + gcd.iType = GC_EVENT_SENDMESSAGE; + gcd.ptszID = gci.pszID; + gce.cbSize = sizeof(GCEVENT); + gce.pDest = &gcd; + gce.bIsMe = TRUE; + gce.dwFlags = isUnicodePlugin ? (GCEF_ADDTOLOG | GC_UNICODE) : GCEF_ADDTOLOG; + wchar_t* s = NULL; + if(isUnicodePlugin) + { + // If session ID is in unicode, text must be too in unicode + s = mir_a2u_cp(pasteToWeb->szFileLink, CP_ACP); + gce.ptszText = s; + } + else + { + // If session ID is in ascii, text must be too in ascii + gce.pszText = pasteToWeb->szFileLink; + } + gce.time = time(NULL); + CallService(MS_GC_EVENT, 0, (LPARAM)(GCEVENT *) &gce); + if(s != NULL) + mir_free(s); + break; + } + } + } + + // Send message to focus window + CallServiceSync(MS_MSG_SENDMESSAGE, (WPARAM)hContact, 0); + } + else + { + if(isChat) + { + // MS_MSG_SENDMESSAGE in incompatible with chat rooms, + // because it sends text to IDC_MESSAGE window, + // but in chat rooms is only IDC_CHAT_MESSAGE window. + // contactWindows map contains all opened hContact + // with assaigned to them chat windows. + // This map is prepared in ME_MSG_WINDOWEVENT event. + std::map::iterator it = contactWindows->find(hContact); + if(it != contactWindows->end()) + { + // it->second is imput window, so now I can send to them + // new text. Afterr all is sended MS_MSG_SENDMESSAGE + // to focus window. + SendMessage(it->second, EM_SETSEL, -1, SendMessage(it->second, WM_GETTEXTLENGTH, 0, 0)); + SendMessageA(it->second, EM_REPLACESEL, FALSE, (LPARAM)pasteToWeb->szFileLink); + CallServiceSync(MS_MSG_SENDMESSAGE, (WPARAM)hContact, NULL); + } + else + { + // If window do not exist, maybe it is not chat + CallServiceSync(MS_MSG_SENDMESSAGE, (WPARAM)hContact, (LPARAM)pasteToWeb->szFileLink); + } + } + else + { + CallServiceSync(MS_MSG_SENDMESSAGE, (WPARAM)hContact, (LPARAM)pasteToWeb->szFileLink); + } + } + } + } +} + +int TabsrmmButtonPressed(WPARAM wParam, LPARAM lParam) +{ + CustomButtonClickData *cbc = (CustomButtonClickData *)lParam; + HANDLE hContact = (HANDLE)wParam; + + if (!strcmp(cbc->pszModule, MODULE) && cbc->dwButtonId == 1 && hContact) + { + if (cbc->flags == BBCF_ARROWCLICKED) + { + HMENU hMenu = CreatePopupMenu(); + if (hMenu) + { + AppendMenu(hMenu, MF_STRING, FROM_CLIPBOARD, TranslateT("Paste from clipboard")); + AppendMenu(hMenu, MF_STRING, FROM_FILE, TranslateT("Paste from file")); + HMENU hDefMenu = CreatePopupMenu(); + for(int i = 0 ; i < PasteToWeb::pages; ++i) + { + UINT flags = MF_STRING; + if(Options::instance->defWeb == i) + flags |= MF_CHECKED; + + AppendMenu(hDefMenu, flags, DEF_PAGES_START + i, pasteToWebs[i]->GetName()); + } + + AppendMenu(hMenu, MF_STRING | MF_POPUP, (UINT_PTR)hDefMenu, TranslateT("Default web page")); + + POINT pt; + GetCursorPos(&pt); + HWND hwndBtn = WindowFromPoint(pt); + if (hwndBtn) + { + RECT rc; + GetWindowRect(hwndBtn, &rc); + SetForegroundWindow(cbc->hwndFrom); + int selected = TrackPopupMenu(hMenu, TPM_RETURNCMD, rc.left, rc.bottom, 0, cbc->hwndFrom, 0); + if (selected != 0) + { + if(selected >= DEF_PAGES_START) + { + Options::instance->SetDefWeb(selected - DEF_PAGES_START); + } + else + { + PasteIt(hContact, selected); + } + } + } + + DestroyMenu(hDefMenu); + DestroyMenu(hMenu); + } + } + else + { + PasteIt(hContact, FROM_CLIPBOARD); + } + } + + return 0; +} + +int PrebuildContactMenu(WPARAM wParam, LPARAM lParam) +{ + bool bIsContact = false; + + char *szProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0); + if (szProto && (INT_PTR)szProto != CALLSERVICE_NOTFOUND) bIsContact = (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IM) ? true : false; + + CLISTMENUITEM mi = {0}; + mi.cbSize = sizeof(mi); + mi.flags = CMIM_FLAGS; + + if (!bIsContact) mi.flags |= CMIF_HIDDEN; + else mi.flags &= ~CMIF_HIDDEN; + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hContactMenu, (LPARAM)&mi); + + return 0; +} + +INT_PTR ContactMenuService(WPARAM wParam, LPARAM lParam) +{ + if(lParam >= DEF_PAGES_START) + { + Options::instance->SetDefWeb(lParam - DEF_PAGES_START); + } + else + { + HANDLE hContact = (HANDLE)wParam; + PasteIt(hContact, lParam); + } + return 0; +} + +void InitIcolib() +{ + TCHAR stzFile[MAX_PATH]; + + SKINICONDESC sid = {0}; + sid.cbSize = sizeof(sid); + sid.cx = sid.cy = 16; + sid.ptszDefaultFile = stzFile; + sid.ptszSection = LPGENT("Paste It"); + sid.flags = SIDF_ALL_TCHAR; + + GetModuleFileName(hInst, stzFile, MAX_PATH); + + sid.pszName = "PasteIt_main"; + sid.ptszDescription = LPGENT("Paste It"); + sid.iDefaultIndex = -IDI_MENU; + hMainIcon = Skin_AddIcon(&sid); +} + +void InitMenuItems() +{ + CLISTMENUITEM mi = {0}; + CLISTMENUITEM mi2 = {0}; + + mi.cbSize = sizeof(mi); + mi.flags = CMIF_ROOTPOPUP | CMIF_ICONFROMICOLIB | CMIF_TCHAR; + mi.icolibItem = hMainIcon; + mi.position = 3000090005; + mi.ptszName = _T("Paste It"); + + hContactMenu = Menu_AddContactMenuItem(&mi); + + memset(&mi, 0, sizeof(mi)); + mi.cbSize = sizeof(mi); + mi.flags = CMIF_CHILDPOPUP | CMIF_ROOTHANDLE | CMIF_TCHAR; + mi.pszService = MS_PASTEIT_CONTACTMENU; + mi.hParentMenu = hContactMenu; + mi.popupPosition = FROM_CLIPBOARD; + mi.ptszName = _T("Paste from clipboard"); + Menu_AddContactMenuItem(&mi); + + mi.popupPosition = FROM_FILE; + mi.ptszName = _T("Paste from file"); + Menu_AddContactMenuItem(&mi); + + mi.popupPosition = DEF_PAGES_START - 1; + mi.ptszName = _T("Default web page"); + HGENMENU hDefWebMenu = Menu_AddContactMenuItem(&mi); + + mi2.cbSize = sizeof(mi2); + mi2.pszService = MS_PASTEIT_CONTACTMENU; + mi2.hParentMenu = hDefWebMenu; + for(int i = 0 ; i < PasteToWeb::pages; ++i) + { + mi2.flags = CMIF_CHILDPOPUP | CMIF_ROOTHANDLE | CMIF_TCHAR; + if(Options::instance->defWeb == i) + mi2.flags |= CMIF_CHECKED; + mi2.ptszName = pasteToWebs[i]->GetName(); + mi2.popupPosition = mi2.position = DEF_PAGES_START + i; + hWebPageMenus[i] = Menu_AddContactMenuItem(&mi2); + } + + hPrebuildContactMenu = HookEvent(ME_CLIST_PREBUILDCONTACTMENU, PrebuildContactMenu); +} + +void DefWebPageChanged() +{ + CLISTMENUITEM mi = {0}; + mi.cbSize = sizeof(mi); + + for (int i = 0; i < PasteToWeb::pages; i++) + { + mi.flags = CMIM_FLAGS; + if (Options::instance->defWeb == i) + { + mi.flags |= CMIF_CHECKED; + } + + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hWebPageMenus[i], (LPARAM)&mi); + } +} + +void InitTabsrmmButton() +{ + if (ServiceExists(MS_BB_ADDBUTTON)) + { + BBButton btn = {0}; + btn.cbSize = sizeof(btn); + btn.dwButtonID = 1; + btn.pszModuleName = MODULE; + btn.dwDefPos = 110; + btn.hIcon = hMainIcon; + btn.bbbFlags = BBBF_ISARROWBUTTON | BBBF_ISIMBUTTON | BBBF_ISLSIDEBUTTON | BBBF_CANBEHIDDEN | BBBF_ISCHATBUTTON; + btn.ptszTooltip = TranslateT("Paste It"); + CallService(MS_BB_ADDBUTTON, 0, (LPARAM)&btn); + if(hTabsrmmButtonPressed != NULL) + { + UnhookEvent(hTabsrmmButtonPressed); + } + + hTabsrmmButtonPressed = HookEvent(ME_MSG_BUTTONPRESSED, TabsrmmButtonPressed); + } +} + +int WindowEvent(WPARAM wParam, MessageWindowEventData* lParam) +{ + if(lParam->uType == MSG_WINDOW_EVT_OPEN) + { + char *szProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)lParam->hContact, 0); + if (szProto && (INT_PTR)szProto != CALLSERVICE_NOTFOUND) + { + if(DBGetContactSettingByte(lParam->hContact, szProto, "ChatRoom", 0)) + { + (*contactWindows)[lParam->hContact] = lParam->hwndInput; + } + } + } + else if(lParam->uType == MSG_WINDOW_EVT_CLOSE) + { + std::map::iterator it = contactWindows->find(lParam->hContact); + if(it != contactWindows->end()) + { + contactWindows->erase(it); + } + } + + return 0; +} + +int ModulesLoaded(WPARAM wParam, LPARAM lParam) +{ + InitIcolib(); + InitMenuItems(); + InitTabsrmmButton(); + hWindowEvent = HookEvent(ME_MSG_WINDOWEVENT, (MIRANDAHOOK)WindowEvent); + + return 0; +} + +extern "C" int __declspec(dllexport) Load(void) +{ + mir_getXI(&xi); + mir_getLP(&pluginInfo); + NETLIBUSER nlu = {0}; + nlu.cbSize = sizeof(nlu); + nlu.flags = NUF_TCHAR | NUF_OUTGOING | NUF_HTTPCONNS; + nlu.szSettingsModule = MODULE; + nlu.ptszDescriptiveName = TranslateT("Paste It HTTP connections"); + g_hNetlibUser = ( HANDLE )CallService( MS_NETLIB_REGISTERUSER, 0, ( LPARAM )&nlu ); + + pasteToWebs[0] = new PasteToWeb1(); + pasteToWebs[0]->pageIndex = 0; + pasteToWebs[1] = new PasteToWeb2(); + pasteToWebs[1]->pageIndex = 1; + Options::instance = new Options(); + pasteToWebs[0]->ConfigureSettings(); + pasteToWebs[1]->ConfigureSettings(); + Options::instance->Load(); + hModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded); + hOptionsInit = HookEvent(ME_OPT_INITIALISE, Options::InitOptions); + hTabsrmmButtonPressed = NULL; + hServiceContactMenu = CreateServiceFunction(MS_PASTEIT_CONTACTMENU, ContactMenuService); + contactWindows = new std::map(); + return 0; +} + +extern "C" int __declspec(dllexport) Unload(void) +{ + UnhookEvent(hModulesLoaded); + UnhookEvent(hPrebuildContactMenu); + UnhookEvent(hOptionsInit); + if(hWindowEvent != NULL) + { + UnhookEvent(hWindowEvent); + } + DestroyServiceFunction(hServiceContactMenu); + Netlib_CloseHandle(g_hNetlibUser); + if(hTabsrmmButtonPressed != NULL) + { + UnhookEvent(hTabsrmmButtonPressed); + } + for(int i=0; i < PasteToWeb::pages; ++i) + { + if(pasteToWebs[i] != NULL) + { + delete pasteToWebs[i]; + pasteToWebs[i] = NULL; + } + } + if(Options::instance != NULL) + { + delete Options::instance; + Options::instance = NULL; + } + + delete contactWindows; + return 0; +} diff --git a/plugins/PasteIt/src/PasteToWeb.cpp b/plugins/PasteIt/src/PasteToWeb.cpp new file mode 100644 index 0000000000..a7cc9a3b5f --- /dev/null +++ b/plugins/PasteIt/src/PasteToWeb.cpp @@ -0,0 +1,577 @@ +/* +Paste It plugin +Copyright (C) 2011 Krzysztof Kral + +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 version 2 +of the License. + +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, see . +*/ + +#include "StdAfx.h" +#include "PasteToWeb.h" +#include "Options.h" +#include "resource.h" + +extern HINSTANCE hInst; + +PasteToWeb::PasteToWeb() +{ +} + + +PasteToWeb::~PasteToWeb() +{ +} + +struct FromClipboardData +{ + std::wstring content; + int page; + std::wstring format; +}; + +struct FromFileData +{ + char* content; + int contentLen; + wchar_t* contentW; + UINT codepage; + std::wstring *fileName; + int page; + std::wstring format; + bool sendFileName; +}; + +INT_PTR CALLBACK DlgProcFromClipboard(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch (msg) + { + case WM_INITDIALOG: + { + TranslateDialogDefault(hwndDlg); + FromClipboardData* data = (FromClipboardData*)lParam; + SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam); + int ts = 4; + Edit_SetTabStops(GetDlgItem(hwndDlg, IDC_CLIPBOARD_DATA), 1, &ts); + SetDlgItemText(hwndDlg, IDC_CLIPBOARD_DATA, data->content.c_str()); + int sel = 0; + int i = 0; + std::wstring &defFormat = Options::instance->webOptions[data->page]->defFormatId; + HWND cb = GetDlgItem(hwndDlg, IDC_FORMAT); + for(std::list::iterator it = Options::instance->webOptions[data->page]->formats.begin(); it != Options::instance->webOptions[data->page]->formats.end(); ++it) + { + ComboBox_AddString(cb, it->name.c_str()); + if(it->id == defFormat) + sel = i; + ++i; + } + if(!Options::instance->webOptions[data->page]->formats.empty()) + { + ComboBox_SetCurSel(cb, sel); + } + return TRUE; + } + case WM_COMMAND: + { + if (HIWORD(wParam) == BN_CLICKED) + { + if (LOWORD(wParam) == IDOK) + { + FromClipboardData *clipboardData = (FromClipboardData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + int sel = ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_FORMAT)); + for(std::list::iterator it = Options::instance->webOptions[clipboardData->page]->formats.begin(); it != Options::instance->webOptions[clipboardData->page]->formats.end(); ++it) + { + if(sel-- <= 0) + { + clipboardData->format = it->id; + break; + } + } + + EndDialog(hwndDlg, IDC_BTN_OK); + } + else if (LOWORD(wParam) == IDCANCEL) + { + EndDialog(hwndDlg, IDCANCEL); + } + } + + break; + } + } + + return FALSE; +} + +void RecodeDlg(HWND hwndDlg) +{ + ShowWindow(GetDlgItem(hwndDlg,IDC_RECODE),SW_HIDE); + FromFileData *fromFileData = (FromFileData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + unsigned int cp = Options::GetCodepageCB(GetDlgItem(hwndDlg, IDC_CODEPAGE), false, fromFileData->codepage); + mir_free(fromFileData->contentW); + int cbLen = 0; + if(cp == 1200 || cp == 1201) + { + // UTF-16 + cbLen = fromFileData->contentLen / 2; + } + else + { + cbLen = MultiByteToWideChar( cp, 0, fromFileData->content, fromFileData->contentLen, NULL, 0 ); + } + + fromFileData->contentW = ( wchar_t* )mir_alloc( sizeof( wchar_t )*(cbLen+1)); + if ( fromFileData->contentW != NULL ) + { + if(cp == 1200) + { + memcpy_s(fromFileData->contentW, sizeof( wchar_t )*(cbLen+1), fromFileData->content, sizeof( wchar_t )*cbLen); + } + else if(cp == 1201) + { + for(int i = 0 ; i < cbLen; ++i) + { + fromFileData->contentW[i] = ((unsigned char)fromFileData->content[i*2] << 8) | (unsigned char)fromFileData->content[i*2 + 1]; + } + } + else + { + MultiByteToWideChar( cp, 0, fromFileData->content, fromFileData->contentLen, fromFileData->contentW, cbLen ); + } + + fromFileData->contentW[ cbLen ] = 0; + SetDlgItemText(hwndDlg, IDC_FILE_DATA, fromFileData->contentW); + } + else + { + SetDlgItemText(hwndDlg, IDC_FILE_DATA, _T("")); + } + + fromFileData->codepage = cp; +} + +INT_PTR CALLBACK DlgProcFromFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch (msg) + { + case WM_INITDIALOG: + { + TranslateDialogDefault(hwndDlg); + FromFileData *fromFileData = (FromFileData*)lParam; + int ts = 4; + Edit_SetTabStops(GetDlgItem(hwndDlg, IDC_FILE_DATA), 1, &ts); + SetDlgItemText(hwndDlg, IDC_FILE_DATA, fromFileData->contentW); + SetDlgItemText(hwndDlg, IDC_FILE_PATH, fromFileData->fileName->c_str()); + Options::InitCodepageCB(GetDlgItem(hwndDlg, IDC_CODEPAGE), fromFileData->codepage); + SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam); + ShowWindow(GetDlgItem(hwndDlg,IDC_RECODE),SW_HIDE); + + int sel = 0; + int i = 0; + std::wstring &defFormat = Options::instance->webOptions[fromFileData->page]->defFormatId; + HWND cb = GetDlgItem(hwndDlg, IDC_FORMAT); + for(std::list::iterator it = Options::instance->webOptions[fromFileData->page]->formats.begin(); it != Options::instance->webOptions[fromFileData->page]->formats.end(); ++it) + { + ComboBox_AddString(cb, it->name.c_str()); + if(it->id == defFormat) + sel = i; + ++i; + } + if(!Options::instance->webOptions[fromFileData->page]->formats.empty()) + { + ComboBox_SetCurSel(cb, sel); + } + + if(Options::instance->webOptions[fromFileData->page]->isSendFileName) + { + bool sendFileName = Options::instance->webOptions[fromFileData->page]->sendFileName; + CheckDlgButton(hwndDlg, IDC_AUTOFORMAT, sendFileName ? 1 : 0); + Button_Enable(GetDlgItem(hwndDlg, IDC_FORMAT), sendFileName ? 0 : 1); + Button_Enable(GetDlgItem(hwndDlg, IDC_FORMATTEXT), sendFileName ? 0 : 1); + } + else + Button_Enable(GetDlgItem(hwndDlg, IDC_AUTOFORMAT), FALSE); + return TRUE; + } + case WM_COMMAND: + { + if (HIWORD(wParam) == BN_CLICKED) + { + if (LOWORD(wParam) == IDOK) + { + FromFileData *fromFileData = (FromFileData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + int sel = ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_FORMAT)); + for(std::list::iterator it = Options::instance->webOptions[fromFileData->page]->formats.begin(); it != Options::instance->webOptions[fromFileData->page]->formats.end(); ++it) + { + if(sel-- <= 0) + { + fromFileData->format = it->id; + break; + } + } + + if(Options::instance->webOptions[fromFileData->page]->isSendFileName) + fromFileData->sendFileName = IsDlgButtonChecked(hwndDlg, IDC_AUTOFORMAT) ? true : false; + else + fromFileData->sendFileName = false; + + EndDialog(hwndDlg, IDC_BTN_OK); + } + else if (LOWORD(wParam) == IDCANCEL) + { + EndDialog(hwndDlg, IDCANCEL); + } + else if(LOWORD(wParam) == IDC_RECODE) + { + RecodeDlg(hwndDlg); + } + else if(LOWORD(wParam) == IDC_AUTOFORMAT) + { + UINT sendFileName = IsDlgButtonChecked(hwndDlg, IDC_AUTOFORMAT); + Button_Enable(GetDlgItem(hwndDlg, IDC_FORMAT), sendFileName ? 0 : 1); + Button_Enable(GetDlgItem(hwndDlg, IDC_FORMATTEXT), sendFileName ? 0 : 1); + } + } + else if(LOWORD(wParam) == IDC_CODEPAGE) + { + if(HIWORD(wParam) == CBN_SELCHANGE) + { + RecodeDlg(hwndDlg); + } + else if(HIWORD(wParam) == CBN_EDITCHANGE) + { + ShowWindow(GetDlgItem(hwndDlg,IDC_RECODE),SW_SHOW); + } + else if(HIWORD(wParam) == CBN_KILLFOCUS) + { + FromFileData *fromFileData = (FromFileData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + Options::GetCodepageCB(GetDlgItem(hwndDlg, IDC_CODEPAGE), true, fromFileData->codepage); + } + } + + break; + } + } + + return FALSE; +} + +void PasteToWeb::FromClipboard() +{ + szFileLink[0] = 0; + error = NULL; + std::wstring str; + BOOL isFile = 0; + if(OpenClipboard(NULL)) + { + HANDLE obj = GetClipboardData(CF_UNICODETEXT); + if(obj != NULL) + { + LPCWSTR wStr = (LPCWSTR)GlobalLock(obj); + str.append(wStr, wStr + wcslen(wStr)); + GlobalUnlock(obj); + // Sometimes clipboard CF_UNICODETEXT format returns only 2 characters, + // to fix this I check if CF_TEXT contains more characters, + // if this is true, this mean that CF_UNICODETEXT is invalid. + obj = GetClipboardData(CF_TEXT); + if(obj != NULL) + { + LPCSTR cStr = (LPCSTR)GlobalLock(obj); + if(strlen(cStr) > str.length()) + { + str = L""; + LPWSTR wStr = mir_a2u_cp(cStr, CP_ACP); + str.append(wStr, wStr + wcslen(wStr)); + mir_free(wStr); + } + GlobalUnlock(obj); + } + } + else + { + obj = GetClipboardData(CF_TEXT); + if(obj != NULL) + { + LPCSTR cStr = (LPCSTR)GlobalLock(obj); + LPWSTR wStr = mir_a2u_cp(cStr, CP_ACP); + str.append(wStr, wStr + wcslen(wStr)); + mir_free(wStr); + GlobalUnlock(obj); + } + else + { + obj = GetClipboardData(CF_HDROP); + if(obj != NULL) + { + LPDROPFILES df = (LPDROPFILES) GlobalLock(obj); + isFile = 1; + if(df->fWide) + { + // Unicode + WCHAR* file = (WCHAR*)((BYTE*)obj + df->pFiles); + size_t len = wcslen(file); + if(*(file + len + 1) == L'\0') + { + str.append(file, file + len); + } + else + { + error = TranslateT("You can only paste 1 file"); + } + } + else + { + // ANSI + char* file = (char*)obj + df->pFiles; + size_t len = strlen(file); + if(*(file + len + 1) == '\0') + { + LPWSTR wStr = mir_a2u_cp(file, CP_ACP); + str.append(wStr, wStr + wcslen(wStr)); + mir_free(wStr); + } + else + { + error = TranslateT("You can only paste 1 file"); + } + } + GlobalUnlock(obj); + } + } + } + + CloseClipboard(); + } + + if(str.length() > 0) + { + if(isFile) + FromFile(str); + else + { + FromClipboardData data; + data.content = str; + data.page = pageIndex; + if (Options::instance->confDlg && DialogBoxParam (hInst, MAKEINTRESOURCE(IDD_DLG_FROM_CLIPBOARD), 0, DlgProcFromClipboard, (LPARAM)&data) != IDC_BTN_OK) + return; + + SendToServer(str, L"", data.format); + } + } + else if(error == NULL) + { + error = TranslateT("Cannot get data from clipboard"); + } +} + +void PasteToWeb::FromFile(std::wstring file) +{ + error = NULL; + szFileLink[0] = 0; + HANDLE hFile = CreateFile(file.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); + FromFileData fromFileData; + fromFileData.content = NULL; + fromFileData.contentLen = 0; + fromFileData.fileName = &file; + if(hFile != INVALID_HANDLE_VALUE) + { + LARGE_INTEGER fileSize; + if(GetFileSizeEx(hFile, &fileSize)) + { + if(fileSize.QuadPart <= 10485760LL) + { + if(fileSize.QuadPart > 512000LL) + { + _stprintf_s(bufErr, 1024, TranslateT("File size is %dKB, do you realy want to paste such large file?"), fileSize.LowPart / 1024); + if(MessageBox(NULL, bufErr, TranslateT("Are You sure?"), MB_YESNO | MB_ICONQUESTION) != IDYES) + { + CloseHandle(hFile); + return; + } + } + DWORD readed; + fromFileData.contentLen = fileSize.LowPart; + fromFileData.content = (char*)mir_alloc(fromFileData.contentLen); + if(!ReadFile(hFile, fromFileData.content, fromFileData.contentLen, &readed, NULL)) + { + mir_free(fromFileData.content); + fromFileData.content = NULL; + fromFileData.contentLen = 0; + _stprintf_s(bufErr, 1024, TranslateT("Cannot read file '%s'"), file.c_str()); + error = bufErr; + } + } + else + { + error = TranslateT("File size is larger then 10MB, cannot be send"); + } + } + + CloseHandle(hFile); + } + else + { + _stprintf_s(bufErr, 1024, TranslateT("Cannot open file '%s'"), file.c_str()); + error = bufErr; + } + + if(fromFileData.content != NULL) + { + int cbLen = 0; + bool isDefTranslation = true; + if(Options::instance->autoUTF) + { + isDefTranslation = false; + fromFileData.codepage = CP_UTF8; + cbLen = MultiByteToWideChar( fromFileData.codepage, MB_ERR_INVALID_CHARS, fromFileData.content, fromFileData.contentLen, NULL, 0 ); + if(cbLen == 0) + { + int errorN = GetLastError(); + if(errorN == ERROR_NO_UNICODE_TRANSLATION) + { + isDefTranslation = true; + } + } + } + + if(isDefTranslation) + { + fromFileData.codepage = Options::instance->codepage; + if(fromFileData.codepage == 1200 || fromFileData.codepage == 1201) + { + // UTF-16 + cbLen = fromFileData.contentLen / 2; + } + else + { + cbLen = MultiByteToWideChar( fromFileData.codepage, 0, fromFileData.content, fromFileData.contentLen, NULL, 0 ); + } + } + + if(cbLen > 0) + { + fromFileData.contentW = ( wchar_t* )mir_alloc( sizeof( wchar_t )*(cbLen+1)); + if ( fromFileData.contentW != NULL ) + { + if(fromFileData.codepage == 1200) + { + memcpy_s(fromFileData.contentW, sizeof( wchar_t )*(cbLen+1), fromFileData.content, sizeof( wchar_t )*cbLen); + } + else if(fromFileData.codepage == 1201) + { + for(int i = 0 ; i < cbLen; ++i) + { + fromFileData.contentW[i] = (fromFileData.content[i*2] << 8) | fromFileData.content[i*2 + 1]; + } + } + else + { + MultiByteToWideChar( fromFileData.codepage, 0, fromFileData.content, fromFileData.contentLen, fromFileData.contentW, cbLen ); + } + + fromFileData.contentW[ cbLen ] = 0; + fromFileData.page = pageIndex; + if (!Options::instance->confDlg || DialogBoxParam (hInst, MAKEINTRESOURCE(IDD_DLG_FROM_FILE), 0, DlgProcFromFile, (LPARAM)&fromFileData) == IDC_BTN_OK) + { + std::wstring fileName; + std::wstring::size_type pos1 = file.find_last_of(L'\\'); + std::wstring::size_type pos2 = file.find_last_of(L'/'); + if(pos2 > pos1 && pos2 < file.length()) + pos1 = pos2; + if(pos1 >= 0 && pos1 + 1 < file.length()) + fileName = file.substr(pos1 + 1); + else + fileName = file; + SendToServer(fromFileData.contentW, fromFileData.sendFileName ? fileName : L"", fromFileData.format); + } + mir_free(fromFileData.contentW); + } + } + else + { + _stprintf_s(bufErr, 1024, TranslateT("File '%s' is empty"), file.c_str()); + error = bufErr; + } + mir_free(fromFileData.content); + } +} + +extern HANDLE g_hNetlibUser; + +wchar_t* PasteToWeb::SendToWeb(char* url, std::map& headers, std::wstring content) +{ + wchar_t* resCont = NULL; + int cbLen = WideCharToMultiByte( CP_UTF8, 0, content.c_str(), -1, NULL, 0, NULL, NULL ); + char* contentBytes = ( char* )mir_alloc(cbLen); + if ( contentBytes == NULL ) + return resCont; + + WideCharToMultiByte( CP_UTF8, 0, content.c_str(), -1, contentBytes, cbLen, NULL, NULL ); + --cbLen; + + int nHeaders = 0; + for(std::map::iterator it = headers.begin(); it != headers.end(); ++it) + { + ++nHeaders; + } + + NETLIBHTTPREQUEST nlhr={0}; + NETLIBHTTPHEADER* httpHeaders = new NETLIBHTTPHEADER[nHeaders]; + nlhr.cbSize=sizeof(nlhr); + nlhr.requestType=REQUEST_POST; + nlhr.flags=NLHRF_NODUMPSEND|NLHRF_DUMPASTEXT|NLHPIF_HTTP11; + nlhr.szUrl=url; + nlhr.headers = httpHeaders; + nlhr.pData = contentBytes; + nlhr.dataLength = cbLen; + nHeaders = 0; + std::list mallBuf; + for(std::map::iterator it = headers.begin(); it != headers.end(); ++it) + { + char* b1 = new char[it->first.length() + 1]; + char* b2 = new char[it->second.length() + 1]; + strcpy_s(b1, it->first.length() + 1, it->first.c_str()); + strcpy_s(b2, it->second.length() + 1, it->second.c_str()); + httpHeaders[nHeaders].szName = b1; + httpHeaders[nHeaders].szValue = b2; + mallBuf.push_back(b1); + mallBuf.push_back(b2); + ++nHeaders; + } + + nlhr.headersCount = nHeaders; + NETLIBHTTPREQUEST* nlhrReply = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION,(WPARAM)g_hNetlibUser,(LPARAM)&nlhr); + if(nlhrReply != NULL) + { + if(nlhrReply->resultCode == 200) + { + int resLen = MultiByteToWideChar(CP_UTF8, 0, nlhrReply->pData, nlhrReply->dataLength, NULL, 0); + ++resLen; + resCont = ( wchar_t* )mir_alloc(resLen * sizeof(wchar_t)); + if ( resCont != NULL ) + { + resLen = MultiByteToWideChar( CP_UTF8, 0, nlhrReply->pData, nlhrReply->dataLength, resCont, resLen); + resCont[resLen] = 0; + } + } + + CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT,0,(LPARAM)nlhrReply); + } + delete httpHeaders; + for(std::list::iterator it = mallBuf.begin(); it != mallBuf.end(); ++it) + { + delete *it; + } + + mir_free(contentBytes); + return resCont; +} diff --git a/plugins/PasteIt/src/PasteToWeb.h b/plugins/PasteIt/src/PasteToWeb.h new file mode 100644 index 0000000000..51e2141790 --- /dev/null +++ b/plugins/PasteIt/src/PasteToWeb.h @@ -0,0 +1,47 @@ +/* +Paste It plugin +Copyright (C) 2011 Krzysztof Kral + +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 version 2 +of the License. + +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, see . +*/ + +#pragma once + +struct PasteFormat +{ + std::wstring id; + std::wstring name; +}; + +class PasteToWeb +{ +protected: + virtual void SendToServer(std::wstring str, std::wstring fileName, std::wstring format) = 0; + wchar_t* SendToWeb(char* url, std::map& headers, std::wstring content); + PasteToWeb(); + TCHAR bufErr[1024]; +public: + virtual ~PasteToWeb(); + char szFileLink[256]; + TCHAR* error; + void FromClipboard(); + void FromFile(std::wstring file); + virtual TCHAR* GetName() = 0; + virtual void ConfigureSettings() = 0; + int pageIndex; + virtual std::list GetFormats() = 0; + virtual std::list GetDefFormats() = 0; + static const int pages = 2; +}; + diff --git a/plugins/PasteIt/src/PasteToWeb1.cpp b/plugins/PasteIt/src/PasteToWeb1.cpp new file mode 100644 index 0000000000..bbdc2e1ba5 --- /dev/null +++ b/plugins/PasteIt/src/PasteToWeb1.cpp @@ -0,0 +1,393 @@ +/* +Paste It plugin +Copyright (C) 2011 Krzysztof Kral + +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 version 2 +of the License. + +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, see . +*/ + +#include "StdAfx.h" +#include "PasteToWeb1.h" +#include "Options.h" + +PasteFormat PasteToWeb1::formats[] = +{ + {L"4cs", L"4CS"}, + {L"6502acme", L"6502 ACME Cross Assembler"}, + {L"6502kickass", L"6502 Kick Assembler"}, + {L"6502tasm", L"6502 TASM/64TASS"}, + {L"abap", L"ABAP"}, + {L"actionscript", L"ActionScript"}, + {L"actionscript3", L"ActionScript 3"}, + {L"ada", L"Ada"}, + {L"algol68", L"ALGOL 68"}, + {L"apache", L"Apache Log"}, + {L"applescript", L"AppleScript"}, + {L"apt_sources", L"APT Sources"}, + {L"asm", L"ASM (NASM)"}, + {L"asp", L"ASP"}, + {L"autoconf", L"autoconf"}, + {L"autohotkey", L"Autohotkey"}, + {L"autoit", L"AutoIt"}, + {L"avisynth", L"Avisynth"}, + {L"awk", L"Awk"}, + {L"bascomavr", L"BASCOM AVR"}, + {L"bash", L"Bash"}, + {L"basic4gl", L"Basic4GL"}, + {L"bibtex", L"BibTeX"}, + {L"blitzbasic", L"Blitz Basic"}, + {L"bnf", L"BNF"}, + {L"boo", L"BOO"}, + {L"bf", L"BrainFuck"}, + {L"c", L"C"}, + {L"c_mac", L"C for Macs"}, + {L"cil", L"C Intermediate Language"}, + {L"csharp", L"C#"}, + {L"cpp", L"C++"}, + {L"cpp-qt", L"C++ (with QT extensions)"}, + {L"c_loadrunner", L"C: Loadrunner"}, + {L"caddcl", L"CAD DCL"}, + {L"cadlisp", L"CAD Lisp"}, + {L"cfdg", L"CFDG"}, + {L"chaiscript", L"ChaiScript"}, + {L"clojure", L"Clojure"}, + {L"klonec", L"Clone C"}, + {L"klonecpp", L"Clone C++"}, + {L"cmake", L"CMake"}, + {L"cobol", L"COBOL"}, + {L"coffeescript", L"CoffeeScript"}, + {L"cfm", L"ColdFusion"}, + {L"css", L"CSS"}, + {L"cuesheet", L"Cuesheet"}, + {L"d", L"D"}, + {L"dcs", L"DCS"}, + {L"delphi", L"Delphi"}, + {L"oxygene", L"Delphi Prism (Oxygene)"}, + {L"diff", L"Diff"}, + {L"div", L"DIV"}, + {L"dos", L"DOS"}, + {L"dot", L"DOT"}, + {L"e", L"E"}, + {L"ecmascript", L"ECMAScript"}, + {L"eiffel", L"Eiffel"}, + {L"email", L"Email"}, + {L"epc", L"EPC"}, + {L"erlang", L"Erlang"}, + {L"fsharp", L"F#"}, + {L"falcon", L"Falcon"}, + {L"fo", L"FO Language"}, + {L"f1", L"Formula One"}, + {L"fortran", L"Fortran"}, + {L"freebasic", L"FreeBasic"}, + {L"gambas", L"GAMBAS"}, + {L"gml", L"Game Maker"}, + {L"gdb", L"GDB"}, + {L"genero", L"Genero"}, + {L"genie", L"Genie"}, + {L"gettext", L"GetText"}, + {L"go", L"Go"}, + {L"groovy", L"Groovy"}, + {L"gwbasic", L"GwBasic"}, + {L"haskell", L"Haskell"}, + {L"hicest", L"HicEst"}, + {L"hq9plus", L"HQ9 Plus"}, + {L"html4strict", L"HTML"}, + {L"html5", L"HTML 5"}, + {L"icon", L"Icon"}, + {L"idl", L"IDL"}, + {L"ini", L"INI file"}, + {L"inno", L"Inno Script"}, + {L"intercal", L"INTERCAL"}, + {L"io", L"IO"}, + {L"j", L"J"}, + {L"java", L"Java"}, + {L"java5", L"Java 5"}, + {L"javascript", L"JavaScript"}, + {L"jquery", L"jQuery"}, + {L"kixtart", L"KiXtart"}, + {L"latex", L"Latex"}, + {L"lb", L"Liberty BASIC"}, + {L"lsl2", L"Linden Scripting"}, + {L"lisp", L"Lisp"}, + {L"llvm", L"LLVM"}, + {L"locobasic", L"Loco Basic"}, + {L"logtalk", L"Logtalk"}, + {L"lolcode", L"LOL Code"}, + {L"lotusformulas", L"Lotus Formulas"}, + {L"lotusscript", L"Lotus Script"}, + {L"lscript", L"LScript"}, + {L"lua", L"Lua"}, + {L"m68k", L"M68000 Assembler"}, + {L"magiksf", L"MagikSF"}, + {L"make", L"Make"}, + {L"mapbasic", L"MapBasic"}, + {L"matlab", L"MatLab"}, + {L"mirc", L"mIRC"}, + {L"mmix", L"MIX Assembler"}, + {L"modula2", L"Modula 2"}, + {L"modula3", L"Modula 3"}, + {L"68000devpac", L"Motorola 68000 HiSoft Dev"}, + {L"mpasm", L"MPASM"}, + {L"mxml", L"MXML"}, + {L"mysql", L"MySQL"}, + {L"newlisp", L"newLISP"}, + {L"text", L"None"}, + {L"nsis", L"NullSoft Installer"}, + {L"oberon2", L"Oberon 2"}, + {L"objeck", L"Objeck Programming Langua"}, + {L"objc", L"Objective C"}, + {L"ocaml-brief", L"OCalm Brief"}, + {L"ocaml", L"OCaml"}, + {L"pf", L"OpenBSD PACKET FILTER"}, + {L"glsl", L"OpenGL Shading"}, + {L"oobas", L"Openoffice BASIC"}, + {L"oracle11", L"Oracle 11"}, + {L"oracle8", L"Oracle 8"}, + {L"oz", L"Oz"}, + {L"pascal", L"Pascal"}, + {L"pawn", L"PAWN"}, + {L"pcre", L"PCRE"}, + {L"per", L"Per"}, + {L"perl", L"Perl"}, + {L"perl6", L"Perl 6"}, + {L"php", L"PHP"}, + {L"php-brief", L"PHP Brief"}, + {L"pic16", L"Pic 16"}, + {L"pike", L"Pike"}, + {L"pixelbender", L"Pixel Bender"}, + {L"plsql", L"PL/SQL"}, + {L"postgresql", L"PostgreSQL"}, + {L"povray", L"POV-Ray"}, + {L"powershell", L"Power Shell"}, + {L"powerbuilder", L"PowerBuilder"}, + {L"proftpd", L"ProFTPd"}, + {L"progress", L"Progress"}, + {L"prolog", L"Prolog"}, + {L"properties", L"Properties"}, + {L"providex", L"ProvideX"}, + {L"purebasic", L"PureBasic"}, + {L"pycon", L"PyCon"}, + {L"python", L"Python"}, + {L"q", L"q/kdb+"}, + {L"qbasic", L"QBasic"}, + {L"rsplus", L"R"}, + {L"rails", L"Rails"}, + {L"rebol", L"REBOL"}, + {L"reg", L"REG"}, + {L"robots", L"Robots"}, + {L"rpmspec", L"RPM Spec"}, + {L"ruby", L"Ruby"}, + {L"gnuplot", L"Ruby Gnuplot"}, + {L"sas", L"SAS"}, + {L"scala", L"Scala"}, + {L"scheme", L"Scheme"}, + {L"scilab", L"Scilab"}, + {L"sdlbasic", L"SdlBasic"}, + {L"smalltalk", L"Smalltalk"}, + {L"smarty", L"Smarty"}, + {L"sql", L"SQL"}, + {L"systemverilog", L"SystemVerilog"}, + {L"tsql", L"T-SQL"}, + {L"tcl", L"TCL"}, + {L"teraterm", L"Tera Term"}, + {L"thinbasic", L"thinBasic"}, + {L"typoscript", L"TypoScript"}, + {L"unicon", L"Unicon"}, + {L"uscript", L"UnrealScript"}, + {L"vala", L"Vala"}, + {L"vbnet", L"VB.NET"}, + {L"verilog", L"VeriLog"}, + {L"vhdl", L"VHDL"}, + {L"vim", L"VIM"}, + {L"visualprolog", L"Visual Pro Log"}, + {L"vb", L"VisualBasic"}, + {L"visualfoxpro", L"VisualFoxPro"}, + {L"whitespace", L"WhiteSpace"}, + {L"whois", L"WHOIS"}, + {L"winbatch", L"Win Batch"}, + {L"xbasic", L"XBasic"}, + {L"xml", L"XML"}, + {L"xorg_conf", L"Xorg Config"}, + {L"xpp", L"XPP"}, + {L"yaml", L"YAML"}, + {L"z80", L"Z80 Assembler"}, + {L"zxbasic", L"ZXBasic"}, +}; + +PasteFormat PasteToWeb1::defFormats[] = +{ + {L"text", L"None"}, + {L"xml", L"XML"}, + {L"html4strict", L"HTML"}, + {L"html5", L"HTML 5"}, + {L"javascript", L"JavaScript"}, + {L"php", L"PHP"}, + {L"c", L"C"}, + {L"csharp", L"C#"}, + {L"cpp", L"C++"}, + {L"java", L"Java"}, + {L"java5", L"Java 5"}, + {L"ini", L"INI file"}, + {L"css", L"CSS"}, + {L"sql", L"SQL"}, + {L"asm", L"ASM (NASM)"}, + {L"asp", L"ASP"}, + {L"caddcl", L"CAD DCL"}, + {L"cadlisp", L"CAD Lisp"}, + {L"delphi", L"Delphi"}, + {L"diff", L"Diff"}, + {L"jquery", L"jQuery"}, + {L"latex", L"Latex"}, + {L"pascal", L"Pascal"}, + {L"perl", L"Perl"}, + {L"perl6", L"Perl 6"}, + {L"python", L"Python"}, + {L"vbnet", L"VB.NET"}, + {L"vb", L"VisualBasic"}, +}; + +PasteToWeb1::PasteToWeb1() +{ +} + + +PasteToWeb1::~PasteToWeb1() +{ +} + +void PasteToWeb1::SendToServer(std::wstring str, std::wstring fileName, std::wstring format) +{ + std::map headers; + headers["Content-Type"] = "application/x-www-form-urlencoded"; + std::wstring content = _T("api_option=paste&api_paste_private="); + content += Options::instance->webOptions[pageIndex]->publicPaste ? _T("0") : _T("1"); + content += _T("&api_paste_expire_date="); + content += Options::instance->webOptions[pageIndex]->combo1.empty() ? _T("1M") : Options::instance->webOptions[pageIndex]->combo1; + content += _T("&api_dev_key=dcba056bf9cc71729fdad76dddcb0dcd&api_paste_format="); + content += format; + if(!Options::instance->webOptions[pageIndex]->pastebinUserKey.empty()) + { + content += _T("&api_user_key="); + content += Options::instance->webOptions[pageIndex]->pastebinUserKey; + } + content += _T("&api_paste_code="); + for(std::wstring::iterator it = str.begin(); it != str.end(); ++it) + { + if(*it == L'%') + { + content += L"%25"; + } + else if(*it ==L'&') + { + content += L"%26"; + } + else if(*it ==L'=') + { + content += L"%3D"; + } + else + { + content += *it; + } + } + + wchar_t* resCont = SendToWeb("http://pastebin.com/api/api_post.php", headers, content); + if(resCont != NULL) + { + if(memcmp(L"Bad API request, ", resCont, 17 * sizeof(wchar_t)) == 0) + { + _stprintf_s(bufErr, 1024, TranslateT("Error during sending text to web page: %s"), resCont + 17); + error = bufErr; + } + else + { + char* s = mir_u2a_cp(resCont, CP_ACP); + strcpy_s(szFileLink, 256, s); + mir_free(s); + } + mir_free(resCont); + } + else + { + error = TranslateT("Error during sending text to web page"); + } +} + +std::wstring PasteToWeb1::GetUserKey(std::wstring& user, std::wstring& password) +{ + std::map headers; + headers["Content-Type"] = "application/x-www-form-urlencoded"; + std::wstring content = _T("api_user_name="); + content += user; + content += _T("&api_user_password="); + content += password; + content += _T("&api_dev_key=dcba056bf9cc71729fdad76dddcb0dcd"); + wchar_t* resCont = SendToWeb("http://pastebin.com/api/api_login.php", headers, content); + std::wstring toRet; + if(resCont != NULL) + { + if(memcmp(L"Bad API request, ", resCont, 17 * sizeof(wchar_t)) == 0) + { + _stprintf_s(bufErr, 1024, TranslateT("Error during getting user key from web page: %s"), resCont + 17); + MessageBox(NULL, bufErr, TranslateT("Error"), MB_OK | MB_ICONERROR); + } + else + toRet = resCont; + mir_free(resCont); + } + + return toRet; +} + +std::list PasteToWeb1::GetFormats() +{ + int count = sizeof(formats) / sizeof(formats[0]); + std::list ret(formats, formats + count); + + return ret; +} + +std::list PasteToWeb1::GetDefFormats() +{ + int count = sizeof(defFormats) / sizeof(defFormats[0]); + std::list ret(defFormats, defFormats + count); + + return ret; +} + +void PasteToWeb1::ConfigureSettings() +{ + Options::instance->webOptions[pageIndex]->isSendFileName = false; + Options::instance->webOptions[pageIndex]->isPublicPaste = true; + Options::instance->webOptions[pageIndex]->isCombo1 = true; + Options::instance->webOptions[pageIndex]->combo1Desc = TranslateT("Paste expire date"); + PasteFormat pf; + pf.id = L"N"; + pf.name = TranslateT("Never"); + Options::instance->webOptions[pageIndex]->combo1Values.push_back(pf); + pf.id = L"10M"; + pf.name = TranslateT("10 minutes"); + Options::instance->webOptions[pageIndex]->combo1Values.push_back(pf); + pf.id = L"1H"; + pf.name = TranslateT("1 hour"); + Options::instance->webOptions[pageIndex]->combo1Values.push_back(pf); + pf.id = L"1D"; + pf.name = TranslateT("1 day"); + Options::instance->webOptions[pageIndex]->combo1Values.push_back(pf); + pf.id = L"1M"; + pf.name = TranslateT("1 month"); + Options::instance->webOptions[pageIndex]->combo1Values.push_back(pf); + Options::instance->webOptions[pageIndex]->combo1 = L"1M"; + Options::instance->webOptions[pageIndex]->isPastebin = true; +} + diff --git a/plugins/PasteIt/src/PasteToWeb1.h b/plugins/PasteIt/src/PasteToWeb1.h new file mode 100644 index 0000000000..b1611855d6 --- /dev/null +++ b/plugins/PasteIt/src/PasteToWeb1.h @@ -0,0 +1,40 @@ +/* +Paste It plugin +Copyright (C) 2011 Krzysztof Kral + +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 version 2 +of the License. + +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, see . +*/ + +#pragma once +#include "pastetoweb.h" +class PasteToWeb1 : + public PasteToWeb +{ +protected: + virtual void SendToServer(std::wstring str, std::wstring fileName, std::wstring format); + static PasteFormat formats[]; + static PasteFormat defFormats[]; +public: + PasteToWeb1(); + virtual ~PasteToWeb1(); + virtual TCHAR* GetName() + { + return _T("pastebin.com"); + } + virtual void ConfigureSettings(); + virtual std::list GetFormats(); + virtual std::list GetDefFormats(); + std::wstring GetUserKey(std::wstring& user, std::wstring& password); +}; + diff --git a/plugins/PasteIt/src/PasteToWeb2.cpp b/plugins/PasteIt/src/PasteToWeb2.cpp new file mode 100644 index 0000000000..c2edbddeef --- /dev/null +++ b/plugins/PasteIt/src/PasteToWeb2.cpp @@ -0,0 +1,247 @@ +/* +Paste It plugin +Copyright (C) 2011 Krzysztof Kral + +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 version 2 +of the License. + +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, see . +*/ + +#include "StdAfx.h" +#include "PasteToWeb2.h" + +PasteFormat PasteToWeb2::defFormats[] = +{ + {L"text", L"Text"}, + {L"xml", L"XML"}, + {L"html", L"HTML"}, + {L"js", L"JavaScript"}, + {L"php", L"PHP"}, + {L"c", L"C"}, + {L"csharp", L"C#"}, + {L"cpp", L"C++"}, + {L"java", L"Java"}, + {L"ini", L"INI"}, + {L"css", L"CSS"}, + {L"sql", L"SQL"}, + {L"nasm", L"NASM"}, + {L"delphi", L"Delphi"}, + {L"diff", L"Diff"}, + {L"tex", L"TeX"}, + {L"perl", L"Perl"}, + {L"python", L"Python"}, + {L"vb.net", L"VB.net"} +}; + +PasteToWeb2::PasteToWeb2() +{ +} + + +PasteToWeb2::~PasteToWeb2() +{ +} + +void PasteToWeb2::SendToServer(std::wstring str, std::wstring fileName, std::wstring format) +{ + std::map headers; + headers["Content-Type"] = "text/xml"; + std::wstring content = _T("\r\ncreate_paste"); + if(fileName == L"") + { + content += format; + content += _T(""); + } + else + { + content += _T(""); + } + for(std::wstring::iterator it = str.begin(); it != str.end(); ++it) + { + if(*it == L'&') + { + content += L"&"; + } + else if(*it ==L'<') + { + content += L"<"; + } + else + { + content += *it; + } + } + + content += _T(""); + if(fileName != L"") + { + for(std::wstring::iterator it = fileName.begin(); it != fileName.end(); ++it) + { + if(*it == L'&') + { + content += L"&"; + } + else if(*it ==L'<') + { + content += L"<"; + } + else + { + content += *it; + } + } + } + content += _T("1.5"); + + wchar_t* resCont = SendToWeb("http://wklej.to/api/", headers, content); + error = TranslateT("Error during sending text to web page"); + if(resCont != NULL) + { + HXML hXml = xi.parseString(resCont, NULL, _T("methodResponse")); + if(hXml != NULL) + { + HXML node = xi.getChildByPath(hXml, _T("params/param/value/array/data/value/int"), 0); + if(node != NULL && !_tcscmp(xi.getText(node), _T("1"))) + { + node = xi.getChildByPath(hXml, _T("params/param/value/array/data"), 0); + if(node != NULL) + { + node = xi.getNthChild(node, _T("value"), 1); + if(node != NULL) + { + node = xi.getChildByPath(node, _T("string"), 0); + if(node != NULL) + { + char* s = mir_t2a_cp(xi.getText(node), CP_ACP); + strcpy_s(szFileLink, 256, s); + mir_free(s); + error = NULL; + } + } + } + } + xi.destroyNode(hXml); + } + mir_free(resCont); + } +} + +std::list PasteToWeb2::GetFormats() +{ + std::list ret; + + std::map headers; + headers["Content-Type"] = "text/xml"; + std::wstring content = _T("\r\ntypes"); + + wchar_t* resCont = SendToWeb("http://wklej.to/api/", headers, content); + if(resCont != NULL) + { + HXML hXml = xi.parseString(resCont, NULL, _T("methodResponse")); + if(hXml != NULL) + { + HXML node = xi.getChildByPath(hXml, _T("params/param/value/array/data/value/int"), 0); + if(node != NULL && !_tcscmp(xi.getText(node), _T("1"))) + { + node = xi.getChildByPath(hXml, _T("params/param/value/array/data"), 0); + if(node != NULL) + { + node = xi.getNthChild(node, _T("value"), 1); + if(node != NULL) + { + node = xi.getChildByPath(node, _T("string"), 0); + if(node != NULL) + { + std::wstring str = xi.getText(node); + std::wstring::size_type pos = str.find(L'\n'); + if(pos < str.length()) + { + str = str.substr(pos + 1); + } + pos = str.find(L'\n'); + if(pos < str.length()) + { + str = str.substr(pos + 1); + } + pos = str.find(L'\n'); + while(pos < str.length()) + { + std::wstring line = str.substr(0, pos); + std::wstring::size_type sep = line.find(L':'); + if(sep < line.length()) + { + PasteFormat pf; + pf.name = line.substr(0, sep); + std::wstring::size_type sep2 = line.find(L','); + if(sep2 < line.length()) + { + pf.id = line.substr(sep + 2, sep2 - sep - 2); + } + else + { + pf.id = line.substr(sep + 2); + } + ret.push_back(pf); + } + + if(pos < str.length() - 1) + { + str = str.substr(pos + 1); + } + else + { + str = L""; + } + pos = str.find(L'\n'); + } + { + std::wstring line = str; + std::wstring::size_type sep = line.find(L':'); + if(sep < line.length()) + { + PasteFormat pf; + pf.name = line.substr(0, sep); + std::wstring::size_type sep2 = line.find(L','); + if(sep2 < line.length()) + { + pf.id = line.substr(sep + 2, sep2 - sep - 2); + } + else + { + pf.id = line.substr(sep + 2); + } + ret.push_back(pf); + } + } + } + } + } + } + xi.destroyNode(hXml); + } + mir_free(resCont); + } + + return ret; +} + +std::list PasteToWeb2::GetDefFormats() +{ + int count = sizeof(defFormats) / sizeof(defFormats[0]); + std::list ret(defFormats, defFormats + count); + + return ret; +} + +void PasteToWeb2::ConfigureSettings() +{ +} diff --git a/plugins/PasteIt/src/PasteToWeb2.h b/plugins/PasteIt/src/PasteToWeb2.h new file mode 100644 index 0000000000..364c6eb4e4 --- /dev/null +++ b/plugins/PasteIt/src/PasteToWeb2.h @@ -0,0 +1,38 @@ +/* +Paste It plugin +Copyright (C) 2011 Krzysztof Kral + +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 version 2 +of the License. + +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, see . +*/ + +#pragma once +#include "pastetoweb.h" +class PasteToWeb2 : + public PasteToWeb +{ +protected: + virtual void SendToServer(std::wstring str, std::wstring fileName, std::wstring format); + static PasteFormat defFormats[]; +public: + PasteToWeb2(); + virtual ~PasteToWeb2(); + virtual TCHAR* GetName() + { + return _T("wklej.to"); + } + virtual void ConfigureSettings(); + virtual std::list GetFormats(); + virtual std::list GetDefFormats(); +}; + diff --git a/plugins/PasteIt/src/resource.h b/plugins/PasteIt/src/resource.h new file mode 100644 index 0000000000..cbfa566679 --- /dev/null +++ b/plugins/PasteIt/src/resource.h @@ -0,0 +1,50 @@ + +#define IDD_OPT_MAIN 101 +#define IDD_DLG_FROM_CLIPBOARD 102 +#define IDD_DLG_FROM_FILE 103 +#define IDD_OPT_PAGES 104 +#define IDD_DLG_CONFIGURE 105 +#define IDD_DLG_PASTEBIN_LOGIN 106 +#define IDC_WEBLIST 1001 +#define IDC_CONFDLG 1002 +#define IDC_AUTOSEND 1003 +#define IDC_CODEPAGE 1004 +#define IDC_AUTOUTF 1005 +#define IDC_CLIPBOARD_DATA 1006 +#define IDC_BTN_OK 1007 +#define IDC_FILE_DATA 1008 +#define IDC_FILE_PATH 1009 +#define IDC_RECODE 1010 +#define IDC_WEBPAGE 1011 +#define IDC_DEFFORMAT 1012 +#define IDC_AUTOFORMAT 1013 +#define IDC_CONFIGURE 1014 +#define IDC_FORMATTING 1015 +#define IDC_RESTORE 1016 +#define IDC_DOWNLOAD 1017 +#define IDC_DELETE 1018 +#define IDC_UP 1019 +#define IDC_DOWN 1020 +#define IDC_FORMAT 1021 +#define IDC_FORMATTEXT 1022 +#define IDC_PUBLICPASTE 1023 +#define IDC_COMBO1 1024 +#define IDC_COMBO1_DESC 1025 +#define IDC_GUEST 1026 +#define IDC_PASTEBIN_KEY 1027 +#define IDC_PASTEBIN_KEY_DESC 1028 +#define IDC_PASTEBIN_LOGIN 1029 +#define IDC_PASTEBIN_USER 1031 +#define IDC_PASTEBIN_PASSWORD 1032 +#define IDI_MENU 20000 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 107 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1033 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/plugins/PasteIt/src/stdafx.h b/plugins/PasteIt/src/stdafx.h new file mode 100644 index 0000000000..2be1eff36d --- /dev/null +++ b/plugins/PasteIt/src/stdafx.h @@ -0,0 +1,42 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#pragma once + +#include "targetver.h" + +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +// Windows Header Files: +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#define MIRANDA_VER 0x0A00 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "m_msg_buttonsbar.h" diff --git a/plugins/PasteIt/src/targetver.h b/plugins/PasteIt/src/targetver.h new file mode 100644 index 0000000000..90e767bfce --- /dev/null +++ b/plugins/PasteIt/src/targetver.h @@ -0,0 +1,8 @@ +#pragma once + +// Including SDKDDKVer.h defines the highest available Windows platform. + +// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and +// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. + +#include diff --git a/plugins/PasteIt/src/version.h b/plugins/PasteIt/src/version.h new file mode 100644 index 0000000000..e7d016c0a4 --- /dev/null +++ b/plugins/PasteIt/src/version.h @@ -0,0 +1,20 @@ +#define __MAJOR_VERSION 1 +#define __MINOR_VERSION 0 +#define __RELEASE_NUM 0 +#define __BUILD_NUM 3 + +#define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM +#define __FILEVERSION_DOTS __MAJOR_VERSION.__MINOR_VERSION.__RELEASE_NUM.__BUILD_NUM + +#define __STRINGIFY_IMPL(x) #x +#define __STRINGIFY(x) __STRINGIFY_IMPL(x) +#define __VERSION_STRING __STRINGIFY(__FILEVERSION_DOTS) + +#define __PLUGIN_NAME "Paste It" +#define __INTERNAL_NAME "PasteIt" +#define __FILENAME "PasteIt.dll" +#define __DESCRIPTION "Uploads the text to web page and sends the URL to your friends." +#define __AUTHOR "Krzysztof Kral" +#define __AUTHOREMAIL "programista@poczta.of.pl" +#define __AUTHORWEB "http://programista.free.of.pl/miranda/" +#define __COPYRIGHT "Copyright (c) 2011 KrzysztofKral" diff --git a/plugins/PasteIt/stdafx.h b/plugins/PasteIt/stdafx.h deleted file mode 100644 index 2be1eff36d..0000000000 --- a/plugins/PasteIt/stdafx.h +++ /dev/null @@ -1,42 +0,0 @@ -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, but -// are changed infrequently -// - -#pragma once - -#include "targetver.h" - -#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers -// Windows Header Files: -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#define MIRANDA_VER 0x0A00 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "m_msg_buttonsbar.h" diff --git a/plugins/PasteIt/targetver.h b/plugins/PasteIt/targetver.h deleted file mode 100644 index 90e767bfce..0000000000 --- a/plugins/PasteIt/targetver.h +++ /dev/null @@ -1,8 +0,0 @@ -#pragma once - -// Including SDKDDKVer.h defines the highest available Windows platform. - -// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and -// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. - -#include diff --git a/plugins/PasteIt/version.h b/plugins/PasteIt/version.h deleted file mode 100644 index e7d016c0a4..0000000000 --- a/plugins/PasteIt/version.h +++ /dev/null @@ -1,20 +0,0 @@ -#define __MAJOR_VERSION 1 -#define __MINOR_VERSION 0 -#define __RELEASE_NUM 0 -#define __BUILD_NUM 3 - -#define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM -#define __FILEVERSION_DOTS __MAJOR_VERSION.__MINOR_VERSION.__RELEASE_NUM.__BUILD_NUM - -#define __STRINGIFY_IMPL(x) #x -#define __STRINGIFY(x) __STRINGIFY_IMPL(x) -#define __VERSION_STRING __STRINGIFY(__FILEVERSION_DOTS) - -#define __PLUGIN_NAME "Paste It" -#define __INTERNAL_NAME "PasteIt" -#define __FILENAME "PasteIt.dll" -#define __DESCRIPTION "Uploads the text to web page and sends the URL to your friends." -#define __AUTHOR "Krzysztof Kral" -#define __AUTHOREMAIL "programista@poczta.of.pl" -#define __AUTHORWEB "http://programista.free.of.pl/miranda/" -#define __COPYRIGHT "Copyright (c) 2011 KrzysztofKral" diff --git a/plugins/PasteIt/version.rc b/plugins/PasteIt/version.rc deleted file mode 100644 index 5c39da0829..0000000000 --- a/plugins/PasteIt/version.rc +++ /dev/null @@ -1,40 +0,0 @@ -#ifdef APSTUDIO_INVOKED -#error this file is not editable by Microsoft Visual C++ -#endif //APSTUDIO_INVOKED - -#include -#include "version.h" - -VS_VERSION_INFO VERSIONINFO - FILEVERSION __FILEVERSION_STRING - PRODUCTVERSION __FILEVERSION_STRING - FILEFLAGSMASK VS_FFI_FILEFLAGSMASK -#ifdef _DEBUG - FILEFLAGS VS_FF_DEBUG -#else - FILEFLAGS 0x0L -#endif - FILEOS VOS_NT_WINDOWS32 - FILETYPE VFT_DLL - FILESUBTYPE VFT2_UNKNOWN -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "000004b0" - BEGIN - VALUE "Author", "Krzysztof Kral" - VALUE "CompanyName", "Krzysztof Kral" - VALUE "FileDescription", __DESCRIPTION - VALUE "FileVersion", __VERSION_STRING - VALUE "InternalName", __INTERNAL_NAME - VALUE "LegalCopyright", __COPYRIGHT - VALUE "OriginalFilename", __FILENAME - VALUE "ProductName", __PLUGIN_NAME - VALUE "ProductVersion", __VERSION_STRING - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x0, 1200 - END -END diff --git a/plugins/Popup/PopUp_10.vcxproj b/plugins/Popup/PopUp_10.vcxproj index d58d67ad27..e58bc2812a 100644 --- a/plugins/Popup/PopUp_10.vcxproj +++ b/plugins/Popup/PopUp_10.vcxproj @@ -73,7 +73,7 @@ Disabled ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_WINDOWS;_USRDLL;POPUP_EXPORTS;MTEXT_NOHELPERS;_UNICODE;UNICODE;%(PreprocessorDefinitions) + WIN32;_DEBUG;_WINDOWS;_USRDLL;MTEXT_NOHELPERS;%(PreprocessorDefinitions) MultiThreadedDebugDLL Use headers.h @@ -98,7 +98,7 @@ Disabled ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - WIN64;_DEBUG;_WINDOWS;_USRDLL;POPUP_EXPORTS;MTEXT_NOHELPERS;_UNICODE;UNICODE;%(PreprocessorDefinitions) + WIN64;_DEBUG;_WINDOWS;_USRDLL;MTEXT_NOHELPERS;%(PreprocessorDefinitions) MultiThreadedDebugDLL Use headers.h @@ -123,7 +123,7 @@ Full OnlyExplicitInline ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_WINDOWS;_USRDLL;POPUP_EXPORTS;MTEXT_NOHELPERS;_UNICODE;UNICODE;%(PreprocessorDefinitions) + WIN32;NDEBUG;_WINDOWS;_USRDLL;MTEXT_NOHELPERS;%(PreprocessorDefinitions) true true Use @@ -152,7 +152,7 @@ Full OnlyExplicitInline ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - WIN64;NDEBUG;_WINDOWS;_USRDLL;POPUP_EXPORTS;MTEXT_NOHELPERS;_UNICODE;UNICODE;%(PreprocessorDefinitions) + WIN64;NDEBUG;_WINDOWS;_USRDLL;MTEXT_NOHELPERS;%(PreprocessorDefinitions) true true Use @@ -223,7 +223,7 @@ - + @@ -238,46 +238,11 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + diff --git a/plugins/Popup/PopUp_10.vcxproj.filters b/plugins/Popup/PopUp_10.vcxproj.filters index 1fe3cb9eca..0823317a3f 100644 --- a/plugins/Popup/PopUp_10.vcxproj.filters +++ b/plugins/Popup/PopUp_10.vcxproj.filters @@ -9,17 +9,10 @@ {58b87470-6530-4485-8a11-2b34996c3d54} h;hpp;hxx;hm;inl - - {0fd67b29-f530-424d-a3c6-9cff1c322fe9} - {19999220-077c-4521-b4e8-e28baf26ea12} ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe - - {2c54b55f-1f99-474e-99ef-34c8f4210772} - txt - {529f787f-6a3b-402b-8451-73ab712c2fd5} @@ -153,7 +146,7 @@ Header Files - + Header Files @@ -198,116 +191,15 @@ Header Files - + Header Files - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - docs - - - docs - - - - + Resource Files - + Resource Files diff --git a/plugins/Popup/PopUp_10.vcxproj.user b/plugins/Popup/PopUp_10.vcxproj.user new file mode 100644 index 0000000000..695b5c78b9 --- /dev/null +++ b/plugins/Popup/PopUp_10.vcxproj.user @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/plugins/Popup/docs/popup-translation.txt b/plugins/Popup/docs/popup-translation.txt new file mode 100644 index 0000000000..e97f268222 --- /dev/null +++ b/plugins/Popup/docs/popup-translation.txt @@ -0,0 +1,187 @@ +; Common strings that belong to many files +;[Failed to register %s class.] +;[General] +;[Ignore fullscreen] +;[Maximum width] +;[Popup History] +;[Skins] + +; ../../plugins/Popup/resource.rc +;[* - built-in skins] +;[-1 = Infinite] +;[0 = Default] +;[Add default actions for contacts only] +;[Add info && menu for IM contacts only] +;[Always (has priority)] +;[Avatar size:] +;[Avatars] +;[Close] +;[Colors can be configured in\r\nCustomize > Fonts && Colors] +;[Common Actions] +;[Configure popup area] +;[Content && Style] +;[Debug] +;[Default Timeout] +;[Desktop] +;[Disable if message window is open] +;[Disable when global status is...] +;[Disable when relevant protocol's status is...] +;[Disable when:] +;[Distance between popups] +;[Do not close hovered popups] +;[Don't close popups on default actions] +;[Download more skins] +;[Draw avatar borders] +;[Draw borders for semitransparent avatars too] +;[Dynamically resize the popups] +;[Effect:] +;[Effects] +;[Enable Win 9x/Me transparency] +;[Enable avatar updates] +;[Enable popup actions] +;[Enable popup history] +;[Enable this notification] +;[Fullscreen mode] +;[General options] +;[Go to Customize > Fonts && Colors for fonts and colors options] +;[History] +;[Icons aligned to the right] +;[Icons and labels below text] +;[Icons on the left] +;[Infinite popup delay] +;[Layout:] +;[Left click action:] +;[LeftButton] +;[Limit window amount to:] +;[Live Preview] +;[MiddleButton] +;[Minimum width] +;[Miranda's window] +;[Miscellaneous] +;[More...] +;[Mouse Actions Overwrite] +;[Multimonitor (98/ME/2000/XP)] +;[Never show] +;[Notifications] +;[Opaque popups under cursor] +;[Per-contact settings] +;[Please choose in what cases default actions should be added:] +;[Popup Actions are those tiny buttons below notification text.] +;[Popup Area] +;[Popup actions will be displayed as:] +;[Popup delay:] +;[Popup timeout:] +;[Position:] +;[Preview] +;[R] +;[Reorder Popups] +;[Right click action:] +;[RightButton] +;[Round corners by] +;[Sec] +;[Show Actions: (requires apply)] +;[Show always] +;[Show default] +;[Size && Position] +;[Skin options] +;[Slide Popup] +;[Start the popups in the monitor with] +;[Store last] +;[Time (in):] +;[Time (out):] +;[Transparency] +;[Use History++ to render log] +;[Use large icons] +;[Use transparency (Windows 2000+)] +;[events] +;[ms] +;[opacity:] +;[pixel(s)] +;[pixels] +;[seconds] +;[the active window] + +; ../../plugins/Popup/src/actions.cpp +;[Action] +;[Contact menu] +;[Copy to clipboard] +;[Dismiss popup] +;[Pin popup] +;[Quick reply] +;[Send message] +;[User details] +;[no overwrite] + +; ../../plugins/Popup/src/bitmap_funcs.cpp +;[You need the png2dib plugin v. 0.1.3.x or later to process PNG images] + +; ../../plugins/Popup/src/config.cpp +;[Test preview for the popup plugin settings. This is supposed to be long enough not to fit in one line...] +;[The Jabberwocky] +;[This is a notification message] +;[This is a warning message] +;[This is an error message] + +; ../../plugins/Popup/src/history.cpp +;[Popup History is disabled] +;[Popup History message] + +; ../../plugins/Popup/src/main.cpp +;[Actions] +;[Advanced] +;[Classes] +;[Contacts] +;[Disable &popup module] +;[Disable popups] +;[Enable &popup module] +;[Enable popups] +;[Popups are disabled] +;[Popups are enabled] +;[Toggle Popups] + +; ../../plugins/Popup/src/opt_adv.cpp +;[%d%%] +;[Fade in/out] +;[No effect] + +; ../../plugins/Popup/src/opt_class.cpp +;[Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn!] + +; ../../plugins/Popup/src/opt_gen.cpp +;[Popup Plus Warning] +;[Width] +;[You cannot specify a value lower than %d and higher than %d.] +;[horizontal] +;[lower left corner] +;[lower right corner] +;[upper left corner] +;[upper right corner] +;[vertical] + +; ../../plugins/Popup/src/opt_skins.cpp +;[Drop shadow effect (Windows XP+)] +;[Drop shadow effect (Windows XP+)/non rectangular] +;[Enable Aero Glass (Vista+)] +;[Just take a look at this skin... ;)] +;[Refresh List] +;[Show clock] +;[Skin preview] +;[Use Windows colours] +;[Use advanced text render] + +; ../../plugins/Popup/src/popup_wnd2.cpp +;[Failed to GetClassInfoExW from EDIT class.] + +; ../../plugins/Popup/src/services.cpp +;[Error] +;[Notify] +;[Warning] + +; ../../plugins/Popup/src/srmm_menu.cpp +;[Auto] +;[Block] +;[Favourite] +;[Popup Mode: Auto] +;[Popup Mode: Block contact] +;[Popup Mode: Favourite] +;[Popup Mode: Ignore fullscreen] diff --git a/plugins/Popup/docs/whatsnew.txt b/plugins/Popup/docs/whatsnew.txt new file mode 100644 index 0000000000..63b0bd2abf --- /dev/null +++ b/plugins/Popup/docs/whatsnew.txt @@ -0,0 +1,15 @@ +The new Popup Team welcomes you. +Due to the huge amount of changes we advice you to use the "Reset" button below. + +Your advantages from new version: +- seperate unicode release +- seperate x64 unicode release +- skins moved to official folder (%miranda%/skins/popup) +- reworked/fixed option pages +- fixes in quickreply (unicode and empty messages) +- user color for avatar border +- support to customize/overwrite the 3 main mouse buttons +- Hotkey and ModernToolbar support +- be ready for updates in other plugins + +Many more changes have been done on programmer side. Checkout the changelog for details. \ No newline at end of file diff --git a/plugins/Popup/popup-translation.txt b/plugins/Popup/popup-translation.txt deleted file mode 100644 index e97f268222..0000000000 --- a/plugins/Popup/popup-translation.txt +++ /dev/null @@ -1,187 +0,0 @@ -; Common strings that belong to many files -;[Failed to register %s class.] -;[General] -;[Ignore fullscreen] -;[Maximum width] -;[Popup History] -;[Skins] - -; ../../plugins/Popup/resource.rc -;[* - built-in skins] -;[-1 = Infinite] -;[0 = Default] -;[Add default actions for contacts only] -;[Add info && menu for IM contacts only] -;[Always (has priority)] -;[Avatar size:] -;[Avatars] -;[Close] -;[Colors can be configured in\r\nCustomize > Fonts && Colors] -;[Common Actions] -;[Configure popup area] -;[Content && Style] -;[Debug] -;[Default Timeout] -;[Desktop] -;[Disable if message window is open] -;[Disable when global status is...] -;[Disable when relevant protocol's status is...] -;[Disable when:] -;[Distance between popups] -;[Do not close hovered popups] -;[Don't close popups on default actions] -;[Download more skins] -;[Draw avatar borders] -;[Draw borders for semitransparent avatars too] -;[Dynamically resize the popups] -;[Effect:] -;[Effects] -;[Enable Win 9x/Me transparency] -;[Enable avatar updates] -;[Enable popup actions] -;[Enable popup history] -;[Enable this notification] -;[Fullscreen mode] -;[General options] -;[Go to Customize > Fonts && Colors for fonts and colors options] -;[History] -;[Icons aligned to the right] -;[Icons and labels below text] -;[Icons on the left] -;[Infinite popup delay] -;[Layout:] -;[Left click action:] -;[LeftButton] -;[Limit window amount to:] -;[Live Preview] -;[MiddleButton] -;[Minimum width] -;[Miranda's window] -;[Miscellaneous] -;[More...] -;[Mouse Actions Overwrite] -;[Multimonitor (98/ME/2000/XP)] -;[Never show] -;[Notifications] -;[Opaque popups under cursor] -;[Per-contact settings] -;[Please choose in what cases default actions should be added:] -;[Popup Actions are those tiny buttons below notification text.] -;[Popup Area] -;[Popup actions will be displayed as:] -;[Popup delay:] -;[Popup timeout:] -;[Position:] -;[Preview] -;[R] -;[Reorder Popups] -;[Right click action:] -;[RightButton] -;[Round corners by] -;[Sec] -;[Show Actions: (requires apply)] -;[Show always] -;[Show default] -;[Size && Position] -;[Skin options] -;[Slide Popup] -;[Start the popups in the monitor with] -;[Store last] -;[Time (in):] -;[Time (out):] -;[Transparency] -;[Use History++ to render log] -;[Use large icons] -;[Use transparency (Windows 2000+)] -;[events] -;[ms] -;[opacity:] -;[pixel(s)] -;[pixels] -;[seconds] -;[the active window] - -; ../../plugins/Popup/src/actions.cpp -;[Action] -;[Contact menu] -;[Copy to clipboard] -;[Dismiss popup] -;[Pin popup] -;[Quick reply] -;[Send message] -;[User details] -;[no overwrite] - -; ../../plugins/Popup/src/bitmap_funcs.cpp -;[You need the png2dib plugin v. 0.1.3.x or later to process PNG images] - -; ../../plugins/Popup/src/config.cpp -;[Test preview for the popup plugin settings. This is supposed to be long enough not to fit in one line...] -;[The Jabberwocky] -;[This is a notification message] -;[This is a warning message] -;[This is an error message] - -; ../../plugins/Popup/src/history.cpp -;[Popup History is disabled] -;[Popup History message] - -; ../../plugins/Popup/src/main.cpp -;[Actions] -;[Advanced] -;[Classes] -;[Contacts] -;[Disable &popup module] -;[Disable popups] -;[Enable &popup module] -;[Enable popups] -;[Popups are disabled] -;[Popups are enabled] -;[Toggle Popups] - -; ../../plugins/Popup/src/opt_adv.cpp -;[%d%%] -;[Fade in/out] -;[No effect] - -; ../../plugins/Popup/src/opt_class.cpp -;[Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn!] - -; ../../plugins/Popup/src/opt_gen.cpp -;[Popup Plus Warning] -;[Width] -;[You cannot specify a value lower than %d and higher than %d.] -;[horizontal] -;[lower left corner] -;[lower right corner] -;[upper left corner] -;[upper right corner] -;[vertical] - -; ../../plugins/Popup/src/opt_skins.cpp -;[Drop shadow effect (Windows XP+)] -;[Drop shadow effect (Windows XP+)/non rectangular] -;[Enable Aero Glass (Vista+)] -;[Just take a look at this skin... ;)] -;[Refresh List] -;[Show clock] -;[Skin preview] -;[Use Windows colours] -;[Use advanced text render] - -; ../../plugins/Popup/src/popup_wnd2.cpp -;[Failed to GetClassInfoExW from EDIT class.] - -; ../../plugins/Popup/src/services.cpp -;[Error] -;[Notify] -;[Warning] - -; ../../plugins/Popup/src/srmm_menu.cpp -;[Auto] -;[Block] -;[Favourite] -;[Popup Mode: Auto] -;[Popup Mode: Block contact] -;[Popup Mode: Favourite] -;[Popup Mode: Ignore fullscreen] diff --git a/plugins/Popup/res/img.ico b/plugins/Popup/res/img.ico deleted file mode 100644 index fef70bdd1e..0000000000 Binary files a/plugins/Popup/res/img.ico and /dev/null differ diff --git a/plugins/Popup/res/popup_plus.ico b/plugins/Popup/res/popup_plus.ico deleted file mode 100644 index 37ddc85035..0000000000 Binary files a/plugins/Popup/res/popup_plus.ico and /dev/null differ diff --git a/plugins/Popup/res/resource.rc b/plugins/Popup/res/resource.rc new file mode 100644 index 0000000000..6eada48e5d --- /dev/null +++ b/plugins/Popup/res/resource.rc @@ -0,0 +1,418 @@ +// Microsoft Visual C++ generated resource script. +// +#include "..\src\resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "winres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// Íåéòðàëüíûé resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU) +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +#pragma code_page(1251) + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_POPUP ICON "popup.ico" +IDI_PU_FULLSCREEN ICON "popup_fs.ico" +IDI_PU_FAVOURITE ICON "popup_fav.ico" +IDI_NOPOPUP ICON "popup_no.ico" +IDI_HISTORY ICON "popup_history.ico" +IDI_RELOAD ICON "reload.ico" +IDI_OPT_CHECK_OFF ICON "Check_off.ico" +IDI_OPT_CHECK_ON ICON "Check_on.ico" +IDI_OPT_RADIO_OFF ICON "Radio_off.ico" +IDI_OPT_RADIO_ON ICON "Radio_on.ico" +IDI_ACT_INFO ICON "info.ico" +IDI_ACT_MENU ICON "menu.ico" +IDI_ACT_MESSAGE ICON "message.ico" +IDI_ACT_OK ICON "ok.ico" +IDI_ACT_ADD ICON "add.ico" +IDI_ACT_CLOSE ICON "close.ico" +IDI_ACT_PINNED ICON "pinned.ico" +IDI_ACT_PIN ICON "pin.ico" +IDI_RESIZE ICON "resize.ico" +IDI_MB_STOP ICON "error.ico" +IDI_MB_INFO ICON "notify.ico" +IDI_MB_WARN ICON "warning.ico" +IDI_OPT_GROUP ICON "popup_group.ico" +IDI_OPT_FULLSCREEN ICON "fullscreen.ico" +IDI_OPT_BLOCK ICON "block.ico" +IDI_OPT_FAVORITE ICON "favorite.ico" +IDI_ACT_REPLY ICON "reply.ico" +IDI_ACT_COPY ICON "copy.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_OPT_POPUP DIALOGEX 0, 0, 304, 228 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD +EXSTYLE WS_EX_CONTROLPARENT +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + GROUPBOX "Content && Style",IDC_STATIC,3,3,143,151 + LTEXT "Go to Customize > Fonts && Colors for fonts and colors options",IDC_STATIC,28,60,113,18 + GROUPBOX "Miscellaneous",IDC_STATIC,3,159,143,38 + GROUPBOX "Effects",IDC_STATIC,151,84,146,113 + PUSHBUTTON "Live Preview",IDC_PREVIEW,219,203,73,14 + ICON IDI_MB_INFO,IDC_ICO_INFO,5,59,20,20,SS_CENTERIMAGE | SS_REALSIZEIMAGE + GROUPBOX "Size && Position",IDC_STATIC,151,3,146,80 +END + +IDD_OPT_POPUP_ADVANCED DIALOGEX 0, 0, 304, 228 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD +EXSTYLE WS_EX_CONTROLPARENT +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + GROUPBOX "History",IDC_STATIC,3,3,143,56 + CONTROL "Enable popup history",IDC_ENABLE_HISTORY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,9,15,134,8 + RTEXT "Store last",IDC_HISTORY_STATIC1,8,25,58,12,SS_CENTERIMAGE + EDITTEXT IDC_HISTORYSIZE,68,25,26,12,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER + LTEXT "events",IDC_HISTORY_STATIC2,99,25,42,12,SS_CENTERIMAGE + CONTROL "",IDC_SHOWHISTORY,"MButtonClass",WS_TABSTOP,9,37,16,15 + CONTROL "Use History++ to render log",IDC_HPPLOG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,30,40,111,8 + GROUPBOX "Avatars",IDC_STATIC,3,63,143,84 + CONTROL "Draw avatar borders",IDC_AVT_BORDER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,9,74,134,8 + CONTROL "Draw borders for semitransparent avatars too",IDC_AVT_PNGBORDER, + "Button",BS_AUTOCHECKBOX | BS_LEFT | BS_TOP | BS_MULTILINE | WS_TABSTOP,21,85,118,18 + LTEXT "Round corners by",IDC_STATIC,9,103,74,12,SS_CENTERIMAGE + EDITTEXT IDC_AVT_RADIUS,83,103,39,12,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER + CONTROL "",IDC_AVT_RADIUS_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,112,103,11,14 + LTEXT "pixels",IDC_STATIC,125,103,18,12,SS_CENTERIMAGE + LTEXT "Avatar size:",IDC_STATIC,9,116,44,12,SS_CENTERIMAGE + CONTROL "",IDC_AVT_SIZE_SLIDE,"msctls_trackbar32",WS_TABSTOP,53,116,72,12 + CTEXT "32",IDC_AVT_SIZE,125,116,17,12,SS_CENTERIMAGE | NOT WS_GROUP + CONTROL "Enable avatar updates",IDC_AVT_REQUEST,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,9,132,134,8 + GROUPBOX "Multimonitor (98/ME/2000/XP)",IDC_GRP_MULTIMONITOR,3,151,143,46 + LTEXT "Start the popups in the monitor with",IDC_MULTIMONITOR_DESC,8,161,134,8,SS_NOPREFIX + CONTROL "Miranda's window",IDC_MIRANDAWND,"Button",BS_AUTORADIOBUTTON,21,172,115,10 + CONTROL "the active window",IDC_ACTIVEWND,"Button",BS_AUTORADIOBUTTON,21,183,115,10 + GROUPBOX "Transparency",IDC_STATIC,151,3,146,56 + CONTROL "Enable Win 9x/Me transparency",IDC_TRANS_9X,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,157,15,136,8 + CONTROL "Use transparency (Windows 2000+)",IDC_TRANS,"Button",BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,157,15,136,8 + RTEXT "opacity:",IDC_TRANS_TXT1,157,25,59,12,SS_CENTERIMAGE + CONTROL "",IDC_TRANS_SLIDER,"msctls_trackbar32",WS_TABSTOP,218,25,56,12 + LTEXT "100%",IDC_TRANS_PERCENT,274,25,20,12,SS_CENTERIMAGE | NOT WS_GROUP + CONTROL "Opaque popups under cursor",IDC_TRANS_OPAQUEONHOVER, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,175,40,118,8 + GROUPBOX "Effects",IDC_STATIC,151,63,146,84 + CONTROL "Slide Popup",IDC_USEANIMATIONS,"Button",BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,157,79,136,8 + LTEXT "Effect:",IDC_EFFECT_TXT,157,90,33,12,SS_CENTERIMAGE + COMBOBOX IDC_EFFECT,191,91,78,64,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + RTEXT "Time (in):",IDC_FADEIN_TXT1,157,107,69,12,SS_CENTERIMAGE + EDITTEXT IDC_FADEIN,230,107,39,12,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER + CONTROL "",IDC_FADEIN_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,257,107,11,14 + LTEXT "ms",IDC_FADEIN_TXT2,274,107,20,12,SS_CENTERIMAGE + RTEXT "Time (out):",IDC_FADEOUT_TXT1,157,122,69,12,SS_CENTERIMAGE + EDITTEXT IDC_FADEOUT,230,122,39,12,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER + CONTROL "",IDC_FADEOUT_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,257,121,11,14 + LTEXT "ms",IDC_FADEOUT_TXT2,274,122,20,12,SS_CENTERIMAGE + LTEXT "Limit window amount to:",IDC_STATIC,154,159,96,12,SS_CENTERIMAGE + EDITTEXT IDC_MAXPOPUPS,255,159,26,12,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER + ICON IDI_MB_WARN,IDC_ICO_RESTART,8,201,20,20,SS_CENTERIMAGE | SS_REALSIZEIMAGE | NOT WS_VISIBLE + PUSHBUTTON "Live Preview",IDC_PREVIEW,219,203,73,14 +END + +IDD_OPT_SKIN2 DIALOGEX 0, 0, 304, 228 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD +EXSTYLE WS_EX_CONTROLPARENT +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + GROUPBOX "Skins",IDC_STATIC,3,3,98,219 + LISTBOX IDC_SKINLIST,8,13,88,185,LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP + CONTROL "R",IDC_BTN_RELOAD,"MButtonClass",WS_TABSTOP,8,201,16,16 + RTEXT "* - built-in skins",IDC_STATIC,41,203,52,14,SS_CENTERIMAGE + GROUPBOX "Skin options",IDC_STATIC,106,3,191,134 + CONTROL "",IDC_SKIN_LIST_OPT,"SysTreeView32",WS_BORDER | WS_HSCROLL | WS_TABSTOP,112,13,180,119 + GROUPBOX "Preview",IDC_STATIC,106,140,191,82 + CONTROL "",IDC_PREVIEWBOX,"Static",SS_BLACKRECT,112,150,180,48,WS_EX_TRANSPARENT + PUSHBUTTON "Live Preview",IDC_PREVIEW,219,203,73,14 + CONTROL "Download more skins",IDC_GETSKINS,"Hyperlink",WS_TABSTOP,109,203,100,16 +END + +IDD_HISTORY DIALOG 0, 0, 293, 236 +STYLE DS_SETFONT | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME +CAPTION "Popup History" +FONT 8, "MS Shell Dlg" +BEGIN + LISTBOX IDC_POPUP_LIST,5,5,283,226,LBS_OWNERDRAWVARIABLE | LBS_NOINTEGRALHEIGHT | LBS_EXTENDEDSEL | NOT WS_VISIBLE | WS_VSCROLL | WS_TABSTOP +END + +IDD_POSITION DIALOGEX 0, 0, 190, 128 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP +EXSTYLE WS_EX_TOOLWINDOW +CLASS "PopupPlusDlgBox" +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME,0,0,190,128,WS_EX_TRANSPARENT + CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME,5,20,179,102,WS_EX_TRANSPARENT + CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME,40,44,110,55,WS_EX_TRANSPARENT + EDITTEXT IDC_TXT_TOP,83,26,25,12,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER + EDITTEXT IDC_TXT_LEFT,10,70,25,12,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER + EDITTEXT IDC_TXT_RIGHT,155,70,25,12,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER + EDITTEXT IDC_TXT_BOTTOM,83,105,25,12,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER + LTEXT "Desktop",IDC_STATIC,10,25,71,8 + LTEXT "Popup Area",IDC_STATIC,44,48,99,8 + LTEXT "pixel(s)",IDC_STATIC,112,25,38,14,SS_CENTERIMAGE + LTEXT "pixel(s)",IDC_STATIC,112,104,38,14,SS_CENTERIMAGE + CTEXT "pixel(s)",IDC_STATIC,10,84,25,8 + CTEXT "pixel(s)",IDC_STATIC,155,84,25,8 + EDITTEXT IDC_TXT_SPACING,83,70,25,12,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER + LTEXT "pixel(s)",IDC_STATIC,112,70,35,12,SS_CENTERIMAGE + LTEXT "Distance between popups",IDC_STATIC,44,56,99,8,SS_CENTERIMAGE + LTEXT "Configure popup area",IDC_TITLE,5,5,144,13,SS_CENTERIMAGE + CONTROL "Close",IDCANCEL,"MButtonClass",WS_TABSTOP,170,5,14,13 + CONTROL "Close",IDOK,"MButtonClass",WS_TABSTOP,155,5,14,13 +END + +IDD_OPT_ACTIONS DIALOGEX 0, 0, 304, 228 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD +EXSTYLE WS_EX_CONTROLPARENT +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + GROUPBOX "General",IDC_STATIC,3,3,143,45 + CONTROL "Enable popup actions",IDC_CHK_ENABLEACTIONS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,14,136,10 + ICON IDI_MB_INFO,IDC_ICO_INFO,6,23,21,20,SS_CENTERIMAGE | SS_REALSIZEIMAGE + LTEXT "Popup Actions are those tiny buttons below notification text.",IDC_STATIC,27,24,116,22 + GROUPBOX "Common Actions",IDC_GRP_CUSTOMACTIONS,3,51,143,71 + LTEXT "Please choose in what cases default actions should be added:",IDC_TXT_CUSTOMACTIONS,8,61,136,17 + CONTROL "Add info && menu for IM contacts only",IDC_CHK_IMCONTACTSONLY, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,82,136,10 + CONTROL "Add default actions for contacts only",IDC_CHK_CONTACTSONLY, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,95,136,10 + CONTROL "Don't close popups on default actions",IDC_CHK_DONTCLOSE, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,107,136,10 + GROUPBOX "Size && Position",IDC_GRP_SIZEPOSITION,3,125,143,72 + CONTROL "Use large icons",IDC_CHK_LARGEICONS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,135,136,10 + LTEXT "Popup actions will be displayed as:",IDC_TXT_POSITION,8,147,136,8 + CONTROL "Icons and labels below text",IDC_RD_TEXT,"Button",BS_AUTORADIOBUTTON,26,159,117,10 + CONTROL "Icons on the left",IDC_RD_LEFTICONS,"Button",BS_AUTORADIOBUTTON,26,171,117,10 + CONTROL "Icons aligned to the right",IDC_RD_RIGHTICONS,"Button",BS_AUTORADIOBUTTON,26,183,117,10 + GROUPBOX "Show Actions: (requires apply)",IDC_GRP_ACTIONS,151,3,146,134 + CONTROL "",IDC_ACTIONS,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_ALIGNLEFT | WS_BORDER | WS_TABSTOP,156,13,136,118 + GROUPBOX "Mouse Actions Overwrite",IDC_GRP_SIZEPOSITION2,151,141,146,56 + CONTROL "LeftButton",IDC_TXT_POSITION2,"Static",SS_LEFTNOWORDWRAP | SS_CENTERIMAGE | WS_GROUP,157,152,64,12 + COMBOBOX IDC_CB_LEFT,223,152,69,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + CONTROL "MiddleButton",IDC_TXT_MIDDLE,"Static",SS_LEFTNOWORDWRAP | SS_CENTERIMAGE | WS_GROUP,157,166,64,12 + COMBOBOX IDC_CB_MIDDLE,223,166,69,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + CONTROL "RightButton",IDC_TXT_RIGHT,"Static",SS_LEFTNOWORDWRAP | SS_CENTERIMAGE | WS_GROUP,157,180,64,12 + COMBOBOX IDC_CB_RIGHT,223,180,69,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "Live Preview",IDC_PREVIEW,219,203,73,14 +END + +IDD_OPT_NOTIFICATIONS DIALOGEX 0, 0, 304, 228 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD +EXSTYLE WS_EX_CONTROLPARENT +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + GROUPBOX "Notifications",IDC_STATIC,3,3,294,194 + CONTROL "",IDC_TREE1,"SysTreeView32",TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | TVS_DISABLEDRAGDROP | TVS_SHOWSELALWAYS | TVS_INFOTIP | WS_BORDER | WS_HSCROLL | WS_TABSTOP,8,13,99,179 + LTEXT "General options",IDC_TXT_TITLE1,112,13,180,8 + CONTROL "Enable this notification",IDC_ENABLE,"Button",BS_AUTOCHECKBOX | BS_LEFT | BS_VCENTER | WS_TABSTOP,122,26,170,8 + RTEXT "Popup timeout:",IDC_TXT_TIMEOUT,112,42,62,8,SS_CENTERIMAGE + LTEXT "Left click action:",IDC_TXT_LACTION,111,59,62,12,SS_CENTERIMAGE | NOT WS_GROUP,WS_EX_RIGHT + COMBOBOX IDC_LACTION,179,59,113,55,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "Right click action:",IDC_TXT_RACTION,111,77,62,12,SS_CENTERIMAGE | NOT WS_GROUP,WS_EX_RIGHT + COMBOBOX IDC_RACTION,179,77,113,55,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "Disable when global status is...",IDC_TXT_TITLE3,112,107,180,8 + CONTROL "",IDC_SOFFLINE,"MButtonClass",WS_TABSTOP,132,120,15,14 + CONTROL "",IDC_SONLINE,"MButtonClass",WS_TABSTOP,148,120,15,14 + CONTROL "",IDC_SAWAY,"MButtonClass",WS_TABSTOP,164,120,15,14 + CONTROL "",IDC_SNA,"MButtonClass",WS_TABSTOP,180,120,15,14 + CONTROL "",IDC_SOCCUPIED,"MButtonClass",WS_TABSTOP,196,120,15,14 + CONTROL "",IDC_SDND,"MButtonClass",WS_TABSTOP,212,120,15,14 + CONTROL "",IDC_SFREE4CHAT,"MButtonClass",WS_TABSTOP,228,120,15,14 + CONTROL "",IDC_SINVISIBLE,"MButtonClass",WS_TABSTOP,244,120,15,14 + CONTROL "",IDC_SPHONE,"MButtonClass",WS_TABSTOP,260,120,15,14 + CONTROL "",IDC_SLUNCH,"MButtonClass",WS_TABSTOP,276,120,16,14 + LTEXT "Disable when relevant protocol's status is...",IDC_TXT_TITLE4,112,138,180,8 + CONTROL "",IDC_SOFFLINE2,"MButtonClass",WS_TABSTOP,132,151,15,14 + CONTROL "",IDC_SONLINE2,"MButtonClass",WS_TABSTOP,148,151,15,14 + CONTROL "",IDC_SAWAY2,"MButtonClass",WS_TABSTOP,164,151,15,14 + CONTROL "",IDC_SNA2,"MButtonClass",WS_TABSTOP,180,151,15,14 + CONTROL "",IDC_SOCCUPIED2,"MButtonClass",WS_TABSTOP,196,151,15,14 + CONTROL "",IDC_SDND2,"MButtonClass",WS_TABSTOP,212,151,15,14 + CONTROL "",IDC_SFREE4CHAT2,"MButtonClass",WS_TABSTOP,228,151,15,14 + CONTROL "",IDC_SINVISIBLE2,"MButtonClass",WS_TABSTOP,244,151,15,14 + CONTROL "",IDC_SPHONE2,"MButtonClass",WS_TABSTOP,260,151,15,14 + CONTROL "",IDC_SLUNCH2,"MButtonClass",WS_TABSTOP,276,151,16,14 + ICON IDI_MB_INFO,IDC_ICO_INFO,112,170,21,20,SS_CENTERIMAGE | SS_REALSIZEIMAGE + LTEXT "Colors can be configured in\r\nCustomize > Fonts && Colors",IDC_TXT_COLORS,132,171,108,24 + PUSHBUTTON "More...",IDC_MORE,242,176,50,14 + PUSHBUTTON "Live Preview",IDC_PREVIEW,219,203,73,14 + CONTROL "Disable if message window is open",IDC_CHECKWINDOW, + "Button",BS_AUTOCHECKBOX | BS_LEFT | BS_VCENTER | WS_TABSTOP,122,95,170,8 + EDITTEXT IDC_TIMEOUT,179,41,33,12,ES_AUTOHSCROLL + CONTROL "",IDC_TIMEOUT_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,201,41,12,12 + LTEXT "Sec",IDC_TXT_TIMEOUT_SEC,217,43,18,8 + LTEXT "0 = Default",IDC_TXT_TIMEOUT_DEFAULT,242,38,51,8 + LTEXT "-1 = Infinite",IDC_TXT_TIMEOUT_INFINITE,239,48,54,8 +END + +IDD_OPT_CONTACTS DIALOGEX 0, 0, 304, 228 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD +EXSTYLE WS_EX_CONTROLPARENT +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + GROUPBOX "Per-contact settings",IDC_STATIC,3,3,294,219 + CONTROL "",IDC_LIST,"CListControl",WS_TABSTOP | 0x1f2,8,13,284,184,WS_EX_CLIENTEDGE + ICON IDI_OPT_FAVORITE,IDC_ICO_FAVORITE,79,198,20,20,SS_CENTERIMAGE | SS_REALSIZEIMAGE + LTEXT "Show always",IDC_STATIC,101,198,49,20,SS_CENTERIMAGE + ICON IDI_OPT_FULLSCREEN,IDC_ICO_FULLSCREEN,150,198,20,20,SS_CENTERIMAGE | SS_REALSIZEIMAGE + LTEXT "Ignore fullscreen",IDC_STATIC,172,198,57,20,SS_CENTERIMAGE + ICON IDI_OPT_BLOCK,IDC_ICO_BLOCK,229,198,20,20,SS_CENTERIMAGE | SS_REALSIZEIMAGE + LTEXT "Never show",IDC_STATIC,251,198,41,20,SS_CENTERIMAGE + ICON IDI_ACT_OK,IDC_ICO_OK,8,198,20,20,SS_CENTERIMAGE | SS_REALSIZEIMAGE + LTEXT "Show default",IDC_STATIC,30,198,49,20,SS_CENTERIMAGE +END + +IDD_OPT_POPUP_GENERAL DIALOGEX 0, 0, 304, 228 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD +EXSTYLE WS_EX_CONTROLPARENT +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + GROUPBOX "Default Timeout",IDC_STATIC,3,3,143,53 + CONTROL "Infinite popup delay",IDC_INFINITEDELAY,"Button",BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,9,15,133,8 + LTEXT "Popup delay:",IDC_SECONDS_STATIC1,18,26,50,12,SS_CENTERIMAGE + EDITTEXT IDC_SECONDS,70,26,31,12,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER + CONTROL "",IDC_SECONDS_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,92,25,11,12 + LTEXT "seconds",IDC_SECONDS_STATIC2,107,26,35,12,SS_CENTERIMAGE + CONTROL "Do not close hovered popups",IDC_LEAVEHOVERED,"Button",BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,18,41,124,8 + GROUPBOX "Size && Position",IDC_STATIC,3,60,143,83 + CONTROL "Dynamically resize the popups",IDC_DYNAMICRESIZE,"Button",BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,9,71,133,8 + CONTROL "Minimum width",IDC_USEMINIMUMWIDTH,"Button",BS_AUTOCHECKBOX | BS_VCENTER | BS_NOTIFY | WS_TABSTOP,7,81,88,12,WS_EX_RIGHT + EDITTEXT IDC_MINIMUMWIDTH,100,81,40,12,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER + CONTROL "",IDC_MINIMUMWIDTH_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,128,80,11,14 + CONTROL "Maximum width",IDC_USEMAXIMUMWIDTH,"Button",BS_AUTOCHECKBOX | BS_VCENTER | BS_NOTIFY | WS_TABSTOP,7,95,88,12,WS_EX_RIGHT + EDITTEXT IDC_MAXIMUMWIDTH,100,95,40,12,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER + CONTROL "",IDC_MAXIMUMWIDTH_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,128,93,11,14 + RTEXT "Position:",IDC_STATIC,7,110,34,12,SS_CENTERIMAGE + COMBOBOX IDC_WHERE,46,110,79,70,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + CONTROL "...",IDC_CUSTOMPOS,"MButtonClass",WS_TABSTOP,127,110,14,13 + RTEXT "Layout:",IDC_STATIC,7,125,34,12,SS_CENTERIMAGE + COMBOBOX IDC_LAYOUT,46,125,94,64,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + GROUPBOX "Miscellaneous",IDC_STATIC,3,147,143,50 + CONTROL "Reorder Popups",IDC_REORDERPOPUPS,"Button",BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,9,158,133,8 + GROUPBOX "Disable when:",IDC_STATIC,151,3,146,194 + CONTROL "Always (has priority)",IDC_POPUPENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,15,135,8 + CONTROL "Fullscreen mode",IDC_DISABLEINFS,"Button",BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,159,26,135,8 + CONTROL "Tree1",IDC_STATUSES,"SysTreeView32",WS_BORDER | WS_HSCROLL | WS_TABSTOP,159,39,130,151 + CONTROL "Debug",IDC_DEBUG,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,159,203,57,14 + PUSHBUTTON "Live Preview",IDC_PREVIEW,219,203,73,14 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog Info +// + +IDD_OPT_NOTIFICATIONS DLGINIT +BEGIN + IDC_LACTION, 0x403, 13, 0 +0x6553, 0x646e, 0x4d20, 0x7365, 0x6173, 0x6567, "\000" + IDC_LACTION, 0x403, 14, 0 +0x6944, 0x6d73, 0x7369, 0x2073, 0x6f50, 0x7570, 0x0070, + IDC_RACTION, 0x403, 13, 0 +0x6553, 0x646e, 0x4d20, 0x7365, 0x6173, 0x6567, "\000" + IDC_RACTION, 0x403, 14, 0 +0x6944, 0x6d73, 0x7369, 0x2073, 0x6f50, 0x7570, 0x0070, + 0 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// SKIN +// + +CLASSIC.POPUPSKIN SKIN "classic.popupskin" + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDB_NOAVATAR BITMAP "avatar.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO +BEGIN + IDD_OPT_POPUP_GENERAL, DIALOG + BEGIN + HORZGUIDE, 203 + END +END +#endif // APSTUDIO_INVOKED + +#endif // Íåéòðàëüíûé resources +///////////////////////////////////////////////////////////////////////////// + + +///////////////////////////////////////////////////////////////////////////// +// Èòàëüÿíñêèé (Èòàëèÿ) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ITA) +LANGUAGE LANG_ITALIAN, SUBLANG_ITALIAN +#pragma code_page(1252) + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "..\\src\\resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + +#endif // Èòàëüÿíñêèé (Èòàëèÿ) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/plugins/Popup/res/version.rc b/plugins/Popup/res/version.rc new file mode 100644 index 0000000000..85065fb60c --- /dev/null +++ b/plugins/Popup/res/version.rc @@ -0,0 +1,44 @@ +#ifdef APSTUDIO_INVOKED +#error this file is not editable by Microsoft Visual C++ +#endif //APSTUDIO_INVOKED + +#include // include for version info constants +#include "..\src\version.h" + +// +// TO CHANGE VERSION INFORMATION, EDIT PROJECT OPTIONS... +// +VS_VERSION_INFO VERSIONINFO + FILEVERSION __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM + PRODUCTVERSION __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x21L +#else + FILEFLAGS 0x20L +#endif + FILEOS 0x4L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "000004b0" + BEGIN + VALUE "Comments", POPUP_DESCRIPTION + VALUE "CompanyName", "MPK" + VALUE "FileDescription", "Popup Plus plugin for Miranda IM" + VALUE "FileVersion", __VERSION_STRING_DOT + VALUE "InternalName", MODULNAME + VALUE "LegalCopyright", POPUP_COPYRIGHT + VALUE "OriginalFilename", POPUP_FILENAME + VALUE "ProductName", POPUP_DISPLAYNAME + VALUE "ProductVersion", __VERSION_STRING_DOT + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0, 1200 + END +END + diff --git a/plugins/Popup/res/whatsnew.txt b/plugins/Popup/res/whatsnew.txt deleted file mode 100644 index 63b0bd2abf..0000000000 --- a/plugins/Popup/res/whatsnew.txt +++ /dev/null @@ -1,15 +0,0 @@ -The new Popup Team welcomes you. -Due to the huge amount of changes we advice you to use the "Reset" button below. - -Your advantages from new version: -- seperate unicode release -- seperate x64 unicode release -- skins moved to official folder (%miranda%/skins/popup) -- reworked/fixed option pages -- fixes in quickreply (unicode and empty messages) -- user color for avatar border -- support to customize/overwrite the 3 main mouse buttons -- Hotkey and ModernToolbar support -- be ready for updates in other plugins - -Many more changes have been done on programmer side. Checkout the changelog for details. \ No newline at end of file diff --git a/plugins/Popup/resource.h b/plugins/Popup/resource.h deleted file mode 100644 index 9585f9e793..0000000000 --- a/plugins/Popup/resource.h +++ /dev/null @@ -1,196 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by resource.rc -// -#define IDD_OPT_POPUP 101 -#define IDD_OPT_POPUP_ADVANCED 102 -#define IDD_OPT_SKIN2 103 -#define IDD_OPT_ACTIONS 104 -#define IDD_OPT_NOTIFICATIONS 105 -#define IDD_OPT_CONTACTS 106 -#define IDD_OPT_POPUP_GENERAL 107 -#define IDD_HISTORY 108 -#define IDD_POSITION 109 -#define IDB_NOAVATAR 110 -#define IDR_WHATSNEW 111 -#define IDI_POPUP 118 -#define IDI_NOPOPUP 120 -#define IDI_HISTORY 184 -#define IDI_RELOAD 185 -#define IDI_MB_STOP 189 -#define IDI_MB_INFO 191 -#define IDI_MB_WARN 194 -#define IDI_RESIZE 196 -#define IDI_OPT_CHECK_OFF 198 -#define IDI_OPT_CHECK_ON 199 -#define IDI_OPT_RADIO_OFF 200 -#define IDI_OPT_RADIO_ON 201 -#define IDI_ACT_INFO 203 -#define IDI_ACT_MENU 204 -#define IDI_ACT_MESSAGE 205 -#define IDI_ACT_OK 206 -#define IDI_ACT_ADD 207 -#define IDI_ACT_CLOSE 208 -#define IDI_ACT_PINNED 209 -#define IDI_ACT_PIN 210 -#define IDI_ACT_COPY 211 -#define IDI_OPT_GROUP 213 -#define IDI_OPT_FULLSCREEN 215 -#define IDI_OPT_BLOCK 216 -#define IDI_OPT_FAVORITE 217 -#define IDI_OPT_AUTO 218 -#define IDI_ACT_REPLY 219 -#define IDI_PU_FULLSCREEN 221 -#define IDI_PU_FAVOURITE 222 -#define IDC_USEANIMATIONS 1005 -#define IDC_EFFECT_TXT 1006 -#define IDC_EFFECT 1007 -#define IDC_FADEIN_TXT1 1008 -#define IDC_FADEIN 1009 -#define IDC_FADEIN_SPIN 1010 -#define IDC_FADEIN_TXT2 1011 -#define IDC_FADEOUT_TXT1 1012 -#define IDC_FADEOUT 1013 -#define IDC_FADEOUT_SPIN 1014 -#define IDC_FADEOUT_TXT2 1015 -#define IDC_PREVIEW 1033 -#define IDC_DEBUG 1034 -#define IDC_GRP_MULTIMONITOR 1035 -#define IDC_MULTIMONITOR_DESC 1036 -#define IDC_MIRANDAWND 1037 -#define IDC_ACTIVEWND 1038 -#define IDC_AVT_BORDER 1050 -#define IDC_AVT_PNGBORDER 1051 -#define IDC_AVT_RADIUS 1053 -#define IDC_AVT_RADIUS_SPIN 1054 -#define IDC_AVT_SIZE_SLIDE 1057 -#define IDC_AVT_SIZE 1058 -#define IDC_AVT_REQUEST 1059 -#define IDC_TRANS_9X 1062 -#define IDC_TRANS 1063 -#define IDC_TRANS_TXT1 1064 -#define IDC_TRANS_SLIDER 1065 -#define IDC_TRANS_PERCENT 1066 -#define IDC_TRANS_OPAQUEONHOVER 1067 -#define IDC_CHECKWINDOW 1095 -#define IDC_LACTION 1096 -#define IDC_RACTION 1097 -#define IDC_SOFFLINE 1099 -#define IDC_SONLINE 1100 -#define IDC_SAWAY 1101 -#define IDC_SNA 1102 -#define IDC_SOCCUPIED 1103 -#define IDC_SDND 1104 -#define IDC_SFREE4CHAT 1105 -#define IDC_SINVISIBLE 1106 -#define IDC_SPHONE 1107 -#define IDC_SLUNCH 1108 -#define IDC_TIMEOUT 1110 -#define IDC_SOFFLINE2 1111 -#define IDC_SONLINE2 1112 -#define IDC_SAWAY2 1113 -#define IDC_SNA2 1114 -#define IDC_SOCCUPIED2 1115 -#define IDC_SDND2 1116 -#define IDC_TREE1 1117 -#define IDC_SKINLIST 1118 -#define IDC_SINVISIBLE2 1119 -#define IDC_SPHONE2 1120 -#define IDC_SLUNCH2 1121 -#define IDC_TXT_TIMEOUT_SEC 1122 -#define IDC_PREVIEWBOX 1123 -#define IDC_TXT_TIMEOUT_INFINITE 1124 -#define IDC_SFREE4CHAT2 1125 -#define IDC_TXT_TIMEOUT_DEFAULT 1126 -#define IDC_POPUP_LIST 1134 -#define IDC_SHOWHISTORY 1135 -#define IDC_ENABLE_HISTORY 1137 -#define IDC_HPPLOG 1138 -#define IDC_BTN_RELOAD 1144 -#define IDC_MAXPOPUPS 1145 -#define IDC_HISTORY_STATIC1 1147 -#define IDC_HISTORY_STATIC2 1148 -#define IDC_HISTORYSIZE 1149 -#define IDC_TITLE 1150 -#define IDC_TXT_TOP 1163 -#define IDC_TIMEOUT_SPIN 1164 -#define IDC_TXT_LEFT 1165 -#define IDC_TXT_RIGHT 1166 -#define IDC_TXT_BOTTOM 1167 -#define IDC_TXT_SPACING 1168 -#define IDC_LIST 1169 -#define IDC_ACTIONS 1170 -#define IDC_CHK_ENABLEACTIONS 1175 -#define IDC_CHK_IMCONTACTSONLY 1176 -#define IDC_CHK_LARGEICONS 1177 -#define IDC_CHK_CONTACTSONLY 1178 -#define IDC_CHK_DONTCLOSE 1179 -#define IDC_RD_TEXT 1180 -#define IDC_RD_RIGHTICONS 1181 -#define IDC_RD_LEFTICONS 1182 -#define IDC_ICO_INFO 1183 -#define IDC_GRP_CUSTOMACTIONS 1185 -#define IDC_GRP_SIZEPOSITION 1186 -#define IDC_GRP_ACTIONS 1187 -#define IDC_TXT_CUSTOMACTIONS 1189 -#define IDC_TXT_POSITION 1190 -#define IDC_ICO_RESTART 1191 -#define IDC_MORE 1193 -#define IDC_TXT_TITLE1 1194 -#define IDC_TXT_POSITION2 1195 -#define IDC_TXT_TITLE3 1196 -#define IDC_TXT_TITLE4 1197 -#define IDC_ENABLE 1198 -#define IDC_TXT_TIMEOUT 1199 -#define IDC_TXT_LACTION 1200 -#define IDC_TXT_RACTION 1201 -#define IDC_TXT_COLORS 1202 -#define IDC_ICO_FAVORITE 1203 -#define IDC_ICO_FULLSCREEN 1204 -#define IDC_ICO_BLOCK 1205 -#define IDC_ICO_AUTO 1206 -#define IDC_GRP_SIZEPOSITION2 1207 -#define IDC_ICO_OK 1208 -#define IDC_CB_RIGHT 1213 -#define IDC_CB_MIDDLE 1214 -#define IDC_CB_LEFT 1215 -#define IDC_TXT_MIDDLE 1216 -#define IDC_SKIN_LIST_OPT 1217 -#define IDC_INFINITEDELAY 1218 -#define IDC_SECONDS_STATIC1 1219 -#define IDC_SECONDS 1220 -#define IDC_SECONDS_SPIN 1221 -#define IDC_SECONDS_STATIC2 1222 -#define IDC_LEAVEHOVERED 1223 -#define IDC_DYNAMICRESIZE 1225 -#define IDC_USEMINIMUMWIDTH 1226 -#define IDC_MINIMUMWIDTH 1227 -#define IDC_MINIMUMWIDTH_SPIN 1228 -#define IDC_USEMAXIMUMWIDTH 1229 -#define IDC_MAXIMUMWIDTH 1230 -#define IDC_MAXIMUMWIDTH_SPIN 1231 -#define IDC_WHERE 1233 -#define IDC_CUSTOMPOS 1234 -#define IDC_LAYOUT 1236 -#define IDC_REORDERPOPUPS 1238 -#define IDC_POPUPENABLED 1240 -#define IDC_DISABLEINFS 1241 -#define IDC_STATUSES 1242 -#define IDC_GETSKINS 1243 -#define IDC_CHK_OFFLINE 40071 -#define IDC_CHK_ONLINE 40072 -#define IDC_CHK_NA 40075 -#define IDC_CHK_OCCUPIED 40076 -#define IDC_CHK_ONTHEPHONE 40079 -#define IDC_CHK_OUTTOLUNCH 40080 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 224 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1244 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/plugins/Popup/resource.rc b/plugins/Popup/resource.rc deleted file mode 100644 index 0d01beb1d7..0000000000 --- a/plugins/Popup/resource.rc +++ /dev/null @@ -1,425 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "winres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// Íåéòðàëüíûé resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU) -LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL -#pragma code_page(1251) - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDI_POPUP ICON "res\\popup.ico" -IDI_PU_FULLSCREEN ICON "res\\popup_fs.ico" -IDI_PU_FAVOURITE ICON "res\\popup_fav.ico" -IDI_NOPOPUP ICON "res\\popup_no.ico" -IDI_HISTORY ICON "res\\popup_history.ico" -IDI_RELOAD ICON "res\\reload.ico" -IDI_OPT_CHECK_OFF ICON "res\\Check_off.ico" -IDI_OPT_CHECK_ON ICON "res\\Check_on.ico" -IDI_OPT_RADIO_OFF ICON "res\\Radio_off.ico" -IDI_OPT_RADIO_ON ICON "res\\Radio_on.ico" -IDI_ACT_INFO ICON "res\\info.ico" -IDI_ACT_MENU ICON "res\\menu.ico" -IDI_ACT_MESSAGE ICON "res\\message.ico" -IDI_ACT_OK ICON "res\\ok.ico" -IDI_ACT_ADD ICON "res\\add.ico" -IDI_ACT_CLOSE ICON "res\\close.ico" -IDI_ACT_PINNED ICON "res\\pinned.ico" -IDI_ACT_PIN ICON "res\\pin.ico" -IDI_RESIZE ICON "res\\resize.ico" -IDI_MB_STOP ICON "res\\error.ico" -IDI_MB_INFO ICON "res\\notify.ico" -IDI_MB_WARN ICON "res\\warning.ico" -IDI_OPT_GROUP ICON "res\\popup_group.ico" -IDI_OPT_FULLSCREEN ICON "res\\fullscreen.ico" -IDI_OPT_BLOCK ICON "res\\block.ico" -IDI_OPT_FAVORITE ICON "res\\favorite.ico" -IDI_ACT_REPLY ICON "res\\reply.ico" -IDI_ACT_COPY ICON "res\\copy.ico" - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_OPT_POPUP DIALOGEX 0, 0, 304, 228 -STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD -EXSTYLE WS_EX_CONTROLPARENT -FONT 8, "MS Shell Dlg", 0, 0, 0x1 -BEGIN - GROUPBOX "Content && Style",IDC_STATIC,3,3,143,151 - LTEXT "Go to Customize > Fonts && Colors for fonts and colors options",IDC_STATIC,28,60,113,18 - GROUPBOX "Miscellaneous",IDC_STATIC,3,159,143,38 - GROUPBOX "Effects",IDC_STATIC,151,84,146,113 - PUSHBUTTON "Live Preview",IDC_PREVIEW,219,203,73,14 - ICON IDI_MB_INFO,IDC_ICO_INFO,5,59,20,20,SS_CENTERIMAGE | SS_REALSIZEIMAGE - GROUPBOX "Size && Position",IDC_STATIC,151,3,146,80 -END - -IDD_OPT_POPUP_ADVANCED DIALOGEX 0, 0, 304, 228 -STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD -EXSTYLE WS_EX_CONTROLPARENT -FONT 8, "MS Shell Dlg", 0, 0, 0x1 -BEGIN - GROUPBOX "History",IDC_STATIC,3,3,143,56 - CONTROL "Enable popup history",IDC_ENABLE_HISTORY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,9,15,134,8 - RTEXT "Store last",IDC_HISTORY_STATIC1,8,25,58,12,SS_CENTERIMAGE - EDITTEXT IDC_HISTORYSIZE,68,25,26,12,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER - LTEXT "events",IDC_HISTORY_STATIC2,99,25,42,12,SS_CENTERIMAGE - CONTROL "",IDC_SHOWHISTORY,"MButtonClass",WS_TABSTOP,9,37,16,15 - CONTROL "Use History++ to render log",IDC_HPPLOG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,30,40,111,8 - GROUPBOX "Avatars",IDC_STATIC,3,63,143,84 - CONTROL "Draw avatar borders",IDC_AVT_BORDER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,9,74,134,8 - CONTROL "Draw borders for semitransparent avatars too",IDC_AVT_PNGBORDER, - "Button",BS_AUTOCHECKBOX | BS_LEFT | BS_TOP | BS_MULTILINE | WS_TABSTOP,21,85,118,18 - LTEXT "Round corners by",IDC_STATIC,9,103,74,12,SS_CENTERIMAGE - EDITTEXT IDC_AVT_RADIUS,83,103,39,12,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER - CONTROL "",IDC_AVT_RADIUS_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,112,103,11,14 - LTEXT "pixels",IDC_STATIC,125,103,18,12,SS_CENTERIMAGE - LTEXT "Avatar size:",IDC_STATIC,9,116,44,12,SS_CENTERIMAGE - CONTROL "",IDC_AVT_SIZE_SLIDE,"msctls_trackbar32",WS_TABSTOP,53,116,72,12 - CTEXT "32",IDC_AVT_SIZE,125,116,17,12,SS_CENTERIMAGE | NOT WS_GROUP - CONTROL "Enable avatar updates",IDC_AVT_REQUEST,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,9,132,134,8 - GROUPBOX "Multimonitor (98/ME/2000/XP)",IDC_GRP_MULTIMONITOR,3,151,143,46 - LTEXT "Start the popups in the monitor with",IDC_MULTIMONITOR_DESC,8,161,134,8,SS_NOPREFIX - CONTROL "Miranda's window",IDC_MIRANDAWND,"Button",BS_AUTORADIOBUTTON,21,172,115,10 - CONTROL "the active window",IDC_ACTIVEWND,"Button",BS_AUTORADIOBUTTON,21,183,115,10 - GROUPBOX "Transparency",IDC_STATIC,151,3,146,56 - CONTROL "Enable Win 9x/Me transparency",IDC_TRANS_9X,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,157,15,136,8 - CONTROL "Use transparency (Windows 2000+)",IDC_TRANS,"Button",BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,157,15,136,8 - RTEXT "opacity:",IDC_TRANS_TXT1,157,25,59,12,SS_CENTERIMAGE - CONTROL "",IDC_TRANS_SLIDER,"msctls_trackbar32",WS_TABSTOP,218,25,56,12 - LTEXT "100%",IDC_TRANS_PERCENT,274,25,20,12,SS_CENTERIMAGE | NOT WS_GROUP - CONTROL "Opaque popups under cursor",IDC_TRANS_OPAQUEONHOVER, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,175,40,118,8 - GROUPBOX "Effects",IDC_STATIC,151,63,146,84 - CONTROL "Slide Popup",IDC_USEANIMATIONS,"Button",BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,157,79,136,8 - LTEXT "Effect:",IDC_EFFECT_TXT,157,90,33,12,SS_CENTERIMAGE - COMBOBOX IDC_EFFECT,191,91,78,64,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - RTEXT "Time (in):",IDC_FADEIN_TXT1,157,107,69,12,SS_CENTERIMAGE - EDITTEXT IDC_FADEIN,230,107,39,12,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER - CONTROL "",IDC_FADEIN_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,257,107,11,14 - LTEXT "ms",IDC_FADEIN_TXT2,274,107,20,12,SS_CENTERIMAGE - RTEXT "Time (out):",IDC_FADEOUT_TXT1,157,122,69,12,SS_CENTERIMAGE - EDITTEXT IDC_FADEOUT,230,122,39,12,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER - CONTROL "",IDC_FADEOUT_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,257,121,11,14 - LTEXT "ms",IDC_FADEOUT_TXT2,274,122,20,12,SS_CENTERIMAGE - LTEXT "Limit window amount to:",IDC_STATIC,154,159,96,12,SS_CENTERIMAGE - EDITTEXT IDC_MAXPOPUPS,255,159,26,12,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER - ICON IDI_MB_WARN,IDC_ICO_RESTART,8,201,20,20,SS_CENTERIMAGE | SS_REALSIZEIMAGE | NOT WS_VISIBLE - PUSHBUTTON "Live Preview",IDC_PREVIEW,219,203,73,14 -END - -IDD_OPT_SKIN2 DIALOGEX 0, 0, 304, 228 -STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD -EXSTYLE WS_EX_CONTROLPARENT -FONT 8, "MS Shell Dlg", 0, 0, 0x1 -BEGIN - GROUPBOX "Skins",IDC_STATIC,3,3,98,219 - LISTBOX IDC_SKINLIST,8,13,88,185,LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP - CONTROL "R",IDC_BTN_RELOAD,"MButtonClass",WS_TABSTOP,8,201,16,16 - RTEXT "* - built-in skins",IDC_STATIC,41,203,52,14,SS_CENTERIMAGE - GROUPBOX "Skin options",IDC_STATIC,106,3,191,134 - CONTROL "",IDC_SKIN_LIST_OPT,"SysTreeView32",WS_BORDER | WS_HSCROLL | WS_TABSTOP,112,13,180,119 - GROUPBOX "Preview",IDC_STATIC,106,140,191,82 - CONTROL "",IDC_PREVIEWBOX,"Static",SS_BLACKRECT,112,150,180,48,WS_EX_TRANSPARENT - PUSHBUTTON "Live Preview",IDC_PREVIEW,219,203,73,14 - CONTROL "Download more skins",IDC_GETSKINS,"Hyperlink",WS_TABSTOP,109,203,100,16 -END - -IDD_HISTORY DIALOG 0, 0, 293, 236 -STYLE DS_SETFONT | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME -CAPTION "Popup History" -FONT 8, "MS Shell Dlg" -BEGIN - LISTBOX IDC_POPUP_LIST,5,5,283,226,LBS_OWNERDRAWVARIABLE | LBS_NOINTEGRALHEIGHT | LBS_EXTENDEDSEL | NOT WS_VISIBLE | WS_VSCROLL | WS_TABSTOP -END - -IDD_POSITION DIALOGEX 0, 0, 190, 128 -STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP -EXSTYLE WS_EX_TOOLWINDOW -CLASS "PopupPlusDlgBox" -FONT 8, "MS Shell Dlg", 0, 0, 0x1 -BEGIN - CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME,0,0,190,128,WS_EX_TRANSPARENT - CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME,5,20,179,102,WS_EX_TRANSPARENT - CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME,40,44,110,55,WS_EX_TRANSPARENT - EDITTEXT IDC_TXT_TOP,83,26,25,12,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER - EDITTEXT IDC_TXT_LEFT,10,70,25,12,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER - EDITTEXT IDC_TXT_RIGHT,155,70,25,12,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER - EDITTEXT IDC_TXT_BOTTOM,83,105,25,12,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER - LTEXT "Desktop",IDC_STATIC,10,25,71,8 - LTEXT "Popup Area",IDC_STATIC,44,48,99,8 - LTEXT "pixel(s)",IDC_STATIC,112,25,38,14,SS_CENTERIMAGE - LTEXT "pixel(s)",IDC_STATIC,112,104,38,14,SS_CENTERIMAGE - CTEXT "pixel(s)",IDC_STATIC,10,84,25,8 - CTEXT "pixel(s)",IDC_STATIC,155,84,25,8 - EDITTEXT IDC_TXT_SPACING,83,70,25,12,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER - LTEXT "pixel(s)",IDC_STATIC,112,70,35,12,SS_CENTERIMAGE - LTEXT "Distance between popups",IDC_STATIC,44,56,99,8,SS_CENTERIMAGE - LTEXT "Configure popup area",IDC_TITLE,5,5,144,13,SS_CENTERIMAGE - CONTROL "Close",IDCANCEL,"MButtonClass",WS_TABSTOP,170,5,14,13 - CONTROL "Close",IDOK,"MButtonClass",WS_TABSTOP,155,5,14,13 -END - -IDD_OPT_ACTIONS DIALOGEX 0, 0, 304, 228 -STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD -EXSTYLE WS_EX_CONTROLPARENT -FONT 8, "MS Shell Dlg", 0, 0, 0x1 -BEGIN - GROUPBOX "General",IDC_STATIC,3,3,143,45 - CONTROL "Enable popup actions",IDC_CHK_ENABLEACTIONS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,14,136,10 - ICON IDI_MB_INFO,IDC_ICO_INFO,6,23,21,20,SS_CENTERIMAGE | SS_REALSIZEIMAGE - LTEXT "Popup Actions are those tiny buttons below notification text.",IDC_STATIC,27,24,116,22 - GROUPBOX "Common Actions",IDC_GRP_CUSTOMACTIONS,3,51,143,71 - LTEXT "Please choose in what cases default actions should be added:",IDC_TXT_CUSTOMACTIONS,8,61,136,17 - CONTROL "Add info && menu for IM contacts only",IDC_CHK_IMCONTACTSONLY, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,82,136,10 - CONTROL "Add default actions for contacts only",IDC_CHK_CONTACTSONLY, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,95,136,10 - CONTROL "Don't close popups on default actions",IDC_CHK_DONTCLOSE, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,107,136,10 - GROUPBOX "Size && Position",IDC_GRP_SIZEPOSITION,3,125,143,72 - CONTROL "Use large icons",IDC_CHK_LARGEICONS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,135,136,10 - LTEXT "Popup actions will be displayed as:",IDC_TXT_POSITION,8,147,136,8 - CONTROL "Icons and labels below text",IDC_RD_TEXT,"Button",BS_AUTORADIOBUTTON,26,159,117,10 - CONTROL "Icons on the left",IDC_RD_LEFTICONS,"Button",BS_AUTORADIOBUTTON,26,171,117,10 - CONTROL "Icons aligned to the right",IDC_RD_RIGHTICONS,"Button",BS_AUTORADIOBUTTON,26,183,117,10 - GROUPBOX "Show Actions: (requires apply)",IDC_GRP_ACTIONS,151,3,146,134 - CONTROL "",IDC_ACTIONS,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_ALIGNLEFT | WS_BORDER | WS_TABSTOP,156,13,136,118 - GROUPBOX "Mouse Actions Overwrite",IDC_GRP_SIZEPOSITION2,151,141,146,56 - CONTROL "LeftButton",IDC_TXT_POSITION2,"Static",SS_LEFTNOWORDWRAP | SS_CENTERIMAGE | WS_GROUP,157,152,64,12 - COMBOBOX IDC_CB_LEFT,223,152,69,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - CONTROL "MiddleButton",IDC_TXT_MIDDLE,"Static",SS_LEFTNOWORDWRAP | SS_CENTERIMAGE | WS_GROUP,157,166,64,12 - COMBOBOX IDC_CB_MIDDLE,223,166,69,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - CONTROL "RightButton",IDC_TXT_RIGHT,"Static",SS_LEFTNOWORDWRAP | SS_CENTERIMAGE | WS_GROUP,157,180,64,12 - COMBOBOX IDC_CB_RIGHT,223,180,69,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "Live Preview",IDC_PREVIEW,219,203,73,14 -END - -IDD_OPT_NOTIFICATIONS DIALOGEX 0, 0, 304, 228 -STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD -EXSTYLE WS_EX_CONTROLPARENT -FONT 8, "MS Shell Dlg", 0, 0, 0x1 -BEGIN - GROUPBOX "Notifications",IDC_STATIC,3,3,294,194 - CONTROL "",IDC_TREE1,"SysTreeView32",TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | TVS_DISABLEDRAGDROP | TVS_SHOWSELALWAYS | TVS_INFOTIP | WS_BORDER | WS_HSCROLL | WS_TABSTOP,8,13,99,179 - LTEXT "General options",IDC_TXT_TITLE1,112,13,180,8 - CONTROL "Enable this notification",IDC_ENABLE,"Button",BS_AUTOCHECKBOX | BS_LEFT | BS_VCENTER | WS_TABSTOP,122,26,170,8 - RTEXT "Popup timeout:",IDC_TXT_TIMEOUT,112,42,62,8,SS_CENTERIMAGE - LTEXT "Left click action:",IDC_TXT_LACTION,111,59,62,12,SS_CENTERIMAGE | NOT WS_GROUP,WS_EX_RIGHT - COMBOBOX IDC_LACTION,179,59,113,55,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Right click action:",IDC_TXT_RACTION,111,77,62,12,SS_CENTERIMAGE | NOT WS_GROUP,WS_EX_RIGHT - COMBOBOX IDC_RACTION,179,77,113,55,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Disable when global status is...",IDC_TXT_TITLE3,112,107,180,8 - CONTROL "",IDC_SOFFLINE,"MButtonClass",WS_TABSTOP,132,120,15,14 - CONTROL "",IDC_SONLINE,"MButtonClass",WS_TABSTOP,148,120,15,14 - CONTROL "",IDC_SAWAY,"MButtonClass",WS_TABSTOP,164,120,15,14 - CONTROL "",IDC_SNA,"MButtonClass",WS_TABSTOP,180,120,15,14 - CONTROL "",IDC_SOCCUPIED,"MButtonClass",WS_TABSTOP,196,120,15,14 - CONTROL "",IDC_SDND,"MButtonClass",WS_TABSTOP,212,120,15,14 - CONTROL "",IDC_SFREE4CHAT,"MButtonClass",WS_TABSTOP,228,120,15,14 - CONTROL "",IDC_SINVISIBLE,"MButtonClass",WS_TABSTOP,244,120,15,14 - CONTROL "",IDC_SPHONE,"MButtonClass",WS_TABSTOP,260,120,15,14 - CONTROL "",IDC_SLUNCH,"MButtonClass",WS_TABSTOP,276,120,16,14 - LTEXT "Disable when relevant protocol's status is...",IDC_TXT_TITLE4,112,138,180,8 - CONTROL "",IDC_SOFFLINE2,"MButtonClass",WS_TABSTOP,132,151,15,14 - CONTROL "",IDC_SONLINE2,"MButtonClass",WS_TABSTOP,148,151,15,14 - CONTROL "",IDC_SAWAY2,"MButtonClass",WS_TABSTOP,164,151,15,14 - CONTROL "",IDC_SNA2,"MButtonClass",WS_TABSTOP,180,151,15,14 - CONTROL "",IDC_SOCCUPIED2,"MButtonClass",WS_TABSTOP,196,151,15,14 - CONTROL "",IDC_SDND2,"MButtonClass",WS_TABSTOP,212,151,15,14 - CONTROL "",IDC_SFREE4CHAT2,"MButtonClass",WS_TABSTOP,228,151,15,14 - CONTROL "",IDC_SINVISIBLE2,"MButtonClass",WS_TABSTOP,244,151,15,14 - CONTROL "",IDC_SPHONE2,"MButtonClass",WS_TABSTOP,260,151,15,14 - CONTROL "",IDC_SLUNCH2,"MButtonClass",WS_TABSTOP,276,151,16,14 - ICON IDI_MB_INFO,IDC_ICO_INFO,112,170,21,20,SS_CENTERIMAGE | SS_REALSIZEIMAGE - LTEXT "Colors can be configured in\r\nCustomize > Fonts && Colors",IDC_TXT_COLORS,132,171,108,24 - PUSHBUTTON "More...",IDC_MORE,242,176,50,14 - PUSHBUTTON "Live Preview",IDC_PREVIEW,219,203,73,14 - CONTROL "Disable if message window is open",IDC_CHECKWINDOW, - "Button",BS_AUTOCHECKBOX | BS_LEFT | BS_VCENTER | WS_TABSTOP,122,95,170,8 - EDITTEXT IDC_TIMEOUT,179,41,33,12,ES_AUTOHSCROLL - CONTROL "",IDC_TIMEOUT_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,201,41,12,12 - LTEXT "Sec",IDC_TXT_TIMEOUT_SEC,217,43,18,8 - LTEXT "0 = Default",IDC_TXT_TIMEOUT_DEFAULT,242,38,51,8 - LTEXT "-1 = Infinite",IDC_TXT_TIMEOUT_INFINITE,239,48,54,8 -END - -IDD_OPT_CONTACTS DIALOGEX 0, 0, 304, 228 -STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD -EXSTYLE WS_EX_CONTROLPARENT -FONT 8, "MS Shell Dlg", 0, 0, 0x1 -BEGIN - GROUPBOX "Per-contact settings",IDC_STATIC,3,3,294,219 - CONTROL "",IDC_LIST,"CListControl",WS_TABSTOP | 0x1f2,8,13,284,184,WS_EX_CLIENTEDGE - ICON IDI_OPT_FAVORITE,IDC_ICO_FAVORITE,79,198,20,20,SS_CENTERIMAGE | SS_REALSIZEIMAGE - LTEXT "Show always",IDC_STATIC,101,198,49,20,SS_CENTERIMAGE - ICON IDI_OPT_FULLSCREEN,IDC_ICO_FULLSCREEN,150,198,20,20,SS_CENTERIMAGE | SS_REALSIZEIMAGE - LTEXT "Ignore fullscreen",IDC_STATIC,172,198,57,20,SS_CENTERIMAGE - ICON IDI_OPT_BLOCK,IDC_ICO_BLOCK,229,198,20,20,SS_CENTERIMAGE | SS_REALSIZEIMAGE - LTEXT "Never show",IDC_STATIC,251,198,41,20,SS_CENTERIMAGE - ICON IDI_ACT_OK,IDC_ICO_OK,8,198,20,20,SS_CENTERIMAGE | SS_REALSIZEIMAGE - LTEXT "Show default",IDC_STATIC,30,198,49,20,SS_CENTERIMAGE -END - -IDD_OPT_POPUP_GENERAL DIALOGEX 0, 0, 304, 228 -STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD -EXSTYLE WS_EX_CONTROLPARENT -FONT 8, "MS Shell Dlg", 0, 0, 0x1 -BEGIN - GROUPBOX "Default Timeout",IDC_STATIC,3,3,143,53 - CONTROL "Infinite popup delay",IDC_INFINITEDELAY,"Button",BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,9,15,133,8 - LTEXT "Popup delay:",IDC_SECONDS_STATIC1,18,26,50,12,SS_CENTERIMAGE - EDITTEXT IDC_SECONDS,70,26,31,12,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER - CONTROL "",IDC_SECONDS_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,92,25,11,12 - LTEXT "seconds",IDC_SECONDS_STATIC2,107,26,35,12,SS_CENTERIMAGE - CONTROL "Do not close hovered popups",IDC_LEAVEHOVERED,"Button",BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,18,41,124,8 - GROUPBOX "Size && Position",IDC_STATIC,3,60,143,83 - CONTROL "Dynamically resize the popups",IDC_DYNAMICRESIZE,"Button",BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,9,71,133,8 - CONTROL "Minimum width",IDC_USEMINIMUMWIDTH,"Button",BS_AUTOCHECKBOX | BS_VCENTER | BS_NOTIFY | WS_TABSTOP,7,81,88,12,WS_EX_RIGHT - EDITTEXT IDC_MINIMUMWIDTH,100,81,40,12,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER - CONTROL "",IDC_MINIMUMWIDTH_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,128,80,11,14 - CONTROL "Maximum width",IDC_USEMAXIMUMWIDTH,"Button",BS_AUTOCHECKBOX | BS_VCENTER | BS_NOTIFY | WS_TABSTOP,7,95,88,12,WS_EX_RIGHT - EDITTEXT IDC_MAXIMUMWIDTH,100,95,40,12,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER - CONTROL "",IDC_MAXIMUMWIDTH_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,128,93,11,14 - RTEXT "Position:",IDC_STATIC,7,110,34,12,SS_CENTERIMAGE - COMBOBOX IDC_WHERE,46,110,79,70,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - CONTROL "...",IDC_CUSTOMPOS,"MButtonClass",WS_TABSTOP,127,110,14,13 - RTEXT "Layout:",IDC_STATIC,7,125,34,12,SS_CENTERIMAGE - COMBOBOX IDC_LAYOUT,46,125,94,64,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - GROUPBOX "Miscellaneous",IDC_STATIC,3,147,143,50 - CONTROL "Reorder Popups",IDC_REORDERPOPUPS,"Button",BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,9,158,133,8 - GROUPBOX "Disable when:",IDC_STATIC,151,3,146,194 - CONTROL "Always (has priority)",IDC_POPUPENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,15,135,8 - CONTROL "Fullscreen mode",IDC_DISABLEINFS,"Button",BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,159,26,135,8 - CONTROL "Tree1",IDC_STATUSES,"SysTreeView32",WS_BORDER | WS_HSCROLL | WS_TABSTOP,159,39,130,151 - CONTROL "Debug",IDC_DEBUG,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,159,203,57,14 - PUSHBUTTON "Live Preview",IDC_PREVIEW,219,203,73,14 -END - - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog Info -// - -IDD_OPT_NOTIFICATIONS DLGINIT -BEGIN - IDC_LACTION, 0x403, 13, 0 -0x6553, 0x646e, 0x4d20, 0x7365, 0x6173, 0x6567, "\000" - IDC_LACTION, 0x403, 14, 0 -0x6944, 0x6d73, 0x7369, 0x2073, 0x6f50, 0x7570, 0x0070, - IDC_RACTION, 0x403, 13, 0 -0x6553, 0x646e, 0x4d20, 0x7365, 0x6173, 0x6567, "\000" - IDC_RACTION, 0x403, 14, 0 -0x6944, 0x6d73, 0x7369, 0x2073, 0x6f50, 0x7570, 0x0070, - 0 -END - - -///////////////////////////////////////////////////////////////////////////// -// -// SKIN -// - -CLASSIC.POPUPSKIN SKIN "res\\classic.popupskin" - -///////////////////////////////////////////////////////////////////////////// -// -// Bitmap -// - -IDB_NOAVATAR BITMAP "res\\avatar.bmp" - -///////////////////////////////////////////////////////////////////////////// -// -// TEXT -// - -IDR_WHATSNEW TEXT "res\\whatsnew.txt" - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO -BEGIN - IDD_OPT_POPUP_GENERAL, DIALOG - BEGIN - HORZGUIDE, 203 - END -END -#endif // APSTUDIO_INVOKED - -#endif // Íåéòðàëüíûé resources -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// Èòàëüÿíñêèé (Èòàëèÿ) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ITA) -LANGUAGE LANG_ITALIAN, SUBLANG_ITALIAN -#pragma code_page(1252) - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - -#endif // Èòàëüÿíñêèé (Èòàëèÿ) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/plugins/Popup/src/headers.h b/plugins/Popup/src/headers.h index e4eca04876..0b0c32298e 100644 --- a/plugins/Popup/src/headers.h +++ b/plugins/Popup/src/headers.h @@ -86,7 +86,7 @@ Last change by : $Author: Merlin_de $ #endif //Resources - #include "../resource.h" + #include "resource.h" #define NOWIN2K #define MIRANDA_VER 0x0A00 @@ -139,7 +139,7 @@ Last change by : $Author: Merlin_de $ //PopUp common handlers #include "defs.h" - #include "../version.h" + #include "version.h" #include "config.h" #include "common.h" #include "def_settings.h" diff --git a/plugins/Popup/src/resource.h b/plugins/Popup/src/resource.h new file mode 100644 index 0000000000..9585f9e793 --- /dev/null +++ b/plugins/Popup/src/resource.h @@ -0,0 +1,196 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by resource.rc +// +#define IDD_OPT_POPUP 101 +#define IDD_OPT_POPUP_ADVANCED 102 +#define IDD_OPT_SKIN2 103 +#define IDD_OPT_ACTIONS 104 +#define IDD_OPT_NOTIFICATIONS 105 +#define IDD_OPT_CONTACTS 106 +#define IDD_OPT_POPUP_GENERAL 107 +#define IDD_HISTORY 108 +#define IDD_POSITION 109 +#define IDB_NOAVATAR 110 +#define IDR_WHATSNEW 111 +#define IDI_POPUP 118 +#define IDI_NOPOPUP 120 +#define IDI_HISTORY 184 +#define IDI_RELOAD 185 +#define IDI_MB_STOP 189 +#define IDI_MB_INFO 191 +#define IDI_MB_WARN 194 +#define IDI_RESIZE 196 +#define IDI_OPT_CHECK_OFF 198 +#define IDI_OPT_CHECK_ON 199 +#define IDI_OPT_RADIO_OFF 200 +#define IDI_OPT_RADIO_ON 201 +#define IDI_ACT_INFO 203 +#define IDI_ACT_MENU 204 +#define IDI_ACT_MESSAGE 205 +#define IDI_ACT_OK 206 +#define IDI_ACT_ADD 207 +#define IDI_ACT_CLOSE 208 +#define IDI_ACT_PINNED 209 +#define IDI_ACT_PIN 210 +#define IDI_ACT_COPY 211 +#define IDI_OPT_GROUP 213 +#define IDI_OPT_FULLSCREEN 215 +#define IDI_OPT_BLOCK 216 +#define IDI_OPT_FAVORITE 217 +#define IDI_OPT_AUTO 218 +#define IDI_ACT_REPLY 219 +#define IDI_PU_FULLSCREEN 221 +#define IDI_PU_FAVOURITE 222 +#define IDC_USEANIMATIONS 1005 +#define IDC_EFFECT_TXT 1006 +#define IDC_EFFECT 1007 +#define IDC_FADEIN_TXT1 1008 +#define IDC_FADEIN 1009 +#define IDC_FADEIN_SPIN 1010 +#define IDC_FADEIN_TXT2 1011 +#define IDC_FADEOUT_TXT1 1012 +#define IDC_FADEOUT 1013 +#define IDC_FADEOUT_SPIN 1014 +#define IDC_FADEOUT_TXT2 1015 +#define IDC_PREVIEW 1033 +#define IDC_DEBUG 1034 +#define IDC_GRP_MULTIMONITOR 1035 +#define IDC_MULTIMONITOR_DESC 1036 +#define IDC_MIRANDAWND 1037 +#define IDC_ACTIVEWND 1038 +#define IDC_AVT_BORDER 1050 +#define IDC_AVT_PNGBORDER 1051 +#define IDC_AVT_RADIUS 1053 +#define IDC_AVT_RADIUS_SPIN 1054 +#define IDC_AVT_SIZE_SLIDE 1057 +#define IDC_AVT_SIZE 1058 +#define IDC_AVT_REQUEST 1059 +#define IDC_TRANS_9X 1062 +#define IDC_TRANS 1063 +#define IDC_TRANS_TXT1 1064 +#define IDC_TRANS_SLIDER 1065 +#define IDC_TRANS_PERCENT 1066 +#define IDC_TRANS_OPAQUEONHOVER 1067 +#define IDC_CHECKWINDOW 1095 +#define IDC_LACTION 1096 +#define IDC_RACTION 1097 +#define IDC_SOFFLINE 1099 +#define IDC_SONLINE 1100 +#define IDC_SAWAY 1101 +#define IDC_SNA 1102 +#define IDC_SOCCUPIED 1103 +#define IDC_SDND 1104 +#define IDC_SFREE4CHAT 1105 +#define IDC_SINVISIBLE 1106 +#define IDC_SPHONE 1107 +#define IDC_SLUNCH 1108 +#define IDC_TIMEOUT 1110 +#define IDC_SOFFLINE2 1111 +#define IDC_SONLINE2 1112 +#define IDC_SAWAY2 1113 +#define IDC_SNA2 1114 +#define IDC_SOCCUPIED2 1115 +#define IDC_SDND2 1116 +#define IDC_TREE1 1117 +#define IDC_SKINLIST 1118 +#define IDC_SINVISIBLE2 1119 +#define IDC_SPHONE2 1120 +#define IDC_SLUNCH2 1121 +#define IDC_TXT_TIMEOUT_SEC 1122 +#define IDC_PREVIEWBOX 1123 +#define IDC_TXT_TIMEOUT_INFINITE 1124 +#define IDC_SFREE4CHAT2 1125 +#define IDC_TXT_TIMEOUT_DEFAULT 1126 +#define IDC_POPUP_LIST 1134 +#define IDC_SHOWHISTORY 1135 +#define IDC_ENABLE_HISTORY 1137 +#define IDC_HPPLOG 1138 +#define IDC_BTN_RELOAD 1144 +#define IDC_MAXPOPUPS 1145 +#define IDC_HISTORY_STATIC1 1147 +#define IDC_HISTORY_STATIC2 1148 +#define IDC_HISTORYSIZE 1149 +#define IDC_TITLE 1150 +#define IDC_TXT_TOP 1163 +#define IDC_TIMEOUT_SPIN 1164 +#define IDC_TXT_LEFT 1165 +#define IDC_TXT_RIGHT 1166 +#define IDC_TXT_BOTTOM 1167 +#define IDC_TXT_SPACING 1168 +#define IDC_LIST 1169 +#define IDC_ACTIONS 1170 +#define IDC_CHK_ENABLEACTIONS 1175 +#define IDC_CHK_IMCONTACTSONLY 1176 +#define IDC_CHK_LARGEICONS 1177 +#define IDC_CHK_CONTACTSONLY 1178 +#define IDC_CHK_DONTCLOSE 1179 +#define IDC_RD_TEXT 1180 +#define IDC_RD_RIGHTICONS 1181 +#define IDC_RD_LEFTICONS 1182 +#define IDC_ICO_INFO 1183 +#define IDC_GRP_CUSTOMACTIONS 1185 +#define IDC_GRP_SIZEPOSITION 1186 +#define IDC_GRP_ACTIONS 1187 +#define IDC_TXT_CUSTOMACTIONS 1189 +#define IDC_TXT_POSITION 1190 +#define IDC_ICO_RESTART 1191 +#define IDC_MORE 1193 +#define IDC_TXT_TITLE1 1194 +#define IDC_TXT_POSITION2 1195 +#define IDC_TXT_TITLE3 1196 +#define IDC_TXT_TITLE4 1197 +#define IDC_ENABLE 1198 +#define IDC_TXT_TIMEOUT 1199 +#define IDC_TXT_LACTION 1200 +#define IDC_TXT_RACTION 1201 +#define IDC_TXT_COLORS 1202 +#define IDC_ICO_FAVORITE 1203 +#define IDC_ICO_FULLSCREEN 1204 +#define IDC_ICO_BLOCK 1205 +#define IDC_ICO_AUTO 1206 +#define IDC_GRP_SIZEPOSITION2 1207 +#define IDC_ICO_OK 1208 +#define IDC_CB_RIGHT 1213 +#define IDC_CB_MIDDLE 1214 +#define IDC_CB_LEFT 1215 +#define IDC_TXT_MIDDLE 1216 +#define IDC_SKIN_LIST_OPT 1217 +#define IDC_INFINITEDELAY 1218 +#define IDC_SECONDS_STATIC1 1219 +#define IDC_SECONDS 1220 +#define IDC_SECONDS_SPIN 1221 +#define IDC_SECONDS_STATIC2 1222 +#define IDC_LEAVEHOVERED 1223 +#define IDC_DYNAMICRESIZE 1225 +#define IDC_USEMINIMUMWIDTH 1226 +#define IDC_MINIMUMWIDTH 1227 +#define IDC_MINIMUMWIDTH_SPIN 1228 +#define IDC_USEMAXIMUMWIDTH 1229 +#define IDC_MAXIMUMWIDTH 1230 +#define IDC_MAXIMUMWIDTH_SPIN 1231 +#define IDC_WHERE 1233 +#define IDC_CUSTOMPOS 1234 +#define IDC_LAYOUT 1236 +#define IDC_REORDERPOPUPS 1238 +#define IDC_POPUPENABLED 1240 +#define IDC_DISABLEINFS 1241 +#define IDC_STATUSES 1242 +#define IDC_GETSKINS 1243 +#define IDC_CHK_OFFLINE 40071 +#define IDC_CHK_ONLINE 40072 +#define IDC_CHK_NA 40075 +#define IDC_CHK_OCCUPIED 40076 +#define IDC_CHK_ONTHEPHONE 40079 +#define IDC_CHK_OUTTOLUNCH 40080 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 224 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1244 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/plugins/Popup/src/version.h b/plugins/Popup/src/version.h new file mode 100644 index 0000000000..b53bb51f65 --- /dev/null +++ b/plugins/Popup/src/version.h @@ -0,0 +1,70 @@ +/* +Popup Plus plugin for Miranda IM + +Copyright � 2002 Luca Santarelli, + � 2004-2007 Victor Pavlychko + � 2010 MPK + � 2010 Merlin_de + +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. + +=============================================================================== + +File name : $HeadURL: http://svn.miranda.im/mainrepo/popup/trunk/version.h $ +Revision : $Revision: 1650 $ +Last change on : $Date: 2010-07-15 19:03:34 +0300 (Чт, 15 июл 2010) $ +Last change by : $Author: Merlin_de $ + +=============================================================================== +*/ + #define PU_COMMONMODUL "PopUp" //common DB modul name for all Popup plugins + #define PU_MODULNAME "PopUpPlus" //DB modul for this plugin + #define PU_MODULCLASS "PopUpCLASS" //temp DB modul for this plugin + #define MODULNAME "PopUp" + #define MODULNAME_LONG "Popup Plus" //dont use "PopUp Plus" coz notify register use "Popup Plus" + #define MODULNAME_PLU "PopUps" + + #define POPUP_FILENAME "PopUp.dll" + #define POPUP_DISPLAYNAME "PopUp Plus" + #define __FLVersionURL "http://nightly.miranda.im/" + #define __FLVersionPrefix "PopUp Plus (Unicode) " + #define __FLUpdateURL "http://nightly.miranda.im/x32/popup.zip" //.zip + #define __BetaUpdateURL "" + + #define __BetaVersionURL "http://nightly.miranda.im/" + #define __BetaVersionPrefix "beta: " + #define __BetaChangelogURL "http://nightly.miranda.im/" + + #define __MAJOR_VERSION 2 + #define __MINOR_VERSION 1 + #define __RELEASE_NUM 1 + #define __BUILD_NUM 6 + + #define __STRINGIFY(x) #x + #define __STRINGIFY2(x) __STRINGIFY(x) + #define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM + #define __FILEVERSION_STRING_DOTS __MAJOR_VERSION.__MINOR_VERSION.__RELEASE_NUM.__BUILD_NUM + + #define __VERSION_STRING __STRINGIFY2(__FILEVERSION_STRING) + #define __VERSION_STRING_DOT __STRINGIFY2(__FILEVERSION_STRING_DOTS) + + #define POPUP_DESCRIPTION "Provides popup notification services for different plugins." + #define POPUP_AUTHOR "MPK, Merlin_de (Luca Santarelli, Victor Pavlychko)" + #define POPUP_EMAIL "mp-king@web.de" + #define POPUP_COPYRIGHT "�2002 Luca Santarelli, �2004-2007 Victor Pavlychko, �2010 MPK, Merlin_de" + #define POPUP_WEBPAGE "http://nightly.miranda.im/" + #define POPUP_UUID {0x26a9125d, 0x7863, 0x4e01, {0xaf, 0xe, 0xd1, 0x4e, 0xf9, 0x5c, 0x50, 0x54}} + #define POPUP_PID 0x12a3fdbdecd273ee67dbc4d6d00e9268 + diff --git a/plugins/Popup/version.h b/plugins/Popup/version.h deleted file mode 100644 index b53bb51f65..0000000000 --- a/plugins/Popup/version.h +++ /dev/null @@ -1,70 +0,0 @@ -/* -Popup Plus plugin for Miranda IM - -Copyright � 2002 Luca Santarelli, - � 2004-2007 Victor Pavlychko - � 2010 MPK - � 2010 Merlin_de - -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. - -=============================================================================== - -File name : $HeadURL: http://svn.miranda.im/mainrepo/popup/trunk/version.h $ -Revision : $Revision: 1650 $ -Last change on : $Date: 2010-07-15 19:03:34 +0300 (Чт, 15 июл 2010) $ -Last change by : $Author: Merlin_de $ - -=============================================================================== -*/ - #define PU_COMMONMODUL "PopUp" //common DB modul name for all Popup plugins - #define PU_MODULNAME "PopUpPlus" //DB modul for this plugin - #define PU_MODULCLASS "PopUpCLASS" //temp DB modul for this plugin - #define MODULNAME "PopUp" - #define MODULNAME_LONG "Popup Plus" //dont use "PopUp Plus" coz notify register use "Popup Plus" - #define MODULNAME_PLU "PopUps" - - #define POPUP_FILENAME "PopUp.dll" - #define POPUP_DISPLAYNAME "PopUp Plus" - #define __FLVersionURL "http://nightly.miranda.im/" - #define __FLVersionPrefix "PopUp Plus (Unicode) " - #define __FLUpdateURL "http://nightly.miranda.im/x32/popup.zip" //.zip - #define __BetaUpdateURL "" - - #define __BetaVersionURL "http://nightly.miranda.im/" - #define __BetaVersionPrefix "beta: " - #define __BetaChangelogURL "http://nightly.miranda.im/" - - #define __MAJOR_VERSION 2 - #define __MINOR_VERSION 1 - #define __RELEASE_NUM 1 - #define __BUILD_NUM 6 - - #define __STRINGIFY(x) #x - #define __STRINGIFY2(x) __STRINGIFY(x) - #define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM - #define __FILEVERSION_STRING_DOTS __MAJOR_VERSION.__MINOR_VERSION.__RELEASE_NUM.__BUILD_NUM - - #define __VERSION_STRING __STRINGIFY2(__FILEVERSION_STRING) - #define __VERSION_STRING_DOT __STRINGIFY2(__FILEVERSION_STRING_DOTS) - - #define POPUP_DESCRIPTION "Provides popup notification services for different plugins." - #define POPUP_AUTHOR "MPK, Merlin_de (Luca Santarelli, Victor Pavlychko)" - #define POPUP_EMAIL "mp-king@web.de" - #define POPUP_COPYRIGHT "�2002 Luca Santarelli, �2004-2007 Victor Pavlychko, �2010 MPK, Merlin_de" - #define POPUP_WEBPAGE "http://nightly.miranda.im/" - #define POPUP_UUID {0x26a9125d, 0x7863, 0x4e01, {0xaf, 0xe, 0xd1, 0x4e, 0xf9, 0x5c, 0x50, 0x54}} - #define POPUP_PID 0x12a3fdbdecd273ee67dbc4d6d00e9268 - diff --git a/plugins/Popup/version.rc b/plugins/Popup/version.rc deleted file mode 100644 index 160afdf230..0000000000 --- a/plugins/Popup/version.rc +++ /dev/null @@ -1,44 +0,0 @@ -#ifdef APSTUDIO_INVOKED -#error this file is not editable by Microsoft Visual C++ -#endif //APSTUDIO_INVOKED - -#include // include for version info constants -#include "version.h" - -// -// TO CHANGE VERSION INFORMATION, EDIT PROJECT OPTIONS... -// -VS_VERSION_INFO VERSIONINFO - FILEVERSION __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM - PRODUCTVERSION __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x21L -#else - FILEFLAGS 0x20L -#endif - FILEOS 0x4L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "000004b0" - BEGIN - VALUE "Comments", POPUP_DESCRIPTION - VALUE "CompanyName", "MPK" - VALUE "FileDescription", "Popup Plus plugin for Miranda IM" - VALUE "FileVersion", __VERSION_STRING_DOT - VALUE "InternalName", MODULNAME - VALUE "LegalCopyright", POPUP_COPYRIGHT - VALUE "OriginalFilename", POPUP_FILENAME - VALUE "ProductName", POPUP_DISPLAYNAME - VALUE "ProductVersion", __VERSION_STRING_DOT - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x0, 1200 - END -END - diff --git a/plugins/ProfileManager/docs/profilemanager-translation.txt b/plugins/ProfileManager/docs/profilemanager-translation.txt new file mode 100644 index 0000000000..52329c17db --- /dev/null +++ b/plugins/ProfileManager/docs/profilemanager-translation.txt @@ -0,0 +1,2 @@ +; Common strings that belong to many files +;[] diff --git a/plugins/ProfileManager/pmanagerEx.cpp b/plugins/ProfileManager/pmanagerEx.cpp deleted file mode 100644 index be6bfb8c0f..0000000000 --- a/plugins/ProfileManager/pmanagerEx.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/* -Miranda plugin template, originally by Richard Hughes -http://miranda-icq.sourceforge.net/ - -This file is placed in the public domain. Anybody is free to use or -modify it as they wish with no restriction. -There is no warranty. -*/ -#define MIRANDA_VER 0x0A00 - -#include -#include - -#include -#include -#include -#include -#include - -#include "resource.h" - -HINSTANCE hInst; - -TCHAR fn[MAX_PATH]; -TCHAR lmn[MAX_PATH]; -TCHAR* pathn; -int hLangpack; -HANDLE hLoadPM, hChangePM; - -PLUGININFOEX pluginInfo={ - sizeof(PLUGININFOEX), - "Miranda IM Profile Changer", - PLUGIN_MAKE_VERSION(0,0,0,3), - "Adds a menu item to change or load a different profile of Miranda IM.", - "Roman Gemini", - "woobind@ukr.net", - "© 2008 - 2010 Roman Gemini", - "http://code.google.com/p/alfamar/", - UNICODE_AWARE, - {0x7eeeb55e, 0x9d83, 0x4e1a, { 0xa1, 0x2f, 0x8f, 0x13, 0xf1, 0xa1, 0x24, 0xfb } } -}; - -extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion) -{ - return &pluginInfo; -} - -BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) -{ - hInst = hinstDLL; - return TRUE; -} - -static INT_PTR ChangePM(WPARAM wParam, LPARAM lParam) -{ - GetModuleFileName(GetModuleHandle(NULL), fn, SIZEOF(fn)); - ShellExecute(0, _T("open"), fn, _T("/FORCESHOW"), _T(""), 1); - CallService("CloseAction", 0, 0); - return 0; -} - -static INT_PTR LoadPM(WPARAM wParam, LPARAM lParam) -{ - GetModuleFileName(GetModuleHandle(NULL), fn, SIZEOF(fn)); - ShellExecute(0, _T("open"), fn, _T("/FORCESHOW"), _T(""), 1); - return 0; -} - -extern "C" __declspec(dllexport) int Load(void) -{ - CLISTMENUITEM mi; - - mir_getLP(&pluginInfo); - - hLoadPM = CreateServiceFunction("Database/LoadPM", LoadPM); - ZeroMemory(&mi, sizeof(mi)); - mi.cbSize = sizeof(mi); - mi.position = -500200000; - mi.flags = CMIF_TCHAR; - mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_LoadPM)); - mi.ptszPopupName = _T("Database"); - mi.ptszName = _T("Load profile"); - mi.pszService = "Database/LoadPM"; - Menu_AddMainMenuItem(&mi); - - hChangePM = CreateServiceFunction("Database/ChangePM", ChangePM); - ZeroMemory(&mi, sizeof(mi)); - mi.cbSize = sizeof(mi); - mi.position = -500200000; - mi.flags = CMIF_TCHAR; - mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_ChangePM)); - mi.ptszPopupName = _T("Database"); - mi.ptszName = _T("Change profile"); - mi.pszService = "Database/ChangePM"; - Menu_AddMainMenuItem(&mi); - - return 0; -} - -extern "C" __declspec(dllexport) int Unload(void) -{ - DestroyServiceFunction(hLoadPM); - DestroyServiceFunction(hChangePM); - - return 0; -} \ No newline at end of file diff --git a/plugins/ProfileManager/pmanagerEx.vcxproj b/plugins/ProfileManager/pmanagerEx.vcxproj index cb727ed048..38508aa2eb 100644 --- a/plugins/ProfileManager/pmanagerEx.vcxproj +++ b/plugins/ProfileManager/pmanagerEx.vcxproj @@ -73,7 +73,7 @@ Disabled ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_WINDOWS;_USRDLL;pmanager_EXPORTS;%(PreprocessorDefinitions) + WIN32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebugDLL @@ -96,7 +96,7 @@ Disabled ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - WIN64;_DEBUG;_WINDOWS;_USRDLL;pmanager_EXPORTS;%(PreprocessorDefinitions) + WIN64;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebugDLL Level3 @@ -119,7 +119,7 @@ AnySuitable Size ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_WINDOWS;_USRDLL;pmanager_EXPORTS;%(PreprocessorDefinitions) + WIN32;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) true true Level3 @@ -144,7 +144,7 @@ AnySuitable Size ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - WIN64;NDEBUG;_WINDOWS;_USRDLL;pmanager_EXPORTS;%(PreprocessorDefinitions) + WIN64;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) true true Level3 @@ -164,13 +164,13 @@ - + - + - + diff --git a/plugins/ProfileManager/pmanagerEx.vcxproj.filters b/plugins/ProfileManager/pmanagerEx.vcxproj.filters index 91e07c558e..223e2d2d66 100644 --- a/plugins/ProfileManager/pmanagerEx.vcxproj.filters +++ b/plugins/ProfileManager/pmanagerEx.vcxproj.filters @@ -15,17 +15,17 @@ - + Source Files - + Header Files - + Resource Files diff --git a/plugins/ProfileManager/pmanagerEx.vcxproj.user b/plugins/ProfileManager/pmanagerEx.vcxproj.user new file mode 100644 index 0000000000..695b5c78b9 --- /dev/null +++ b/plugins/ProfileManager/pmanagerEx.vcxproj.user @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/plugins/ProfileManager/profilemanager-translation.txt b/plugins/ProfileManager/profilemanager-translation.txt deleted file mode 100644 index 52329c17db..0000000000 --- a/plugins/ProfileManager/profilemanager-translation.txt +++ /dev/null @@ -1,2 +0,0 @@ -; Common strings that belong to many files -;[] diff --git a/plugins/ProfileManager/res/resource.rc b/plugins/ProfileManager/res/resource.rc new file mode 100644 index 0000000000..8a81324da1 --- /dev/null +++ b/plugins/ProfileManager/res/resource.rc @@ -0,0 +1,46 @@ +// Microsoft Visual C++ generated resource script. +// +#include "..\src\resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// Neutral resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU) +#ifdef _WIN32 +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +#pragma code_page(1250) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_ChangePM ICON "ChangePM.ico" +IDI_LoadPM ICON "LoadPM.ico" +#endif // Neutral resources +///////////////////////////////////////////////////////////////////////////// + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/plugins/ProfileManager/resource.h b/plugins/ProfileManager/resource.h deleted file mode 100644 index 638fcfb4f6..0000000000 --- a/plugins/ProfileManager/resource.h +++ /dev/null @@ -1,17 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by resource.rc -// -#define IDI_ChangePM 101 -#define IDI_LoadPM 102 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 105 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1007 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/plugins/ProfileManager/resource.rc b/plugins/ProfileManager/resource.rc deleted file mode 100644 index 92a42063c4..0000000000 --- a/plugins/ProfileManager/resource.rc +++ /dev/null @@ -1,46 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// Neutral resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU) -#ifdef _WIN32 -LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL -#pragma code_page(1250) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDI_ChangePM ICON "res/ChangePM.ico" -IDI_LoadPM ICON "res/LoadPM.ico" -#endif // Neutral resources -///////////////////////////////////////////////////////////////////////////// - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/plugins/ProfileManager/src/pmanagerEx.cpp b/plugins/ProfileManager/src/pmanagerEx.cpp new file mode 100644 index 0000000000..be6bfb8c0f --- /dev/null +++ b/plugins/ProfileManager/src/pmanagerEx.cpp @@ -0,0 +1,106 @@ +/* +Miranda plugin template, originally by Richard Hughes +http://miranda-icq.sourceforge.net/ + +This file is placed in the public domain. Anybody is free to use or +modify it as they wish with no restriction. +There is no warranty. +*/ +#define MIRANDA_VER 0x0A00 + +#include +#include + +#include +#include +#include +#include +#include + +#include "resource.h" + +HINSTANCE hInst; + +TCHAR fn[MAX_PATH]; +TCHAR lmn[MAX_PATH]; +TCHAR* pathn; +int hLangpack; +HANDLE hLoadPM, hChangePM; + +PLUGININFOEX pluginInfo={ + sizeof(PLUGININFOEX), + "Miranda IM Profile Changer", + PLUGIN_MAKE_VERSION(0,0,0,3), + "Adds a menu item to change or load a different profile of Miranda IM.", + "Roman Gemini", + "woobind@ukr.net", + "© 2008 - 2010 Roman Gemini", + "http://code.google.com/p/alfamar/", + UNICODE_AWARE, + {0x7eeeb55e, 0x9d83, 0x4e1a, { 0xa1, 0x2f, 0x8f, 0x13, 0xf1, 0xa1, 0x24, 0xfb } } +}; + +extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion) +{ + return &pluginInfo; +} + +BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) +{ + hInst = hinstDLL; + return TRUE; +} + +static INT_PTR ChangePM(WPARAM wParam, LPARAM lParam) +{ + GetModuleFileName(GetModuleHandle(NULL), fn, SIZEOF(fn)); + ShellExecute(0, _T("open"), fn, _T("/FORCESHOW"), _T(""), 1); + CallService("CloseAction", 0, 0); + return 0; +} + +static INT_PTR LoadPM(WPARAM wParam, LPARAM lParam) +{ + GetModuleFileName(GetModuleHandle(NULL), fn, SIZEOF(fn)); + ShellExecute(0, _T("open"), fn, _T("/FORCESHOW"), _T(""), 1); + return 0; +} + +extern "C" __declspec(dllexport) int Load(void) +{ + CLISTMENUITEM mi; + + mir_getLP(&pluginInfo); + + hLoadPM = CreateServiceFunction("Database/LoadPM", LoadPM); + ZeroMemory(&mi, sizeof(mi)); + mi.cbSize = sizeof(mi); + mi.position = -500200000; + mi.flags = CMIF_TCHAR; + mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_LoadPM)); + mi.ptszPopupName = _T("Database"); + mi.ptszName = _T("Load profile"); + mi.pszService = "Database/LoadPM"; + Menu_AddMainMenuItem(&mi); + + hChangePM = CreateServiceFunction("Database/ChangePM", ChangePM); + ZeroMemory(&mi, sizeof(mi)); + mi.cbSize = sizeof(mi); + mi.position = -500200000; + mi.flags = CMIF_TCHAR; + mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_ChangePM)); + mi.ptszPopupName = _T("Database"); + mi.ptszName = _T("Change profile"); + mi.pszService = "Database/ChangePM"; + Menu_AddMainMenuItem(&mi); + + return 0; +} + +extern "C" __declspec(dllexport) int Unload(void) +{ + DestroyServiceFunction(hLoadPM); + DestroyServiceFunction(hChangePM); + + return 0; +} \ No newline at end of file diff --git a/plugins/ProfileManager/src/resource.h b/plugins/ProfileManager/src/resource.h new file mode 100644 index 0000000000..638fcfb4f6 --- /dev/null +++ b/plugins/ProfileManager/src/resource.h @@ -0,0 +1,17 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by resource.rc +// +#define IDI_ChangePM 101 +#define IDI_LoadPM 102 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 105 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1007 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif -- cgit v1.2.3