Ejemplo n.º 1
0
Archivo: view.c Proyecto: lyuts/vifm
/* Handles view data reloading key. */
static void
cmd_R(key_info_t key_info, keys_info_t *keys_info)
{
	view_info_t new_vi;

	init_view_info(&new_vi);

	if(load_view_data(&new_vi, "File exploring reload", vi->filename) == 0)
	{
		replace_vi(vi, &new_vi);
		view_redraw();
	}
}
Ejemplo n.º 2
0
} END_TEST

/**
 * \brief Test call to generic update() method.
 *
 * The test checks that the view_redraw() function fail when the view supplied
 * to it is generic view and not the specific view.
 */
START_TEST(test_generic_redraw) {

	fail_if( OK != view_redraw(view_generic, &test_region), NULL);
	fail_if( error_is_error(), NULL);
} END_TEST
Ejemplo n.º 3
0
static void
redraw_views (ply_boot_splash_plugin_t *plugin)
{
        ply_list_node_t *node;

        node = ply_list_get_first_node (plugin->views);
        while (node != NULL) {
                ply_list_node_t *next_node;
                view_t *view;

                view = ply_list_node_get_data (node);
                next_node = ply_list_get_next_node (plugin->views, node);

                view_redraw (view);

                node = next_node;
        }
}
Ejemplo n.º 4
0
void
enter_view_mode(FileView *view, int explore)
{
	char full_path[PATH_MAX];

	if(get_file_to_explore(curr_view, full_path, sizeof(full_path)) != 0)
	{
		show_error_msg("File exploring", "The file cannot be explored");
		return;
	}

	/* Either make use of abandoned view or prune it. */
	if(try_ressurect_abandoned(full_path, explore) == 0)
	{
		ui_views_update_titles();
		return;
	}

	pick_vi(explore);

	vi->view = view;
	if(load_view_data(vi, "File exploring", full_path, NOSILENT) != 0)
	{
		return;
	}

	vi->filename = strdup(full_path);

	vle_mode_set(VIEW_MODE, VMT_SECONDARY);

	if(explore)
	{
		vi->view = curr_view;
		curr_view->explore_mode = 1;
	}
	else
	{
		vi->view = other_view;
	}

	ui_views_update_titles();

	view_redraw();
}
Ejemplo n.º 5
0
static void
view_start_animation (view_t *view)
{
        ply_boot_splash_plugin_t *plugin;

        unsigned long screen_width, screen_height;
        long width, height;

        assert (view != NULL);

        plugin = view->plugin;

        assert (plugin != NULL);
        assert (plugin->loop != NULL);

        screen_width = ply_pixel_display_get_width (view->display);
        screen_height = ply_pixel_display_get_height (view->display);

        ply_pixel_display_draw_area (view->display, 0, 0,
                                     screen_width, screen_height);

        if (plugin->mode == PLY_BOOT_SPLASH_MODE_SHUTDOWN)
                return;

        plugin->is_idle = false;

        width = ply_throbber_get_width (view->throbber);
        height = ply_throbber_get_height (view->throbber);
        ply_throbber_start (view->throbber,
                            plugin->loop,
                            view->display,
                            screen_width / 2.0 - width / 2.0,
                            view->logo_area.y + view->logo_area.height + height / 2);
        ply_progress_bar_show (view->progress_bar,
                               view->display,
                               0, screen_height - ply_progress_bar_get_height (view->progress_bar));
        view_redraw (view);
}
Ejemplo n.º 6
0
void
leave_view_mode(void)
{
	vle_mode_set(NORMAL_MODE, VMT_PRIMARY);

	if(curr_view->explore_mode)
	{
		curr_view->explore_mode = 0;
		redraw_current_view();
	}
	else
	{
		quick_view_file(curr_view);
	}

	ui_view_title_update(curr_view);

	reset_view_info(vi);

	if(curr_view->explore_mode || other_view->explore_mode)
	{
		view_redraw();
	}
}
Ejemplo n.º 7
0
void
modes_redraw(void)
{
	LOG_FUNC_ENTER;

	static int in_here;

	if(curr_stats.load_stage < 2)
	{
		return;
	}

	if(in_here++ > 0)
	{
		/* TODO: is this still needed?  Update scheduling might have solved issues
		 * caused by asynchronous execution of this function in the past. */
		return;
	}

	if(curr_stats.term_state != TS_NORMAL)
	{
		update_screen(UT_REDRAW);
		goto finish;
	}

	if(vle_mode_is(CMDLINE_MODE))
	{
		redraw_cmdline();
		goto finish;
	}
	else if(vle_primary_mode_is(MENU_MODE))
	{
		menu_redraw();
		if(vle_mode_is(MSG_MODE))
		{
			redraw_msg_dialog(0);
		}
		goto finish;
	}
	else if(vle_mode_is(FILE_INFO_MODE))
	{
		redraw_file_info_dialog();
		goto finish;
	}

	update_screen(UT_REDRAW);

	if(curr_stats.save_msg)
	{
		status_bar_message(NULL);
	}

	if(vle_mode_is(SORT_MODE))
	{
		redraw_sort_dialog();
	}
	else if(vle_mode_is(CHANGE_MODE))
	{
		redraw_change_dialog();
	}
	else if(vle_mode_is(ATTR_MODE))
	{
		redraw_attr_dialog();
	}
	else if(vle_mode_is(VIEW_MODE))
	{
		view_redraw();
	}
	else if(vle_mode_is(MSG_MODE))
	{
		redraw_msg_dialog(0);
	}

finish:
	if(--in_here > 0)
	{
		modes_redraw();
	}
}
Ejemplo n.º 8
0
/**
 * Function recursively redraws a node of the container view. Only nodes whose
 * region intersects supplied redraw region are updated.
 *
 * The leave node that has assigned view uses the view itself for redrawing.
 * Leaves that do not have view assigned only outlines leaf region.
 *
 * \param specificData pointer to container specific view structure
 * \param node pointer to currenlty processed node
 * \param region region of screen that need to be redrawn
 * \param window pointer to the window associated with view
 * \return OK on success
 */
RCode view_cv_redraw_node(ViewContainer *specificData, ContainerNode *node, GdkRectangle region, GdkWindow *window) {
	GdkRectangle area;

	ASSERT( NULL != node );
	ASSERT( NULL != specificData );

	TRACE_MESSAGE(VIEW, TL_DEBUG, "Container node redraw (node=%p, type=%d, "
			"[x=%d,y=%d,width=%d,height=%d])",
			node, node->type, region.x, region.y, region.width, region.height
		);

	// redraw only if rectangles do intersect
	if ( ! gdk_rectangle_intersect(&(node->region), &region, &area) ) {
		return OK;
	}

	if ( CONTAINER_LEAF == node->type ) {
		ViewGeneric *view_ptr = container_node_get_view(node);

		if ( NULL != view_ptr ) {
			return view_redraw(view_ptr, &(node->region));

		} else if ( NULL != window ) {
			GdkGC *gc = gdk_gc_new(window);

			// clear inner part of the container node
			gdk_gc_set_rgb_fg_color(gc, &(specificData->color.bg));
			gdk_draw_rectangle(
					window, gc, TRUE,
					node->region.x, node->region.y,
					node->region.width, node->region.height
				);

			// draw rectangle around the node
			if ( node == specificData->focus_node ) {
				gdk_gc_set_rgb_fg_color(gc, &(specificData->color.active));

			} else {
				gdk_gc_set_rgb_fg_color(gc, &(specificData->color.inactive));
			}
			gdk_draw_rectangle(
					window, gc, FALSE,
					node->region.x, node->region.y,
					node->region.width - 1, node->region.height - 1
				);

			g_object_unref( (gpointer)gc );
		}

	} else {
		gint i;

		for (i = 0; i < node->data.node.size; i++ ) {
			ContainerNode *child_node = container_node_get_child(node, i);

			// log underlaying errors, do not quit whole function
			if ( FAIL == view_cv_redraw_node(specificData, child_node, region, window) ) {
				ERROR_LOG();
			}
		}
	}

	return OK;
}
Ejemplo n.º 9
0
static void
cmd_ctrl_wv(key_info_t key_info, keys_info_t *keys_info)
{
	split_view(VSPLIT);
	view_redraw();
}
Ejemplo n.º 10
0
static void
cmd_ctrl_l(key_info_t key_info, keys_info_t *keys_info)
{
	view_redraw();
}