diff options
Diffstat (limited to 'plugins/SendScreenshotPlus/src')
-rw-r--r-- | plugins/SendScreenshotPlus/src/CSend.cpp | 98 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/CSend.h | 4 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/CSendFTPFile.cpp | 5 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/CSendFTPFile.h | 1 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/CSendHTTPServer.cpp | 6 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/CSendHTTPServer.h | 1 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/mir_icolib.cpp | 5 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/mir_icolib.h | 5 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/resource.h | 19 |
9 files changed, 115 insertions, 29 deletions
diff --git a/plugins/SendScreenshotPlus/src/CSend.cpp b/plugins/SendScreenshotPlus/src/CSend.cpp index 7de9574cf6..b79fd340cd 100644 --- a/plugins/SendScreenshotPlus/src/CSend.cpp +++ b/plugins/SendScreenshotPlus/src/CSend.cpp @@ -27,6 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "global.h" +#define CSEND_DIALOG 8800 //--------------------------------------------------------------------------- CSend::CSend(HWND /*Owner*/, MCONTACT hContact, bool bAsync, bool bSilent) : @@ -35,6 +36,8 @@ CSend::CSend(HWND /*Owner*/, MCONTACT hContact, bool bAsync, bool bSilent) : m_bSilent(bSilent), m_pszFile(NULL), m_pszFileDesc(NULL), + m_URL(NULL), + m_URLthumb(NULL), m_pszSendTyp(NULL), m_pszProto(NULL), // m_hContact(hContact), // initialized below @@ -54,6 +57,8 @@ CSend::CSend(HWND /*Owner*/, MCONTACT hContact, bool bAsync, bool bSilent) : CSend::~CSend(){ mir_free(m_pszFile); mir_free(m_pszFileDesc); + mir_free(m_URL); + mir_free(m_URLthumb); mir_free(m_szEventMsg); mir_free(m_ErrorMsg); mir_free(m_ErrorTitle); @@ -88,19 +93,80 @@ INT_PTR CALLBACK CSend::ResultDialogProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LP mir_tcsadd(tmp,self->m_pszSendTyp); SetDlgItemText(hwndDlg,IDC_HEADERBAR,tmp); mir_free(tmp); - SendMessage(GetDlgItem(hwndDlg,IDC_HEADERBAR),WM_SETICON,ICON_BIG,(LPARAM)Skin_GetIcon(ICO_COMMON_ARROWR,1)); - SetDlgItemText(hwndDlg,ID_edtURL,self->m_ErrorTitle); - if(self->m_pszFileDesc) + SendDlgItemMessage(hwndDlg,IDC_HEADERBAR,WM_SETICON,ICON_BIG,(LPARAM)Skin_GetIcon(ICO_COMMON_ARROWR,1)); + SetDlgItemTextA(hwndDlg,ID_edtURL,self->m_URL); + if(self->m_URLthumb){ + SetDlgItemTextA(hwndDlg,ID_edtURLthumb,self->m_URLthumb); + }else{ + SetDlgItemTextA(hwndDlg,ID_edtURLthumb,"-"); + for(int i=ID_btnThumbCopy; i<=ID_edtURLthumb; ++i){ + EnableWindow(GetDlgItem(hwndDlg,i),FALSE); + } + } + if(!self->m_pszFileDesc) + SetDlgItemText(hwndDlg,ID_bvlDesc,self->m_ErrorTitle); + else SetDlgItemText(hwndDlg,ID_bvlDesc,self->m_pszFileDesc); - SendMessage(GetDlgItem(hwndDlg,IDOK),BUTTONSETDEFAULT,1,NULL); - SendMessage(GetDlgItem(hwndDlg,IDOK),BM_SETIMAGE,IMAGE_ICON,(LPARAM)Skin_GetIcon(ICO_BTN_EDIT)); - SendMessage(GetDlgItem(hwndDlg,IDCANCEL),BM_SETIMAGE,IMAGE_ICON,(LPARAM)Skin_GetIcon(ICO_BTN_CANCEL)); + SendDlgItemMessage(hwndDlg,IDOK,BM_SETIMAGE,IMAGE_ICON,(LPARAM)Skin_GetIcon(ICO_BTN_COPY)); + SendDlgItemMessage(hwndDlg,IDOK,BUTTONTRANSLATE,0,0); + SendDlgItemMessage(hwndDlg,IDCANCEL,BM_SETIMAGE,IMAGE_ICON,(LPARAM)Skin_GetIcon(ICO_BTN_CANCEL)); + SendDlgItemMessage(hwndDlg,IDCANCEL,BUTTONTRANSLATE,0,0); + for(int i=ID_btnCopy; i<=ID_btnThumbBBC2; ++i){ + SendDlgItemMessage(hwndDlg,i,BUTTONSETASTHEMEDBTN,0,0); + SendDlgItemMessage(hwndDlg,i,BUTTONSETASFLATBTN,1,0); + switch(i){ + case ID_btnCopy: + case ID_btnThumbCopy: + SendDlgItemMessage(hwndDlg,i,BM_SETIMAGE,IMAGE_ICON,(LPARAM)Skin_GetIcon(ICO_BTN_COPY)); + SendDlgItemMessage(hwndDlg,i,BUTTONADDTOOLTIP,(WPARAM)LPGENT("Copy"),BATF_TCHAR); + break; + case ID_btnBBC: + case ID_btnThumbBBC: + SendDlgItemMessage(hwndDlg,i,BM_SETIMAGE,IMAGE_ICON,(LPARAM)Skin_GetIcon(ICO_BTN_BBC)); + SendDlgItemMessage(hwndDlg,i,BUTTONADDTOOLTIP,(WPARAM)LPGENT("Copy BBCode"),BATF_TCHAR); + break; + default: + SendDlgItemMessage(hwndDlg,i,BM_SETIMAGE,IMAGE_ICON,(LPARAM)Skin_GetIcon(ICO_BTN_BBC2)); + SendDlgItemMessage(hwndDlg,i,BUTTONADDTOOLTIP,(WPARAM)LPGENT("Copy BBCode w/ link"),BATF_TCHAR); + } + } + TranslateDialogDefault(hwndDlg); return TRUE;} case WM_COMMAND: switch(LOWORD(wParam)) { - case IDOK:{ - TCHAR tmp[1024]; - size_t len=GetDlgItemText(hwndDlg,ID_edtURL,tmp,1024); + case IDOK: + case ID_btnCopy: + case ID_btnThumbCopy: + case ID_btnBBC: + case ID_btnThumbBBC: + case ID_btnThumbBBC2:{ + TCHAR tmp[2048]; + int edtID=ID_edtURL; + int bbc=0; + switch(LOWORD(wParam)){ + case ID_btnThumbBBC2: ++bbc; + case ID_btnThumbBBC: ++bbc; + case ID_btnThumbCopy: + edtID=ID_edtURLthumb; + break; + case ID_btnBBC: ++bbc; + break; + } + size_t len; + if(bbc){ + if(bbc==1){ + memcpy(tmp,_T("[img]"),5*sizeof(TCHAR)); len=5; + len+=GetDlgItemText(hwndDlg,edtID,tmp+len,2048-11); + memcpy(tmp+len,_T("[/img]"),7*sizeof(TCHAR)); len+=7; + }else{ + memcpy(tmp,_T("[url="),5*sizeof(TCHAR)); len=5; + len+=GetDlgItemText(hwndDlg,ID_edtURL,tmp+len,1024); + memcpy(tmp+len,_T("][img]"),6*sizeof(TCHAR)); len+=6; + len+=GetDlgItemText(hwndDlg,edtID,tmp+len,1024); + memcpy(tmp+len,_T("[/img][/url]"),13*sizeof(TCHAR)); len+=12; + } + }else + len=GetDlgItemText(hwndDlg,edtID,tmp,2048); int retries=3; do{ if(!OpenClipboard(hwndDlg)){ @@ -116,7 +182,8 @@ INT_PTR CALLBACK CSend::ResultDialogProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LP CloseClipboard(); break; }while(--retries); - DestroyWindow(hwndDlg); + if(LOWORD(wParam)==IDOK) + DestroyWindow(hwndDlg); return TRUE;} case IDCANCEL: DestroyWindow(hwndDlg); @@ -130,9 +197,9 @@ void CSend::svcSendMsgExit(const char* szMessage) { Exit(ACKRESULT_SUCCESS); return; } if(!m_hContact){ - mir_free(m_ErrorTitle), m_ErrorTitle=mir_a2t(szMessage); - DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_UResultForm),0, ResultDialogProc,(LPARAM)this); - Exit(ACKRESULT_SUCCESS); return; + if(!m_pszFileDesc) + m_pszFileDesc=mir_a2t(szMessage); + Exit(CSEND_DIALOG); return; } if(m_ChatRoom){ TCHAR* tmp = mir_a2t(szMessage); @@ -339,6 +406,11 @@ void CSend::Exit(unsigned int Result) { if(!m_bSilent){ bool err = true; switch(Result) { + case CSEND_DIALOG: + SkinPlaySound("FileDone"); + DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_UResultForm),0, ResultDialogProc,(LPARAM)this); + err = false; + break; case ACKRESULT_SUCCESS: case GC_RESULT_SUCCESS: SkinPlaySound("FileDone"); diff --git a/plugins/SendScreenshotPlus/src/CSend.h b/plugins/SendScreenshotPlus/src/CSend.h index 63047b7fd3..77b0d677e9 100644 --- a/plugins/SendScreenshotPlus/src/CSend.h +++ b/plugins/SendScreenshotPlus/src/CSend.h @@ -58,6 +58,8 @@ class CSend { void SetFile(char* file){mir_free(m_pszFile), m_pszFile=mir_a2t(file);}; void SetDescription(TCHAR* descr){mir_free(m_pszFileDesc), m_pszFileDesc=mir_tstrdup(descr);}; void SetContact(MCONTACT hContact); + char* GetURL(){return m_URL;}; + char* GetURLthumbnail(){return m_URLthumb;}; BYTE GetEnableItem() {return m_EnableItem;}; TCHAR* GetErrorMsg() {return m_ErrorMsg;}; @@ -67,6 +69,8 @@ class CSend { bool m_bSilent; TCHAR* m_pszFile; TCHAR* m_pszFileDesc; + char* m_URL; + char* m_URLthumb; static int OnSend(void *obj, WPARAM wParam, LPARAM lParam); TCHAR* m_pszSendTyp; //hold string for error mess char* m_pszProto; //Contact Proto Modul diff --git a/plugins/SendScreenshotPlus/src/CSendFTPFile.cpp b/plugins/SendScreenshotPlus/src/CSendFTPFile.cpp index b52a3925e8..407a63a734 100644 --- a/plugins/SendScreenshotPlus/src/CSendFTPFile.cpp +++ b/plugins/SendScreenshotPlus/src/CSendFTPFile.cpp @@ -36,12 +36,10 @@ CSendFTPFile::CSendFTPFile(HWND Owner, MCONTACT hContact, bool /*bAsync*/) m_EnableItem = 0 ; //SS_DLG_DESCRIPTION | SS_DLG_AUTOSEND | SS_DLG_DELETEAFTERSSEND; m_pszSendTyp = LPGENT("FTPFile transfer"); m_pszFileName = NULL; - m_URL = NULL; } CSendFTPFile::~CSendFTPFile(){ mir_free(m_pszFileName); - mir_free(m_URL); } //--------------------------------------------------------------------------- @@ -70,7 +68,6 @@ int CSendFTPFile::Send() } void CSendFTPFile::SendThread() { - mir_freeAndNil(m_URL); INT_PTR ret = FTPFileUploadA(m_hContact, FNUM_DEFAULT, FMODE_RAWFILE, &m_pszFileName,1); if (ret != 0) { @@ -81,7 +78,7 @@ void CSendFTPFile::SendThread() { //Can't delete the file since FTP File plugin will use it m_bDeleteAfterSend = false; - if (m_URL && m_URL[0]!= NULL) { + if (m_URL && *m_URL) {/// @fixme : m_URL never set svcSendMsgExit(m_URL); return; } Exit(ACKRESULT_FAILED); diff --git a/plugins/SendScreenshotPlus/src/CSendFTPFile.h b/plugins/SendScreenshotPlus/src/CSendFTPFile.h index fb70249f1c..c5c64d1bba 100644 --- a/plugins/SendScreenshotPlus/src/CSendFTPFile.h +++ b/plugins/SendScreenshotPlus/src/CSendFTPFile.h @@ -40,7 +40,6 @@ class CSendFTPFile : public CSend { protected: char* m_pszFileName; - char* m_URL; void SendThread(); static void SendThreadWrapper(void * Obj); }; diff --git a/plugins/SendScreenshotPlus/src/CSendHTTPServer.cpp b/plugins/SendScreenshotPlus/src/CSendHTTPServer.cpp index cc705ba0e0..e0726c82e1 100644 --- a/plugins/SendScreenshotPlus/src/CSendHTTPServer.cpp +++ b/plugins/SendScreenshotPlus/src/CSendHTTPServer.cpp @@ -39,14 +39,12 @@ CSendHTTPServer::CSendHTTPServer(HWND Owner, MCONTACT hContact, bool /*bAsync*/) m_EnableItem = SS_DLG_DESCRIPTION ; //| SS_DLG_AUTOSEND | SS_DLG_DELETEAFTERSSEND; m_pszSendTyp = LPGENT("HTTPServer transfer"); m_pszFileName = NULL; - m_URL = NULL; m_fsi_pszSrvPath = NULL; m_fsi_pszRealPath = NULL; } CSendHTTPServer::~CSendHTTPServer(){ mir_free(m_pszFileName); - mir_free(m_URL); mir_free(m_fsi_pszSrvPath); mir_free(m_fsi_pszRealPath); } @@ -85,12 +83,12 @@ int CSendHTTPServer::Send() void CSendHTTPServer::SendThread() { INT_PTR ret; - mir_freeAndNil(m_URL); if (ServiceExists(MS_HTTP_GET_LINK)) { //patched plugin version ret = CallService(MS_HTTP_ADD_CHANGE_REMOVE, (WPARAM)m_hContact, (LPARAM)&m_fsi); if (!ret) { + mir_free(m_URL); m_URL = (char*)CallService(MS_HTTP_GET_LINK, (WPARAM)m_fsi.pszSrvPath, NULL); } } @@ -110,7 +108,7 @@ void CSendHTTPServer::SendThread() { //Share the file by HTTP Server plugin, SendSS does not own the file anymore = auto-delete won't work m_bDeleteAfterSend = false; - if (m_URL && m_URL[0]!= NULL) { + if (m_URL && *m_URL) { svcSendMsgExit(m_URL); return; } Exit(ACKRESULT_FAILED); diff --git a/plugins/SendScreenshotPlus/src/CSendHTTPServer.h b/plugins/SendScreenshotPlus/src/CSendHTTPServer.h index 5b62896739..d3070806a9 100644 --- a/plugins/SendScreenshotPlus/src/CSendHTTPServer.h +++ b/plugins/SendScreenshotPlus/src/CSendHTTPServer.h @@ -40,7 +40,6 @@ class CSendHTTPServer : public CSend { protected: char* m_pszFileName; - char* m_URL; STFileShareInfo m_fsi; char* m_fsi_pszSrvPath; char* m_fsi_pszRealPath; diff --git a/plugins/SendScreenshotPlus/src/mir_icolib.cpp b/plugins/SendScreenshotPlus/src/mir_icolib.cpp index e4f198081a..61e61f9c6e 100644 --- a/plugins/SendScreenshotPlus/src/mir_icolib.cpp +++ b/plugins/SendScreenshotPlus/src/mir_icolib.cpp @@ -63,7 +63,10 @@ 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_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 }, { ICO_BTN_DOWNARROW, LPGEN("Down arrow"), SECT_BUTTONS, IDI_DOWNARROW, 0 }, }; diff --git a/plugins/SendScreenshotPlus/src/mir_icolib.h b/plugins/SendScreenshotPlus/src/mir_icolib.h index bd026b3875..3176047f3d 100644 --- a/plugins/SendScreenshotPlus/src/mir_icolib.h +++ b/plugins/SendScreenshotPlus/src/mir_icolib.h @@ -48,7 +48,10 @@ 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_COPY MODNAME"_plug_copy" +#define ICO_BTN_BBC MODNAME"_plug_bbc" +#define ICO_BTN_BBC2 MODNAME"_plug_bbclnk" #define ICO_BTN_DOWNARROW MODNAME"_plug_downarrow" //#define ICO_BTN_OVERLAYOFF MODNAME"_plug_SSOverlayOff" diff --git a/plugins/SendScreenshotPlus/src/resource.h b/plugins/SendScreenshotPlus/src/resource.h index 572372d490..0385d53f00 100644 --- a/plugins/SendScreenshotPlus/src/resource.h +++ b/plugins/SendScreenshotPlus/src/resource.h @@ -5,9 +5,9 @@ #define IDOK 1 #define IDA_btnClose 1 #define IDCANCEL 2 -#define IDB_Bmp1 2 +//#define IDB_Bmp1 2 #define IDABORT 3 -#define IDB_Bmp2 3 +//#define IDB_Bmp2 3 #define IDRETRY 4 #define IDIGNORE 5 #define IDYES 6 @@ -45,8 +45,11 @@ #define IDI_OK 205 #define IDI_CLOSE 206 //#define IDI_APPLY 207 -#define IDI_EDIT 208 -#define IDI_DOWNARROW 210 +//#define IDI_EDIT 208 +#define IDI_COPY 209 +#define IDI_BBC 210 +#define IDI_BBC2 211 +#define IDI_DOWNARROW 212 #define IDC_CAPTURETAB 1005 #define IDC_CREDIT 1009 #define STATIC_WHITERECT 1100 @@ -91,6 +94,14 @@ #define ID_btnCapture 2005 #define ID_edtURL 2010 #define ID_bvlDesc 2011 +#define ID_bvlLine 2012 +#define ID_btnCopy 2013//group I +#define ID_btnBBC 2014 +#define ID_btnThumbCopy 2015//group II +#define ID_btnThumbBBC 2016 +#define ID_btnThumbBBC2 2017//end group I +#define ID_edtURLthumbLabel 2018 +#define ID_edtURLthumb 2019//end group II #define IDE_StatusBar 2501 // Next default values for new objects |