diff options
| -rw-r--r-- | plugins/Scriver/res/resource.rc | 1 | ||||
| -rw-r--r-- | plugins/Scriver/src/msgdialog.cpp | 31 | ||||
| -rw-r--r-- | plugins/Scriver/src/resource.h | 1 | ||||
| -rw-r--r-- | plugins/Scriver/src/utils.cpp | 48 | 
4 files changed, 25 insertions, 56 deletions
diff --git a/plugins/Scriver/res/resource.rc b/plugins/Scriver/res/resource.rc index f9a27eb23a..5fcf5bb658 100644 --- a/plugins/Scriver/res/resource.rc +++ b/plugins/Scriver/res/resource.rc @@ -206,7 +206,6 @@ BEGIN      CONTROL         "",IDC_MESSAGE,"RichEdit50W",WS_VSCROLL | WS_TABSTOP | 0x1144,0,87,181,13,WS_EX_ACCEPTFILES | WS_EX_STATICEDGE
      CONTROL         "&User menu",IDC_USERMENU,"MButtonClass",0x0,1,71,16,14,WS_EX_NOACTIVATE | 0x10000000L
      CONTROL         "User &details",IDC_DETAILS,"MButtonClass",0x0,17,71,16,14,WS_EX_NOACTIVATE | 0x10000000L
 -    CONTROL         "&Emoticons",IDC_SMILEYS,"MButtonClass",0x0,41,71,16,14,WS_EX_NOACTIVATE | 0x10000000L
      CONTROL         "&Add",IDC_ADD,"MButtonClass",0x0,110,71,16,14,WS_EX_NOACTIVATE | 0x10000000L
      CONTROL         "&History",IDC_HISTORY,"MButtonClass",0x0,130,71,16,14,WS_EX_NOACTIVATE | 0x10000000L
      CONTROL         "&Quote",IDC_QUOTE,"MButtonClass",0x0,130,71,16,14,WS_EX_NOACTIVATE | 0x10000000L
 diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index b6c03cf06c..8f15fc1be7 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -35,7 +35,6 @@ static void UpdateReadChars(HWND hwndDlg, SrmmWindowData * dat);  static ToolbarButton toolbarButtons[] = {
  	{LPGENT("Quote"), IDC_QUOTE, 0, 4, 24},
 -	{LPGENT("Smiley"), IDC_SMILEYS, 0, 10, 24},
  	{LPGENT("Add contact"), IDC_ADD, 0, 10, 24},
  	{LPGENT("User menu"), IDC_USERMENU, 1, 0, 24},
  	{LPGENT("User details"), IDC_DETAILS, 1, 0, 24},
 @@ -194,9 +193,6 @@ static void SetDialogToType(HWND hwndDlg)  		ShowToolbarControls(hwndDlg, _countof(toolbarButtons), toolbarButtons, g_dat.buttonVisibility, showToolbar ? SW_SHOW : SW_HIDE);
  		if (!db_get_b(dat->hContact, "CList", "NotOnList", 0))
  			ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), SW_HIDE);
 -
 -		if (!g_dat.smileyAddInstalled)
 -			ShowWindow(GetDlgItem(hwndDlg, IDC_SMILEYS), SW_HIDE);
  	}
  	else ShowToolbarControls(hwndDlg, _countof(toolbarButtons), toolbarButtons, g_dat.buttonVisibility, SW_HIDE);
 @@ -684,6 +680,8 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP  			dat = (SrmmWindowData*)mir_calloc(sizeof(SrmmWindowData));
  			SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat);
  			dat->hContact = newData->hContact;
 +			WindowList_Add(g_dat.hMessageWindowList, hwndDlg, dat->hContact);
 +
  			NotifyLocalWinEvent(dat->hContact, hwndDlg, MSG_WINDOW_EVT_OPENING);
  			dat->hwnd = hwndDlg;
 @@ -753,7 +751,6 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP  			dat->toolbarSize.cx = GetToolbarWidth(_countof(toolbarButtons), toolbarButtons);
  			if (dat->splitterPos == -1)
  				dat->splitterPos = dat->minEditBoxHeight;
 -			WindowList_Add(g_dat.hMessageWindowList, hwndDlg, dat->hContact);
  			if (newData->szInitialText) {
  				if (newData->isWchar)
 @@ -779,7 +776,6 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP  			SendDlgItemMessage(hwndDlg, IDC_HISTORY, BUTTONADDTOOLTIP, (WPARAM)LPGEN("View user's history"), 0);
  			SendDlgItemMessage(hwndDlg, IDC_QUOTE, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Quote text"), 0);
 -			SendDlgItemMessage(hwndDlg, IDC_SMILEYS, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Insert emoticon"), 0);
  			SendDlgItemMessage(hwndDlg, IDOK, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Send message"), 0);
  			SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETOLECALLBACK, 0, (LPARAM)&reOleCallback);
 @@ -991,7 +987,6 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP  		SendDlgItemMessage(hwndDlg, IDC_DETAILS, BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon("scriver_USERDETAILS"));
  		SendDlgItemMessage(hwndDlg, IDC_HISTORY, BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon("scriver_HISTORY"));
  		SendDlgItemMessage(hwndDlg, IDC_QUOTE, BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon("scriver_QUOTE"));
 -		SendDlgItemMessage(hwndDlg, IDC_SMILEYS, BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon("scriver_SMILEY"));
  		SendDlgItemMessage(hwndDlg, IDOK, BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon("scriver_SEND"));
  		SendMessage(hwndDlg, DM_UPDATESTATUSBAR, 0, 0);
  		SetStatusIcon(dat);
 @@ -1652,28 +1647,6 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP  			CallService(MS_USERINFO_SHOWDIALOG, dat->hContact, 0);
  			break;
 -		case IDC_SMILEYS:
 -			if (g_dat.smileyAddInstalled) {
 -				SMADD_SHOWSEL3 smaddInfo;
 -				smaddInfo.cbSize = sizeof(SMADD_SHOWSEL3);
 -				smaddInfo.hwndParent = dat->hwndParent;
 -				smaddInfo.hwndTarget = GetDlgItem(hwndDlg, IDC_MESSAGE);
 -				smaddInfo.targetMessage = EM_REPLACESEL;
 -				smaddInfo.targetWParam = TRUE;
 -
 -				MCONTACT hContact = db_mc_getSrmmSub(dat->hContact);
 -				smaddInfo.Protocolname = (hContact != NULL) ? GetContactProto(hContact) : dat->szProto;
 -
 -				RECT rc;
 -				GetWindowRect(GetDlgItem(hwndDlg, IDC_SMILEYS), &rc);
 -				smaddInfo.Direction = 0;
 -				smaddInfo.xPosition = rc.left;
 -				smaddInfo.yPosition = rc.bottom;
 -				smaddInfo.hContact = dat->hContact;
 -				CallService(MS_SMILEYADD_SHOWSELECTION, 0, (LPARAM)&smaddInfo);
 -			}
 -			break;
 -
  		case IDC_QUOTE:
  			if (dat->hDbEventLast != NULL) {
  				SETTEXTEX  st;
 diff --git a/plugins/Scriver/src/resource.h b/plugins/Scriver/src/resource.h index f1eca2d5f9..6a48d04865 100644 --- a/plugins/Scriver/src/resource.h +++ b/plugins/Scriver/src/resource.h @@ -122,7 +122,6 @@  #define IDC_USERMENU                    1071
  #define IDC_QUOTE                       1072
  #define IDC_HISTORY                     1080
 -#define IDC_SMILEYS                     1081
  #define IDC_REMEMBER                    1082
  #define IDC_INFOBAR_NAME                1090
  #define IDC_INFOBAR_STATUS              1091
 diff --git a/plugins/Scriver/src/utils.cpp b/plugins/Scriver/src/utils.cpp index f9fac518df..95a4bc074c 100644 --- a/plugins/Scriver/src/utils.cpp +++ b/plugins/Scriver/src/utils.cpp @@ -192,11 +192,11 @@ TCHAR* limitText(TCHAR *text, int limit)  	}
  	return text;
  }
 +
  TCHAR* GetRichTextWord(HWND hwnd, POINTL *ptl)
  {
 -	TCHAR* pszWord = NULL;
  	long iCharIndex, start, end, iRes;
 -	pszWord = GetRichEditSelection(hwnd);
 +	TCHAR *pszWord = GetRichEditSelection(hwnd);
  	if (pszWord == NULL) {
  		iCharIndex = SendMessage(hwnd, EM_CHARFROMPOS, 0, (LPARAM)ptl);
  		if (iCharIndex >= 0) {
 @@ -219,9 +219,9 @@ TCHAR* GetRichTextWord(HWND hwnd, POINTL *ptl)  			}
  		}
  	}
 -	if (pszWord != NULL) {
 +	if (pszWord != NULL)
  		rtrimText(pszWord);
 -	}
 +
  	return pszWord;
  }
 @@ -240,20 +240,19 @@ TCHAR *GetRichEditSelection(HWND hwnd)  {
  	CHARRANGE sel;
  	SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM)&sel);
 -	if (sel.cpMin != sel.cpMax) {
 -		MessageSendQueueItem msi;
 -		EDITSTREAM stream;
 -		DWORD dwFlags = 0;
 -		memset(&stream, 0, sizeof(stream));
 -		stream.pfnCallback = StreamOutCallback;
 -		stream.dwCookie = (DWORD_PTR)&msi;
 -		dwFlags = SF_TEXT | SF_UNICODE | SFF_SELECTION;
 -		msi.sendBuffer = NULL;
 -		msi.sendBufferSize = 0;
 -		SendMessage(hwnd, EM_STREAMOUT, (WPARAM)dwFlags, (LPARAM)&stream);
 -		return (TCHAR*)msi.sendBuffer;
 -	}
 -	return NULL;
 +	if (sel.cpMin == sel.cpMax)
 +		return NULL;
 +		
 +	MessageSendQueueItem msi;
 +	msi.sendBuffer = NULL;
 +	msi.sendBufferSize = 0;
 +
 +	EDITSTREAM stream;
 +	memset(&stream, 0, sizeof(stream));
 +	stream.pfnCallback = StreamOutCallback;
 +	stream.dwCookie = (DWORD_PTR)&msi;
 +	SendMessage(hwnd, EM_STREAMOUT, SF_TEXT | SF_UNICODE | SFF_SELECTION, (LPARAM)&stream);
 +	return (TCHAR*)msi.sendBuffer;
  }
  void AppendToBuffer(char *&buffer, size_t &cbBufferEnd, size_t &cbBufferAlloced, const char *fmt, ...)
 @@ -367,7 +366,7 @@ char *url_encode(char *str)  	return buf;
  }
 -void SearchWord(TCHAR * word, int engine)
 +void SearchWord(TCHAR *word, int engine)
  {
  	char szURL[4096];
  	if (word && word[0]) {
 @@ -439,7 +438,7 @@ void GetContactUniqueId(SrmmWindowData *dat, char *buf, int maxlen)  	}
  }
 -HWND CreateToolTip(HWND hwndParent, LPTSTR ptszText, LPTSTR ptszTitle, RECT* rect)
 +HWND CreateToolTip(HWND hwndParent, LPTSTR ptszText, LPTSTR ptszTitle, RECT *rect)
  {
  	TOOLINFO ti = { 0 };
  	HWND hwndTT;
 @@ -472,7 +471,7 @@ void SetToolTipText(HWND hwndParent, HWND hwndTT, LPTSTR ptszText, LPTSTR ptszTi  	SendMessage(hwndTT, TTM_SETTITLE, TTI_NONE, (LPARAM)ptszTitle);
  }
 -void SetToolTipRect(HWND hwndParent, HWND hwndTT, RECT* rect)
 +void SetToolTipRect(HWND hwndParent, HWND hwndTT, RECT *rect)
  {
  	TOOLINFO ti = { sizeof(ti) };
  	ti.hinst = g_hInst;
 @@ -483,7 +482,7 @@ void SetToolTipRect(HWND hwndParent, HWND hwndTT, RECT* rect)  /* toolbar-related stuff, to be moved to a separate file */
 -HDWP ResizeToolbar(HWND hwnd, HDWP hdwp, int width, int vPos, int height, int cControls, const ToolbarButton * buttons, int controlVisibility)
 +HDWP ResizeToolbar(HWND hwnd, HDWP hdwp, int width, int vPos, int height, int cControls, const ToolbarButton *buttons, int controlVisibility)
  {
  	HWND hCtrl;
  	int i;
 @@ -515,12 +514,11 @@ void ShowToolbarControls(HWND hwndDlg, int cControls, const ToolbarButton* butto  		ShowWindow(GetDlgItem(hwndDlg, buttons[i].controlId), (controlVisibility & (1 << i)) ? state : SW_HIDE);
  }
 -int GetToolbarWidth(int cControls, const ToolbarButton * buttons)
 +int GetToolbarWidth(int cControls, const ToolbarButton *buttons)
  {
  	int w = 0;
  	for (int i = 0; i < cControls; i++)
 -		if (buttons[i].controlId != IDC_SMILEYS || g_dat.smileyAddInstalled)
 -			w += buttons[i].width + buttons[i].spacing;
 +		w += buttons[i].width + buttons[i].spacing;
  	return w;
  }
  | 
