//
LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
- static int last_split;
-// Pane* pane;
- ChildWnd* pChildWnd = (ChildWnd*)GetWindowLong(hWnd, GWL_USERDATA);
-// ChildWnd* new_child;
- ASSERT(pChildWnd);
+ static int last_split;
+ ChildWnd* pChildWnd = (ChildWnd*)GetWindowLong(hWnd, GWL_USERDATA);
+ ASSERT(pChildWnd);
if (1) {
switch(message) {
//goto def;
break;
- case WM_LBUTTONDOWN: {
+ case WM_LBUTTONDOWN: {
+ RECT rt;
+ int x = LOWORD(lParam);
+ GetClientRect(hWnd, &rt);
+ if (x>=pChildWnd->nSplitPos-SPLIT_WIDTH/2 && x<pChildWnd->nSplitPos+SPLIT_WIDTH/2+1) {
+ last_split = pChildWnd->nSplitPos;
+#ifdef _NO_EXTENSIONS
+ draw_splitbar(hWnd, last_split);
+#endif
+ SetCapture(hWnd);
+ }
+ break;}
+
+ case WM_LBUTTONUP:
+ if (GetCapture() == hWnd) {
+#ifdef _NO_EXTENSIONS
RECT rt;
int x = LOWORD(lParam);
-
+ draw_splitbar(hWnd, last_split);
+ last_split = -1;
GetClientRect(hWnd, &rt);
+ pChildWnd->nSplitPos = x;
+ //resize_tree(pChildWnd, rt.right, rt.bottom);
+#endif
+ ReleaseCapture();
+ }
+ break;
- if (x>=pChildWnd->nSplitPos-SPLIT_WIDTH/2 && x<pChildWnd->nSplitPos+SPLIT_WIDTH/2+1) {
- last_split = pChildWnd->nSplitPos;
#ifdef _NO_EXTENSIONS
- draw_splitbar(hWnd, last_split);
+ case WM_CAPTURECHANGED:
+ if (GetCapture()==hWnd && last_split>=0)
+ draw_splitbar(hWnd, last_split);
+ break;
#endif
- SetCapture(hWnd);
- }
-
- break;}
-
- case WM_LBUTTONUP:
+ case WM_KEYDOWN:
+ if (wParam == VK_ESCAPE)
if (GetCapture() == hWnd) {
-#ifdef _NO_EXTENSIONS
RECT rt;
- int x = LOWORD(lParam);
+#ifdef _NO_EXTENSIONS
draw_splitbar(hWnd, last_split);
- last_split = -1;
+#else
+ pChildWnd->nSplitPos = last_split;
+#endif
GetClientRect(hWnd, &rt);
- pChildWnd->nSplitPos = x;
//resize_tree(pChildWnd, rt.right, rt.bottom);
-#endif
+ last_split = -1;
ReleaseCapture();
+ SetCursor(LoadCursor(0, IDC_ARROW));
}
- break;
+ break;
+ case WM_MOUSEMOVE:
+ if (GetCapture() == hWnd) {
+ RECT rt;
+ int x = LOWORD(lParam);
#ifdef _NO_EXTENSIONS
- case WM_CAPTURECHANGED:
- if (GetCapture()==hWnd && last_split>=0)
- draw_splitbar(hWnd, last_split);
- break;
-#endif
-
- case WM_KEYDOWN:
- if (wParam == VK_ESCAPE)
- if (GetCapture() == hWnd) {
- RECT rt;
-#ifdef _NO_EXTENSIONS
- draw_splitbar(hWnd, last_split);
+ HDC hdc = GetDC(hWnd);
+ GetClientRect(hWnd, &rt);
+ rt.left = last_split-SPLIT_WIDTH/2;
+ rt.right = last_split+SPLIT_WIDTH/2+1;
+ InvertRect(hdc, &rt);
+ last_split = x;
+ rt.left = x-SPLIT_WIDTH/2;
+ rt.right = x+SPLIT_WIDTH/2+1;
+ InvertRect(hdc, &rt);
+ ReleaseDC(hWnd, hdc);
#else
- pChildWnd->nSplitPos = last_split;
-#endif
- GetClientRect(hWnd, &rt);
- //resize_tree(pChildWnd, rt.right, rt.bottom);
- last_split = -1;
- ReleaseCapture();
- SetCursor(LoadCursor(0, IDC_ARROW));
- }
- break;
-
- case WM_MOUSEMOVE:
- if (GetCapture() == hWnd) {
- RECT rt;
- int x = LOWORD(lParam);
-
-#ifdef _NO_EXTENSIONS
- HDC hdc = GetDC(hWnd);
- GetClientRect(hWnd, &rt);
-
- rt.left = last_split-SPLIT_WIDTH/2;
- rt.right = last_split+SPLIT_WIDTH/2+1;
- InvertRect(hdc, &rt);
-
- last_split = x;
+ GetClientRect(hWnd, &rt);
+ if (x>=0 && x<rt.right) {
+ pChildWnd->nSplitPos = x;
+ resize_tree(pChildWnd, rt.right, rt.bottom);
rt.left = x-SPLIT_WIDTH/2;
rt.right = x+SPLIT_WIDTH/2+1;
- InvertRect(hdc, &rt);
-
- ReleaseDC(hWnd, hdc);
-#else
- GetClientRect(hWnd, &rt);
-
- if (x>=0 && x<rt.right) {
- pChildWnd->nSplitPos = x;
- resize_tree(pChildWnd, rt.right, rt.bottom);
- rt.left = x-SPLIT_WIDTH/2;
- rt.right = x+SPLIT_WIDTH/2+1;
- InvalidateRect(hWnd, &rt, FALSE);
- UpdateWindow(pChildWnd->left.hWnd);
- UpdateWindow(hWnd);
- UpdateWindow(pChildWnd->right.hWnd);
- }
-#endif
+ InvalidateRect(hWnd, &rt, FALSE);
+ UpdateWindow(pChildWnd->left.hWnd);
+ UpdateWindow(hWnd);
+ UpdateWindow(pChildWnd->right.hWnd);
}
- break;
+#endif
+ }
+ break;
#ifndef _NO_EXTENSIONS
- case WM_GETMINMAXINFO:
- DefMDIChildProc(hWnd, message, wParam, lParam);
-
- {LPMINMAXINFO lpmmi = (LPMINMAXINFO)lParam;
-
- lpmmi->ptMaxTrackSize.x <<= 1;//2*GetSystemMetrics(SM_CXSCREEN) / SM_CXVIRTUALSCREEN
- lpmmi->ptMaxTrackSize.y <<= 1;//2*GetSystemMetrics(SM_CYSCREEN) / SM_CYVIRTUALSCREEN
- break;}
+ case WM_GETMINMAXINFO:
+ DefMDIChildProc(hWnd, message, wParam, lParam);
+ {LPMINMAXINFO lpmmi = (LPMINMAXINFO)lParam;
+ lpmmi->ptMaxTrackSize.x <<= 1;//2*GetSystemMetrics(SM_CXSCREEN) / SM_CXVIRTUALSCREEN
+ lpmmi->ptMaxTrackSize.y <<= 1;//2*GetSystemMetrics(SM_CYSCREEN) / SM_CYVIRTUALSCREEN
+ break;}
#endif
- case WM_SETFOCUS:
- SetCurrentDirectory(pChildWnd->szPath);
- SetFocus(pChildWnd->nFocusPanel? pChildWnd->hRightWnd: pChildWnd->hLeftWnd);
- break;
+ case WM_SETFOCUS:
+ SetCurrentDirectory(pChildWnd->szPath);
+ SetFocus(pChildWnd->nFocusPanel? pChildWnd->hRightWnd: pChildWnd->hLeftWnd);
+ break;
/*
case WM_COMMAND:
pane = GetFocus()==pChildWnd->left.hWnd? &pChildWnd->left: &pChildWnd->right;
}
break;
*/
- case WM_SIZE:
- if (wParam != SIZE_MINIMIZED) {
- OnSize(pChildWnd, wParam, lParam);
- }
- // fall through
- default: def:
- return DefMDIChildProc(hWnd, message, wParam, lParam);
+ case WM_SIZE:
+ if (wParam != SIZE_MINIMIZED) {
+ OnSize(pChildWnd, wParam, lParam);
}
- }
+ // fall through
+ default: def:
+ return DefMDIChildProc(hWnd, message, wParam, lParam);
+ }
return DefMDIChildProc(hWnd, message, wParam, lParam);
}
////////////////////////////////////////////////////////////////////////////////
-//
-//
-// FUNCTION: InitInstance(HANDLE, int)
-//
-// PURPOSE: Saves instance handle and creates main window
-//
-// COMMENTS:
-//
-// In this function, we save the instance handle in a global variable and
-// create and display the main program window.
-//
+
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
-// ChildWnd* pChildWnd;
-
WNDCLASSEX wcFrame = {
sizeof(WNDCLASSEX),
CS_HREDRAW | CS_VREDRAW/*style*/,
return TRUE;
}
+////////////////////////////////////////////////////////////////////////////////
+
void UpdateStatusBar(void)
{
TCHAR text[260];
return TRUE;
}
+////////////////////////////////////////////////////////////////////////////////
void ExitInstance(void)
{
int nCmdShow)
{
MSG msg;
- HACCEL hAccel;
+// HACCEL hAccel;
HWND hMDIClient;
// Initialize global strings
if (!InitInstance(hInstance, nCmdShow)) {
return FALSE;
}
- hAccel = LoadAccelerators(hInstance, (LPCTSTR)IDC_MDI_APP);
+// hAccel = LoadAccelerators(hInstance, (LPCTSTR)IDC_MDI_APP);
hMDIClient = GetWindow(hFrameWnd, GW_CHILD);
// Main message loop:
while (GetMessage(&msg, (HWND)NULL, 0, 0)) {
if (!TranslateMDISysAccel(hMDIClient, &msg) &&
- !TranslateAccelerator(hFrameWnd/*hwndFrame*/, hAccel, &msg)) {
+ !TranslateAccelerator(hFrameWnd, hAccel, &msg)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}