#define FIXED_ICON_SIZE_MAX 512
+#define TOGGLE_WIDTH 13
+#define TOGGLE_SPACING 18
+
+
static void gqv_cell_renderer_icon_get_property(GObject *object,
guint param_id,
GValue *value,
PROP_BACKGROUND_SET,
PROP_FOREGROUND_SET,
- PROP_SHOW_TEXT
+ PROP_SHOW_TEXT,
+ PROP_SHOW_MARKS,
+ PROP_NUM_MARKS,
+ PROP_MARKS
};
static gpointer parent_class;
_("Whether the text is displayed"),
TRUE,
G_PARAM_READWRITE));
+
+ g_object_class_install_property(object_class,
+ PROP_SHOW_MARKS,
+ g_param_spec_boolean("show_marks",
+ _("Show marks"),
+ _("Whether the marks are displayed"),
+ TRUE,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property(object_class,
+ PROP_NUM_MARKS,
+ g_param_spec_int("num_marks",
+ _("Number of marks"),
+ _("Number of marks"),
+ 0, 32,
+ 6,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property(object_class,
+ PROP_MARKS,
+ g_param_spec_uint("marks",
+ _("Marks"),
+ _("Marks bit array"),
+ 0, 0xffffffff,
+ 0,
+ G_PARAM_READWRITE));
}
static void
case PROP_SHOW_TEXT:
g_value_set_boolean(value, cellicon->show_text);
break;
+ case PROP_SHOW_MARKS:
+ g_value_set_boolean(value, cellicon->show_marks);
+ break;
+ case PROP_NUM_MARKS:
+ g_value_set_int(value, cellicon->num_marks);
+ break;
+ case PROP_MARKS:
+ g_value_set_uint(value, cellicon->marks);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, pspec);
break;
case PROP_SHOW_TEXT:
cellicon->show_text = g_value_get_boolean(value);
break;
+ case PROP_SHOW_MARKS:
+ cellicon->show_marks = g_value_get_boolean(value);
+ break;
+ case PROP_NUM_MARKS:
+ cellicon->num_marks = g_value_get_int(value);
+ break;
+ case PROP_MARKS:
+ cellicon->marks = g_value_get_uint(value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, pspec);
break;
calc_height += rect.height;
}
+ if (cellicon->show_marks)
+ {
+ calc_height += TOGGLE_SPACING;
+ calc_width = MAX(calc_width, TOGGLE_SPACING * cellicon->num_marks);
+ }
+
calc_width += (gint)cell->xpad * 2;
calc_height += (gint)cell->ypad * 2;
pix_rect.height = text_rect.height;
pix_rect.x = cell_area->x + cell->xpad + (cell_rect.width - text_rect.width + 1) / 2;
pix_rect.y = cell_area->y + cell->ypad + (cell_rect.height - text_rect.height);
+
+ if (cellicon->show_marks)
+ {
+ pix_rect.y -= TOGGLE_SPACING;
+ }
if (gdk_rectangle_intersect(cell_area, &pix_rect, &draw_rect) &&
gdk_rectangle_intersect(expose_area, &draw_rect, &draw_rect))
g_object_unref(layout);
}
+ if (cellicon->show_marks)
+ {
+ GdkRectangle pix_rect;
+ GdkRectangle draw_rect;
+ gint i;
+
+ pix_rect.width = TOGGLE_SPACING * cellicon->num_marks;
+ pix_rect.height = TOGGLE_SPACING;
+ pix_rect.x = cell_area->x + cell->xpad + (cell_rect.width - pix_rect.width + 1) / 2 + (TOGGLE_SPACING - TOGGLE_WIDTH) / 2;
+ pix_rect.y = cell_area->y + cell->ypad + (cell_rect.height - pix_rect.height) + (TOGGLE_SPACING - TOGGLE_WIDTH) / 2;
+
+ for (i = 0; i < cellicon->num_marks; i++)
+ {
+ gtk_paint_check (widget->style, window,
+ state, (cellicon->marks & (1 << i)) ? GTK_SHADOW_IN : GTK_SHADOW_OUT,
+ cell_area, widget, "cellcheck",
+ pix_rect.x + i * TOGGLE_SPACING + (TOGGLE_WIDTH - TOGGLE_SPACING) / 2,
+ pix_rect.y,
+ TOGGLE_WIDTH, TOGGLE_WIDTH);
+ }
+ }
+
if (cellicon->focused && GTK_WIDGET_HAS_FOCUS(widget))
{
gtk_paint_focus(widget->style, window,
vficon_selection_set(vf, id, id->selected & ~mask, iter);
}
+void vficon_marks_set(ViewFile *vf, gint enable)
+{
+ vficon_populate_at_new_size(vf, vf->listview->allocation.width, vf->listview->allocation.height, TRUE);
+}
+
/*
*-------------------------------------------------------------------
* selections
{
g_object_set(G_OBJECT(cell), "fixed_width", thumb_width,
"fixed_height", options->thumbnails.max_height,
- "show_text", VFICON_INFO(vf, show_text), NULL);
+ "show_text", VFICON_INFO(vf, show_text),
+ "show_marks", vf->marks_enabled,
+ "num_marks", FILEDATA_MARKS_SIZE,
+ NULL);
}
}
if (GTK_WIDGET_REALIZED(vf->listview)) gtk_tree_view_columns_autosize(GTK_TREE_VIEW(vf->listview));
g_object_set(cell, "pixbuf", id->fd->thumb_pixbuf,
"text", name_sidecars,
+ "marks", id->fd->marks,
+ "show_marks", vf->marks_enabled,
"cell-background-gdk", &color_bg,
"cell-background-set", TRUE,
"foreground-gdk", &color_fg,
{
g_object_set(cell, "pixbuf", NULL,
"text", NULL,
+ "show_marks", FALSE,
"cell-background-set", FALSE,
"foreground-set", FALSE,
"has-focus", FALSE, NULL);