buttons/b_zoomin.c buttons/b_zoomout.c \
buttons/b_highlight.c buttons/b_eye.c buttons/b_pal.c buttons/b_col.c \
buttons/b_bc.c buttons/b_preview.c buttons/b_flow.c buttons/b_fill.c \
+ buttons/b_mark.c \
menu.c \
toolbar.c \
main.c
--- /dev/null
+#include <gtk/gtk.h>
+/* GdkPixbuf RGB C-Source image dump */
+
+#ifdef __SUNPRO_C
+#pragma align 4 (img_mark)
+#endif
+#ifdef __GNUC__
+const guint8 img_mark[] __attribute__ ((__aligned__ (4))) =
+#else
+const guint8 img_mark[] =
+#endif
+{ ""
+ /* Pixbuf magic (0x47646b50) */
+ "GdkP"
+ /* length: header (24) + pixel_data (1976) */
+ "\0\0\7\320"
+ /* pixdata_type (0x1010001) */
+ "\1\1\0\1"
+ /* rowstride (104) */
+ "\0\0\0h"
+ /* width (34) */
+ "\0\0\0\""
+ /* height (19) */
+ "\0\0\0\23"
+ /* pixel_data: */
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\"\12\377\377\377\377\377\377n=\240n=\240n=\240n=\240\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377=\240@=\240@"
+ "=\240@=\240@\377\377\377xb\377\377\377n=\240n=\240n=\240n=\240n=\240"
+ "n=\240\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377=\240@=\240@=\240"
+ "@=\240@=\240@=\240@de\377\377\377n=\240n=\240n=\240n=\240n=\240n=\240"
+ "n=\240\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377=\240@=\240@=\240@=\240@=\240@=\240@=\240"
+ "@\40\0\377\377\377n=\240n=\240n=\240n=\240n=\240n=\240n=\240n=\240n="
+ "\240\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377=\240@=\240"
+ "@=\240@=\240@=\240@=\240@=\240@=\240@\40""1\377\377\377\377\377\377n"
+ "=\240n=\240n=\240n=\240n=\240n=\240n=\240n=\240n=\240\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377=\240@=\240@=\240@=\240@=\240@=\240@=\240@=\240@=\240@\377\377\377"
+ "it\377\377\377\377\377\377\377\377\377n=\240n=\240n=\240n=\240n=\240"
+ "n=\240n=\240n=\240\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377=\240@=\240@=\240@=\240@=\240@=\240@=\240@=\240"
+ "@=\240@\377\377\377\377\377\377ap\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377n=\240n=\240n=\240n=\240n=\240n=\240\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377=\240@=\240@"
+ "=\240@=\240@=\240@=\240@=\240@=\240@=\240@\377\377\377\377\377\377\377"
+ "\377\377\40\0\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377n=\240n=\240n=\240n=\240n=\240n=\240\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377=\240@=\240@=\240@=\240@=\240@=\240@=\240@=\240"
+ "@=\240@\377\377\377\377\377\377\377\377\377\377\377\377ne\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377n=\240n="
+ "\240n=\240n=\240n=\240n=\240\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "=\240@=\240@=\240@=\240@=\240@=\240@=\240@=\240@\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377xb\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377n=\240n=\240n=\240n=\240"
+ "n=\240n=\240\376\376\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377=\240@=\240@=\240@=\240@=\240"
+ "@=\240@=\240@\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\0\0\377\377\377\377\377\377\377\377\377"
+ "\377\377\377n=\240n=\240n=\240n=\240n=\240n=\240n=\240n=\240\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377=\240@=\240@=\240@=\240@=\240@=\240@\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\0\0\377\377\377\377\377\377\377\377\377n=\240n=\240"
+ "n=\240n=\240n=\240n=\240n=\240n=\240n=\240\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377=\240@=\240@=\240@=\240@"
+ "=\240@=\240@=\240@\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\0\0\377\377"
+ "\377n=\240n=\240n=\240n=\240n=\240n=\240n=\240n=\240n=\240n=\240\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "=\240@=\240@=\240@=\240@=\240@=\240@=\240@=\240@\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\0\0n=\240n=\240n=\240n=\240n=\240n=\240n=\240n="
+ "\240n=\240n=\240\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377=\240@=\240@=\240@=\240@=\240@=\240@=\240@=\240@"
+ "=\240@\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\0\0n=\240n=\240n=\240n="
+ "\240n=\240n=\240n=\240n=\240n=\240\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377=\240@=\240@=\240@=\240"
+ "@=\240@=\240@=\240@=\240@\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\0\0n=\240n=\240n=\240n=\240n=\240n=\240n=\240\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377=\240@=\240@=\240@=\240@=\240@=\240@\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\0\0n=\240n=\240n=\240n=\240n=\240\366\367\374\355\355\367\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\371\371\373\361\362\365\370\370\370=\240@=\240@=\240@=\240@\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\0\0\377\377\377n=\240n=\240n=\240\377\377\377\370\370"
+ "\374\366\366\373\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\375\375\376\355\356\364\355\355\355\342\342\342\343\343\343"
+ "\343\343\343\347\347\347\353\353\353\361\361\361\371\371\371\374\374"
+ "\374\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\0\0"};
+
+
-for i in size_1 size_3 size_5 size_9 size_11 size_19 move eye pal col highlight zoomin zoomout bc preview flow fill pick
+for i in size_1 size_3 size_5 size_9 size_11 size_19 move eye pal col highlight mark zoomin zoomout bc preview flow fill pick
do
echo "#include <gtk/gtk.h>" >b_$i.c
gdk-pixbuf-csource --raw --name=img_$i $i.bmp | sed -e 's/static //g' >>b_$i.c
compose[j*3+2] = img_grey_buffer[((j+x)*16/img_scale_x+img_width*((i+y)*16/img_scale_y))*3+2] >> 8;
}
c = img_mark_buffer[(j+x)*16/img_scale_x+img_width*((i+y)*16/img_scale_y)];
- if (c > 0 && !flowview && !(rendered && preview)) {
- if (highlight) {
- if (c-1 == mark_selected) {
- compose[j*3] = 255;
- compose[j*3+1] = 0;
- compose[j*3+2] = 0;
- } else {
- compose[j*3] = 0;
- compose[j*3+1] = 0;
- compose[j*3+2] = 128;
- }
- } else {
+ if (c > 0 && !flowview) {
+ if (mark) {
cr = mark_palette[c-1].r;
cg = mark_palette[c-1].g;
cb = mark_palette[c-1].b;
compose[j*3+1] = cg;
compose[j*3+2] = cb;
}
+ if (highlight) {
+ if (c-1 == mark_selected) {
+ compose[j*3] = 255;
+ compose[j*3+1] = 0;
+ compose[j*3+2] = 0;
+ } else {
+ compose[j*3] = 0;
+ compose[j*3+1] = 0;
+ compose[j*3+2] = 128;
+ }
+ }
}
}
memcpy(data + rs*(i+y) + x*3, compose, w*3);
GtkWidget *timeline_scroll;
GtkWidget *palette_treeview = NULL;
GtkLabel *img_label;
-GtkToggleButton *show_highlighted_button, *show_preview_button, *show_colorized_button;
+GtkToggleButton *show_marked_button, *show_highlighted_button, *show_preview_button, *show_colorized_button;
#ifdef WITH_OPENCV
GtkToggleButton *show_flow_button;
#endif
int button_down = 0, button_down_x = -1000, button_down_y = -1000, shift_pressed = 0, button_num = 1;
int brush_size;
-int highlight = 0, preview = 0, rendered = 0, draw_mode = 1, move_mode = 0, fill_mode = 0, pick_mode = 0, flowview = 0;
+int mark = 1, highlight = 0, preview = 0, rendered = 0, draw_mode = 1, move_mode = 0, fill_mode = 0, pick_mode = 0, flowview = 0;
int mouse_over_palette_area = 0, mouse_over_drawing_area = 0, mouse_over_timeline_area = 0;
#define min(x,y) ((x < y) ? x : y)
#define abs(x,y) ((x < y) ? y - x : x - y)
}
if ((state & (GDK_BUTTON1_MASK | GDK_BUTTON2_MASK | GDK_BUTTON3_MASK))) {
- if (button_down && pick_mode) {
- pick_color(x, y);
- }
- if (button_down && !pick_mode) {
- if (move_mode) {
- move_mark((x-button_down_x)*16/img_scale_x, (y-button_down_y)*16/img_scale_y);
- draw_image(0, 0, -1, -1);
- } else
- if (draw_mode) {
- draw_line(x, y, button_num == 1);
+ if (mark || highlight) {
+ if (button_down && pick_mode) {
+ pick_color(x, y);
+ }
+ if (button_down && !pick_mode) {
+ if (move_mode) {
+ move_mark((x-button_down_x)*16/img_scale_x, (y-button_down_y)*16/img_scale_y);
+ draw_image(0, 0, -1, -1);
+ } else
+ if (draw_mode) {
+ draw_line(x, y, button_num == 1);
+ }
}
}
} else {
y = event->y;
button_num = event->button;
- if (!button_down && !pick_mode)
- copy_mark_to_undo();
- if (pick_mode) {
- pick_color(x, y);
- } else
- if (fill_mode) {
- if (button_down)
- return TRUE;
- fill(x, y, event->button != 1);
- draw_image(0, 0, -1, -1);
- } else
- if (move_mode) {
- if (button_down)
- return TRUE;
- button_down_x = x;
- button_down_y = y;
- } else
- if (draw_mode) {
- /* if not shift, draw a dot and not a line */
- if (!shift_pressed || button_down_x == -1000) {
+ if (mark || highlight) {
+ if (pick_mode) {
+ pick_color(x, y);
+ } else
+ if (fill_mode) {
+ if (button_down)
+ return TRUE;
+ copy_mark_to_undo();
+ fill(x, y, event->button != 1);
+ draw_image(0, 0, -1, -1);
+ } else
+ if (move_mode) {
+ if (button_down)
+ return TRUE;
+ copy_mark_to_undo();
button_down_x = x;
button_down_y = y;
+ } else
+ if (draw_mode) {
+ if (!button_down)
+ copy_mark_to_undo();
+ /* if not shift, draw a dot and not a line */
+ if (!shift_pressed || button_down_x == -1000) {
+ button_down_x = x;
+ button_down_y = y;
+ }
+ draw_line(x, y, button_num == 1);
}
- draw_line(x, y, button_num == 1);
+ button_down = 1;
}
- button_down = 1;
return TRUE;
}
gtk_widget_show(menu_bar);
create_menus(menu_bar);
+ set_menu_toggel_by_label(TOGGLE_LABEL_MARK, mark);
+
/* add tool_bar to vbox (bottom part of palette box) */
tool_bar = gtk_hbox_new(FALSE, 0);
gtk_box_pack_start(GTK_BOX(vbox), tool_bar, FALSE, FALSE, 2);
gtk_widget_show(tool_bar);
create_toolbar(tool_bar);
+ set_button_toggel_by_label(TOGGLE_LABEL_MARK, mark);
+
/* add paned view to vbox (middle part of vbox) */
paned = gtk_hpaned_new ();
gtk_widget_show(paned);
/* the labels are used to identify menu and button items */
enum toggle_label {
TOGGLE_LABEL_NONE = 0,
+ TOGGLE_LABEL_MARK,
TOGGLE_LABEL_HIGHLIGHT,
TOGGLE_LABEL_PREVIEW,
TOGGLE_LABEL_RENDERED,
void set_button_toggel_by_label(enum toggle_label label, gboolean active);
extern int brush_size;
-extern int highlight, preview, rendered, draw_mode, move_mode, fill_mode, pick_mode, flowview;
+extern int mark, highlight, preview, rendered, draw_mode, move_mode, fill_mode, pick_mode, flowview;
void undo_event(gpointer priv)
{
+ if (!mark && !highlight)
+ return;
copy_undo_to_mark(0);
draw_image(0, 0, -1, -1);
}
void redo_event(gpointer priv)
{
+ if (!mark && !highlight)
+ return;
copy_undo_to_mark(1);
draw_image(0, 0, -1, -1);
}
void copy_event(gpointer priv)
{
+ if (!mark && !highlight)
+ return;
copy_color(mark_selected + 1);
}
static void copy_all_event(gpointer priv)
{
+ if (!mark && !highlight)
+ return;
copy_color(0);
}
void paste_event(gpointer priv)
{
+ if (!mark && !highlight)
+ return;
copy_mark_to_undo();
paste_color();
draw_image(0, 0, -1, -1);
{
highlight = gtk_check_menu_item_get_active((GtkCheckMenuItem *)priv);
set_button_toggel_by_label(TOGGLE_LABEL_HIGHLIGHT, highlight);
+ if (mark == 1 && highlight == 1) {
+ mark = 0;
+ set_button_toggel_by_label(TOGGLE_LABEL_MARK, mark);
+ set_menu_toggel_by_label(TOGGLE_LABEL_MARK, mark);
+ }
+}
+
+static void show_marked_event(gpointer priv)
+{
+ mark = gtk_check_menu_item_get_active((GtkCheckMenuItem *)priv);
+ set_button_toggel_by_label(TOGGLE_LABEL_MARK, mark);
+ if (mark == 1 && highlight == 1) {
+ highlight = 0;
+ set_button_toggel_by_label(TOGGLE_LABEL_HIGHLIGHT, highlight);
+ set_menu_toggel_by_label(TOGGLE_LABEL_HIGHLIGHT, highlight);
+ }
}
static void show_preview_event(gpointer priv)
{ TOGGLE_LABEL_NONE, NULL, "Zoom 100", zoom_100_event, GTK_STOCK_ZOOM_100 },
{ TOGGLE_LABEL_ZOOMFIELDS, NULL, "Zoom Field", zoom_field_event, NULL },
{ TOGGLE_LABEL_NONE, NULL, "", dummy_event, NULL },
+ { TOGGLE_LABEL_MARK, NULL, "Mark color", show_marked_event, NULL },
{ TOGGLE_LABEL_HIGHLIGHT, NULL, "Highlight color", show_highlighted_event, NULL },
{ TOGGLE_LABEL_PREVIEW, NULL, "Preview color", show_preview_event, NULL },
{ TOGGLE_LABEL_RENDERED, NULL, "Show colorized", show_colorized_event, NULL },
zoom_out_event(NULL);
}
+void mark_button_toggled(GtkButton *button, gpointer index)
+{
+ mark = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button));
+ set_menu_toggel_by_label(TOGGLE_LABEL_MARK, mark);
+ if (mark == 1 && highlight == 1) {
+ highlight = 0;
+ set_menu_toggel_by_label(TOGGLE_LABEL_HIGHLIGHT, highlight);
+ set_button_toggel_by_label(TOGGLE_LABEL_HIGHLIGHT, highlight);
+ }
+ draw_image(0, 0, -1, -1);
+}
+
void highlight_button_toggled(GtkButton *button, gpointer index)
{
highlight = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button));
set_menu_toggel_by_label(TOGGLE_LABEL_HIGHLIGHT, highlight);
+ if (mark == 1 && highlight == 1) {
+ mark = 0;
+ set_menu_toggel_by_label(TOGGLE_LABEL_MARK, mark);
+ set_button_toggel_by_label(TOGGLE_LABEL_MARK, mark);
+ }
draw_image(0, 0, -1, -1);
}
extern const guint8 img_zoomout[];
extern const guint8 img_pal[];
extern const guint8 img_bc[];
+extern const guint8 img_mark[];
extern const guint8 img_highlight[];
extern const guint8 img_preview[];
extern const guint8 img_eye[];
{ TOGGLE_LABEL_NONE, NULL, img_zoomout, 0, zoomout_button_clicked, NULL, "Zoom out" },
{ TOGGLE_LABEL_NONE, NULL, img_pal, 0, palette_button_clicked, NULL, "Palette dialog" },
{ TOGGLE_LABEL_NONE, NULL, img_bc, 0, bc_button_clicked, NULL, "Brightness+Contrast dialog" },
+ { TOGGLE_LABEL_MARK, NULL, img_mark, 1, mark_button_toggled, &show_marked_button, "Show marked pixles on view" },
{ TOGGLE_LABEL_HIGHLIGHT, NULL, img_highlight, 1, highlight_button_toggled, &show_highlighted_button, "Highlight selected mark color" },
{ TOGGLE_LABEL_PREVIEW, NULL, img_preview, 1, preview_button_toggled, &show_preview_button, "Show preview of selected mark color" },
{ TOGGLE_LABEL_RENDERED, NULL, img_eye, 1, view_colorized_button_toggled, &show_colorized_button, "Show result of a rendered sequence" },
-extern GtkToggleButton *show_highlighted_button, *show_preview_button, *show_colorized_button;
+extern GtkToggleButton *show_marked_button, *show_highlighted_button, *show_preview_button, *show_colorized_button;
#ifdef WITH_OPENCV
extern GtkToggleButton *show_flow_button;
#endif