diff options
author | Mataes <mataes2007@gmail.com> | 2018-05-16 21:48:52 +0300 |
---|---|---|
committer | Mataes <mataes2007@gmail.com> | 2018-05-16 21:49:13 +0300 |
commit | 650fc5a2103cedfe149500ade9c684ecf381d348 (patch) | |
tree | a7f4727baa7b298992a65d240a6017dda3a82f9a /plugins/FTPFileYM/src/dialog.cpp | |
parent | f1195d51ea8094492fcf63a301f2cdc9d1173d6c (diff) |
FavContacts, FileAsMessage, Fingerprint, FloatingContacts, Folders, FTPFile: cmplugin adaptation
Diffstat (limited to 'plugins/FTPFileYM/src/dialog.cpp')
-rw-r--r-- | plugins/FTPFileYM/src/dialog.cpp | 290 |
1 files changed, 145 insertions, 145 deletions
diff --git a/plugins/FTPFileYM/src/dialog.cpp b/plugins/FTPFileYM/src/dialog.cpp index bed6074e26..2783a1fa17 100644 --- a/plugins/FTPFileYM/src/dialog.cpp +++ b/plugins/FTPFileYM/src/dialog.cpp @@ -27,7 +27,7 @@ extern Options &opt; UploadDialog::UploadDialog()
{
- m_hwnd = CreateDialog(hInst, MAKEINTRESOURCE(IDD_DLG_UPLOAD), nullptr, UploadDlgProc);
+ m_hwnd = CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_DLG_UPLOAD), nullptr, UploadDlgProc);
m_hwndTabs = GetDlgItem(m_hwnd, IDC_TAB);
EnableThemeDialogTexture(m_hwnd, ETDT_ENABLETAB);
@@ -151,20 +151,20 @@ LRESULT CALLBACK UploadDialog::TabControlProc(HWND hwnd, UINT msg, WPARAM wParam switch (msg) {
case WM_LBUTTONDBLCLK:
case WM_MBUTTONDOWN:
- {
- POINT pt;
- GetCursorPos(&pt);
- ScreenToClient(uDlg->m_hwndTabs, &pt);
+ {
+ POINT pt;
+ GetCursorPos(&pt);
+ ScreenToClient(uDlg->m_hwndTabs, &pt);
- TCHITTESTINFO tch;
- tch.pt = pt;
- tch.flags = 0;
- int index = TabCtrl_HitTest(uDlg->m_hwndTabs, &tch);
+ TCHITTESTINFO tch;
+ tch.pt = pt;
+ tch.flags = 0;
+ int index = TabCtrl_HitTest(uDlg->m_hwndTabs, &tch);
- if (index != -1)
- uDlg->m_tabs[index]->m_job->closeTab();
- }
- break;
+ if (index != -1)
+ uDlg->m_tabs[index]->m_job->closeTab();
+ }
+ break;
}
return mir_callNextSubclass(hwnd, UploadDialog::TabControlProc, msg, wParam, lParam);
@@ -233,131 +233,131 @@ INT_PTR CALLBACK UploadDialog::UploadDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar return Menu_DrawItem(lParam);
case WM_COMMAND:
- {
- MCONTACT hContact = uDlg->m_tabs[uDlg->m_activeTab]->m_job->m_hContact;
- if (hContact != NULL)
- if (Clist_MenuProcessCommand(LOWORD(wParam), MPCF_CONTACTMENU, hContact))
- break;
-
- if (HIWORD(wParam) == BN_CLICKED) {
- switch (LOWORD(wParam)) {
- case IDC_BTN_PROTO:
- if (hContact != NULL) {
- RECT rc;
- GetWindowRect((HWND)lParam, &rc);
- HMENU hMenu = Menu_BuildContactMenu(hContact);
- TrackPopupMenu(hMenu, 0, rc.left, rc.bottom, 0, hwndDlg, nullptr);
- DestroyMenu(hMenu);
- }
- break;
-
- case IDC_BTN_PAUSE:
- uDlg->m_tabs[uDlg->m_activeTab]->m_job->pauseHandler();
- return TRUE;
-
- case IDC_BTN_CLIPBOARD:
- job = (UploadJob*)uDlg->m_tabs[uDlg->m_activeTab]->m_job;
- Utils::copyToClipboard(job->m_szFileLink);
- return TRUE;
-
- case IDC_BTN_DOWNLOAD:
- job = (UploadJob*)uDlg->m_tabs[uDlg->m_activeTab]->m_job;
- ShellExecuteA(nullptr, "open", job->m_szFileLink, nullptr, nullptr, SW_SHOWNORMAL);
- return TRUE;
-
- case IDC_BTN_FILEMANAGER:
- CallService(MS_FTPFILE_SHOWMANAGER, 0, 0);
- return TRUE;
-
- case IDC_BTN_CLOSE:
- uDlg->m_tabs[uDlg->m_activeTab]->m_job->closeTab();
- return TRUE;
-
- case IDC_BTN_OPTIONS:
- Tab *tab = uDlg->m_tabs[uDlg->m_activeTab];
-
- POINT pt;
- GetCursorPos(&pt);
- SetForegroundWindow(uDlg->m_hwndTabs);
-
- HMENU hMenu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_MENU_UPLOAD));
- if (hMenu) {
- HMENU hPopupMenu = GetSubMenu(hMenu, 0);
- TranslateMenu(hPopupMenu);
- CheckMenuItem(hPopupMenu, IDM_CLOSEDLG, MF_BYCOMMAND | tab->m_bOptCloseDlg ? MF_CHECKED : 0);
- CheckMenuItem(hPopupMenu, IDM_COPYLINK, MF_BYCOMMAND | tab->m_bOptCopyLink ? MF_CHECKED : 0);
- CheckMenuItem(hPopupMenu, IDM_AUTOSEND, MF_BYCOMMAND | tab->m_bOptAutosend ? MF_CHECKED : 0);
-
- HMENU hTimeMenu = GetSubMenu(hPopupMenu, 3);
- CheckMenuItem(hTimeMenu, IDM_DISABLED, MF_BYCOMMAND | (tab->m_iOptAutoDelete == -1) ? MF_CHECKED : MF_UNCHECKED);
-
- int times[10] = { 5, 15, 30, 1 * 60, 2 * 60, 5 * 60, 10 * 60, 1 * 24 * 60, 2 * 24 * 60, 7 * 24 * 60 };
- bool bChecked = (tab->m_iOptAutoDelete == -1);
- wchar_t buff[256];
-
- for (int i = 0; i < _countof(times); i++) {
- if (i == 3 || i == 7)
- AppendMenu(hTimeMenu, MF_SEPARATOR, 0, nullptr);
-
- if (i < 3)
- mir_snwprintf(buff, TranslateT("%d minutes"), times[i]);
- else if (i < 7)
- mir_snwprintf(buff, TranslateT("%d hours"), times[i] / 60);
- else
- mir_snwprintf(buff, TranslateT("%d days"), times[i] / 60 / 24);
-
- UINT check = MF_UNCHECKED;
- if (!bChecked && tab->m_iOptAutoDelete == times[i]) {
- check = MF_CHECKED;
- bChecked = true;
- }
-
- AppendMenu(hTimeMenu, MF_STRING | check, times[i], buff);
+ {
+ MCONTACT hContact = uDlg->m_tabs[uDlg->m_activeTab]->m_job->m_hContact;
+ if (hContact != NULL)
+ if (Clist_MenuProcessCommand(LOWORD(wParam), MPCF_CONTACTMENU, hContact))
+ break;
+
+ if (HIWORD(wParam) == BN_CLICKED) {
+ switch (LOWORD(wParam)) {
+ case IDC_BTN_PROTO:
+ if (hContact != NULL) {
+ RECT rc;
+ GetWindowRect((HWND)lParam, &rc);
+ HMENU hMenu = Menu_BuildContactMenu(hContact);
+ TrackPopupMenu(hMenu, 0, rc.left, rc.bottom, 0, hwndDlg, nullptr);
+ DestroyMenu(hMenu);
+ }
+ break;
+
+ case IDC_BTN_PAUSE:
+ uDlg->m_tabs[uDlg->m_activeTab]->m_job->pauseHandler();
+ return TRUE;
+
+ case IDC_BTN_CLIPBOARD:
+ job = (UploadJob*)uDlg->m_tabs[uDlg->m_activeTab]->m_job;
+ Utils::copyToClipboard(job->m_szFileLink);
+ return TRUE;
+
+ case IDC_BTN_DOWNLOAD:
+ job = (UploadJob*)uDlg->m_tabs[uDlg->m_activeTab]->m_job;
+ ShellExecuteA(nullptr, "open", job->m_szFileLink, nullptr, nullptr, SW_SHOWNORMAL);
+ return TRUE;
+
+ case IDC_BTN_FILEMANAGER:
+ CallService(MS_FTPFILE_SHOWMANAGER, 0, 0);
+ return TRUE;
+
+ case IDC_BTN_CLOSE:
+ uDlg->m_tabs[uDlg->m_activeTab]->m_job->closeTab();
+ return TRUE;
+
+ case IDC_BTN_OPTIONS:
+ Tab * tab = uDlg->m_tabs[uDlg->m_activeTab];
+
+ POINT pt;
+ GetCursorPos(&pt);
+ SetForegroundWindow(uDlg->m_hwndTabs);
+
+ HMENU hMenu = LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDR_MENU_UPLOAD));
+ if (hMenu) {
+ HMENU hPopupMenu = GetSubMenu(hMenu, 0);
+ TranslateMenu(hPopupMenu);
+ CheckMenuItem(hPopupMenu, IDM_CLOSEDLG, MF_BYCOMMAND | tab->m_bOptCloseDlg ? MF_CHECKED : 0);
+ CheckMenuItem(hPopupMenu, IDM_COPYLINK, MF_BYCOMMAND | tab->m_bOptCopyLink ? MF_CHECKED : 0);
+ CheckMenuItem(hPopupMenu, IDM_AUTOSEND, MF_BYCOMMAND | tab->m_bOptAutosend ? MF_CHECKED : 0);
+
+ HMENU hTimeMenu = GetSubMenu(hPopupMenu, 3);
+ CheckMenuItem(hTimeMenu, IDM_DISABLED, MF_BYCOMMAND | (tab->m_iOptAutoDelete == -1) ? MF_CHECKED : MF_UNCHECKED);
+
+ int times[10] = { 5, 15, 30, 1 * 60, 2 * 60, 5 * 60, 10 * 60, 1 * 24 * 60, 2 * 24 * 60, 7 * 24 * 60 };
+ bool bChecked = (tab->m_iOptAutoDelete == -1);
+ wchar_t buff[256];
+
+ for (int i = 0; i < _countof(times); i++) {
+ if (i == 3 || i == 7)
+ AppendMenu(hTimeMenu, MF_SEPARATOR, 0, nullptr);
+
+ if (i < 3)
+ mir_snwprintf(buff, TranslateT("%d minutes"), times[i]);
+ else if (i < 7)
+ mir_snwprintf(buff, TranslateT("%d hours"), times[i] / 60);
+ else
+ mir_snwprintf(buff, TranslateT("%d days"), times[i] / 60 / 24);
+
+ UINT check = MF_UNCHECKED;
+ if (!bChecked && tab->m_iOptAutoDelete == times[i]) {
+ check = MF_CHECKED;
+ bChecked = true;
}
- if (opt.bAutoDelete) {
- switch (opt.timeRange) {
- case Options::TR_MINUTES: mir_snwprintf(buff, TranslateT("%d minutes"), opt.iDeleteTime); break;
- case Options::TR_HOURS: mir_snwprintf(buff, TranslateT("%d hours"), opt.iDeleteTime); break;
- case Options::TR_DAYS: mir_snwprintf(buff, TranslateT("%d days"), opt.iDeleteTime); break;
- }
+ AppendMenu(hTimeMenu, MF_STRING | check, times[i], buff);
+ }
- AppendMenu(hTimeMenu, MF_SEPARATOR, 0, nullptr);
- AppendMenu(hTimeMenu, MF_STRING | bChecked ? MF_UNCHECKED : MF_CHECKED, IDM_CUSTOM, buff);
+ if (opt.bAutoDelete) {
+ switch (opt.timeRange) {
+ case Options::TR_MINUTES: mir_snwprintf(buff, TranslateT("%d minutes"), opt.iDeleteTime); break;
+ case Options::TR_HOURS: mir_snwprintf(buff, TranslateT("%d hours"), opt.iDeleteTime); break;
+ case Options::TR_DAYS: mir_snwprintf(buff, TranslateT("%d days"), opt.iDeleteTime); break;
}
- int command = TrackPopupMenu(hPopupMenu, TPM_LEFTALIGN | TPM_RETURNCMD, pt.x, pt.y, 0, uDlg->m_hwndTabs, nullptr);
- switch (command) {
- case IDM_CLOSEDLG:
- tab->m_bOptCloseDlg = !tab->m_bOptCloseDlg; break;
- case IDM_COPYLINK:
- tab->m_bOptCopyLink = !tab->m_bOptCopyLink; break;
- case IDM_AUTOSEND:
- tab->m_bOptAutosend = !tab->m_bOptAutosend; break;
- case IDM_DISABLED:
- tab->m_iOptAutoDelete = -1; break;
- case IDM_CUSTOM:
- switch (opt.timeRange) {
- case Options::TR_MINUTES: tab->m_iOptAutoDelete = opt.iDeleteTime; break;
- case Options::TR_HOURS: tab->m_iOptAutoDelete = opt.iDeleteTime * 60; break;
- case Options::TR_DAYS: tab->m_iOptAutoDelete = opt.iDeleteTime * 60 * 24; break;
- }
- break;
- default:
- tab->m_iOptAutoDelete = command;
- break;
+ AppendMenu(hTimeMenu, MF_SEPARATOR, 0, nullptr);
+ AppendMenu(hTimeMenu, MF_STRING | bChecked ? MF_UNCHECKED : MF_CHECKED, IDM_CUSTOM, buff);
+ }
+
+ int command = TrackPopupMenu(hPopupMenu, TPM_LEFTALIGN | TPM_RETURNCMD, pt.x, pt.y, 0, uDlg->m_hwndTabs, nullptr);
+ switch (command) {
+ case IDM_CLOSEDLG:
+ tab->m_bOptCloseDlg = !tab->m_bOptCloseDlg; break;
+ case IDM_COPYLINK:
+ tab->m_bOptCopyLink = !tab->m_bOptCopyLink; break;
+ case IDM_AUTOSEND:
+ tab->m_bOptAutosend = !tab->m_bOptAutosend; break;
+ case IDM_DISABLED:
+ tab->m_iOptAutoDelete = -1; break;
+ case IDM_CUSTOM:
+ switch (opt.timeRange) {
+ case Options::TR_MINUTES: tab->m_iOptAutoDelete = opt.iDeleteTime; break;
+ case Options::TR_HOURS: tab->m_iOptAutoDelete = opt.iDeleteTime * 60; break;
+ case Options::TR_DAYS: tab->m_iOptAutoDelete = opt.iDeleteTime * 60 * 24; break;
}
+ break;
+ default:
+ tab->m_iOptAutoDelete = command;
+ break;
+ }
- if (command && ((UploadJob *)tab->m_job)->isCompleted())
- DBEntry::setDeleteTS(tab->m_job);
+ if (command && ((UploadJob *)tab->m_job)->isCompleted())
+ DBEntry::setDeleteTS(tab->m_job);
- DestroyMenu(hMenu);
- }
- return TRUE;
+ DestroyMenu(hMenu);
}
+ return TRUE;
}
}
- break;
+ }
+ break;
case WM_NOTIFY:
switch (((LPNMHDR)lParam)->code) {
@@ -393,26 +393,26 @@ INT_PTR CALLBACK UploadDialog::UploadDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar break;
case WM_CLOSE:
- {
+ {
+ for (UINT i = 0; i < uDlg->m_tabs.size(); i++)
+ uDlg->m_tabs[i]->m_job->pause();
+
+ int result = IDYES;
+ if (!Miranda_IsTerminated() && UploadJob::iRunningJobCount > 0)
+ result = Utils::msgBox(TranslateT("Do you really want to cancel all running jobs?"), MB_YESNO | MB_ICONQUESTION);
+
+ if (result == IDYES) {
+ Skin_PlaySound(SOUND_CANCEL);
+ size_t count = uDlg->m_tabs.size();
+ for (UINT i = 0; i < count; i++)
+ uDlg->m_tabs[0]->m_job->closeAllTabs();
+ }
+ else {
for (UINT i = 0; i < uDlg->m_tabs.size(); i++)
- uDlg->m_tabs[i]->m_job->pause();
-
- int result = IDYES;
- if (!Miranda_IsTerminated() && UploadJob::iRunningJobCount > 0)
- result = Utils::msgBox(TranslateT("Do you really want to cancel all running jobs?"), MB_YESNO | MB_ICONQUESTION);
-
- if (result == IDYES) {
- Skin_PlaySound(SOUND_CANCEL);
- size_t count = uDlg->m_tabs.size();
- for (UINT i = 0; i < count; i++)
- uDlg->m_tabs[0]->m_job->closeAllTabs();
- }
- else {
- for (UINT i = 0; i < uDlg->m_tabs.size(); i++)
- uDlg->m_tabs[i]->m_job->resume();
- }
+ uDlg->m_tabs[i]->m_job->resume();
}
- break;
+ }
+ break;
case WMU_DESTROY:
DestroyWindow(hwndDlg);
|