diff options
Diffstat (limited to 'src/mir_app')
-rw-r--r-- | src/mir_app/src/chat.h | 3 | ||||
-rw-r--r-- | src/mir_app/src/srmm_base.cpp | 10 | ||||
-rw-r--r-- | src/mir_app/src/srmm_toolbar.cpp | 5 |
3 files changed, 11 insertions, 7 deletions
diff --git a/src/mir_app/src/chat.h b/src/mir_app/src/chat.h index 9b2564bad0..84e9be92d9 100644 --- a/src/mir_app/src/chat.h +++ b/src/mir_app/src/chat.h @@ -30,6 +30,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define STREAMSTAGE_TAIL 2
#define STREAMSTAGE_STOP 3
+#define N_CUSTOM_BBCODES 3
+extern wchar_t *wszBbcodes[N_CUSTOM_BBCODES];
+
#define DM_OPTIONSAPPLIED (WM_USER+14)
void Srmm_CreateToolbarIcons(CSrmmBaseDialog *pDlg, int flags);
diff --git a/src/mir_app/src/srmm_base.cpp b/src/mir_app/src/srmm_base.cpp index 9495a98690..57b03ca48a 100644 --- a/src/mir_app/src/srmm_base.cpp +++ b/src/mir_app/src/srmm_base.cpp @@ -581,6 +581,8 @@ static void doMarkEventRead(MCONTACT hContact, MEVENT hEvent) Clist_RemoveEvent(-1, hEvent);
}
+wchar_t *wszBbcodes[N_CUSTOM_BBCODES] = { L"[img]", L"[code]", L"[quote]" };
+
INT_PTR CSrmmBaseDialog::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
@@ -608,12 +610,10 @@ INT_PTR CSrmmBaseDialog::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) }
if (wParam == IDC_CODE) {
- switch (lParam) {
- case 1: InsertBbcodeString(L"[code]"); break;
- case 2: InsertBbcodeString(L"[quote]"); break;
- default:
+ if (lParam > 0 && lParam < _countof(wszBbcodes))
+ InsertBbcodeString(wszBbcodes[lParam-1]);
+ else
Srmm_ClickToolbarIcon(m_hContact, wParam, m_hwnd, 0);
- }
}
break;
diff --git a/src/mir_app/src/srmm_toolbar.cpp b/src/mir_app/src/srmm_toolbar.cpp index b0ddabd7bd..1f7f2e0e9b 100644 --- a/src/mir_app/src/srmm_toolbar.cpp +++ b/src/mir_app/src/srmm_toolbar.cpp @@ -885,8 +885,9 @@ static int OnToolbarClicked(WPARAM, LPARAM lParam) return 0;
HMENU hMenu = CreatePopupMenu();
- AppendMenuW(hMenu, MF_STRING, 1, TranslateT("[code]"));
- AppendMenuW(hMenu, MF_STRING, 2, TranslateT("[quote]"));
+ for (int i = 0; i < N_CUSTOM_BBCODES; i++)
+ AppendMenuW(hMenu, MF_STRING, i + 1, wszBbcodes[i]);
+
int ret = TrackPopupMenu(hMenu, TPM_RETURNCMD, cbcd->pt.x, cbcd->pt.y, 0, cbcd->hwndFrom, nullptr);
if (ret != 0)
PostMessage(cbcd->hwndFrom, WM_COMMAND, IDC_CODE, ret);
|