soc.2009.vulture: 9c35d774: Beginnings of chat dialogue.

gdick at soc.pidgin.im gdick at soc.pidgin.im
Tue Jun 23 16:00:29 EDT 2009


-----------------------------------------------------------------
Revision: 9c35d774ce4998581f96e80a2b451dc1b20d34af
Ancestor: 7831e63942dee872ab655116e9bb7dc09c188296
Author: gdick at soc.pidgin.im
Date: 2009-06-23T13:37:33
Branch: im.pidgin.soc.2009.vulture
URL: http://d.pidgin.im/viewmtn/revision/info/9c35d774ce4998581f96e80a2b451dc1b20d34af

Modified files:
        vulture/purpleconv.c vulture/resource.h
        vulture/vulture-res.rc vulture/vultureconv.c
        vulture/vultureconv.h

ChangeLog: 

Beginnings of chat dialogue.

-------------- next part --------------
============================================================
--- vulture/purpleconv.c	2a67703f1d2bc79b3ce328b2ed3a018e0737ae8b
+++ vulture/purpleconv.c	4e56c5e9d7ef2e506dc537d4fd7fa2211e7138fe
@@ -48,6 +48,11 @@ void PurpleNewConversation(PurpleConvers
 	lpvconv->lpconv = lpconv;
 	lpvconv->hwndContainer = lpvconv->hwndConv = NULL;
 
+	/* Cache this, since the UI should not mess with the PurpleConversation
+	 * directly.
+	 */
+	lpvconv->convtype = lpconv->type;
+
 	InitializeCriticalSection(&lpvconv->sync.cs);
 	lpvconv->sync.szTitle = VultureUTF8ToTCHAR(purple_conversation_get_title(lpconv));
 
============================================================
--- vulture/resource.h	c8fb6d5e7659ea613f5f6afdba671100bb735ef8
+++ vulture/resource.h	a6055c0465d0535fe29a544087fcc5bd137fbf99
@@ -10,6 +10,8 @@
 #define IDM_CONV                                111
 #define IDD_CONVCONT                            113
 #define IDD_IM                                  115
+#define IDD_CHAT                                117
+#define IDC_LIST_NAMES                          1001
 #define IDC_TAB_CONVERSATIONS                   1001
 #define IDC_BUDDY_ICON                          1002
 #define IDC_LIST_ACCOUNTS                       1003
============================================================
--- vulture/vulture-res.rc	5f10333ff32a684cf4253efa092c20382a7d9dde
+++ vulture/vulture-res.rc	21a80ef8271d5e11fc42bebb78fa093252a4f5ef
@@ -70,6 +70,18 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_U
 
 
 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
+IDD_CHAT DIALOG 0, 0, 325, 235
+STYLE DS_3DLOOK | DS_CENTER | DS_SHELLFONT | WS_CHILDWINDOW | WS_DISABLED
+FONT 8, "Ms Shell Dlg"
+{
+    CONTROL         "", IDC_RICHEDIT_CONV, RICHEDIT_CLASS, WS_TABSTOP | WS_VSCROLL | WS_BORDER | ES_AUTOVSCROLL | ES_MULTILINE | ES_READONLY, 5, 5, 245, 180
+    CONTROL         "", IDC_RICHEDIT_INPUT, RICHEDIT_CLASS, WS_TABSTOP | WS_BORDER | ES_MULTILINE | ES_WANTRETURN, 5, 190, 245, 40
+    CONTROL         "", IDC_LIST_NAMES, WC_LISTVIEW, WS_TABSTOP | WS_BORDER | LVS_ALIGNLEFT | LVS_NOCOLUMNHEADER | LVS_SHAREIMAGELISTS | LVS_REPORT, 255, 5, 65, 225
+}
+
+
+
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
 IDD_CONVCONT DIALOG 0, 0, 281, 169
 STYLE DS_3DLOOK | DS_CENTER | DS_SHELLFONT | WS_VISIBLE | WS_CHILDWINDOW
 EXSTYLE WS_EX_TRANSPARENT
============================================================
--- vulture/vultureconv.c	0cd659ff231db7b73c5d403abdacafd36a3da840
+++ vulture/vultureconv.c	27e07705ec7564e6c22844bf80ee6d5778fa2b10
@@ -46,12 +46,15 @@ static int g_cyInput = 48;
 
 
 static int g_cyInput = 48;
+static int g_cxNames = 64;
 
 
 static LRESULT CALLBACK ConvContainerWndProc(HWND hwnd, UINT uiMsg, WPARAM wParam, LPARAM lParam);
 static INT_PTR CALLBACK ConvContTabDlgProc(HWND hwndDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam);
 static void RecalcTabIndices(HWND hwndTabs);
 static INT_PTR CALLBACK IMDlgProc(HWND hwndDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam);
+static INT_PTR CALLBACK ChatDlgProc(HWND hwndDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam);
+static INT_PTR CALLBACK ConvCommonDlgProc(HWND hwndDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam);
 static void ResizeActiveConversationWindow(HWND hwndConvContainer, HWND hwndTabs);
 static void RepositionConvControls(HWND hwndConvDlg);
 static LRESULT CALLBACK InputBoxSubclassProc(HWND hwnd, UINT uiMsg, WPARAM wParam, LPARAM lParam);
@@ -165,7 +168,11 @@ static LRESULT CALLBACK ConvContainerWnd
 				/* Create conversation dialogue. It is
 				 * initially disabled and hidden.
 				 */
-				lpvconv->hwndConv = CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_IM), hwndTabs, IMDlgProc, (LPARAM)lpvconv);
+				if(lpvconv->convtype == PURPLE_CONV_TYPE_IM)
+					lpvconv->hwndConv = CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_IM), hwndTabs, IMDlgProc, (LPARAM)lpvconv);
+				else
+					lpvconv->hwndConv = CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_CHAT), hwndTabs, ChatDlgProc, (LPARAM)lpvconv);
+
 				SetWindowPos(lpvconv->hwndConv, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOREPOSITION | SWP_NOSIZE);
 
 				/* Only strictly necessary if we're the only
@@ -373,6 +380,41 @@ static INT_PTR CALLBACK IMDlgProc(HWND h
  */
 static INT_PTR CALLBACK IMDlgProc(HWND hwndDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
 {
+	return ConvCommonDlgProc(hwndDlg, uiMsg, wParam, lParam);
+}
+
+
+/**
+ * Dialogue procedure for chat dialogues. Delegates processing common with IMs
+ * to ConvCommonDlgProc.
+ *
+ * @param	hwndDlg		Dialogue window handle.
+ * @param	uiMsg		Message ID.
+ * @param	wParam		Message-specific.
+ * @param	lParam		Message-specific.
+ *
+ * @return Usually TRUE if message processed and FALSE otherwise. There are
+ * some exceptions for particular messages.
+ */
+static INT_PTR CALLBACK ChatDlgProc(HWND hwndDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
+{
+	return ConvCommonDlgProc(hwndDlg, uiMsg, wParam, lParam);
+}
+
+
+/**
+ * Handles processing common to IM and chat windows.
+ *
+ * @param	hwndDlg		Dialogue window handle.
+ * @param	uiMsg		Message ID.
+ * @param	wParam		Message-specific.
+ * @param	lParam		Message-specific.
+ *
+ * @return Usually TRUE if message processed and FALSE otherwise. There are
+ * some exceptions for particular messages.
+ */
+static INT_PTR CALLBACK ConvCommonDlgProc(HWND hwndDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
+{
 	VULTURE_CONVERSATION *lpvconv;
 
 	switch(uiMsg)
@@ -471,7 +513,7 @@ static void ResizeActiveConversationWind
 }
 
 
-#define CONV_TOP_MARGIN		48
+#define CONV_IM_TOP_MARGIN		48
 
 /**
  * Repositions and resizes controls in a conversation window.
@@ -481,18 +523,26 @@ static void RepositionConvControls(HWND 
 static void RepositionConvControls(HWND hwndConvDlg)
 {
 	RECT rcClient;
-	HDWP hdwp = BeginDeferWindowPos(2);
+	VULTURE_CONVERSATION *lpvconv = (VULTURE_CONVERSATION*)GetWindowLongPtr(hwndConvDlg, GWLP_USERDATA);
+	HDWP hdwp = BeginDeferWindowPos(lpvconv->convtype == PURPLE_CONV_TYPE_CHAT ? 3 : 2);
+	int cxLeft, cyTopMargin;
 
 	GetClientRect(hwndConvDlg, &rcClient);
 
+	/* Width of input and output controls. */
+	cxLeft = rcClient.right - 2 * CONV_DLG_MARGIN - (lpvconv->convtype == PURPLE_CONV_TYPE_CHAT ? (CONV_DLG_MARGIN + g_cxNames) : 0);
+
+	/* Space for buddy's name, icon and so on. */
+	cyTopMargin = lpvconv->convtype == PURPLE_CONV_TYPE_IM ? CONV_IM_TOP_MARGIN : 0;
+
 	hdwp = DeferWindowPos(
 		hdwp,
 		GetDlgItem(hwndConvDlg, IDC_RICHEDIT_CONV),
 		NULL,
 		CONV_DLG_MARGIN,
-		CONV_DLG_MARGIN + CONV_TOP_MARGIN,
-		rcClient.right - 2 * CONV_DLG_MARGIN,
-		rcClient.bottom - g_cyInput - 3 * CONV_DLG_MARGIN - CONV_TOP_MARGIN,
+		CONV_DLG_MARGIN + cyTopMargin,
+		cxLeft,
+		rcClient.bottom - g_cyInput - 3 * CONV_DLG_MARGIN - cyTopMargin,
 		SWP_NOACTIVATE | SWP_NOZORDER);
 
 	hdwp = DeferWindowPos(
@@ -501,10 +551,23 @@ static void RepositionConvControls(HWND 
 		NULL,
 		CONV_DLG_MARGIN,
 		rcClient.bottom - g_cyInput - CONV_DLG_MARGIN,
-		rcClient.right - 2 * CONV_DLG_MARGIN,
+		cxLeft,
 		g_cyInput,
 		SWP_NOACTIVATE | SWP_NOZORDER);
 
+	if(lpvconv->convtype == PURPLE_CONV_TYPE_CHAT)
+	{
+		hdwp = DeferWindowPos(
+			hdwp,
+			GetDlgItem(hwndConvDlg, IDC_LIST_NAMES),
+			NULL,
+			2 * CONV_DLG_MARGIN + cxLeft,
+			CONV_DLG_MARGIN,
+			g_cxNames,
+			rcClient.bottom - 2 * CONV_DLG_MARGIN - cyTopMargin,
+			SWP_NOACTIVATE | SWP_NOZORDER);
+	}
+
 	EndDeferWindowPos(hdwp);
 }
 
============================================================
--- vulture/vultureconv.h	ca2cea87404b2370cf5432b9f4776aab779e637c
+++ vulture/vultureconv.h	a96bd80a732ea1aa2a26740f78295c2f2a6f2095
@@ -36,6 +36,7 @@ typedef struct _VULTURE_CONVERSATION
 	HWND			hwndContainer;
 	int			iTabIndex;
 	WNDPROC			wndprocInputOrig;
+	PurpleConversationType	convtype;
 
 	/* Data still needed by the core thread after initialisation. */
 	struct


More information about the Commits mailing list