コード例 #1
0
ファイル: display.c プロジェクト: nvf-crucio/PROX
static void stats_display_layout(uint8_t in_place)
{
	uint8_t cur_stats_height;

	cur_stats_height = current_screen->get_height();
	cur_stats_height = cur_stats_height > max_n_lines? max_n_lines: cur_stats_height;

	display_lock();
	if (!in_place) {
		// moving existing windows does not work
		delwin(win_txt);
		delwin(win_general);
		delwin(win_title);
		delwin(win_tabs);
		delwin(win_cmd);
		delwin(win_txt);
		delwin(win_help);

		clear();
	}

	if (!in_place) {
		win_stat = create_subwindow(cur_stats_height + 2, 0, 4, 0);
		win_tabs = create_subwindow(1, 0, 1, 0);
		win_general = create_subwindow(2, 0, 2, 0);
		win_title = create_subwindow(1, 0, 0, 0);
		win_cmd = create_subwindow(1, 0, cur_stats_height + 2 + 4,  0);
		win_txt_height = LINES - cur_stats_height - 2 - 3 - 3;
		win_txt = create_subwindow(win_txt_height, 0, cur_stats_height + 4 + 3, 0);
		win_help = create_subwindow(1, 0, LINES - 1, 0);
	}

	draw_title();
	draw_general_frame();
	/* Command line */
	wbkgd(win_cmd, COLOR_PAIR(BLACK_ON_YELLOW));
	idlok(win_cmd, FALSE);
	/* Move cursor at insertion point */
	leaveok(win_cmd, FALSE);

	draw_status_bar();
	draw_log_window();

	/* Draw everything to the screen */
	refresh();
	current_screen->draw_frame(&screen_state);
	display_unlock();

	refresh_cmd_win();
	display_stats();
}
コード例 #2
0
ファイル: display.c プロジェクト: nvf-crucio/PROX
void display_init(void)
{
	scr = initscr();
	start_color();
	/* Assign default foreground/background colors to color number -1 */
	use_default_colors();

	init_pair(NO_COLOR,   -1,  -1);
	init_pair(RED_ON_BLACK,     COLOR_RED,  COLOR_BLACK);
	init_pair(BLACK_ON_CYAN,   COLOR_BLACK,  COLOR_CYAN);
	init_pair(BLACK_ON_GREEN,  COLOR_BLACK,  COLOR_GREEN);
	init_pair(BLACK_ON_WHITE,  COLOR_BLACK,  COLOR_WHITE);
	init_pair(BLACK_ON_YELLOW, COLOR_BLACK,  COLOR_YELLOW);
	init_pair(YELLOW_ON_BLACK, COLOR_YELLOW,  COLOR_BLACK);
	init_pair(WHITE_ON_RED,    COLOR_WHITE,  COLOR_RED);
	init_pair(YELLOW_ON_NOTHING,   COLOR_YELLOW,  -1);
	init_pair(GREEN_ON_NOTHING,   COLOR_GREEN,  -1);
	init_pair(RED_ON_NOTHING,   COLOR_RED,  -1);
	init_pair(BLUE_ON_NOTHING,  COLOR_BLUE, -1);
	init_pair(CYAN_ON_NOTHING,  COLOR_CYAN, -1);
	init_pair(MAGENTA_ON_NOTHING,  COLOR_MAGENTA, -1);
	init_pair(WHITE_ON_NOTHING,  COLOR_WHITE, -1);
	/* nodelay(scr, TRUE); */
	noecho();
	curs_set(0);
	/* Create fullscreen log window. When stats are displayed
	   later, it is recreated with appropriate dimensions. */
	win_txt = create_subwindow(0, 0, 0, 0);
	wbkgd(win_txt, COLOR_PAIR(0));

	idlok(win_txt, FALSE);
	/* Get scrolling */
	scrollok(win_txt, TRUE);
	/* Leave cursor where it was */
	leaveok(win_txt, TRUE);

	refresh();

	set_signal_handler();

	max_n_lines = (LINES - 5 - 2 - 3);
	/* core_port_height = max_n_lines < stats_get_n_tasks_tot()? max_n_lines : stats_get_n_tasks_tot(); */

	display_init_screens();
	display_screen(0);
	stats_display_layout(0);
}
コード例 #3
0
static LRESULT CALLBACK SkinBrowserWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
{
    static HWND listbox;
    static char skinspath[MAX_PATH];
    gui_t* gui = (gui_t*) GetWindowLongPtr(hwnd, GWLP_USERDATA);
    switch (iMsg)
    {
        case WM_CREATE:
        {
            HANDLE skinHandle = INVALID_HANDLE_VALUE;
            WIN32_FIND_DATA finddata;

            listbox = CreateWindow("listbox", NULL,
                                   WS_CHILD | WS_VISIBLE | LBS_NOTIFY | LBS_NOINTEGRALHEIGHT |
                                   LBS_DISABLENOSCROLL | WS_VSCROLL | WS_TABSTOP,
                                   4, 5, 166, 60, hwnd,
                                   (HMENU) ID_DIR,
                                   ((LPCREATESTRUCT) lParam) -> hInstance,
                                   NULL);
            SendMessage(listbox, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);

            /* This opens the skins directory, lists the directory names, and adds them to the listbox */
            sprintf(skinspath, "%s/*.", get_path("skins"));

            skinHandle = FindFirstFile(skinspath, &finddata);
            if (skinHandle != INVALID_HANDLE_VALUE)
            {
                do
                {
                    if (finddata.cFileName[0] == '.') continue;
                    /* populate the listbox */
                    capitalize(finddata.cFileName);
                    SendDlgItemMessage(hwnd, ID_DIR, LB_ADDSTRING, 0, (LPARAM) finddata.cFileName);
                } while (FindNextFile(skinHandle, &finddata));
                FindClose(skinHandle);
            }
            else
                mp_msg(MSGT_GPLAYER, MSGL_FATAL, "Error opening %s\n", get_path("skins"));
            break;
        }
        case WM_COMMAND:
        {
            if ((HWND) lParam == listbox)
            {
                if(HIWORD(wParam) == LBN_DBLCLK)
                {
                    int index = SendMessage(listbox, LB_GETCURSEL, 0, 0);
                    int len = SendMessage(listbox, LB_GETTEXTLEN, index, 0);
                    if (len)
                    {
                        if (guiIntfStruct.Playing) guiGetEvent(guiCEvent, (void *) guiSetStop);
                        if (skinName) free(skinName);
                        skinName = (char *) malloc(len+1);
                        SendMessage(listbox, LB_GETTEXT, (WPARAM) index, (LPARAM) skinName);
                        /* fill out the full pathname to the skin */
                        strcpy(skinspath, get_path("skins"));
                        strcat(skinspath, "\\");
                        strcat(skinspath, skinName);
                        ShowWindow(hwnd, SW_HIDE);
                        Shell_NotifyIcon(NIM_DELETE, &nid);
                        destroy_window(gui);
                        create_window(gui, skinspath);
                        create_subwindow(gui, skinspath);
                        SendMessage(hwnd, WM_CLOSE, 0, 0); /* Avoid crashing when switching skin */
                    }
                }
            }
        }
            return 0;
    }
    return DefWindowProc(hwnd, iMsg, wParam, lParam);
}