⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gui.c

📁 君正早期ucos系统(只有早期的才不没有打包成库),MPLAYER,文件系统,图片解码,浏览,电子书,录音,想学ucos,识货的人就下吧 russblock fmradio explore set
💻 C
📖 第 1 页 / 共 4 页
字号:
                        adddirtoplaylist(gui->playlist, path, TRUE);                        gui->startplay(gui);                    }                    break;                }                case ID_PTRACK:                    handlemsg(hWnd, evPrev);                    break;                case ID_SEEKB:                    handlemsg(hWnd, evBackward10sec);                    break;                case ID_PLAY:                    handlemsg(hWnd, evPlaySwitchToPause);                    break;                case ID_STOP:                    handlemsg(hWnd, evStop);                    break;                case ID_SEEKF:                    handlemsg(hWnd, evForward10sec);                    break;                case ID_NTRACK:                    handlemsg(hWnd, evNext);                    break;#ifdef USE_DVDREAD                case ID_CHAPTERSEL:                    display_chapterselwindow(gui);                    break;#endif                case ID_FULLSCREEN:                    mp_input_queue_cmd(mp_input_parse_cmd("vo_fullscreen"));                    break;                case ID_MUTE:                    mp_input_queue_cmd(mp_input_parse_cmd("mute"));                    break;                case ID_ASPECT1:                    mp_input_queue_cmd(mp_input_parse_cmd("switch_ratio 1.777777"));                    break;                case ID_ASPECT2:                    mp_input_queue_cmd(mp_input_parse_cmd("switch_ratio 1.333333"));                    break;                case ID_ASPECT3:                    mp_input_queue_cmd(mp_input_parse_cmd("switch_ratio 2.35"));                    break;                case ID_ASPECT4:                    mp_input_queue_cmd(mp_input_parse_cmd("switch_ratio 0"));                    break;                case IDSUB_TOGGLE:                    mp_input_queue_cmd(mp_input_parse_cmd("sub_visibility"));                    break;                case IDSUB_CYCLE:                    mp_input_queue_cmd(mp_input_parse_cmd("sub_select"));                    break;            }            return 0;        }        case WM_CHAR:            mplayer_put_key(wParam);            break;        case WM_DROPFILES:        {            if(!lParam)            {                char file[MAX_PATH];                int filecount = DragQueryFile((HDROP) wParam, -1, file, MAX_PATH);                int i;                for(i=0; i<filecount; i++)                {                    DragQueryFile((HDROP) wParam, i, file, MAX_PATH);                    mplSetFileName(NULL, file, STREAMTYPE_FILE);                    if(!parse_filename(file, playtree, mconfig, 1))                        gui->playlist->add_track(gui->playlist, file, NULL, NULL, 0);                }                DragFinish((HDROP) wParam);                handlemsg(hWnd, evDropFile);            }            else            {                gui->playlist->clear_playlist(gui->playlist);                gui->playlist->add_track(gui->playlist, (const char *) wParam, NULL, NULL, 0);                handlemsg(hWnd, evDropFile);            }            SetForegroundWindow(gui->subwindow);            return 0;        }        case WM_LBUTTONDOWN:        {            if(!vo_nomouse_input)               mplayer_put_key(MOUSE_BTN0);            break;        }        case WM_MBUTTONDOWN:        {            if(!vo_nomouse_input)               mplayer_put_key(MOUSE_BTN1);            break;        }        case WM_RBUTTONDOWN:        {            POINT point;            point.x = GET_X_LPARAM(lParam);            point.y = GET_Y_LPARAM(lParam);            ClientToScreen(hWnd, &point);            if(guiIntfStruct.StreamType == STREAMTYPE_DVD)                EnableMenuItem(gui->dvdmenu, ID_CHAPTERSEL, MF_BYCOMMAND | MF_ENABLED);            TrackPopupMenu(gui->submenu, 0, point.x, point.y, 0, hWnd, NULL);            return 0;        }        case WM_LBUTTONDBLCLK:        {            if(!vo_nomouse_input)                mplayer_put_key(MOUSE_BTN0_DBL);            break;        }        case WM_MBUTTONDBLCLK:        {            if(!vo_nomouse_input)                mplayer_put_key(MOUSE_BTN1_DBL);            break;        }        case WM_RBUTTONDBLCLK:        {            if(!vo_nomouse_input)                mplayer_put_key(MOUSE_BTN2_DBL);            break;        }        case WM_MOUSEWHEEL:        {            int x = GET_WHEEL_DELTA_WPARAM(wParam);            if(vo_nomouse_input)                break;            if (x > 0)                mplayer_put_key(MOUSE_BTN3);            else                mplayer_put_key(MOUSE_BTN4);            break;        }        case WM_XBUTTONDOWN:        {            if(vo_nomouse_input)                break;            if(HIWORD(wParam) == 1)                mplayer_put_key(MOUSE_BTN5);            else                mplayer_put_key(MOUSE_BTN6);            break;        }        case WM_XBUTTONDBLCLK:        {            if(vo_nomouse_input)                break;            if(HIWORD(wParam) == 1)                mplayer_put_key(MOUSE_BTN5_DBL);            else                mplayer_put_key(MOUSE_BTN6_DBL);            break;        }        case WM_TIMER:        {            if(fullscreen) while(ShowCursor(FALSE) >= 0){}            KillTimer(hWnd, ID_TIMER);            return 0;        }        case WM_MOUSEMOVE:        {            ShowCursor(TRUE);            SetTimer(hWnd, ID_TIMER, 3000, (TIMERPROC) NULL);            break;        }        case WM_WINDOWPOSCHANGED:        {            int tmpheight=0;            static uint32_t rect_width;            static uint32_t rect_height;            RECT rd;            POINT pt;            pt.x = 0;            pt.y = 0;            GetClientRect(hWnd, &rd);            ClientToScreen(hWnd, &pt);            rect_width = rd.right - rd.left;            rect_height = rd.bottom - rd.top;            /* maintain our aspect ratio */            tmpheight = ((float)rect_width/sub_aspect);            tmpheight += tmpheight % 2;            if(tmpheight > rect_height)            {                rect_width = ((float)rect_height*sub_aspect);                rect_width += rect_width % 2;            }            else rect_height = tmpheight;            rd.right = rd.left + rect_width;            rd.bottom = rd.top + rect_height;            AdjustWindowRect(&rd, WS_OVERLAPPEDWINDOW | WS_SIZEBOX, 0);            SetWindowPos(hWnd, 0, fullscreen?0:pt.x+rd.left, fullscreen?0:pt.y+rd.top,                         fullscreen?vo_screenwidth:rd.right-rd.left, fullscreen?vo_screenheight:rd.bottom-rd.top, SWP_NOOWNERZORDER);            SetForegroundWindow(hWnd);            return 0;        }        case WM_SYSCOMMAND:        {            switch(wParam)            {                case SC_SCREENSAVE:                case SC_MONITORPOWER:                    mp_msg(MSGT_VO, MSGL_V ,"<vo_directx><INFO>killing screensaver\n" );                    return 0;            }            break;        }        case WM_PAINT:        {            PAINTSTRUCT ps;            RECT rect;            HDC hdc = BeginPaint(hWnd, &ps);            HDC hMemDC = CreateCompatibleDC(hdc);            HBRUSH blackbrush = (HBRUSH)GetStockObject(BLACK_BRUSH);            int width, height;            GetClientRect(hWnd, &rect);            width = rect.right - rect.left;            height = rect.bottom - rect.top;            if(guiIntfStruct.Playing == 0)            {                int i;                window *desc = NULL;                for (i=0; i<gui->skin->windowcount; i++)                    if(gui->skin->windows[i]->type == wiSub)                        desc = gui->skin->windows[i];                SelectObject(hMemDC, get_bitmap(hWnd));                StretchBlt(hdc, 0, 0, width, height, hMemDC, 0, 0, desc->base->bitmap[0]->width,                           desc->base->bitmap[0]->height, SRCCOPY);            } else {                FillRect(GetDC(hWnd), &rect, fullscreen?blackbrush:colorbrush);            }            DeleteDC(hMemDC);            EndPaint(hWnd, &ps);            return 0;        }    }    return DefWindowProc(hWnd, message, wParam, lParam);}/* Window Proc for the gui Window */static LRESULT CALLBACK EventProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam){    gui_t *gui = (gui_t *) GetWindowLongPtr(hWnd, GWLP_USERDATA);    /* Avoid processing when then window doesn't match gui mainwindow */    if (gui && (gui->mainwindow != hWnd)) return FALSE;    switch (message)    {        case WM_CLOSE:            handlemsg(hWnd, evExit);            return 0;        case WM_DESTROY:            PostQuitMessage(0);            return 0;        case WM_SYSTRAY:        {            switch(lParam)            {                POINT cursor;                case WM_RBUTTONDOWN:                {                    GetCursorPos(&cursor);                    SetForegroundWindow(hWnd);                    TrackPopupMenu(gui->traymenu, 0, cursor.x, cursor.y, 0, hWnd, NULL);                    break;                }                case WM_MBUTTONDBLCLK:                case WM_LBUTTONDBLCLK:                {                    if(IsWindowVisible(hWnd)) ShowWindow(hWnd, SW_HIDE);                    else { ShowWindow(hWnd, SW_SHOW); SetForegroundWindow(hWnd); }                    break;                }            }            break;        }        case WM_KEYDOWN:        {            switch(wParam)            {                case VK_LEFT:                    mplayer_put_key(KEY_LEFT);                    break;                case VK_UP:                    mplayer_put_key(KEY_UP);                    break;                case VK_RIGHT:                    mplayer_put_key(KEY_RIGHT);                    break;                case VK_DOWN:                    mplayer_put_key(KEY_DOWN);                    break;                case VK_TAB:                    mplayer_put_key(KEY_TAB);                    break;                case VK_BACK:                    mplayer_put_key(KEY_BS);                    break;                case VK_DELETE:                    mplayer_put_key(KEY_DELETE);                    break;                case VK_INSERT:                    mplayer_put_key(KEY_INSERT);                    break;                case VK_HOME:                    mplayer_put_key(KEY_HOME);                    break;                case VK_END:                    mplayer_put_key(KEY_END);                    break;                case VK_PRIOR:                    mplayer_put_key(KEY_PAGE_UP);                    break;                case VK_NEXT:                    mplayer_put_key(KEY_PAGE_DOWN);                    break;                case VK_ESCAPE:                    mplayer_put_key(KEY_ESC);                    break;            }            break;        }        case WM_CHAR:            mplayer_put_key(wParam);            break;        case WM_COPYDATA:        {            if(lParam)            {                PCOPYDATASTRUCT cdData;                cdData = (PCOPYDATASTRUCT) lParam;                mplSetFileName(NULL, cdData->lpData, STREAMTYPE_FILE);                if(!parse_filename(cdData->lpData, playtree, mconfig, 1))                    gui->playlist->add_track(gui->playlist, cdData->lpData, NULL, NULL, 0);                gui->startplay(gui);            }            break;        }        case WM_DROPFILES:        {            if(!lParam)            {                char file[MAX_PATH];                int filecount = DragQueryFile((HDROP) wParam, -1, file, MAX_PATH);                int i;                for(i=0; i<filecount; i++)                {                    DragQueryFile((HDROP) wParam, i, file, MAX_PATH);                    mplSetFileName(NULL, file, STREAMTYPE_FILE);                    if(!parse_filename(file, playtree, mconfig, 1))                        gui->playlist->add_track(gui->playlist, file, NULL, NULL, 0);                }                DragFinish((HDROP) wParam);                handlemsg(hWnd, evDropFile);            }            else            {                gui->playlist->clear_playlist(gui->playlist);                gui->playlist->add_track(gui->playlist, (const char *) wParam, NULL, NULL, 0);                handlemsg(hWnd, evDropFile);            }            SetForegroundWindow(gui->mainwindow);            return 0;        }        case WM_LBUTTONDOWN:        {            SetCapture(hWnd);            gui->mousex = GET_X_LPARAM(lParam);            gui->mousey = GET_Y_LPARAM(lParam);            /* inside a widget */            gui->activewidget = clickedinsidewidget(gui, get_windowtype(hWnd), gui->mousex, gui->mousey);            if(gui->activewidget)            {                gui->activewidget->pressed = 1;                gui->mousewx = gui->mousex - gui->activewidget->x;                gui->mousewy = gui->mousey - gui->activewidget->y;                renderwidget(gui->skin, get_drawground(hWnd), gui->activewidget, 0);                RedrawWindow(hWnd, NULL, NULL, RDW_INVALIDATE);                handlemsg(hWnd, gui->activewidget->msg);            }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -