diff options
author | René Schümann <white06tiger@gmail.com> | 2014-06-29 01:59:23 +0000 |
---|---|---|
committer | René Schümann <white06tiger@gmail.com> | 2014-06-29 01:59:23 +0000 |
commit | 932d21d1f18ad08b21d993fc0e205c5986751fe2 (patch) | |
tree | 564f2a29b0af53ca8097e12071719357981c45cd | |
parent | a86e4b2449985fce6d9fa211bad5de7847cec41a (diff) |
SendSS:
+ very basic preview/edit function using systems "default" editor (eg. Paint or user's choice)
git-svn-id: http://svn.miranda-ng.org/main/trunk@9609 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | plugins/SendScreenshotPlus/res/resource.rc | 7 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/res/ssEditOn.ico | bin | 0 -> 1150 bytes | |||
-rw-r--r-- | plugins/SendScreenshotPlus/src/UMainForm.cpp | 68 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/UMainForm.h | 7 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/mir_icolib.cpp | 3 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/mir_icolib.h | 3 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/resource.h | 3 |
7 files changed, 50 insertions, 41 deletions
diff --git a/plugins/SendScreenshotPlus/res/resource.rc b/plugins/SendScreenshotPlus/res/resource.rc index 4b5e3b91cf..d0264dcd6c 100644 --- a/plugins/SendScreenshotPlus/res/resource.rc +++ b/plugins/SendScreenshotPlus/res/resource.rc @@ -69,8 +69,8 @@ BEGIN CONTROL "?",ID_btnAbout,"UInfoButtonClass",WS_TABSTOP | MBS_FLAT,3,145,16,14,WS_EX_NOACTIVATE | 0x10000000L CONTROL "E&xplore",ID_btnExplore,"UInfoButtonClass",WS_TABSTOP | MBS_FLAT,21,145,16,14,WS_EX_NOACTIVATE | 0x10000000L CONTROL "&Fill description textbox.",ID_btnDesc,"UInfoButtonClass",WS_TABSTOP | MBS_PUSHBUTTON|MBS_FLAT,39,145,16,14,WS_EX_NOACTIVATE | 0x10000000L - CONTROL "Delete &after send",ID_btnDeleteAfterSend, - "UInfoButtonClass",WS_TABSTOP | MBS_PUSHBUTTON|MBS_FLAT,57,145,16,14,WS_EX_NOACTIVATE | 0x10000000L + CONTROL "Delete &after send",ID_btnDeleteAfterSend,"UInfoButtonClass",WS_TABSTOP | MBS_PUSHBUTTON|MBS_FLAT,57,145,16,14,WS_EX_NOACTIVATE | 0x10000000L + CONTROL "Open editor before sending",ID_chkEditor,"UInfoButtonClass",WS_TABSTOP | MBS_PUSHBUTTON|MBS_FLAT,75,145,16,14,WS_EX_NOACTIVATE | 0x10000000L CONTROL "Open again",ID_chkOpenAgain,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,100,147,57,9 CONTROL "&Capture",ID_btnCapture,"UInfoButtonClass",WS_TABSTOP | MBS_DEFBUTTON,169,145,54,14,WS_EX_NOACTIVATE | 0x10000000L CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,0,139,231,1 @@ -183,7 +183,8 @@ IDI_UPDATE ICON "ssUpdate.ico" IDI_OK ICON "ssOk.ico" IDI_CLOSE ICON "ssClose.ico" //IDI_APPLY ICON "ssApply.ico" -//IDI_EDIT ICON "ssEdit.ico" +IDI_EDIT ICON "ssEdit.ico" +IDI_EDITON ICON "ssEditOn.ico" IDI_COPY ICON "ssCopy.ico" IDI_BBC ICON "ssBBC.ico" IDI_BBC2 ICON "ssBBClnk.ico" diff --git a/plugins/SendScreenshotPlus/res/ssEditOn.ico b/plugins/SendScreenshotPlus/res/ssEditOn.ico Binary files differnew file mode 100644 index 0000000000..5b391b3415 --- /dev/null +++ b/plugins/SendScreenshotPlus/res/ssEditOn.ico diff --git a/plugins/SendScreenshotPlus/src/UMainForm.cpp b/plugins/SendScreenshotPlus/src/UMainForm.cpp index 85f88eb822..0a818fcc57 100644 --- a/plugins/SendScreenshotPlus/src/UMainForm.cpp +++ b/plugins/SendScreenshotPlus/src/UMainForm.cpp @@ -351,6 +351,14 @@ void TfrmMain::wmInitdialog(WPARAM wParam, LPARAM lParam) { SendMessage(hCtrl, BM_SETCHECK, m_opt_btnDeleteAfterSend ? BST_CHECKED : BST_UNCHECKED, NULL); } + if (hCtrl = GetDlgItem(m_hWnd, ID_chkEditor)) { + SendDlgItemMessage(m_hWnd, ID_chkEditor, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Open editor before sending"), MBBF_TCHAR); + HICON hIcon = Skin_GetIcon(m_opt_chkEditor ? ICO_BTN_EDITON : ICO_BTN_EDIT); + SendMessage(hCtrl, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon); + SetWindowText(hCtrl, hIcon ? _T("") : _T("E")); + SendMessage(hCtrl, BM_SETCHECK, m_opt_chkEditor ? BST_CHECKED : BST_UNCHECKED, NULL); + } + if (hCtrl = GetDlgItem(m_hWnd, ID_btnCapture)) { SendDlgItemMessage(m_hWnd, ID_btnCapture, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Capture"), MBBF_TCHAR); HICON hIcon = Skin_GetIcon(ICO_BTN_OK); @@ -360,7 +368,6 @@ void TfrmMain::wmInitdialog(WPARAM wParam, LPARAM lParam) { } cboxSendByChange(); //enable disable controls -// CheckDlgButton(m_hWnd,ID_chkEditor, m_opt_chkEditor ? BST_CHECKED : BST_UNCHECKED); TranslateDialogDefault(m_hWnd); } @@ -383,12 +390,6 @@ void TfrmMain::wmCommand(WPARAM wParam, LPARAM lParam) { if(m_hTargetWindow) edtSizeUpdate(m_hTargetWindow, m_opt_chkClientArea, GetParent((HWND)lParam), ID_edtSize); break; - case ID_chkOpenAgain: - m_opt_chkOpenAgain = (BYTE)Button_GetCheck((HWND)lParam); - break; - case ID_chkEditor: - m_opt_chkEditor = (BYTE)Button_GetCheck((HWND)lParam); - break; case ID_imgTarget: if(m_opt_tabCapture!=0) break; m_hLastWin=0; @@ -405,13 +406,19 @@ void TfrmMain::wmCommand(WPARAM wParam, LPARAM lParam) { HICON hIcon = Skin_GetIcon(m_opt_btnDesc ? ICO_COMMON_SSDESKON : ICO_COMMON_SSDESKOFF); SendMessage((HWND)lParam, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon); break;} - case ID_btnDeleteAfterSend: - { + case ID_btnDeleteAfterSend:{ m_opt_btnDeleteAfterSend = (m_opt_btnDeleteAfterSend == 0); HICON hIcon = Skin_GetIcon(m_opt_btnDeleteAfterSend ? ICO_COMMON_SSDELON : ICO_COMMON_SSDELOFF); SendMessage((HWND)lParam, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon); if(m_cSend) m_cSend->m_bDeleteAfterSend = m_opt_btnDeleteAfterSend; - } + break;} + case ID_chkEditor:{ + m_opt_chkEditor = Button_GetCheck((HWND)lParam); + HICON hIcon = Skin_GetIcon(m_opt_chkEditor ? ICO_BTN_EDITON : ICO_BTN_EDIT); + SendMessage((HWND)lParam, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon); + break;} + case ID_chkOpenAgain: + m_opt_chkOpenAgain = Button_GetCheck((HWND)lParam); break; case ID_btnCapture: TfrmMain::btnCaptureClick(); @@ -631,20 +638,6 @@ void TfrmMain::UMevent(WPARAM wParam, LPARAM lParam) { Show(); return; } - if (m_opt_chkEditor) { - /* TfrmEdit *frmEdit=new TfrmEdit(this); - m_bFormEdit = true; - - frmEdit->mniClose->Enabled = !chkJustSaveIt->Checked; - frmEdit->mniCloseSend->Enabled = frmEdit->mniClose->Enabled; - frmEdit->OnClose = OnCloseEditWindow; - frmEdit->InitEditor(Screenshot); // Screenshot is copied to another in-memory bitmap inside this method - frmEdit->Show(); - delete Screenshot; // This way we can delete it after the method returns - Screenshot = NULL; - */ - return; - } FormClose(); break; case EVT_SendFileDone: @@ -676,7 +669,7 @@ TfrmMain::TfrmMain() { m_hWnd = NULL; m_hContact = NULL; - m_bDeleteAfterSend=m_bFormAbout=m_bFormEdit=false; + m_bFormAbout=false; m_hTargetWindow =m_hLastWin=NULL; m_hTargetHighlighter=NULL; m_FDestFolder =m_pszFile=m_pszFileDesc=NULL; @@ -726,10 +719,10 @@ void TfrmMain::LoadOptions(void) { m_opt_edtTimed = db_get_b(NULL, SZ_SENDSS, "CapTime", 3); m_opt_cboxFormat = db_get_b(NULL, SZ_SENDSS, "OutputFormat", 0); m_opt_cboxSendBy = db_get_b(NULL, SZ_SENDSS, "SendBy", 0); - - m_opt_chkEditor = db_get_b(NULL, SZ_SENDSS, "Preview", 0); + m_opt_btnDesc = db_get_b(NULL, SZ_SENDSS, "AutoDescription", 1); m_opt_btnDeleteAfterSend = db_get_b(NULL, SZ_SENDSS, "DelAfterSend", 1)!=0; + m_opt_chkEditor = db_get_b(NULL, SZ_SENDSS, "Preview", 0); m_opt_chkOpenAgain = db_get_b(NULL, SZ_SENDSS, "OpenAgain", 0); } @@ -752,8 +745,8 @@ void TfrmMain::SaveOptions(void) { db_set_b(NULL, SZ_SENDSS, "AutoDescription", m_opt_btnDesc); db_set_b(NULL, SZ_SENDSS, "DelAfterSend", m_opt_btnDeleteAfterSend); - db_set_b(NULL, SZ_SENDSS, "OpenAgain", m_opt_chkOpenAgain); db_set_b(NULL, SZ_SENDSS, "Preview", m_opt_chkEditor); + db_set_b(NULL, SZ_SENDSS, "OpenAgain", m_opt_chkOpenAgain); } } @@ -774,8 +767,6 @@ void TfrmMain::Init(TCHAR* DestFolder, MCONTACT Contact) { //--------------------------------------------------------------------------- void TfrmMain::btnCaptureClick() { - m_bFormEdit = false; //until UEditForm is includet - if(m_opt_tabCapture==1) m_hTargetWindow=GetDesktopWindow(); else if(m_opt_tabCapture==2){ TCHAR filename[MAX_PATH]; @@ -1120,10 +1111,25 @@ void TfrmMain::FormClose() { Show(); // Error from SaveScreenshot return; } + + bool send=true; + if(m_opt_chkEditor){ + SHELLEXECUTEINFO shex={sizeof(SHELLEXECUTEINFO)}; + shex.fMask=SEE_MASK_NOCLOSEPROCESS|SEE_MASK_NOASYNC; + shex.lpVerb=_T("edit"); + shex.lpFile=m_pszFile; + shex.nShow=SW_SHOWNORMAL; + ShellExecuteEx(&shex); + WaitForSingleObject(shex.hProcess,INFINITE); + if(MessageBoxA(m_hWnd,"Send screenshot?","SendSS",MB_YESNO|MB_ICONQUESTION|MB_SYSTEMMODAL)!=IDYES) + send=false; + } - if (m_cSend && m_pszFile && !m_bFormEdit) { + if(send && m_cSend && m_pszFile){ if(!m_cSend->Send()) m_cSend=NULL; // not sent now, class deletes itself later cboxSendByChange(); + }else if(!send && m_opt_btnDeleteAfterSend){ + DeleteFile(m_pszFile); } SendMessage(m_hWnd,UM_EVENT, 0, (LPARAM)EVT_CheckOpenAgain); } diff --git a/plugins/SendScreenshotPlus/src/UMainForm.h b/plugins/SendScreenshotPlus/src/UMainForm.h index b6ba02ddd3..c9969234cb 100644 --- a/plugins/SendScreenshotPlus/src/UMainForm.h +++ b/plugins/SendScreenshotPlus/src/UMainForm.h @@ -66,11 +66,11 @@ class TfrmMain{ ~TfrmMain(); BYTE m_opt_tabCapture; //capure tab page - BYTE m_opt_btnDesc; //TCheckBox *chkDesc; BYTE m_opt_cboxDesktop; //TRadioButton *rbtnDesktop; - BYTE m_opt_chkEditor; //TCheckBox *chkEditor; BYTE m_opt_chkTimed; //TCheckBox *chkTimed; BYTE m_opt_cboxSendBy; //TComboBox *cboxSendBy; + BYTE m_opt_btnDesc; //TCheckBox *chkDesc; + BYTE m_opt_chkEditor; //TCheckBox *chkEditor; bool m_bOnExitSave; static void Unload(); @@ -85,8 +85,7 @@ class TfrmMain{ private: HWND m_hWnd; MCONTACT m_hContact; - bool m_bDeleteAfterSend; - bool m_bFormAbout, m_bFormEdit; + bool m_bFormAbout; HWND m_hTargetWindow, m_hLastWin; HWND m_hTargetHighlighter; TCHAR* m_FDestFolder; diff --git a/plugins/SendScreenshotPlus/src/mir_icolib.cpp b/plugins/SendScreenshotPlus/src/mir_icolib.cpp index acf1a545de..fd07d32e69 100644 --- a/plugins/SendScreenshotPlus/src/mir_icolib.cpp +++ b/plugins/SendScreenshotPlus/src/mir_icolib.cpp @@ -63,7 +63,8 @@ static ICODESC icoDesc[] = { ICO_BTN_OK, LPGEN("OK"), SECT_BUTTONS, IDI_OK, 0 }, { ICO_BTN_CANCEL, LPGEN("Cancel"), SECT_BUTTONS, IDI_CLOSE, 0 }, // { ICO_BTN_APPLY, LPGEN("Apply"), SECT_BUTTONS, IDI_APPLY, 0 }, -// { ICO_BTN_EDIT, LPGEN("Edit"), SECT_BUTTONS, IDI_EDIT, 0 }, + { ICO_BTN_EDIT, LPGEN("Edit"), SECT_BUTTONS, IDI_EDIT, 0 }, + { ICO_BTN_EDITON, LPGEN("Edit on"), SECT_BUTTONS, IDI_EDITON, 0 }, { ICO_BTN_COPY, LPGEN("Copy"), SECT_BUTTONS, IDI_COPY, 0 }, { ICO_BTN_BBC, LPGEN("BBC"), SECT_BUTTONS, IDI_BBC, 0 }, { ICO_BTN_BBC2, LPGEN("BBC link"), SECT_BUTTONS, IDI_BBC2, 0 }, diff --git a/plugins/SendScreenshotPlus/src/mir_icolib.h b/plugins/SendScreenshotPlus/src/mir_icolib.h index 3176047f3d..bb0c8ce642 100644 --- a/plugins/SendScreenshotPlus/src/mir_icolib.h +++ b/plugins/SendScreenshotPlus/src/mir_icolib.h @@ -48,7 +48,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define ICO_BTN_OK MODNAME"_plug_ok" #define ICO_BTN_CANCEL MODNAME"_plug_cancel" //#define ICO_BTN_APPLY MODNAME"_plug_apply" -//#define ICO_BTN_EDIT MODNAME"_plug_edit" +#define ICO_BTN_EDIT MODNAME"_plug_edit" +#define ICO_BTN_EDITON MODNAME"_plug_editOn" #define ICO_BTN_COPY MODNAME"_plug_copy" #define ICO_BTN_BBC MODNAME"_plug_bbc" #define ICO_BTN_BBC2 MODNAME"_plug_bbclnk" diff --git a/plugins/SendScreenshotPlus/src/resource.h b/plugins/SendScreenshotPlus/src/resource.h index 5c5dca91ae..9fb928481b 100644 --- a/plugins/SendScreenshotPlus/src/resource.h +++ b/plugins/SendScreenshotPlus/src/resource.h @@ -46,7 +46,8 @@ #define IDI_OK 205 #define IDI_CLOSE 206 //#define IDI_APPLY 207 -//#define IDI_EDIT 208 +#define IDI_EDIT 207 +#define IDI_EDITON 208 #define IDI_COPY 209 #define IDI_BBC 210 #define IDI_BBC2 211 |