Mercurial > geeqie
comparison src/layout_image.c @ 1375:df58e511d90e
Display pixel coordinates and rgb - patch by Ruben Stein
author | nadvornik |
---|---|
date | Wed, 04 Mar 2009 18:53:47 +0000 |
parents | 168e5597ddc7 |
children | dab37628f5d8 |
comparison
equal
deleted
inserted
replaced
1374:27ba259d3496 | 1375:df58e511d90e |
---|---|
24 #include "layout.h" | 24 #include "layout.h" |
25 #include "layout_util.h" | 25 #include "layout_util.h" |
26 #include "menu.h" | 26 #include "menu.h" |
27 #include "misc.h" | 27 #include "misc.h" |
28 #include "pixbuf_util.h" | 28 #include "pixbuf_util.h" |
29 #include "pixbuf-renderer.h" | |
29 #include "slideshow.h" | 30 #include "slideshow.h" |
30 #include "ui_fileops.h" | 31 #include "ui_fileops.h" |
31 #include "ui_menu.h" | 32 #include "ui_menu.h" |
32 #include "uri_utils.h" | 33 #include "uri_utils.h" |
33 #include "utilops.h" | 34 #include "utilops.h" |
1479 { | 1480 { |
1480 image_set_button_func(lw->split_images[i], layout_image_button_inactive_cb, lw); | 1481 image_set_button_func(lw->split_images[i], layout_image_button_inactive_cb, lw); |
1481 image_set_scroll_func(lw->split_images[i], layout_image_scroll_cb, lw); | 1482 image_set_scroll_func(lw->split_images[i], layout_image_scroll_cb, lw); |
1482 } | 1483 } |
1483 | 1484 |
1485 | |
1486 void layout_status_update_pixel_cb(PixbufRenderer *pr, gpointer data) | |
1487 { | |
1488 LayoutWindow *lw = data; | |
1489 gchar *text; | |
1490 | |
1491 if (!data || !layout_valid(&lw) || !lw->image || lw->options.info_pixel_hidden) return; | |
1492 | |
1493 if (!lw->image->unknown) | |
1494 { | |
1495 gint x_pixel, y_pixel; | |
1496 | |
1497 pixbuf_renderer_get_mouse_position(pr, &x_pixel, &y_pixel); | |
1498 | |
1499 if(x_pixel > 0 && y_pixel > 0) | |
1500 { | |
1501 gint r_mouse, g_mouse, b_mouse; | |
1502 gint width, height, slen_width, slen_height; | |
1503 gchar str_temp[10]; | |
1504 | |
1505 pixbuf_renderer_get_pixel_colors(pr, x_pixel, y_pixel, | |
1506 &r_mouse, &g_mouse, &b_mouse); | |
1507 pixbuf_renderer_get_image_size(pr, &width, &height); | |
1508 slen_width = sprintf(str_temp, "%d", width - 1); | |
1509 slen_height = sprintf(str_temp, "%d", height - 1); | |
1510 | |
1511 text = g_strdup_printf(_("<tt>pos(%*d,%*d) rgb(%3d,%3d,%3d)</tt>"), | |
1512 slen_width, x_pixel, slen_height, y_pixel, | |
1513 r_mouse, g_mouse, b_mouse); | |
1514 } | |
1515 else | |
1516 { | |
1517 text = g_strdup(""); | |
1518 } | |
1519 gtk_label_set_markup(GTK_LABEL(lw->info_pixel), text); | |
1520 g_free(text); | |
1521 } | |
1522 } | |
1523 | |
1524 | |
1484 /* | 1525 /* |
1485 *---------------------------------------------------------------------------- | 1526 *---------------------------------------------------------------------------- |
1486 * setup | 1527 * setup |
1487 *---------------------------------------------------------------------------- | 1528 *---------------------------------------------------------------------------- |
1488 */ | 1529 */ |
1504 #if GTK_CHECK_VERSION(2,12,0) | 1545 #if GTK_CHECK_VERSION(2,12,0) |
1505 g_object_ref(lw->split_images[i]->widget); | 1546 g_object_ref(lw->split_images[i]->widget); |
1506 #else | 1547 #else |
1507 gtk_widget_ref(lw->split_images[i]->widget); | 1548 gtk_widget_ref(lw->split_images[i]->widget); |
1508 #endif | 1549 #endif |
1550 | |
1551 g_signal_connect(G_OBJECT(lw->split_images[i]->pr), "update-pixel", | |
1552 G_CALLBACK(layout_status_update_pixel_cb), lw); | |
1553 | |
1509 image_background_set_color(lw->split_images[i], options->image.use_custom_border_color ? &options->image.border_color : NULL); | 1554 image_background_set_color(lw->split_images[i], options->image.use_custom_border_color ? &options->image.border_color : NULL); |
1510 | 1555 |
1511 image_auto_refresh_enable(lw->split_images[i], TRUE); | 1556 image_auto_refresh_enable(lw->split_images[i], TRUE); |
1512 | 1557 |
1513 layout_image_dnd_init(lw, i); | 1558 layout_image_dnd_init(lw, i); |