Commit e9958b1b authored by Michael Natterer's avatar Michael Natterer Committed by Michael Natterer

reorder functions and add static prototypes.

2008-09-26  Michael Natterer  <mitch@gimp.org>

	* app/widgets/gimpnavigationview.c: reorder functions and add
	static prototypes.


svn path=/trunk/; revision=27065
parent d97b6e45
2008-09-26 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpnavigationview.c: reorder functions and add
static prototypes.
2008-09-25 Michael Natterer <mitch@gimp.org>
* app/base/colorize.c (colorize_calculate): fix calculation of
......
......@@ -90,6 +90,12 @@ static gboolean gimp_navigation_view_key_press (GtkWidget *widget,
static void gimp_navigation_view_transform (GimpNavigationView *nav_view);
static void gimp_navigation_view_draw_marker (GimpNavigationView *nav_view,
cairo_t *cr);
static void gimp_navigation_view_move_to (GimpNavigationView *nav_view,
gint tx,
gint ty);
static void gimp_navigation_view_get_ratio (GimpNavigationView *nav_view,
gdouble *ratiox,
gdouble *ratioy);
G_DEFINE_TYPE (GimpNavigationView, gimp_navigation_view, GIMP_TYPE_VIEW)
......@@ -201,43 +207,6 @@ gimp_navigation_view_expose (GtkWidget *widget,
return TRUE;
}
static void
gimp_navigation_view_get_ratio (const GimpNavigationView *nav_view,
gdouble *ratiox,
gdouble *ratioy)
{
GimpView *view = GIMP_VIEW (nav_view);
GimpImage *image;
image = GIMP_IMAGE (view->renderer->viewable);
*ratiox = (gdouble) view->renderer->width /
(gdouble) gimp_image_get_width (image);
*ratioy = (gdouble) view->renderer->height /
(gdouble) gimp_image_get_height (image);
}
static void
gimp_navigation_view_move_to (GimpNavigationView *nav_view,
gint tx,
gint ty)
{
GimpView *view = GIMP_VIEW (nav_view);
gdouble ratiox, ratioy;
gdouble x, y;
if (! view->renderer->viewable)
return;
gimp_navigation_view_get_ratio (nav_view, &ratiox, &ratioy);
x = tx / ratiox;
y = ty / ratioy;
g_signal_emit (view, view_signals[MARKER_CHANGED], 0,
x, y, nav_view->width, nav_view->height);
}
void
gimp_navigation_view_grab_pointer (GimpNavigationView *nav_view)
{
......@@ -465,6 +434,64 @@ gimp_navigation_view_key_press (GtkWidget *widget,
return FALSE;
}
/* public functions */
void
gimp_navigation_view_set_marker (GimpNavigationView *nav_view,
gdouble x,
gdouble y,
gdouble width,
gdouble height)
{
GimpView *view;
g_return_if_fail (GIMP_IS_NAVIGATION_VIEW (nav_view));
view = GIMP_VIEW (nav_view);
g_return_if_fail (view->renderer->viewable);
nav_view->x = x;
nav_view->y = y;
nav_view->width = MAX (1.0, width);
nav_view->height = MAX (1.0, height);
gimp_navigation_view_transform (nav_view);
/* Marker changed, redraw */
gtk_widget_queue_draw (GTK_WIDGET (view));
}
void
gimp_navigation_view_set_motion_offset (GimpNavigationView *view,
gint motion_offset_x,
gint motion_offset_y)
{
g_return_if_fail (GIMP_IS_NAVIGATION_VIEW (view));
view->motion_offset_x = motion_offset_x;
view->motion_offset_y = motion_offset_y;
}
void
gimp_navigation_view_get_local_marker (GimpNavigationView *view,
gint *x,
gint *y,
gint *width,
gint *height)
{
g_return_if_fail (GIMP_IS_NAVIGATION_VIEW (view));
if (x) *x = view->p_x;
if (y) *y = view->p_y;
if (width) *width = view->p_width;
if (height) *height = view->p_height;
}
/* private functions */
static void
gimp_navigation_view_transform (GimpNavigationView *nav_view)
{
......@@ -511,54 +538,39 @@ gimp_navigation_view_draw_marker (GimpNavigationView *nav_view,
}
}
void
gimp_navigation_view_set_marker (GimpNavigationView *nav_view,
gdouble x,
gdouble y,
gdouble width,
gdouble height)
static void
gimp_navigation_view_move_to (GimpNavigationView *nav_view,
gint tx,
gint ty)
{
GimpView *view;
g_return_if_fail (GIMP_IS_NAVIGATION_VIEW (nav_view));
view = GIMP_VIEW (nav_view);
GimpView *view = GIMP_VIEW (nav_view);
gdouble ratiox, ratioy;
gdouble x, y;
g_return_if_fail (view->renderer->viewable);
if (! view->renderer->viewable)
return;
nav_view->x = x;
nav_view->y = y;
nav_view->width = MAX (1.0, width);
nav_view->height = MAX (1.0, height);
gimp_navigation_view_get_ratio (nav_view, &ratiox, &ratioy);
gimp_navigation_view_transform (nav_view);
x = tx / ratiox;
y = ty / ratioy;
/* Marker changed, redraw */
gtk_widget_queue_draw (GTK_WIDGET (view));
g_signal_emit (view, view_signals[MARKER_CHANGED], 0,
x, y, nav_view->width, nav_view->height);
}
void
gimp_navigation_view_set_motion_offset (GimpNavigationView *view,
gint motion_offset_x,
gint motion_offset_y)
static void
gimp_navigation_view_get_ratio (GimpNavigationView *nav_view,
gdouble *ratiox,
gdouble *ratioy)
{
g_return_if_fail (GIMP_IS_NAVIGATION_VIEW (view));
view->motion_offset_x = motion_offset_x;
view->motion_offset_y = motion_offset_y;
}
GimpView *view = GIMP_VIEW (nav_view);
GimpImage *image;
void
gimp_navigation_view_get_local_marker (GimpNavigationView *view,
gint *x,
gint *y,
gint *width,
gint *height)
{
g_return_if_fail (GIMP_IS_NAVIGATION_VIEW (view));
image = GIMP_IMAGE (view->renderer->viewable);
if (x) *x = view->p_x;
if (y) *y = view->p_y;
if (width) *width = view->p_width;
if (height) *height = view->p_height;
*ratiox = (gdouble) view->renderer->width /
(gdouble) gimp_image_get_width (image);
*ratioy = (gdouble) view->renderer->height /
(gdouble) gimp_image_get_height (image);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment