Don't expose implementation details and extend the interface with trivial
2008-07-19 Martin Nordholts <martinn@svn.gnome.org> * app/widgets/gimpnavigationview.[ch]: Don't expose implementation details and extend the interface with trivial new functions. * app/display/gimpnavigationeditor.c (gimp_navigation_editor_popup): Use the new interface instead of directly accessing the members of the navigation view. svn path=/trunk/; revision=26236
This commit is contained in:

committed by
Martin Nordholts

parent
9d17a53267
commit
aa27ae1bd0
@ -1,3 +1,12 @@
|
|||||||
|
2008-07-19 Martin Nordholts <martinn@svn.gnome.org>
|
||||||
|
|
||||||
|
* app/widgets/gimpnavigationview.[ch]: Don't expose implementation
|
||||||
|
details and extend the interface with trivial new functions.
|
||||||
|
|
||||||
|
* app/display/gimpnavigationeditor.c
|
||||||
|
(gimp_navigation_editor_popup): Use the new interface instead of
|
||||||
|
directly accessing the members of the navigation view.
|
||||||
|
|
||||||
2008-07-18 Sven Neumann <sven@gimp.org>
|
2008-07-18 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
* app/core/core-types.h: removed delta_time, delta_x, delta_y,
|
* app/core/core-types.h: removed delta_time, delta_x, delta_y,
|
||||||
|
@ -231,6 +231,10 @@ gimp_navigation_editor_popup (GimpDisplayShell *shell,
|
|||||||
GdkScreen *screen;
|
GdkScreen *screen;
|
||||||
gint x, y;
|
gint x, y;
|
||||||
gint x_org, y_org;
|
gint x_org, y_org;
|
||||||
|
gint view_marker_x;
|
||||||
|
gint view_marker_y;
|
||||||
|
gint view_marker_width;
|
||||||
|
gint view_marker_height;
|
||||||
|
|
||||||
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
||||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||||
@ -272,14 +276,20 @@ gimp_navigation_editor_popup (GimpDisplayShell *shell,
|
|||||||
/* decide where to put the popup */
|
/* decide where to put the popup */
|
||||||
gdk_window_get_origin (widget->window, &x_org, &y_org);
|
gdk_window_get_origin (widget->window, &x_org, &y_org);
|
||||||
|
|
||||||
|
gimp_navigation_view_get_local_marker (view,
|
||||||
|
&view_marker_x,
|
||||||
|
&view_marker_y,
|
||||||
|
&view_marker_width,
|
||||||
|
&view_marker_height);
|
||||||
|
|
||||||
x = (x_org + click_x -
|
x = (x_org + click_x -
|
||||||
view->p_x -
|
view_marker_x -
|
||||||
0.5 * (view->p_width - BORDER_PEN_WIDTH) -
|
0.5 * (view_marker_width - BORDER_PEN_WIDTH) -
|
||||||
2 * style->xthickness);
|
2 * style->xthickness);
|
||||||
|
|
||||||
y = (y_org + click_y -
|
y = (y_org + click_y -
|
||||||
view->p_y -
|
view_marker_y -
|
||||||
0.5 * (view->p_height - BORDER_PEN_WIDTH) -
|
0.5 * (view_marker_height - BORDER_PEN_WIDTH) -
|
||||||
2 * style->ythickness);
|
2 * style->ythickness);
|
||||||
|
|
||||||
/* If the popup doesn't fit into the screen, we have a problem.
|
/* If the popup doesn't fit into the screen, we have a problem.
|
||||||
@ -305,9 +315,9 @@ gimp_navigation_editor_popup (GimpDisplayShell *shell,
|
|||||||
gdk_flush ();
|
gdk_flush ();
|
||||||
|
|
||||||
/* fill in then grab pointer */
|
/* fill in then grab pointer */
|
||||||
view->motion_offset_x = 0.5 * (view->p_width - BORDER_PEN_WIDTH);
|
gimp_navigation_view_set_motion_offset (view,
|
||||||
view->motion_offset_y = 0.5 * (view->p_height - BORDER_PEN_WIDTH);
|
0.5 * (view_marker_width - BORDER_PEN_WIDTH),
|
||||||
|
0.5 * (view_marker_height - BORDER_PEN_WIDTH));
|
||||||
gimp_navigation_view_grab_pointer (view);
|
gimp_navigation_view_grab_pointer (view);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,6 +50,30 @@ enum
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
struct _GimpNavigationView
|
||||||
|
{
|
||||||
|
GimpView parent_instance;
|
||||||
|
|
||||||
|
/* values in image coordinates */
|
||||||
|
gdouble x;
|
||||||
|
gdouble y;
|
||||||
|
gdouble width;
|
||||||
|
gdouble height;
|
||||||
|
|
||||||
|
/* values in view coordinates */
|
||||||
|
gint p_x;
|
||||||
|
gint p_y;
|
||||||
|
gint p_width;
|
||||||
|
gint p_height;
|
||||||
|
|
||||||
|
gint motion_offset_x;
|
||||||
|
gint motion_offset_y;
|
||||||
|
gboolean has_grab;
|
||||||
|
|
||||||
|
GdkGC *gc;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
static void gimp_navigation_view_realize (GtkWidget *widget);
|
static void gimp_navigation_view_realize (GtkWidget *widget);
|
||||||
static void gimp_navigation_view_unrealize (GtkWidget *widget);
|
static void gimp_navigation_view_unrealize (GtkWidget *widget);
|
||||||
static void gimp_navigation_view_size_allocate (GtkWidget *widget,
|
static void gimp_navigation_view_size_allocate (GtkWidget *widget,
|
||||||
@ -135,7 +159,6 @@ gimp_navigation_view_init (GimpNavigationView *view)
|
|||||||
|
|
||||||
gtk_widget_add_events (GTK_WIDGET (view), (GDK_POINTER_MOTION_MASK |
|
gtk_widget_add_events (GTK_WIDGET (view), (GDK_POINTER_MOTION_MASK |
|
||||||
GDK_KEY_PRESS_MASK));
|
GDK_KEY_PRESS_MASK));
|
||||||
|
|
||||||
view->x = 0.0;
|
view->x = 0.0;
|
||||||
view->y = 0.0;
|
view->y = 0.0;
|
||||||
view->width = 0.0;
|
view->width = 0.0;
|
||||||
@ -575,3 +598,29 @@ gimp_navigation_view_set_marker (GimpNavigationView *nav_view,
|
|||||||
if (GTK_WIDGET_DRAWABLE (view))
|
if (GTK_WIDGET_DRAWABLE (view))
|
||||||
gimp_navigation_view_draw_marker (nav_view, NULL);
|
gimp_navigation_view_draw_marker (nav_view, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
@ -38,29 +38,6 @@
|
|||||||
|
|
||||||
typedef struct _GimpNavigationViewClass GimpNavigationViewClass;
|
typedef struct _GimpNavigationViewClass GimpNavigationViewClass;
|
||||||
|
|
||||||
struct _GimpNavigationView
|
|
||||||
{
|
|
||||||
GimpView parent_instance;
|
|
||||||
|
|
||||||
/* values in image coordinates */
|
|
||||||
gdouble x;
|
|
||||||
gdouble y;
|
|
||||||
gdouble width;
|
|
||||||
gdouble height;
|
|
||||||
|
|
||||||
/* values in view coordinates */
|
|
||||||
gint p_x;
|
|
||||||
gint p_y;
|
|
||||||
gint p_width;
|
|
||||||
gint p_height;
|
|
||||||
|
|
||||||
gint motion_offset_x;
|
|
||||||
gint motion_offset_y;
|
|
||||||
gboolean has_grab;
|
|
||||||
|
|
||||||
GdkGC *gc;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _GimpNavigationViewClass
|
struct _GimpNavigationViewClass
|
||||||
{
|
{
|
||||||
GimpViewClass parent_class;
|
GimpViewClass parent_class;
|
||||||
@ -82,6 +59,16 @@ void gimp_navigation_view_set_marker (GimpNavigationView *view,
|
|||||||
gdouble y,
|
gdouble y,
|
||||||
gdouble width,
|
gdouble width,
|
||||||
gdouble height);
|
gdouble height);
|
||||||
|
void gimp_navigation_view_set_motion_offset
|
||||||
|
(GimpNavigationView *view,
|
||||||
|
gint motion_offset_x,
|
||||||
|
gint motion_offset_y);
|
||||||
|
void gimp_navigation_view_get_local_marker
|
||||||
|
(GimpNavigationView *view,
|
||||||
|
gint *x,
|
||||||
|
gint *y,
|
||||||
|
gint *width,
|
||||||
|
gint *height);
|
||||||
void gimp_navigation_view_grab_pointer (GimpNavigationView *view);
|
void gimp_navigation_view_grab_pointer (GimpNavigationView *view);
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user