Esempio n. 1
0
LRESULT FileChildWindow::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
{
	switch(nmsg) {
		case WM_DRAWITEM: {
			LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT)lparam;
			Entry* entry = (Entry*) dis->itemData;

			if (dis->CtlID == IDW_TREE_LEFT) {
				_left->draw_item(dis, entry);
				return TRUE;
			} else if (dis->CtlID == IDW_TREE_RIGHT) {
				_right->draw_item(dis, entry);
				return TRUE;
			}

			goto def;}

		case WM_SIZE:
			if (wparam != SIZE_MINIMIZED)
				resize_children(LOWORD(lparam), HIWORD(lparam));
			return DefMDIChildProc(_hwnd, nmsg, wparam, lparam);

		case PM_GET_FILEWND_PTR:
			return (LRESULT)this;

		case WM_SETFOCUS: {
			TCHAR path[MAX_PATH];

			if (_left && _left->_cur) {
				_left->_cur->get_path(path, COUNTOF(path));
				SetCurrentDirectory(path);
			}

			SetFocus(_focus_pane? _right_hwnd: _left_hwnd);
			goto def;}

		case PM_DISPATCH_COMMAND: {
			Pane* pane = GetFocus()==_left_hwnd? _left: _right;

			switch(LOWORD(wparam)) {
			  case ID_WINDOW_NEW: {CONTEXT("FileChildWindow PM_DISPATCH_COMMAND ID_WINDOW_NEW");
				if (_root._entry->_etype == ET_SHELL)
					FileChildWindow::create(ShellChildWndInfo(GetParent(_hwnd)/*_hmdiclient*/, _path, DesktopFolderPath()));
				else
					FileChildWindow::create(FileChildWndInfo(GetParent(_hwnd)/*_hmdiclient*/, _path));
				break;}

			  case ID_REFRESH: {CONTEXT("ID_REFRESH");
				refresh();
				break;}

			  case ID_ACTIVATE: {CONTEXT("ID_ACTIVATE");
				activate_entry(pane);
				break;}

			  default:
				if (pane->command(LOWORD(wparam)))
					return TRUE;
				else
					return super::WndProc(nmsg, wparam, lparam);
			}

			return TRUE;}

		case WM_CONTEXTMENU: {
			 // first select the current item in the listbox
			HWND hpanel = (HWND) wparam;
			POINT pt;
			pt.x = LOWORD(lparam);
			pt.y = HIWORD(lparam);
			POINT pt_screen = pt;
			ScreenToClient(hpanel, &pt);
			SendMessage(hpanel, WM_LBUTTONDOWN, 0, MAKELONG(pt.x, pt.y));
			SendMessage(hpanel, WM_LBUTTONUP, 0, MAKELONG(pt.x, pt.y));

			 // now create the popup menu using shell namespace and IContextMenu
			Pane* pane = GetFocus()==_left_hwnd? _left: _right;
			int idx = ListBox_GetCurSel(*pane);
			if (idx != -1) {
				Entry* entry = (Entry*) ListBox_GetItemData(*pane, idx);

				HRESULT hr = entry->do_context_menu(_hwnd, pt_screen, _cm_ifs);

				if (SUCCEEDED(hr))
					refresh();
				else
					CHECKERROR(hr);
			}
			break;}

		default: def:
			return super::WndProc(nmsg, wparam, lparam);
	}

	return 0;
}
Esempio n. 2
0
LRESULT
CALLBACK
NewCmd_WindowProc(
    HWND hwnd,
    UINT uMsg,
    WPARAM wParam,
    LPARAM lParam
)
{
    PCMDWIN_DATA pCmdWinData = GetCmdWinData(hwnd);

    switch (uMsg) {
    default:
        return DefMDIChildProc(hwnd, uMsg, wParam, lParam);

    case WM_CREATE:
    {
        RECT rc;

        Assert(NULL == pCmdWinData);

        pCmdWinData = new CMDWIN_DATA;
        if (!pCmdWinData) {
            return -1; // Fail window creation
        }

        pCmdWinData->hwndHistory = CreateWindowEx(
                                       WS_EX_CLIENTEDGE,                           // Extended style
                                       "RichEdit",                                 // class name
                                       NULL,                                       // title
                                       WS_CLIPSIBLINGS
                                       | WS_CHILD | WS_VISIBLE
                                       | WS_HSCROLL | WS_VSCROLL
                                       | ES_AUTOHSCROLL | ES_AUTOVSCROLL
                                       | ES_MULTILINE | ES_READONLY,               // style
                                       0,                                          // x
                                       0,                                          // y
                                       100, //CW_USEDEFAULT,                              // width
                                       100, //CW_USEDEFAULT,                              // height
                                       hwnd,                                       // parent
                                       (HMENU) IDC_RICHEDIT_CMD_HISTORY,           // control id
                                       g_hInst,                                      // hInstance
                                       NULL);                                      // user defined data

        if (!pCmdWinData->hwndHistory) {
            delete pCmdWinData;
            return -1; // Fail window creation
        }


        pCmdWinData->hwndEdit = CreateWindowEx(
                                    WS_EX_CLIENTEDGE,                           // Extended style
                                    "RichEdit",                                 // class name
                                    NULL,                                       // title
                                    WS_CLIPSIBLINGS
                                    | WS_CHILD | WS_VISIBLE
                                    | WS_VSCROLL | ES_AUTOVSCROLL
                                    | ES_MULTILINE,                             // style
                                    0,                                          // x
                                    100,                                        // y
                                    100, //CW_USEDEFAULT,                              // width
                                    100, //CW_USEDEFAULT,                              // height
                                    hwnd,                                       // parent
                                    (HMENU) IDC_RICHEDIT_CMD_EDIT,              // control id
                                    g_hInst,                                      // hInstance
                                    NULL);                                      // user defined data

        if (!pCmdWinData->hwndEdit) {
            delete pCmdWinData;
            return -1; // Fail window creation
        }

        if (pCmdWinData->bHistoryActive) {
            SetFocus(pCmdWinData->hwndHistory);
        } else {
            SetFocus(pCmdWinData->hwndEdit);
        }

        GetClientRect(hwnd, &rc);
        pCmdWinData->nDividerPosition = rc.bottom / 2;
        g_DebuggerWindows.hwndCmd = hwnd;

        // Tell the edit controls, that we want notification of keyboard input
        // This is so we can process the enter key, and then send that text into the
        // History window.
        SendMessage(pCmdWinData->hwndEdit, EM_SETEVENTMASK, 0, ENM_KEYEVENTS);

        // store this in the window
        SetCmdWinData(hwnd, pCmdWinData);
    }
    return 0;

    case WU_INITDEBUGWIN:

        PCTRLC_HANDLER
        AddCtrlCHandler(
            CTRLC_HANDLER_PROC pfnFunc,
            DWORD              dwParam
        );

        BOOL
        DoCtrlCAsyncStop(
            DWORD dwParam
        );


        //
        // set up ctrlc handler
        //
        AddCtrlCHandler(DoCtrlCAsyncStop, FALSE);

        //
        // Initialize cmd processor, show initial prompt.
        //

        CmdSetDefaultCmdProc();
        if (arNone != AutoRun) {
            CmdDoPrompt(TRUE, TRUE);
        }

        return FALSE;

    case WM_NOTIFY:
    {
        switch (wParam) {
        case IDC_RICHEDIT_CMD_EDIT:
        {
            MSGFILTER * lpMsgFilter = (MSGFILTER *) lParam;

            if (EN_MSGFILTER == lpMsgFilter->nmhdr.code) {
                if (WM_CHAR == lpMsgFilter->msg && VK_RETURN == lpMsgFilter->wParam) {
                    long lLen;
                    TEXTRANGE TextRange;

                    // Get length.
                    // +1, we have to take into account the null terminator.
                    // +1 for the '>' character
                    // +4 for "\r\n\r\n"
                    lLen = (long) SendMessage(lpMsgFilter->nmhdr.hwndFrom,
                                              WM_GETTEXTLENGTH,
                                              0,
                                              0
                                             ) +6;

                    // Get everything
                    TextRange.chrg.cpMin = 0;
                    TextRange.chrg.cpMax = -1;
                    TextRange.lpstrText = (PSTR) GlobalAlloc(GPTR, lLen);

                    if (NULL == TextRange.lpstrText) {
                        FatalErrorBox(ERR_Cannot_Allocate_Memory, NULL);
                    } else {
                        *(TextRange.lpstrText) = '>';

                        // Okay got the text
                        SendMessage(pCmdWinData->hwndEdit,
                                    WM_GETTEXT,
                                    lLen,
                                    (LPARAM) (TextRange.lpstrText +1));

                        TextRange.chrg.cpMin = INT_MAX -1;
                        TextRange.chrg.cpMax = INT_MAX;
                        SendMessage(pCmdWinData->hwndHistory,
                                    EM_EXSETSEL,
                                    0,
                                    (LPARAM) &TextRange.chrg);

                        strcat(TextRange.lpstrText, "\n");

                        SendMessage(pCmdWinData->hwndHistory,
                                    EM_REPLACESEL,
                                    FALSE,
                                    (LPARAM) TextRange.lpstrText
                                   );

                        SendMessage(pCmdWinData->hwndHistory,
                                    EM_SCROLLCARET,
                                    0,
                                    0
                                   );

                        SendMessage(pCmdWinData->hwndEdit,
                                    WM_SETTEXT,
                                    0,
                                    (LPARAM) ""
                                   );

                        GlobalFree(TextRange.lpstrText);
                    }

                    // ignore the event
                    return 1;
                }
            }
        }
            // process the event
        return 0;
        }
    }
    return 0;

    case WM_GETMINMAXINFO:
    {
        LPMINMAXINFO lpMinMaxInfo = (LPMINMAXINFO) lParam;

        lpMinMaxInfo->ptMinTrackSize.x = MINWND_SIZE;
        lpMinMaxInfo->ptMinTrackSize.y = MINWND_SIZE;
    }
    return 0;

    case WM_LBUTTONDOWN:
    {
        pCmdWinData->bTrackingMouse = TRUE;
        SetCapture(hwnd);
    }
    return 0;

    case WM_MOUSEMOVE:
    {
        if (MK_LBUTTON & wParam && pCmdWinData->bTrackingMouse) {
            // We are resizing the History & Edit Windows
            RECT rc;

            GetClientRect(hwnd, &rc);

            // y position centered vertically around the cursor
            pCmdWinData->nDividerPosition = HIWORD(lParam) - GetSystemMetrics(SM_CYEDGE) /2;

            SendMessage(hwnd,
                        WM_SIZE,
                        SIZE_RESTORED,
                        MAKELPARAM(rc.right, rc.bottom)
                       );
        }
    }
    return 0;


    case WM_LBUTTONUP:
    {
        pCmdWinData->bTrackingMouse = FALSE;
        ReleaseCapture();
    }
    return 0;

    case WM_SIZE:
    {
        int nWidth = LOWORD(lParam);
        int nHeight = HIWORD(lParam);
        const int nDividerHeight = GetSystemMetrics(SM_CYEDGE);
        int nHistoryHeight = pCmdWinData->nDividerPosition;

        MoveWindow(pCmdWinData->hwndHistory,0, 0, nWidth, nHistoryHeight, TRUE);

        MoveWindow(pCmdWinData->hwndEdit, 0, nHistoryHeight + nDividerHeight,
                   nWidth, nHeight - nHistoryHeight - nDividerHeight, TRUE);
    }
    return 0;

    case WM_DESTROY:
    {
        // Clean up
        PVOID pv = SetCmdWinData(hwnd, NULL);
        if (pv) {
            delete pv;
        }

        g_DebuggerWindows.hwndCmd = NULL;
    }
    return 0;
    }
}
Esempio n. 3
0
LRESULT CALLBACK MenuDrawProc(HWND hwnd, UINT iMessage, WPARAM wParam,
    LPARAM lParam)
{
    static MENUITEM *start;
    static BOOL dragging;
    static HCURSOR oldcurs;
    static struct resRes *resData;
    static struct propertyFuncs *resFuncs;
    POINT mouse;
    RECT r;
    PAINTSTRUCT paint;
    HDC dc;
    LPCREATESTRUCT createStruct;
    struct resRes *menuData;
    int i;
    struct menuUndo *undo;
    switch (iMessage)
    {
        case WM_MDIACTIVATE:
            if ((HWND)lParam == hwnd)
            {
                doMaximize();
            }
            break;
        case WM_SETFOCUS:
            menuData = (struct resRes *)GetWindowLong(hwnd, 0);
            SetResourceProperties(resData, resFuncs);
            break;
        case EM_CANUNDO:
            menuData = (struct resRes *)GetWindowLong(hwnd, 0);
            return menuData->gd.undoData != NULL;
        case WM_KEYDOWN:
            menuData = (struct resRes *)GetWindowLong(hwnd, 0);
            switch (wParam)
            {
            case 'S':
                if (GetKeyState(VK_CONTROL) &0x80000000)
                {
                    PostMessage(hwnd, WM_COMMAND, IDM_SAVE, 0);
                }
                break;
            case 'Z':
                if (GetKeyState(VK_CONTROL) &0x80000000)
                {
                    PostMessage(hwnd, WM_COMMAND, IDM_UNDO, 0);
                }
                break;
            }
            break;
        case WM_CREATE:
            createStruct = (LPCREATESTRUCT)lParam;
            menuData = (struct resRes *)((LPMDICREATESTRUCT)(createStruct->lpCreateParams))->lParam;
            SetWindowLong(hwnd, 0, (long)menuData);
            menuData->activeHwnd = hwnd;
            resData = menuData;
            resFuncs = &menuFuncs;
            MarkUnexpanded(menuData->resource->u.menu->items);
            break;
        
        case WM_CLOSE:
            SendMessage(hwndSrcTab, TABM_REMOVE, 0, (LPARAM)hwnd);
            break;
        case WM_DESTROY:
            menuData = (struct resRes *)GetWindowLong(hwnd, 0);
            menuData->activeHwnd = NULL;
            undo = menuData->gd.undoData;
            menuData->gd.undoData = NULL;
            if (undo)
                menuData->gd.cantClearUndo = TRUE;
            while (undo)
            {
                struct menuUndo *next = undo->next;
                free(undo);
                undo = next;
            }
            break;
//        case WM_LBUTTONUP:
        case WM_MBUTTONUP:
        case WM_MBUTTONDOWN:
        case WM_RBUTTONDBLCLK:
        case WM_MBUTTONDBLCLK:
        case WM_RBUTTONUP:
            SetFocus(hwnd);
            return 1;
        case WM_PAINT:
            menuData = (struct resRes *)GetWindowLong(hwnd, 0);
            GetClientRect(hwnd, &r);
            dc = BeginPaint(hwnd, &paint);
            DoPaint(hwnd, dc, &paint, &r, menuData);
            EndPaint(hwnd, &paint);
            break;
        case WM_RBUTTONDOWN:
            menuData = (struct resRes *)GetWindowLong(hwnd, 0);
            SendMessage(hwnd, WM_COMMAND, ID_EDIT + (EN_KILLFOCUS << 16), 0);
            mouse.x = LOWORD(lParam);
            mouse.y = HIWORD(lParam);
            i = menuHitTest(hwnd, menuData, mouse);
            if (i)
            {
                HMENU menu, popup;
                SendMessage(hwnd, WM_COMMAND, MAKEWPARAM(ID_EDIT, CBN_KILLFOCUS), 0);
                menu = LoadMenuGeneric(hInstance, "RESMENUMENU");
                if (i & 2)
                    EnableMenuItem(menu, IDM_DELETE, MF_BYCOMMAND | MF_GRAYED);
                if (i & 4)
                    EnableMenuItem(menu, IDM_INSERT_SEPARATOR, MF_BYCOMMAND | MF_GRAYED);
                menuData->gd.selectedRow = mouse.y + menuData->gd.scrollPos.y;
                menuData->gd.selectedColumn = mouse.x + menuData->gd.scrollPos.x;
                popup = GetSubMenu(menu, 0);
                ClientToScreen(hwnd, &mouse);
                InsertBitmapsInMenu(popup);
                TrackPopupMenuEx(popup, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_LEFTBUTTON, mouse.x,
                    mouse.y, hwnd, NULL);
                DestroyMenu(menu);
            }
            return 1;
        case WM_LBUTTONDBLCLK:
            SendMessage(hwnd, WM_COMMAND, ID_EDIT + (EN_KILLFOCUS << 16), 0);
            SetFocus(hwnd);
            menuData = (struct resRes *)GetWindowLong(hwnd, 0);
            mouse.x = LOWORD(lParam);
            mouse.y = HIWORD(lParam);
            SelectSubmenu(hwnd, menuData, mouse, TRUE);
            break;
        case WM_MOUSEMOVE:
            if (dragging)
            {
                menuData = (struct resRes *)GetWindowLong(hwnd, 0);
                mouse.x = LOWORD(lParam);
                mouse.y = HIWORD(lParam);
                menuData->gd.selectedMenu = start;
                i = menuHitTest(hwnd, menuData, mouse);
                if (!oldcurs)
                    oldcurs = GetCursor();
                SetCursor(i & 8 ? dragCur : noCur);
            }
            break;
        case WM_LBUTTONDOWN:
            SetFocus(hwnd);
            menuData = (struct resRes *)GetWindowLong(hwnd, 0);
            SendMessage(hwnd, WM_COMMAND, ID_EDIT + (EN_KILLFOCUS << 16), 0);
            mouse.x = LOWORD(lParam);
            mouse.y = HIWORD(lParam);
            i = menuHitTest(hwnd, menuData, mouse);
            if (i & 1)
            {
                resData = menuData;
                resFuncs = &menuItemFuncs;
                start = menuData->gd.selectedMenu;
                dragging = TRUE;
                SetCapture(hwnd);
            }
            else
            {
                resData = menuData;
                resFuncs = &menuFuncs;
            }
            SetResourceProperties(resData, resFuncs);
            break;
        case WM_LBUTTONUP:
            if (dragging)
            {
                dragging = FALSE;
                ReleaseCapture();
            }
            menuData = (struct resRes *)GetWindowLong(hwnd, 0);
            if (oldcurs)
            {
                if (GetCursor() == dragCur)
                {
                    mouse.x = LOWORD(lParam);
                    mouse.y = HIWORD(lParam);
                    i = menuHitTest(hwnd, menuData, mouse);
                    DoMove(menuData, start, menuData->gd.selectedMenu);
                }
                SetCursor(oldcurs);
                oldcurs = NULL;
            }
            else
            {
                SendMessage(hwnd, WM_COMMAND, ID_EDIT + (EN_KILLFOCUS << 16), 0);
                SetFocus(hwnd);
                mouse.x = LOWORD(lParam);
                mouse.y = HIWORD(lParam);
                SelectSubmenu(hwnd, menuData, mouse, FALSE);
            }
            break;
        case WM_COMMAND:
            menuData = (struct resRes *)GetWindowLong(hwnd, 0);
            switch (LOWORD(wParam))
            {
                case ID_EDIT:
                    if (HIWORD(wParam) == EN_KILLFOCUS)
                    {
                        static BOOL inKillFocus;
                        if (menuData->gd.editWindow && !inKillFocus)
                        {
                            char buf[256];
                            char buf2[256];
                            UndoChange(menuData, menuData->gd.selectedMenu);
                            buf[GetWindowText(menuData->gd.editWindow, buf, sizeof(buf))] = 0;
                            StringWToA(buf2, menuData->gd.selectedMenu->text, wcslen(menuData->gd.selectedMenu->text));
                            if (strcmp(buf, buf2))
                            {
                                ResGetHeap(workArea, menuData);
                                if (menuData->gd.selectedMenu->id)
                                    ResGetMenuItemName(menuData->gd.selectedMenu->id, buf);
                                StringAsciiToWChar(&menuData->gd.selectedMenu->text, buf, strlen(buf));
                                ResSetDirty(menuData);
                            }
                            InvalidateRect(hwnd, 0, FALSE);
                            inKillFocus = TRUE;
                            DestroyWindow(menuData->gd.editWindow);
                            inKillFocus = FALSE;
                            menuData->gd.editWindow = NULL;
                        }
                    }
                    break;
                case IDM_DELETE:
                case IDM_INSERT:
                case IDM_INSERT_SEPARATOR:
                    InsertDelete(hwnd, menuData, LOWORD(wParam));
                    break;
                case IDM_SAVE:
                    if (menuData->resource->changed)
                    {
                        ResSaveCurrent(workArea, menuData);
                    }
                    break;
                case IDM_UNDO:
                    DoUndo(menuData);
                    break;
            }
            break;
        case WM_VSCROLL:
            menuData = (struct resRes *)GetWindowLong(hwnd, 0);
            switch (LOWORD(wParam))
            {
            case SB_BOTTOM:
                menuData->gd.scrollPos.y = menuData->gd.scrollMax.y;
                break;
            case SB_TOP:
                menuData->gd.scrollPos.y = 0;
                break;
            case SB_LINEDOWN:
                menuData->gd.scrollPos.y += 8;
                break;
            case SB_LINEUP:
                menuData->gd.scrollPos.y -= 8;
                break;
            case SB_PAGEDOWN:
                menuData->gd.scrollPos.y += 64;
                break;
            case SB_PAGEUP:
                menuData->gd.scrollPos.y -= 64;
                break;
            case SB_ENDSCROLL:
                return 0;
            case SB_THUMBPOSITION:
            case SB_THUMBTRACK:
            {
                SCROLLINFO si;
                memset(&si, 0, sizeof(si));
                si.cbSize = sizeof(si);
                si.fMask = SIF_TRACKPOS;
                GetScrollInfo(hwnd, SB_VERT, &si);
                menuData->gd.scrollPos.y = si.nTrackPos;
            }
                break;
            default:
                return 0;
            }
            if (menuData->gd.scrollPos.y < 0)
                menuData->gd.scrollPos.y = 0;
            if (menuData->gd.scrollPos.y >= menuData->gd.scrollMax.y)
                menuData->gd.scrollPos.y = menuData->gd.scrollMax.y;
            SetScrollPos(hwnd, SB_VERT, menuData->gd.scrollPos.y, TRUE);
            InvalidateRect(hwnd,0,FALSE);
            return 0;
        case WM_HSCROLL:
            menuData = (struct resRes *)GetWindowLong(hwnd, 0);
            switch (LOWORD(wParam))
            {
            case SB_LEFT:
                menuData->gd.scrollPos.x = 0;
                break;
            case SB_RIGHT:
                menuData->gd.scrollPos.x = menuData->gd.scrollMax.x;
                break;
            case SB_LINELEFT:
                menuData->gd.scrollPos.x -= 8;
                break;
            case SB_LINERIGHT:
                menuData->gd.scrollPos.x += 8;
                break;
            case SB_PAGERIGHT:
                menuData->gd.scrollPos.x += 64;
                break;
            case SB_PAGELEFT:
                menuData->gd.scrollPos.x -= 64;
                break;
            case SB_ENDSCROLL:
                return 0;
            case SB_THUMBPOSITION:
            case SB_THUMBTRACK:
            {
                SCROLLINFO si;
                memset(&si, 0, sizeof(si));
                si.cbSize = sizeof(si);
                si.fMask = SIF_TRACKPOS;
                GetScrollInfo(hwnd, SB_HORZ, &si);
                menuData->gd.scrollPos.x = si.nTrackPos;
            }
                break;
            }
            if (menuData->gd.scrollPos.x < 0)
                menuData->gd.scrollPos.x = 0;
            if (menuData->gd.scrollPos.x >= menuData->gd.scrollMax.x)
                menuData->gd.scrollPos.x = menuData->gd.scrollMax.x;
            SetScrollPos(hwnd, SB_HORZ, menuData->gd.scrollPos.x, TRUE);
            SetWindowPos(menuData->gd.childWindow, NULL,
                         menuData->gd.origin.x - menuData->gd.scrollPos.x,
                         menuData->gd.origin.y - menuData->gd.scrollPos.y,
                         0,0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
                         
            InvalidateRect(hwnd,0,FALSE);
                       
            return 0;
        case WM_SIZE:
            InvalidateRect(hwnd, 0, FALSE);
            break;
        default:
            break;
    }
    return DefMDIChildProc(hwnd, iMessage, wParam, lParam);
}
Esempio n. 4
0
/*
================
rvGEApp::MDIChildProc

MDI Child window procedure
================
*/
LRESULT CALLBACK rvGEApp::MDIChildProc ( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
	rvGEWorkspace* workspace = (rvGEWorkspace*)GetWindowLong ( hWnd, GWL_USERDATA );	

	// Give the active workspace a chance to play with it
	if ( workspace )
	{
		workspace->HandleMessage ( uMsg, wParam, lParam );
	}

	switch ( uMsg )
	{
		case WM_CLOSE:
			workspace->GetApplication ( )->mWorkspaces.Remove ( workspace );
			break;

		case WM_CREATE:
		{	
			LPMDICREATESTRUCT	mdics;
			LPCREATESTRUCT		cs;
					
			// MDI windows have their creation params buried two levels deep, extract
			// that param since it is the workspace pointer
			cs = (LPCREATESTRUCT) lParam;
			mdics = (LPMDICREATESTRUCT) cs->lpCreateParams;
			
			// Attach the workspace to the window
			workspace = (rvGEWorkspace*) mdics->lParam;
			workspace->Attach ( hWnd );			

			workspace->GetApplication ( )->mWorkspaces.Append ( workspace );				
				
			break;
		}

		case WM_MDIACTIVATE:
			assert ( workspace );
			if ( (HWND)lParam == hWnd )
			{				
				workspace->GetApplication ( )->GetNavigator().SetWorkspace(workspace);
				workspace->GetApplication ( )->GetTransformer().SetWorkspace(workspace);
				workspace->GetApplication ( )->GetProperties().SetWorkspace(workspace);
				gApp.GetStatusBar ( ).SetSimple ( false );
			}
			else if ( lParam == NULL )
			{
				gApp.GetStatusBar ( ).SetSimple ( true );
			}
			break;		

		case WM_DESTROY:
			assert ( workspace );
			workspace->Detach ( );
			delete workspace;
			break;

		case WM_SETCURSOR:
			return 1;

		case WM_ERASEBKGND:
			return TRUE;

		case WM_PAINT:
		{
			HDC			dc;
			PAINTSTRUCT	ps;
			
			dc = BeginPaint(hWnd, &ps); 
			
			if ( workspace )
			{
				workspace->Render ( dc );
			}
			
            EndPaint(hWnd, &ps); 
           
			break;
		}
	}
	
	return DefMDIChildProc ( hWnd, uMsg, wParam, lParam );
}
Esempio n. 5
0
WXLRESULT wxMDIChildFrame::MSWDefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
{
    return DefMDIChildProc(GetHwnd(),
                           (UINT)message, (WPARAM)wParam, (LPARAM)lParam);
}
Esempio n. 6
0
int OSMDIChildWnd::callDefProc(HWND wnd, UINT msg, int wparam, int lparam) {
#ifdef DETACHABLE
  if (detached) return DefWindowProc(wnd, msg, wparam, lparam);
#endif
  return DefMDIChildProc(wnd, msg, wparam, lparam);
}
Esempio n. 7
0
LRESULT CALLBACK DocWin::WmCommand(
    HWND hwnd,
    WPARAM wParam,
    LPARAM lParam
    ) {
    switch(LOWORD(wParam)) {
    case IDM_SAVE:
        return IdmSave(hwnd, wParam, lParam);
    case IDM_SAVE_AS:
        return IdmSaveAs(hwnd, wParam, lParam);
    case IDM_UNDO:
        return IdmUndo(hwnd, wParam, lParam);
    case IDM_REDO:
        return IdmRedo(hwnd, wParam, lParam);
    case IDM_COPY:
        return IdmCopy(hwnd, wParam, lParam);
    case IDM_CUT:
        return IdmCut(hwnd, wParam, lParam);
    case IDM_PASTE:
        return IdmPaste(hwnd, wParam, lParam);
    case IDM_SELECT_ALL:
        return IdmSelectAll(hwnd, wParam, lParam);
    case IDM_DELETE:
        return IdmDelete(hwnd, wParam, lParam);
    case IDM_FIND:
        return IdmFind(hwnd, wParam, lParam);
    case IDM_FIND_NEXT:
        return IdmFindNext(hwnd, wParam, lParam);
    case IDM_REPLACE:
        return IdmReplace(hwnd, wParam, lParam);
    case IDM_REPLACE_NEXT:
        return IdmReplaceNext(hwnd, wParam, lParam);
    case IDM_EVAL_BUFFER:
        return IdmEvalBuffer(hwnd, wParam, lParam);
    case IDM_EVAL_WITH_ARGV:
        return IdmEvalWithArgv(hwnd, wParam, lParam);
    case IDM_EVAL_SELECT:
        return IdmEvalSelect(hwnd, wParam, lParam);
    case IDM_CHECK_SYNTAX:
        return IdmCheckSyntax(hwnd, wParam, lParam);
    case IDM_SPLIT_CONSOLE:
        return IdmSplitConsole(hwnd, wParam, lParam);
    case CMD_SAVED:
        return CmdSaved(hwnd, wParam, lParam);
    case CMD_UNSAVE:
        return !CmdSaved(hwnd, wParam, lParam);
    case CMD_CONSOLE_GETS:
        return CmdConsoleGets(hwnd, wParam, lParam);
    case CMD_SPLIT_CONSOLE_GETS:
        return CmdSplitConsoleGets(hwnd, wParam, lParam);
    case CMD_SETCHARFORMAT:
        return CmdSetCharFormat(hwnd, wParam, lParam);
    case CMD_SETBACKCOLOR:
        return CmdSetBackColor(hwnd, wParam, lParam);
    case CMD_SETVIEWLINE:
        return CmdSetViewLine(hwnd, wParam, lParam);
    case CMD_CONSOLE_WRITE:
        return CmdConsoleWrite(hwnd, wParam, lParam);
    case CMD_SPLIT_CONSOLE_WRITE:
        return CmdSplitConsoleWrite(hwnd, wParam, lParam);
    }
    return DefMDIChildProc(hwnd, WM_COMMAND, wParam, lParam);
}
Esempio n. 8
0
WINEXPORT LRESULT CALLBACK WdeResWndProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam )
{
    WdeResInfo  *res_info;
    int         msg_processed;
    LRESULT     ret;

    msg_processed = FALSE;
    ret = FALSE;
    res_info = NULL;

    switch( message ) {
    case WM_CREATE:
        res_info = (WdeResInfo *)((MDICREATESTRUCT *)((CREATESTRUCT *)lParam)->lpCreateParams)->lParam;
        res_info->res_win = hWnd;
        SET_WNDINFO( hWnd, (LONG_PTR)res_info );
        break;
    //case WM_COMMAND:
    //case WM_KEYUP:
    //case WM_KEYDOWN:
    case WM_SIZE:
    case WM_MDIACTIVATE:
    case WM_CLOSE:
        res_info = (WdeResInfo *)GET_WNDINFO( hWnd );
        break;
    case WM_DESTROY:
        SET_WNDINFO( hWnd, (LONG_PTR)NULL );
        break;
    }

    if( res_info != NULL ) {
        switch( message ) {
#if 0
        case WM_KEYUP:
        case WM_KEYDOWN:
            WdePassToEdit( message, wParam, lParam );
            break;

        case WM_COMMAND:
            switch( LOWORD( wParam ) ) {
            case IDM_ESCAPE:
                ret = WdePassToEdit( message, wParam, lParam );
                break;
            }
            break;
#endif

        case WM_SIZE:
            WdeResizeEditWindows( res_info );
            break;

        case WM_MDIACTIVATE:
            WdeActivateResourceWindow( res_info, wParam, lParam );
            break;

        case WM_CLOSE:
            if( !WdeDestroyResourceWindow( res_info ) ) {
                return( (LRESULT)FALSE );
            }
            break;
        }
    }

    if( !msg_processed ) {
        ret = DefMDIChildProc( hWnd, message, wParam, lParam );
    }

    return( ret );
}
Esempio n. 9
0
/*------------------------------------------------------------------------
Procedure:     MdiChildWndProc ID:1
Purpose:       The edit control is enclosed in a normal MDI window.
This is the window procedure for that window. When it
receives the WM_CREATE message, it will create the
edit control.
Input:
Output:
Errors:
--------------------------------------------------------------------------
Edit History:
	14 Sept 2003 - Chris Watford [email protected]
		- Added edit buffer and statement buffer support to the WM_NEWLINE
		  message.
	15 Sept 2003 - Chris Watford [email protected]
		- Got it adding to the edit buffer
	16 Sept 2003 - Chris Watford [email protected]
		- Proper handling of newline message finished
	21 Sept 2003 - Chris Watford [email protected]
		- Added error detection on return from ocaml interp
	23 Sept 2003 - Chris Watford [email protected]
		- Fixed prompt detection error as pointed out by Patrick Meredith
------------------------------------------------------------------------*/
static LRESULT CALLBACK MdiChildWndProc(HWND hwnd,UINT msg,WPARAM wparam,LPARAM lparam)
{
	HWND hwndChild;
	RECT rc;
	HDC hDC;

	switch(msg) {
		case WM_CREATE:
			GetClientRect(hwnd,&rc);
			hwndChild= CreateWindow("EDIT",
				NULL,
				WS_CHILD | WS_VISIBLE |
				ES_MULTILINE |
				WS_VSCROLL | WS_HSCROLL |
				ES_AUTOHSCROLL | ES_AUTOVSCROLL,
				0,
				0,
				(rc.right-rc.left),
				(rc.bottom-rc.top),
				hwnd,
				(HMENU) EditControls++,
				hInst,
				NULL);
			SetWindowLongPtr(hwnd, DWLP_USER, (LONG_PTR) hwndChild);
			SendMessage(hwndChild, WM_SETFONT, (WPARAM) ProgramParams.hFont, 0L);
			SendMessage(hwndChild,EM_LIMITTEXT,0xffffffff,0);
			SubClassEditField(hwndChild);
			break;
			// Resize the edit control
		case WM_SIZE:
			hwndChild = (HWND) GetWindowLongPtr(hwnd, DWLP_USER);
			MoveWindow(hwndChild, 0, 0, LOWORD(lparam), HIWORD(lparam), TRUE);
			break;
			// Always set the focus to the edit control.
		case WM_SETFOCUS:
			hwndChild = (HWND) GetWindowLongPtr(hwnd, DWLP_USER);
			SetFocus(hwndChild);
			break;
			// Repainting of the edit control about to happen.
			// Set the text color and the background color
		case WM_CTLCOLOREDIT:
			hDC = (HDC)wparam;
			SetTextColor(hDC,ProgramParams.TextColor);
			SetBkColor(hDC,BackColor);
			return (LRESULT)BackgroundBrush;
			// Take care of erasing the background color to avoid flicker
		case WM_ERASEBKGND:
			GetWindowRect(hwnd,&rc);
			hDC = (HDC)wparam;
			FillRect(hDC,&rc,BackgroundBrush);
			return 1;
			// A carriage return has been pressed. Send the data to the interpreted.
			// This message is posted by the subclassed edit field.
		case WM_COMMAND:
			if (LOWORD(wparam) >= IDEDITCONTROL && LOWORD(wparam) < IDEDITCONTROL+5) {
				switch (HIWORD(wparam)) {
					case EN_ERRSPACE:
					case EN_MAXTEXT:
						ResetText();
						break;
				}
			}
			break;
		case WM_NEWLINE:
			if (busy)
				break;

			hwndChild = (HWND) GetWindowLongPtr(hwnd, DWLP_USER);

			// add what they wrote to the edit buffer
			AppendToEditBuffer(hwndChild);

		/** Modified by Chris Watford 14 Sept 2003, 15 Sept 2003, 16 Sept 2003 **/
			// test if this line has an end or if it needs to be in the Edit Buffer
			if(SendingFullCommand())
			{
				// send the edit buffer to the interpreter
				//SendLastLine(hwndChild);
				SendLastEditBuffer(hwndChild);
				historyEntry = NULL;
			} else {
				AddStringToControl("  ");
			}
		/** End Modifications **/

			break;
			// The timer will call us 4 times a second. Look if the interpreter
			// has written something in its end of the pipe.
		case WM_TIMERTICK:
		/** Modified by Chris Watford 21 Sept 2003 **/
			hwndChild = (HWND) GetWindowLongPtr(hwnd, DWLP_USER);

			if (ReadToLineBuffer())
			{
				int errMsg = 0;
				char *p, *l = lineBuffer;

				// Ok we read something. Display the trimmed version
				while(((*l) == ' ') || ((*l) == '\t') || ((*l) == '\n') || ((*l) == '\r') || ((*l) == '*'))
					l++;

				SendMessage(hwndChild,EM_REPLACESEL,0,(LPARAM)l);

				// fix bug where it won't find prompt
				p = strrchr(l, '\r');
				if((l[0] == '#') || (p != NULL))
				{
					if(p != NULL)
					{
						if(!strcmp(p, "\r\n# "))
						{
							SetLastPrompt(hwndChild);
						}
					// solve the bug Patrick found
					} else if((l[0] == '#') && (l[1] == ' ')) {
						SetLastPrompt(hwndChild);
					}
				}

				// detect syntax errors
				if(strstr(lineBuffer, "Syntax error"))
				{
					errMsg = WM_SYNTAXERROR;
				} else if(strstr(lineBuffer, "Illegal character")) {
					errMsg = WM_ILLEGALCHAR;
				} else if(strstr(lineBuffer, "Unbound value")) {
					errMsg = WM_UNBOUNDVAL;
				}

				// error! error! alert alert!
				if(errMsg > 0)
				{
					int len = strlen(lineBuffer);
					char* err = (char*)SafeMalloc(len+1);
					char *m = err, *n1 = NULL, *n2 = NULL, *nt = NULL;

					// make a copy of the message
					strncpy(err, lineBuffer, len);
					err[len] = '\0';

					// find it
					m = strstr(err, "Characters ");
					if(m == NULL)
						break;

					// got the start char
					n1 = m + strlen("Characters ");
					
					// start looking for the end char
					nt = strstr(n1, "-");
					if(nt == NULL)
						break;
					
					// makes n1 a valid string
					nt[0] = '\0';

					// end char is right after this
					n2 = nt + 1;

					// find the end of n2
					nt = strstr(n2, ":");
					if(nt == NULL)
						break;

					// makes n2 a valid string
					nt[0] = '\0';

					SendMessage(hwndChild, errMsg, (WPARAM)atoi(n1), (LPARAM)atoi(n2));
				}
			}
		/** End Modifications **/

			break;

	}
	return DefMDIChildProc(hwnd, msg, wparam, lparam);
}
Esempio n. 10
0
static LRESULT CALLBACK
EditWndProc(HWND hwnd,
            UINT uMsg,
            WPARAM wParam,
            LPARAM lParam)
{
    PEDIT_WND_INFO Info;
    LRESULT Ret = 0;

    /* Get the window context */
    Info = (PEDIT_WND_INFO)GetWindowLongPtr(hwnd,
                                            GWLP_USERDATA);
    if (Info == NULL && uMsg != WM_CREATE)
    {
        goto HandleDefaultMessage;
    }

    switch (uMsg)
    {
        case WM_CREATE:
        {
            Info = (PEDIT_WND_INFO)(((LPMDICREATESTRUCT)((LPCREATESTRUCT)lParam)->lpCreateParams)->lParam);
            Info->hSelf = hwnd;

            SetWindowLongPtr(hwnd,
                             GWLP_USERDATA,
                             (LONG_PTR)Info);

            if (!InitEditWnd(Info))
            {
                Ret = (LRESULT)-1;
                break;
            }
            break;
        }

        case WM_SIZE:
        {
            RECT rcClient;

            if (GetClientRect(Info->hSelf,
                              &rcClient))
            {
                SetWindowPos(Info->hEdit,
                             NULL,
                             0,
                             0,
                             rcClient.right,
                             rcClient.bottom,
                             SWP_NOZORDER);
            }
        }

        default:
HandleDefaultMessage:
            Ret = DefMDIChildProc(hwnd,
                                  uMsg,
                                  wParam,
                                  lParam);
            break;
    }

    return Ret;

}
Esempio n. 11
0
LRESULT CALLBACK MDIChildWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch (msg)
	{
		case WM_CREATE:
			{
				//Create Edit Control
				HWND hEdit;
				HFONT hfDefault;
				hEdit = CreateWindowEx(WS_EX_CLIENTEDGE, "EDIT", "",
						WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_HSCROLL | ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL,
						0, 0, 100, 100, hwnd, (HMENU)IDC_CHILD_EDIT, GetModuleHandle(NULL), NULL);
				if (hEdit == NULL)
					MessageBox(hwnd, "Could not create edit box.", "Error", MB_OK | MB_ICONERROR);

				hfDefault = (HFONT)GetStockObject(DEFAULT_GUI_FONT);
				SendMessage(hEdit, WM_SETFONT, (WPARAM)hfDefault, MAKELPARAM(FALSE, 0));

				break;
			}

		case WM_MDIACTIVATE:
			{
				HMENU hMenu, hFileMenu;
				UINT EnableFlag;

				hMenu = GetMenu(g_hMainWindow);
				if(hwnd == (HWND)lParam)
				{	   //being activated, enable the menus
					EnableFlag = MF_ENABLED;
				}
				else
				{						   //being de-activated, gray the menus
					EnableFlag = MF_GRAYED;
				}

				EnableMenuItem(hMenu, 1, MF_BYPOSITION | EnableFlag);
				EnableMenuItem(hMenu, 2, MF_BYPOSITION | EnableFlag);

				hFileMenu = GetSubMenu(hMenu, 0);
				EnableMenuItem(hFileMenu, ID_FILE_SAVEAS, MF_BYCOMMAND | EnableFlag);

				EnableMenuItem(hFileMenu, ID_FILE_CLOSE, MF_BYCOMMAND | EnableFlag);
				EnableMenuItem(hFileMenu, ID_FILE_CLOSEALL, MF_BYCOMMAND | EnableFlag);

				DrawMenuBar(g_hMainWindow);
				break;
			}
		case WM_COMMAND:
			switch(LOWORD(wParam))
			{
				case ID_EDIT_CUT:
					SendDlgItemMessage(hwnd, IDC_CHILD_EDIT, WM_CUT, 0, 0);
					break;
				case ID_EDIT_COPY:
					SendDlgItemMessage(hwnd, IDC_CHILD_EDIT, WM_COPY, 0, 0);
					break;
				case ID_EDIT_PASTE:
					SendDlgItemMessage(hwnd, IDC_CHILD_EDIT, WM_PASTE, 0, 0);
					break;
			}
			break;

		case WM_SIZE:
			{
				//Calculate remaining height and size edit
				HWND hEdit;
				RECT rcClient;
				GetClientRect(hwnd, &rcClient);
				hEdit = GetDlgItem(hwnd, IDC_CHILD_EDIT);
				SetWindowPos(hEdit, NULL, 0, 0, rcClient.right, rcClient.bottom, SWP_NOZORDER);

				return DefMDIChildProc(hwnd, msg, wParam, lParam);
			}
		default:
			return DefMDIChildProc(hwnd, msg, wParam, lParam);
	}
	return 0;
}
Esempio n. 12
0
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 子窗口回调函数
LRESULT CALLBACK CChildWnd::ClildWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	CChildWnd *pThis;
	LPMDICREATESTRUCT pmcsCreate;

	switch (uMsg)
	{
	case WM_CREATE:
		// 获取 this 指针
		_Assert(lParam);
		pmcsCreate = (LPMDICREATESTRUCT) ((LPCREATESTRUCT) lParam)->lpCreateParams;
		_Assert(pmcsCreate);
		pThis = (CChildWnd *) pmcsCreate->lParam;
		_Assert(pThis);		
		pThis->m_hWnd = hWnd;
		pThis->OnCreate();
		break;

	case WM_WINDOWPOSCHANGED:
		// 位置改变
		GetWnd(hWnd)->SetDrawRect();
		break;

	case WM_SIZE:
		// 尺寸改变
		if (wParam != SIZE_MINIMIZED)
		{
			_Assert(GetWnd(hWnd));
			GetWnd(hWnd)->OnSize(wParam, lParam);
		}
		break;

	case WM_INITMENUPOPUP:
		if (GetMenuItemID((HMENU) wParam, 0) == IDM_Play_Play)
		{
			GetWnd(hWnd)->OnMenuPopup();
		}
		break;

	case WM_NOTIFY:
	case WM_MENUSELECT:
	case WM_EXITMENULOOP:
		// 设置工具栏和状态栏提示信息
		OnNotify(hWnd, uMsg, wParam, lParam);
		break;

	case WM_COMMAND:
		// 命令消息
		GetWnd(hWnd)->OnCommand(wParam, lParam);
		break;

	case WM_KILLFOCUS:
		// 取消
		_ExIf(GetWnd(hWnd)->m_bExporting, SetFocus(hWnd));
		break;

	case WM_KEYDOWN:
		// 取消
		_ExIf(wParam == VK_ESCAPE, GetWnd(hWnd)->m_bCancel = TRUE);
		break;

	case WM_NCDESTROY:
		// 窗口销毁
		CClientWnd::OnChildOpenClose();
		_Assert(GetWnd(hWnd));
		delete GetWnd(hWnd);
		break;
	}

	return DefMDIChildProc(hWnd, uMsg, wParam, lParam);
}
Esempio n. 13
0
LRESULT CALLBACK QTFrame_MovieWndProc (HWND theWnd, UINT theMessage, UINT wParam, LONG lParam)
{
	WPARAM				myWidth, myHeight;
	MovieController		myMC = NULL;
	Movie				myMovie = NULL;
	WindowObject		myWindowObject = NULL;
	MSG					myMsg = {0};
	EventRecord			myMacEvent;
	Boolean				myIsHandled = false;

	// get the window object, movie, and movie controller for this window
	myWindowObject = QTFrame_GetWindowObjectFromWindow(theWnd);
	if (myWindowObject != NULL) {
		myMC = (**myWindowObject).fController;
		myMovie = (**myWindowObject).fMovie;
	}

	// give the movie controller this message first
	if ((!gShuttingDown) && (theMessage != WM_COMMAND)) {
		LONG			myPoints = GetMessagePos();

		myMsg.hwnd = theWnd;
		myMsg.message = theMessage;
		myMsg.wParam = wParam;
		myMsg.lParam = lParam;
		myMsg.time = GetMessageTime();
		myMsg.pt.x = LOWORD(myPoints);
		myMsg.pt.y = HIWORD(myPoints);

		// translate a Windows event to a Mac event
		WinEventToMacEvent(&myMsg, &myMacEvent);

		// let the application-specific code have a chance to intercept the event
		myIsHandled = QTApp_HandleEvent(&myMacEvent);
		
		// pass the Mac event to the movie controller, but only if the movie window isn't minimized
		if (!myIsHandled)
			if (myMC != NULL)
				if (!IsIconic(theWnd))
					myIsHandled = MCIsPlayerEvent(myMC, (EventRecord *)&myMacEvent);
	}

	switch (theMessage) {
		case WM_CREATE: {
				LONG		myStyles;
				
				// create a new window object associated with the new window
				QTFrame_CreateWindowObject(theWnd);
			
				// disable the maximize button
				myStyles = GetWindowLong(theWnd, GWL_STYLE);
				myStyles &= ~WS_MAXIMIZEBOX;
				SetWindowLong(theWnd, GWL_STYLE, myStyles);
			}
			break;

		case WM_WINDOWPOSCHANGING:
			// don't show the window until we have created a movie and
			// can therefore properly size the window to contain the movie
			if (gWeAreCreatingWindow) {
				WINDOWPOS	*lpWindowPos = (WINDOWPOS*)lParam;
				
				lpWindowPos->flags &= ~SWP_SHOWWINDOW;
			}
			break;

		case WM_WINDOWPOSCHANGED:
			// if a movie window has become minimized, stop the movie
			if (IsIconic(theWnd))
				StopMovie(myMovie);
			break;

		case WM_SIZE:
			// resize the movie and controller to fit the window
			myWidth = LOWORD(lParam);
			myHeight = HIWORD(lParam);
			
			// we do NOT want to resize the movie controller if the window is minimized,
			// if there is no movie controller, or if we are in the middle of resizing the window
			if (!gWeAreSizingWindow && (myMC != NULL) && (wParam != SIZE_MINIMIZED)) {
				Rect		myRect;
				
				myRect.top = 0;
				myRect.left = 0;
				myRect.right = myWidth;
				myRect.bottom = myHeight;
				
				MCSetControllerBoundsRect(myMC, &myRect);
			}
			break;

		case WM_MOUSEMOVE:
			// for QuickTime movies (but NOT for QuickTime VR movies), set the cursor to the arrow cursor
			if (myWindowObject != NULL)
				if (!(**myWindowObject).fIsQTVRMovie)
					SetCursor(LoadCursor(NULL, IDC_ARROW));
			break;

		case WM_PUMPMOVIE:
			// we receive this message only to task the movie
			break;

		case WM_LBUTTONDOWN:
			// do any application-specific mouse-button handling, but only if the message hasn't already been handled
			if (!myIsHandled)
				QTApp_HandleContentClick(theWnd, &myMacEvent);
			break;

		case WM_CHAR:
			// do any application-specific key press handling
			QTApp_HandleKeyPress((char)wParam);
			break;

		case WM_PAINT: {
			// do any application-specific drawing in the window
				PAINTSTRUCT		myPaintStruct;

				BeginPaint(theWnd, &myPaintStruct);

				// if the window contains an image, draw it using GraphicsImportDraw
				if (myWindowObject != NULL)
					if ((**myWindowObject).fGraphicsImporter != NULL)
						GraphicsImportDraw((**myWindowObject).fGraphicsImporter);
			
				QTApp_Draw(theWnd);
				
				EndPaint(theWnd, &myPaintStruct);
			}
			break;

		case WM_MDIACTIVATE:
			// activate or deactivate the movie controller in the specified window
			QTFrame_ActivateController(theWnd, (HWND)theWnd == (HWND)lParam);
			break;

		case WM_COMMAND: {

			switch (LOWORD(wParam)) {
							
				case IDM_FILESAVE:
				case IDM_FILESAVEAS:
					QTFrame_HandleFileMenuItem(theWnd, LOWORD(wParam));
					break;

				case IDM_EDITUNDO:
				case IDM_EDITCUT:
				case IDM_EDITCOPY:
				case IDM_EDITPASTE:
				case IDM_EDITCLEAR:
				case IDM_EDITSELECTALL:
				case IDM_EDITSELECTNONE:
					QTFrame_HandleEditMenuItem(theWnd, LOWORD(wParam));
					break;
					
				default:
					// do any application-specific menu handling
					QTApp_HandleMenu((UInt16)LOWORD(wParam));
					break;
			}
			
			break;
		}	// case WM_COMMAND

		case WM_GETMINMAXINFO:
			QTFrame_CalcWindowMinMaxInfo(theWnd, (LPMINMAXINFO)lParam);
			return(0);

		case WM_CLOSE:
			// prepare to close the window, making sure that any changed data is saved or explicitly discarded;
			// we can still cancel the window closing here
			if (myWindowObject != NULL) {
			
				// if the window's data is "dirty", give the user a chance to save it
				if ((**myWindowObject).fIsDirty) {
					int			myItem;
					char		myText[256];
					UINT		myAction;
		
					// get the title of the window
					GetWindowText(theWnd, myText, sizeof(myText));
		
					// specify the action
					myAction = gShuttingDown ? IDS_SAVEONQUIT : IDS_SAVEONCLOSE;
		
					// display the "Save changes" dialog box
					myItem = QTFrame_ShowCautionAlert(theWnd, myAction, MB_ICONEXCLAMATION, MB_YESNOCANCEL, gAppName, myText);
					switch (myItem) {
						case kSaveChanges:
							// save the data in the window
							QTFrame_UpdateMovieFile(theWnd);
							break;
							
						case kCancelClose:
							// do not close the window and do not quit the application
							gShuttingDown = false;
							return(0);
						
						case kDontSaveChanges:
							// discard any unsaved changes (that is, don't do anything)
							break;
							
						default:
							// unexpected item selected; just return
							return(0);
					}
				}
			} // if (myWindowObject != NULL)
			
			// if we got to this point, it's okay to close and destroy the window
			SendMessage(ghWndMDIClient, WM_MDIDESTROY, (WPARAM)theWnd, 0L);
			break;

		case WM_DESTROY:
			// when we get this message,
			// the window has been removed from the screen and its associated data must be destroyed
			if (myWindowObject != NULL)
				QTFrame_CloseWindowObject(myWindowObject);
		
			SetWindowLong(theWnd, GWL_USERDATA, 0);

			// destroy the port association
			DestroyPortAssociation((CGrafPtr)GetHWNDPort(theWnd));
			
			break;
	}

	return(DefMDIChildProc(theWnd, theMessage, wParam, lParam));
}
Esempio n. 14
0
LRESULT MDIChild::DefProc(HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam)
{
    return DefMDIChildProc(hWnd,Msg,wParam,lParam);
}