Beispiel #1
0
void iconview_redraw(iconview_t *iv) {

    int sb_x, sb_y, sb_width, sb_height;
    int sr_x, sr_y, sr_width, sr_height;
    int rows, iheight, i;

    if (!iv->parent)
        return;

    /* clear the tmp buf */
    for (i = 0; i < iv->active->width * iv->active->height; i++)
        iv->active->buf[i] = 0xFFFFFFFF;

    /* clear the parent window (we do this because the iv contains some
     * transparent pixels that needs white background.
     */
    pixbuf_paint(iv->active, iv->parent->pixbuf, iv->x, iv->y);

    /* draw the active part of the iconview to the tmp buf */
    pixbuf_crop(iv->pixbuf, iv->active, 0, iv->scroll_y);

    /* draw the scroll bar to the tmp buf */
    if (!up_png) {
        up_png   = parse_png("/usr/share/icons/up.png");
        down_png = parse_png("/usr/share/icons/down.png");
    }

    if (iv->show_scroll) {

        pixbuf_paint(up_png, iv->active, iv->width-up_png->width, 0);
        pixbuf_paint(down_png, iv->active, iv->width-down_png->width,
                                        iv->height-down_png->height);

        sb_x = iv->width-up_png->width;
        sb_y = up_png->height;
        sb_width = up_png->width;
        sb_height = iv->height-up_png->height-down_png->height;
        draw_solid(iv->active, sb_x, sb_y, sb_width, sb_height, 0xFFFF9494);

        rows = iv->cur/iv->icons_per_row + (iv->cur%iv->icons_per_row?1:0);
        iheight = iv->height > rows*iv->each_height?
                iv->height : rows*iv->each_height;

        sr_x = sb_x + 2;
        sr_y = sb_y + (iv->scroll_y*sb_height)/iheight;
        sr_width = sb_width-4;
        sr_height = (iv->height*sb_height)/iheight;
        draw_solid(iv->active, sr_x, sr_y, sr_width, sr_height, 0xFFA93131);

    }

    /* draw the tmp buf on the parent window */
    pixbuf_paint(iv->active, iv->parent->pixbuf, iv->x, iv->y);

    /* flush the window buffer to VGA */
    window_flush(iv->parent, iv->x, iv->y, iv->width, iv->height);

}
Beispiel #2
0
void draw_window(win_info_t *win_info, int plot_on_vga, int redraw_mouse) {

    pixbuf_t *osm = get_osm();
    pixbuf_t *full_window;
    int x, y, w_width, w_height, width, height;

    /* calculate full_window parameters */
    x = win_info->x - 4;
    y = win_info->y - 22;
    w_width = win_info->pixbuf->width;
    w_height = win_info->pixbuf->height;
    width = w_width + 8;
    height = w_height + 22 + 4;

    /* allocate pixbuf for full_window */
    full_window = pixbuf_alloc(width, height);

    /* draw title bar */
    draw_solid(full_window, 0, 0, width,  11, 0xFF862030);
    draw_solid(full_window, 0, 11, width, 11, 0xFF611E2D);

    /* draw borders */
    draw_solid(full_window, 0, 22, 4, w_height, 0xFF611E2D);
    draw_solid(full_window, 4+w_width, 22, 4, w_height, 0xFF611E2D);
    draw_solid(full_window, 0, 22+w_height, w_width+4+4, 4, 0xFF611E2D);

    /* draw title */
    draw_text(full_window, (w_width-strlen(win_info->title)*9-30)/2, 4,
              win_info->title, 0xFFFFFFFF);

    /* draw buttons and icons */
    pixbuf_paint(min,  full_window, width-74, 3);
    pixbuf_paint(max,  full_window, width-50, 3);
    pixbuf_paint(clos, full_window, width-26, 3);
    pixbuf_paint(win_info->ico, full_window, 5, 4);

    /* draw the screen content */
    pixbuf_paint(win_info->pixbuf, full_window, 4, 22);

    /* paint full_window on osm */
    pixbuf_paint(full_window, get_osm(), x, y);

    /* paint on screen */
    if (plot_on_vga)
        vga_plot(full_window, x, y);

    /* draw the mouse cursor */
    if (redraw_mouse)
        draw_cursor();

    /* deallocate full_window */
    free(full_window->buf);
    free(full_window);

}
Beispiel #3
0
	void on_select_mesh(const k3d::mesh& Mesh, const k3d::gl::painter_render_state& RenderState, const k3d::gl::painter_selection_state& SelectionState, k3d::iproperty::changed_signal_t& ChangedSignal)
	{
		if(!SelectionState.select_component.count(k3d::selection::SURFACE))
			return;

		k3d::uint_t primitive_index = 0;
		for(k3d::mesh::primitives_t::const_iterator primitive = Mesh.primitives.begin(); primitive != Mesh.primitives.end(); ++primitive, ++primitive_index)
		{
			boost::scoped_ptr<k3d::disk::const_primitive> disk(k3d::disk::validate(Mesh, **primitive));
			if(!disk)
				continue;

			k3d::gl::push_selection_token(k3d::selection::PRIMITIVE, primitive_index);

			glDisable(GL_LIGHTING);

			glMatrixMode(GL_MODELVIEW);
			for(k3d::uint_t i = 0; i != disk->matrices.size(); ++i)
			{
				k3d::gl::push_selection_token(k3d::selection::SURFACE, i);

				glPushMatrix();
				k3d::gl::push_matrix(disk->matrices[i]);
				draw_solid(RenderState, disk->heights[i], disk->radii[i], disk->sweep_angles[i]);
				glPopMatrix();

				k3d::gl::pop_selection_token(); // SURFACE
			}

			k3d::gl::pop_selection_token(); // PRIMITIVE
		}
	}
Beispiel #4
0
	void on_paint_mesh(const k3d::mesh& Mesh, const k3d::gl::painter_render_state& RenderState, k3d::iproperty::changed_signal_t& ChangedSignal)
	{
		const k3d::color color = RenderState.node_selection ? k3d::color(1, 1, 1) : k3d::color(0.8, 0.8, 0.8);
		const k3d::color selected_color = RenderState.show_component_selection ? k3d::color(1, 0, 0) : color;

		for(k3d::mesh::primitives_t::const_iterator primitive = Mesh.primitives.begin(); primitive != Mesh.primitives.end(); ++primitive)
		{
			boost::scoped_ptr<k3d::disk::const_primitive> disk(k3d::disk::validate(Mesh, **primitive));
			if(!disk)
				continue;

			glPolygonOffset(1.0, 1.0);
			glEnable(GL_POLYGON_OFFSET_FILL);
			glEnable(GL_LIGHTING);

			glMatrixMode(GL_MODELVIEW);
			for(k3d::uint_t i = 0; i != disk->matrices.size(); ++i)
			{
				k3d::gl::material(GL_FRONT_AND_BACK, GL_DIFFUSE, disk->selections[i] ? selected_color : color);

				glPushMatrix();
				k3d::gl::push_matrix(disk->matrices[i]);
				draw_solid(RenderState, disk->heights[i], disk->radii[i], disk->sweep_angles[i]);
				glPopMatrix();
			}
		}
	}