示例#1
0
static void mainwindows_resize_two(MAIN_WINDOW_REC *grow_win,
				   MAIN_WINDOW_REC *shrink_win, int count)
{
	mainwindow_resize(grow_win, count, FALSE);
	mainwindow_resize(shrink_win, -count, FALSE);
	gui_window_redraw(grow_win->active);
	gui_window_redraw(shrink_win->active);
	statusbar_redraw(grow_win->statusbar);
	statusbar_redraw(shrink_win->statusbar);
}
示例#2
0
static void mainwindow_resize(MAIN_WINDOW_REC *window, int ychange, int xchange)
{
	GSList *tmp;

	if (ychange == 0 && !xchange) return;

	window->lines = window->last_line-window->first_line+1;
#ifdef USE_CURSES_WINDOWS
#ifdef HAVE_CURSES_WRESIZE
	wresize(window->curses_win, window->lines, COLS);
	mvwin(window->curses_win, window->first_line, 0);
#else
	delwin(window->curses_win);
	create_curses_window(window);
#endif
#endif

	for (tmp = windows; tmp != NULL; tmp = tmp->next) {
		WINDOW_REC *rec = tmp->data;

		if (rec->gui_data != NULL &&
		    WINDOW_GUI(rec)->parent == window)
			gui_window_resize(rec, ychange, xchange);
	}

	gui_window_redraw(window->active);
	signal_emit("mainwindow resized", 1, window);
}
示例#3
0
static void remove_first_line(WINDOW_REC *window)
{
	GUI_WINDOW_REC *gui;
	TEXT_CHUNK_REC *chunk;

	g_return_if_fail(window != NULL);

	gui = WINDOW_GUI(window);
	chunk = gui->text_chunks->data;

	if (--chunk->lines == 0)
		text_chunk_free(gui, chunk);

	if (gui->startline->prev == NULL) {
                /* first line in screen removed */
		gui->startline = gui->startline->next;
		gui->subline = 0;
		gui->ypos--;
	}
	if (gui->bottom_startline->prev == NULL) {
                /* bottom line removed (shouldn't happen?) */
		gui->bottom_startline = gui->bottom_startline->next;
		gui->bottom_subline = 0;
	}

	window->lines--;
	g_mem_chunk_free(gui->line_chunk, gui->lines->data);
	gui->lines = g_list_remove(gui->lines, gui->lines->data);

	if (gui->startline->prev == NULL && is_window_visible(window))
		gui_window_redraw(window);
}
示例#4
0
static void signal_window_changed(WINDOW_REC *window)
{
    MAIN_WINDOW_REC *parent;

    g_return_if_fail(window != NULL);

    if (quitting) return;

    parent = WINDOW_GUI(window)->parent;
    if (is_window_visible(window)) {
        /* already visible */
        active_mainwin = parent;
    } else if (active_mainwin == NULL) {
        /* no main window set yet */
        active_mainwin = parent;
    } else if (g_slist_find(parent->sticky_windows, window) != NULL) {
        /* window is sticky, switch to correct main window */
        if (parent != active_mainwin)
            active_mainwin = parent;
    } else {
        /* move window to active main window */
        if (active_mainwin->sticky_windows != NULL) {
            /* active mainwindow is sticky, we'll need to
               set the window active somewhere else */
            active_mainwin = mainwindow_find_unsticky();
        }
        gui_window_reparent(window, active_mainwin);
    }
    active_mainwin->active = window;

    screen_refresh_freeze();
    window_update_prompt();
    gui_window_redraw(window);
    screen_refresh_thaw();
}
示例#5
0
static void scrollback_goto_pos(WINDOW_REC *window, GList *pos)
{
	GUI_WINDOW_REC *gui;

	g_return_if_fail(window != NULL);
	g_return_if_fail(pos != NULL);

	gui = WINDOW_GUI(window);

	if (g_list_find(gui->bottom_startline, pos->data) == NULL) {
		gui->startline = pos;
		gui->subline = 0;
		gui_window_update_ypos(gui);
		gui->bottom = is_window_bottom(gui);
	} else {
		/* reached the last line */
		if (gui->bottom) return;

		gui->startline = gui->bottom_startline;
		gui->subline = gui->bottom_subline;
		gui->ypos = gui->parent->lines-1;
		gui->bottom = TRUE;
	}

	if (is_window_visible(window))
		gui_window_redraw(window);
	signal_emit("gui page scrolled", 1, window);
}
示例#6
0
void mainwindows_recreate(void)
{
	GSList *tmp;

	for (tmp = mainwindows; tmp != NULL; tmp = tmp->next) {
		MAIN_WINDOW_REC *rec = tmp->data;

		create_curses_window(rec);
		gui_window_redraw(rec->active);
	}
}
示例#7
0
void mainwindows_redraw(void)
{
        GSList *tmp;

	screen_refresh_freeze();
	for (tmp = mainwindows; tmp != NULL; tmp = tmp->next) {
		MAIN_WINDOW_REC *rec = tmp->data;

                gui_window_redraw(rec->active);
	}
	screen_refresh_thaw();
}
示例#8
0
static void window_lastlog_clear(WINDOW_REC *window)
{
	GList *tmp, *next;

	for (tmp = WINDOW_GUI(window)->lines; tmp != NULL; tmp = next) {
		LINE_REC *line = tmp->data;

                next = tmp->next;
                if (line->level & MSGLEVEL_LASTLOG)
			gui_window_line_remove(window, line, FALSE);
	}
        gui_window_redraw(window);
}
示例#9
0
void gui_window_clear(WINDOW_REC *window)
{
    MAIN_WINDOW_REC *parent;

    g_return_if_fail(window != NULL);

    parent = WINDOW_GUI(window)->parent;
    gui_window_deinit(WINDOW_GUI(window));
    window->gui_data = gui_window_init(window, parent);

    window->lines = 0;

    if (is_window_visible(window))
        gui_window_redraw(window);
}
示例#10
0
/* SYNTAX: SCROLLBACK REDRAW */
static void cmd_scrollback_redraw(void)
{
	GUI_WINDOW_REC *gui;
	GList *tmp, *next;

	gui = WINDOW_GUI(active_win);

	screen_refresh_freeze();
	for (tmp = gui->lines; tmp != NULL; tmp = next) {
		next = tmp->next;
		gui_window_reformat_line(active_win, tmp->data);
	}

	gui_window_redraw(active_win);
	screen_refresh_thaw();
}
示例#11
0
void gui_window_scroll(WINDOW_REC *window, int lines)
{
	GUI_WINDOW_REC *gui;

	g_return_if_fail(window != NULL);

	gui = WINDOW_GUI(window);

	if (lines < 0)
		gui_window_scroll_up(gui, -lines);
	else
		gui_window_scroll_down(gui, lines);

	if (is_window_visible(window))
		gui_window_redraw(window);
	signal_emit("gui page scrolled", 1, window);
}
示例#12
0
void mainwindows_redraw_dirty(void)
{
	GSList *tmp;

	for (tmp = mainwindows; tmp != NULL; tmp = tmp->next) {
		MAIN_WINDOW_REC *rec = tmp->data;

		if (rec->size_dirty) {
                        rec->size_dirty = FALSE;
			mainwindow_resize_windows(rec);
		}
		if (rec->dirty) {
                        rec->dirty = FALSE;
			gui_window_redraw(rec->active);
		}
	}
}
示例#13
0
/* SYNTAX: SCROLLBACK END */
static void cmd_scrollback_end(const char *data)
{
	GUI_WINDOW_REC *gui;

	gui = WINDOW_GUI(active_win);
	if (gui->bottom)
                return;

	gui->startline = gui->bottom_startline;
	gui->subline = gui->bottom_subline;
	gui->ypos = gui->parent->lines-1;
	gui->bottom = TRUE;

	if (is_window_visible(active_win))
		gui_window_redraw(active_win);
	signal_emit("gui page scrolled", 1, active_win);
}
示例#14
0
/* SYNTAX: SCROLLBACK REDRAW */
static void cmd_scrollback_redraw(void)
{
	GUI_WINDOW_REC *gui;
	LINE_REC *line, *next;

	gui = WINDOW_GUI(active_win);

	term_refresh_freeze();
	line = textbuffer_view_get_lines(gui->view);
	while (line != NULL) {
		next = line->next;
		textbuffer_reformat_line(active_win, line);
                line = next;
	}

	gui_window_redraw(active_win);
	term_refresh_thaw();
}
示例#15
0
/* SYNTAX: SCROLLBACK HOME */
static void cmd_scrollback_home(const char *data)
{
	GUI_WINDOW_REC *gui;

	gui = WINDOW_GUI(active_win);

	if (gui->startline == gui->lines)
		return;

	gui->startline = gui->lines;
	gui->subline = 0;
	gui_window_update_ypos(gui);
	gui->bottom = is_window_bottom(gui);

	if (is_window_visible(active_win))
		gui_window_redraw(active_win);
	signal_emit("gui page scrolled", 1, active_win);
}
示例#16
0
void gui_window_scroll(WINDOW_REC *window, int lines)
{
    GUI_WINDOW_REC *gui;

    g_return_if_fail(window != NULL);

    gui = WINDOW_GUI(window);

    if (lines < 0) {
        if (gui->startline == NULL || gui->startline->prev == NULL)
            return;
        gui_window_scroll_up(gui, -lines);
    } else {
        if (is_scrolled_bottom(gui))
            return;
        gui_window_scroll_down(gui, lines);
    }

    if (is_window_visible(window))
        gui_window_redraw(window);
    signal_emit("gui page scrolled", 1, window);
}
示例#17
0
static void signal_window_changed(WINDOW_REC *window)
{
	g_return_if_fail(window != NULL);

        if (quitting) return;

	if (is_window_visible(window)) {
		/* already visible, great! */
		active_mainwin = WINDOW_GUI(window)->parent;
	} else {
		/* move it to active main window */
		if (active_mainwin == NULL)
			active_mainwin = WINDOW_GUI(window)->parent;
		else
			gui_window_reparent(window, active_mainwin);
		active_mainwin->active = window;
	}

	screen_refresh_freeze();
	window_update_prompt(window);
	gui_window_redraw(window);
	screen_refresh_thaw();
}
示例#18
0
文件: redraw.c 项目: ruf0us/msx-gui
void gui_redraw(GUIElement *elem, char active)
{
	GUIElement *e = elem;
	GUIEvent evt;
	char result;
	memset(&evt, 0, sizeof(GUIEvent));
	while (e)
	{
		if (e == gTopElement)
			active = 1;
		if (e->type == GUI_ELEMENT_BACKGROUND)
		{
			color(GUI_DEFAULT_FG_COLOR, GUI_DEFAULT_DESKTOP_COLOR, 0);
			cls();
			color(GUI_DEFAULT_FG_COLOR, GUI_DEFAULT_BG_COLOR, 0);
		}
		if (e->type == GUI_ELEMENT_WINDOW)
		{
			gui_window_redraw(e, active);
			evt.type = GUI_EVENT_UPDATE;
			evt.element = e;
			result = gui_evt_handler_invoke(&evt);
		}
		if (e->type == GUI_ELEMENT_TITLE_BAR)
		{
			gui_title_bar_redraw(e, active);
		}
		if (e->type == GUI_ELEMENT_CLOSE_BOX)
		{
			gui_closebox_redraw(e, active);
		}
		if (e->type == GUI_ELEMENT_ZOOM_BOX)
		{
			gui_zoombox_redraw(e, active);
		}
		if (e->type == GUI_ELEMENT_RESIZE_BOX)
		{
			gui_resizebox_redraw(e, active);
		}
		if (e->type == GUI_ELEMENT_MENU_BAR)
		{
			gui_menubar_redraw(e);
		}
		if (e->type == GUI_ELEMENT_DIALOG)
		{
			gui_dialog_redraw(e);
		}
		if (e->type == GUI_ELEMENT_BUTTON)
		{
			gui_button_redraw(e);
		}
		if (e->type == GUI_ELEMENT_LABEL)
		{
			gui_label_redraw(e);
		}
		if (e->type == GUI_ELEMENT_LIST)
		{
			gui_list_redraw(e);
		}
		e = e->next;
	}
}
示例#19
0
void gui_window_line_remove(WINDOW_REC *window, LINE_REC *line, int redraw)
{
	GUI_WINDOW_REC *gui;
        GList *last;
        int screenchange;

	g_return_if_fail(window != NULL);
	g_return_if_fail(line != NULL);

	gui = WINDOW_GUI(window);

        screenchange = g_list_find(gui->startline, line) != NULL;
        if (screenchange) gui->ypos -= gui_window_get_linecount(gui, line);

	gui_window_cache_remove(gui, line);
	gui_window_line_text_free(gui, line);
	if (gui->lastlog_last_check != NULL &&
	    gui->lastlog_last_check->data == line)
		gui->lastlog_last_check = NULL;
	if (gui->lastlog_last_away != NULL &&
	    gui->lastlog_last_away->data == line)
		gui->lastlog_last_away = NULL;

        last = g_list_last(gui->bottom_startline);
	if (last->data == line) {
                /* removing last line */
		gui->last_subline =
			gui_window_get_linecount(gui, last->prev->data)-1;
	}

        if (gui->bottom_startline->data == line) {
                /* bottom line removed */
                if (gui->bottom_startline->next != NULL) {
                        gui->bottom_startline = gui->bottom_startline->next;
                        gui->bottom_subline = 0;
                } else {
                        gui->bottom_startline = gui->bottom_startline->prev;
                        gui->bottom_subline = gui->last_subline+1;
                }
	}

	if (gui->startline->data == line) {
                /* first line in screen removed */
                if (gui->startline->next != NULL) {
                        gui->startline = gui->startline->next;
                        gui->subline = 0;
		} else {
                        gui->startline = gui->startline->prev;
			gui->subline = gui->last_subline+1;
			gui->ypos = -1;
			gui->empty_linecount = gui->parent->lines;
			gui->bottom = TRUE;
		}
        }

	window->lines--;
	g_mem_chunk_free(gui->line_chunk, line);
	gui->lines = g_list_remove(gui->lines, line);

        if (window->lines == 0)
                gui_window_clear(window);

        if (redraw && screenchange && is_window_visible(window))
                gui_window_redraw(window);
}