Ejemplo n.º 1
0
void CRemoteWnd::OnPaint()
{
	CPaintDC dc( this );
	CRect rcClient;

	GetClientRect( &rcClient );

	if ( m_pSkin == NULL )
	{
		dc.FillSolidRect( &rcClient, Colors.m_crSysBtnFace );
		return;
	}

	CSize size = rcClient.Size();
	CDC* pDC = CoolInterface.GetBuffer( dc, size );
	m_pSkin->Prepare( &dc );

	pDC->BitBlt( 0, 0, m_rcBackground.Width(), m_rcBackground.Height(),
		&m_pSkin->m_dcSkin, m_rcBackground.left, m_rcBackground.top, SRCCOPY );

	CFont* pfOld = NULL;

	if ( m_pSkin->m_fnCaption.m_hObject != NULL )
	{
		pfOld = (CFont*)pDC->SelectObject( &m_pSkin->m_fnCaption );
		pDC->SetTextColor( m_pSkin->m_crCaptionText );
	}
	else
	{
		pfOld = (CFont*)pDC->SelectObject( &CoolInterface.m_fntNormal );
		pDC->SetTextColor( RGB( 255, 255, 255 ) );
	}

	pDC->SetBkMode( TRANSPARENT );
	m_bStatus = FALSE;

	PaintHistory( pDC, m_pMonitor->m_pTxItem, m_pMonitor->m_pRxItem, m_pMonitor->m_nMaximumIn );
	PaintFlow( pDC, &m_bsFlowTxDest, &m_rcsFlowTxDest, m_bsFlowTxSrc, m_rcsFlowTxSrc, m_pMonitor->m_pTxItem, m_pMonitor->m_nMaximumOut );
	PaintFlow( pDC, &m_bsFlowRxDest, &m_rcsFlowRxDest, m_bsFlowRxSrc, m_rcsFlowRxSrc, m_pMonitor->m_pRxItem, m_pMonitor->m_nMaximumIn );
	PaintScaler( pDC );
	PaintMedia( pDC );
	PaintStatus( pDC );

	for ( POSITION pos = m_pButtons.GetHeadPosition(); pos; )
	{
		m_pButtons.GetNext( pos )->Paint( pDC, rcClient, m_pSkin, m_pCmdHover, m_pCmdDown );
	}

	pDC->SelectObject( pfOld );
	pDC->SelectClipRgn( NULL );
	dc.BitBlt( 0, 0, rcClient.Width(), rcClient.Height(), pDC, 0, 0, SRCCOPY );
}
Ejemplo n.º 2
0
//---------------------------------------------------------------------------
// MainWndProc
//
// Main window procedure
//
// RETURNS:     Per Windows Convention....
//---------------------------------------------------------------------------
LONG  APIENTRY MainWndProc (HWND hwnd, WORD message,
                             WPARAM wParam, LPARAM lParam)
{
    FARPROC lpProcAbout;

    switch (message)
        {
        case WM_CREATE:
            {
            RECT    r;

            // Create an edit window for the client area
            //---------------------------------------------------------------
            GetClientRect (hwnd, &r);
            hwndEdit = CreateWindow ("RBEdit", NULL,
            //hwndEdit = CreateWindow ("edit", NULL,
            //                         ES_MULTILINE |
                                     WS_BORDER |
                                     WS_CHILD | WS_CLIPCHILDREN |
                                     WS_VSCROLL | WS_HSCROLL,
                                     0,
                                     20,
                                     r.right,
                                     r.bottom-20,
                                     hwnd,
                                     0xCAC,
                                     hInst,
                                     NULL);
            ShowWindow (hwndEdit, SW_SHOWNORMAL);
            fNotify = FALSE;
            break;
            }

        case WM_SIZE:
            // Move the edit window to fit the new client area
            //---------------------------------------------------------------
            if (IsWindow (hwndEdit))
                MoveWindow (hwndEdit, 0, 20,
                                      LOWORD(lParam), HIWORD(lParam)-20, 1);
            break;

        case WM_PAINT:
            {
            HDC         hdc;
            PAINTSTRUCT ps;

            hdc = BeginPaint (hwnd, &ps);
            PaintStatus (hwnd, hdc);
            EndPaint (hwnd, &ps);
            break;
            }

        case WM_SETFOCUS:
            if (IsWindow (hwndEdit))
                SetFocus (hwndEdit);
            break;

        case WM_SYSCOLORCHANGE:
            SendMessage (hwndEdit, message, wParam, lParam);
            break;

        case WM_COMMAND:
            switch (GET_WM_COMMAND_ID (wParam, lParam))
                {
                case IDM_ABOUT:
                    lpProcAbout = MakeProcInstance ((FARPROC)About, hInst);
                    DialogBox (hInst, "AboutBox", hwnd, (WNDPROC)lpProcAbout);
                    FreeProcInstance (lpProcAbout);
                    break;

                case IDM_CRASH:
                    {
                    INT     l;

                    l = (INT)SendMessage (hwndEdit, EM_LINELENGTH, 0, -1L);
                    SendMessage (hwndEdit, EM_SETSELXY, -1,
                                 MAKELONG (l, l+3));
                    break;
                    }

                case IDM_UNDO:
                    if (!SendMessage (hwndEdit, EM_UNDO, 0, 0L))
                        MessageBeep (0);
                    break;

                case IDM_SETRO:
                    SendMessage (hwndEdit, EM_SETREADONLY, 1, 0L);
                    break;

                case IDM_SETRW:
                    SendMessage (hwndEdit, EM_SETREADONLY, 0, 0L);
                    break;

                case IDM_SETFONT:
                    SendMessage (hwndEdit, EM_SETFONT,
                                 (WORD)GetStockObject (ANSI_FIXED_FONT), 0L);
                    break;

                case IDM_CHGATTR:
                    SendMessage (hwndEdit, EM_SETLINEATTR, -1, oldattr++);

                    if (oldattr == 4)
                        oldattr = 0;
                    break;

                case IDM_NOTIFY:
                    fNotify = !fNotify;
                    SendMessage (hwndEdit, EM_SETNOTIFY, fNotify, 0L);
                    CheckMenuItem (GetMenu (hwnd), IDM_NOTIFY,
                                   fNotify ? MF_CHECKED : MF_UNCHECKED);
                    break;

                case IDM_LOADFILE:
                    {
                    HANDLE  hText;
                    LPSTR   lpText;
                    INT     file;
                    LONG    size;
                    DWORD   l1, l2;
                    CHAR    buf[80];

                    l1 = GetWindowLong (hwndEdit, 0);
                    l2 = GetWindowLong (hwndEdit, 4);
                    wsprintf (buf, "HSTATE: %X  LPSTATE: %x\r\n", l1, l2);
                    Out (buf);

                    hText = GlobalAlloc (GHND, 65536);
                    if (!hText)
                        break;
                    lpText = GlobalLock (hText);

                    l1 = GetWindowLong (hwndEdit, 0);
                    l2 = GetWindowLong (hwndEdit, 4);
                    wsprintf (buf, "HSTATE: %X  LPSTATE: %x\r\n", l1, l2);
                    Out (buf);

                    file = _lopen ("edittest.txt", OF_READ);
                    if (file != -1)
                        {
                        size = _llseek (file, 0, 2);
                        if (size > 0x0000ffff)
                            {
                            size = 0xfe00;
                            Alert (hwnd, "File truncated!");
                            }
                        _llseek(file, 0, 0);
                        lpText[_lread(file, lpText, (UINT)size)] = 0;

                    l1 = GetWindowLong (hwndEdit, 0);
                    l2 = GetWindowLong (hwndEdit, 4);
                    wsprintf (buf, "HSTATE: %X  LPSTATE: %x\r\n", l1, l2);
                    Out (buf);

                        _lclose(file);
                        Out ("Sending SETTEXT... ");

                    l1 = GetWindowLong (hwndEdit, 0);
                    l2 = GetWindowLong (hwndEdit, 4);
                    wsprintf (buf, "HSTATE: %X  LPSTATE: %x\r\n", l1, l2);
                    Out (buf);

                        file = (INT)SendMessage (hwndEdit, EM_RBSETTEXT, 0,
                                                 (LONG)lpText);
                        wsprintf (buf, "file = %d\r\n", file);
                        Out (buf);
                        if (!file)
                            Alert (hwnd, "SETTEXT Failed!");
                        }
                    else
                        Alert (hwnd, "EDITTEST.TXT not found...");
                    GlobalUnlock (hText);
                    GlobalFree (hText);
                    break;
                    }

                case 0xCAC:
                    // These (had better be) notification codes for the
                    // edit window
                    //-------------------------------------------------------
                    switch (HIWORD (lParam))
                        {
                        case EN_ERRSPACE:
                            Alert (hwnd, "Out of edit spce");
                            break;
                        case EN_LINETOOLONG:
                            Alert (hwnd, "Line too long");
                            break;
                        case EN_LINEWRAPPED:
                            Alert (hwnd, "Line too long -- CR inserted");
                            break;
                        case EN_SETCURSOR:
                            {
                            HDC     hdc;

                            hdc = GetDC (hwnd);
                            PaintStatus (hwnd, hdc);
                            ReleaseDC (hwnd, hdc);
                            break;
                            }
                        default:
                            break;
                            //Alert (hwnd, "Unknown notification code");
                        }
                    break;


                default:
                    return (DefWindowProc(hwnd, message, wParam, lParam));
                }
            break;

        case WM_DESTROY:
	    PostQuitMessage(0);
	    break;

        default:
            return (DefWindowProc (hwnd, message, wParam, lParam));
        }
    return (NULL);
}
Ejemplo n.º 3
0
    /*
     *  ウインドウ作成
     */
void OnCreate(AG_Widget *parent)
{
        BOOL        flag;
/*
 * ワークエリア初期化
 */
        nErrorCode = 0;
        bMenuLoop = FALSE;
        bCloseReq = FALSE;
        bSync = TRUE;
        bSyncDisasm[0] = TRUE;
        bSyncDisasm[1] = TRUE;
        bActivate = FALSE;
        AG_MutexInit(&VMMutex);
/*
 * コンポーネント初期化
 */
        LoadCfg();
        InitDraw();
#ifdef _USE_OPENCL
        if(AG_UsingGL(NULL) != 0) {
	   do {
	       SDL_Delay(1);
	   } while(bInitCL);
	}
#endif   
        InitSnd();
        InitKbd();
        InitJoy();
        InitSch();
//        CreateStatus();

/*
 * 仮想マシン初期化
 */
        if (!system_init()) {
                nErrorCode = 1;
                return;
        }
/*
 * 直後、リセット
 */
        ApplyCfg();
        system_reset();

/*
 * コンポーネントセレクト
 */
        flag = TRUE;
        if (!SelectDraw()) {
                flag = FALSE;
        }
        if (!SelectSnd()) {
                flag = FALSE;
        }
        if (!SelectKbd()) {
                flag = FALSE;
        }
        if (!SelectSch()) {
                flag = FALSE;
        }
        PaintStatus();

/*
 * エラーコードをセットさせ、スタート
 */
        if (!flag) {
                nErrorCode = 2;
        }
}