Navigation Menu

Skip to content

Commit

Permalink
Initial gtk3 port!
Browse files Browse the repository at this point in the history
  • Loading branch information
dov committed Apr 5, 2018
1 parent b70ac67 commit 3af69ae
Show file tree
Hide file tree
Showing 23 changed files with 778 additions and 868 deletions.
2 changes: 1 addition & 1 deletion SConstruct
Expand Up @@ -137,7 +137,7 @@ env.Append(CPPPATH=[],
]
)

env.ParseConfig("${PKGCONFIG} --cflags --libs gtk+-2.0 glib-2.0 gio-2.0 gmodule-2.0 gthread-2.0")
env.ParseConfig("${PKGCONFIG} --cflags --libs gtk+-3.0 glib-2.0 gio-2.0 gmodule-2.0 gthread-2.0")

env.SConscript(['src/SConscript',
'doc/SConscript',
Expand Down
8 changes: 4 additions & 4 deletions aclocal.m4
Expand Up @@ -79,11 +79,11 @@ AC_ARG_ENABLE(gtktest, [ --disable-gtktest do not try to compile and run
if test x"$no_gtk" = x ; then
GTK_CFLAGS=`$PKG_CONFIG $pkg_config_args --cflags`
GTK_LIBS=`$PKG_CONFIG $pkg_config_args --libs`
gtk_config_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
gtk_config_major_version=`$PKG_CONFIG --modversion gtk+-3.0 | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
gtk_config_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
gtk_config_minor_version=`$PKG_CONFIG --modversion gtk+-3.0 | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
gtk_config_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
gtk_config_micro_version=`$PKG_CONFIG --modversion gtk+-3.0 | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
if test "x$enable_gtktest" = "xyes" ; then
ac_save_CFLAGS="$CFLAGS"
Expand Down Expand Up @@ -119,7 +119,7 @@ main ()
(gtk_minor_version != $gtk_config_minor_version) ||
(gtk_micro_version != $gtk_config_micro_version))
{
printf("\n*** 'pkg-config --modversion gtk+-2.0' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
printf("\n*** 'pkg-config --modversion gtk+-3.0' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
$gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
gtk_major_version, gtk_minor_version, gtk_micro_version);
printf ("*** was found! If pkg-config was correct, then it is best\n");
Expand Down
6 changes: 3 additions & 3 deletions configure.in
Expand Up @@ -5,7 +5,7 @@ AM_CONFIG_HEADER(config.h)
PACKAGE=givwidget
GIVWIDGET_API_VERSION=2.0

AM_INIT_AUTOMAKE(giv, 0.9.26)
AM_INIT_AUTOMAKE(giv, 0.9.30)

dnl Use libtool to get shared libraries
LT_PREREQ
Expand All @@ -23,8 +23,8 @@ AC_ISC_POSIX
AC_HEADER_STDC
AM_PROG_CC_C_O

GTK_REQUIRED_VERSION=2.0.0
REQ_PACKAGES="gtk+-2.0"
GTK_REQUIRED_VERSION=3.0.0
REQ_PACKAGES="gtk+-3.0"

AM_PATH_GTK_2_0($GTK_REQUIRED_VERSION, :,
AC_MSG_ERROR([
Expand Down
3 changes: 1 addition & 2 deletions src/SConscript
Expand Up @@ -71,7 +71,6 @@ src_giv_widget = ["giv-widget.cc",
"GivRenderer.cc",
"GivStringArray.c",
"giv-data.cc",
"giv-backstore.cc",
"giv-markup.cc",
"giv_agg_arrowhead.cc",
"giv-settings.cc",
Expand Down Expand Up @@ -149,7 +148,7 @@ if not env['SBOX']:
env.Command(["giv-color-map.h",
"giv-color-map.c"],
"giv-color-map.vala",
["valac -C --pkg=gtk+-2.0 -H giv-color-map.h --vapi=giv-color-map.vapi giv-color-map.vala"],
["valac -C --pkg=gtk+-3.0 -H giv-color-map.h --vapi=giv-color-map.vapi giv-color-map.vala"],
chdir=True)

env.SConscript(['agg/SConscript',
Expand Down
2 changes: 1 addition & 1 deletion src/dov_image_viewer/SConscript
Expand Up @@ -2,7 +2,7 @@
import re
Import('env')

#env.ParseConfig("env PKG_CONFIG_PATH=${PKG_CONFIG_PATH} pkg-config --cflags --libs gtk+-2.0")
#env.ParseConfig("env PKG_CONFIG_PATH=${PKG_CONFIG_PATH} pkg-config --cflags --libs gtk+-3.0")

# The following python subroutine and the subsequent scons command
# shows how to do general template filling. This system should perhaps
Expand Down
22 changes: 11 additions & 11 deletions src/dov_image_viewer/dov-image-viewer-fixed.cc
Expand Up @@ -1671,8 +1671,8 @@ dov_image_viewer_redraw (DovImageViewer * self, gboolean clear_cache)
if (GTK_WIDGET(self)->window)
dov_image_viewer_expose_area(self,
0,0,
GTK_WIDGET(self)->allocation.width,
GTK_WIDGET(self)->allocation.height);
gtk_widget_get_allocated_width(GTK_WIDGET(self)),
gtk_widget_get_allocated_height(GTK_WIDGET(self)););
return FALSE;
}}
#line 1679 "dov-image-viewer.cc"
Expand Down Expand Up @@ -2123,7 +2123,7 @@ dov_image_viewer_canv_coord_to_img_coord (DovImageViewer * self, double cx, doub

#if 0
if (selfp->do_flip_vertical)
*imgy = -(cy-selfp->current_y0-GTK_WIDGET(self)->allocation.height)/selfp->current_scale_y;
*imgy = -(cy-selfp->current_y0-gtk_widget_get_allocated_height(GTK_WIDGET(self));)/selfp->current_scale_y;
else
*imgy=(cy+selfp->current_y0)/selfp->current_scale_y;
#endif
Expand Down Expand Up @@ -2525,17 +2525,17 @@ view_changed(DovImageViewer *self,
widget->window,
src_x, src_y,
dst_x, dst_y,
GTK_WIDGET(self)->allocation.width - abs (dx),
GTK_WIDGET(self)->allocation.height - abs (dy));
gtk_widget_get_allocated_width(GTK_WIDGET(self)) - abs (dx),
gtk_widget_get_allocated_height(GTK_WIDGET(self)); - abs (dy));

DBG2(g_print("Filling in: dx dy = %d %d\n", dx, dy));
/* And fill in the new areas */
if (dx)
{
expose_rect.x = (dx < 0) ? 0 : GTK_WIDGET(self)->allocation.width - dx;
expose_rect.x = (dx < 0) ? 0 : gtk_widget_get_allocated_width(GTK_WIDGET(self)) - dx;
expose_rect.y = 0;
expose_rect.width = abs(dx);
expose_rect.height = GTK_WIDGET(self)->allocation.height;
expose_rect.height = gtk_widget_get_allocated_height(GTK_WIDGET(self));;

gdk_window_invalidate_rect(widget->window,
&expose_rect,
Expand All @@ -2547,8 +2547,8 @@ view_changed(DovImageViewer *self,
if (dy)
{
expose_rect.x = 0;
expose_rect.y = (dy < 0) ? 0 : GTK_WIDGET(self)->allocation.height - dy;;
expose_rect.width = GTK_WIDGET(self)->allocation.width;
expose_rect.y = (dy < 0) ? 0 : gtk_widget_get_allocated_height(GTK_WIDGET(self)); - dy;;
expose_rect.width = gtk_widget_get_allocated_width(GTK_WIDGET(self));
expose_rect.height = abs(dy);

gdk_window_invalidate_rect(widget->window,
Expand All @@ -2575,8 +2575,8 @@ view_changed(DovImageViewer *self,

expose_rect.x = 0;
expose_rect.y = 0;
expose_rect.width = GTK_WIDGET(self)->allocation.width;
expose_rect.height = GTK_WIDGET(self)->allocation.height;
expose_rect.width = gtk_widget_get_allocated_width(GTK_WIDGET(self));
expose_rect.height = gtk_widget_get_allocated_height(GTK_WIDGET(self));;

/* gdk_window_ref (expose_event.window); */
gdk_window_invalidate_rect(widget->window,
Expand Down
22 changes: 11 additions & 11 deletions src/dov_image_viewer/dov-image-viewer.cc
Expand Up @@ -1671,8 +1671,8 @@ dov_image_viewer_redraw (DovImageViewer * self, gboolean clear_cache)
if (GTK_WIDGET(self)->window)
dov_image_viewer_expose_area(self,
0,0,
GTK_WIDGET(self)->allocation.width,
GTK_WIDGET(self)->allocation.height);
gtk_widget_get_allocated_width(GTK_WIDGET(self)),
gtk_widget_get_allocated_height(GTK_WIDGET(self)););
return FALSE;
}}
#line 1679 "dov-image-viewer.cc"
Expand Down Expand Up @@ -2123,7 +2123,7 @@ dov_image_viewer_canv_coord_to_img_coord (DovImageViewer * self, double cx, doub

#if 0
if (selfp->do_flip_vertical)
*imgy = -(cy-selfp->current_y0-GTK_WIDGET(self)->allocation.height)/selfp->current_scale_y;
*imgy = -(cy-selfp->current_y0-gtk_widget_get_allocated_height(GTK_WIDGET(self));)/selfp->current_scale_y;
else
*imgy=(cy+selfp->current_y0)/selfp->current_scale_y;
#endif
Expand Down Expand Up @@ -2525,17 +2525,17 @@ view_changed(DovImageViewer *self,
widget->window,
src_x, src_y,
dst_x, dst_y,
GTK_WIDGET(self)->allocation.width - abs (dx),
GTK_WIDGET(self)->allocation.height - abs (dy));
gtk_widget_get_allocated_width(GTK_WIDGET(self)) - abs (dx),
gtk_widget_get_allocated_height(GTK_WIDGET(self)); - abs (dy));

DBG2(g_print("Filling in: dx dy = %d %d\n", dx, dy));
/* And fill in the new areas */
if (dx)
{
expose_rect.x = (dx < 0) ? 0 : GTK_WIDGET(self)->allocation.width - dx;
expose_rect.x = (dx < 0) ? 0 : gtk_widget_get_allocated_width(GTK_WIDGET(self)) - dx;
expose_rect.y = 0;
expose_rect.width = abs(dx);
expose_rect.height = GTK_WIDGET(self)->allocation.height;
expose_rect.height = gtk_widget_get_allocated_height(GTK_WIDGET(self));;

gdk_window_invalidate_rect(widget->window,
&expose_rect,
Expand All @@ -2547,8 +2547,8 @@ view_changed(DovImageViewer *self,
if (dy)
{
expose_rect.x = 0;
expose_rect.y = (dy < 0) ? 0 : GTK_WIDGET(self)->allocation.height - dy;;
expose_rect.width = GTK_WIDGET(self)->allocation.width;
expose_rect.y = (dy < 0) ? 0 : gtk_widget_get_allocated_height(GTK_WIDGET(self)); - dy;;
expose_rect.width = gtk_widget_get_allocated_width(GTK_WIDGET(self));
expose_rect.height = abs(dy);

gdk_window_invalidate_rect(widget->window,
Expand All @@ -2575,8 +2575,8 @@ view_changed(DovImageViewer *self,

expose_rect.x = 0;
expose_rect.y = 0;
expose_rect.width = GTK_WIDGET(self)->allocation.width;
expose_rect.height = GTK_WIDGET(self)->allocation.height;
expose_rect.width = gtk_widget_get_allocated_width(GTK_WIDGET(self));
expose_rect.height = gtk_widget_get_allocated_height(GTK_WIDGET(self));;

/* gdk_window_ref (expose_event.window); */
gdk_window_invalidate_rect(widget->window,
Expand Down
22 changes: 11 additions & 11 deletions src/dov_image_viewer/dov-image-viewer.gob
Expand Up @@ -1144,8 +1144,8 @@ class Dov:Image:Viewer from Gtk:Widget
if (GTK_WIDGET(self)->window)
dov_image_viewer_expose_area(self,
0,0,
GTK_WIDGET(self)->allocation.width,
GTK_WIDGET(self)->allocation.height);
gtk_widget_get_allocated_width(GTK_WIDGET(self)),
gtk_widget_get_allocated_height(GTK_WIDGET(self)););
return FALSE;
}

Expand Down Expand Up @@ -1409,7 +1409,7 @@ class Dov:Image:Viewer from Gtk:Widget

#if 0
if (selfp->do_flip_vertical)
*imgy = -(cy-selfp->current_y0-GTK_WIDGET(self)->allocation.height)/selfp->current_scale_y;
*imgy = -(cy-selfp->current_y0-gtk_widget_get_allocated_height(GTK_WIDGET(self));)/selfp->current_scale_y;
else
*imgy=(cy+selfp->current_y0)/selfp->current_scale_y;
#endif
Expand Down Expand Up @@ -1700,17 +1700,17 @@ view_changed(DovImageViewer *self,
widget->window,
src_x, src_y,
dst_x, dst_y,
GTK_WIDGET(self)->allocation.width - abs (dx),
GTK_WIDGET(self)->allocation.height - abs (dy));
gtk_widget_get_allocated_width(GTK_WIDGET(self)) - abs (dx),
gtk_widget_get_allocated_height(GTK_WIDGET(self)); - abs (dy));

DBG2(g_print("Filling in: dx dy = %d %d\n", dx, dy));
/* And fill in the new areas */
if (dx)
{
expose_rect.x = (dx < 0) ? 0 : GTK_WIDGET(self)->allocation.width - dx;
expose_rect.x = (dx < 0) ? 0 : gtk_widget_get_allocated_width(GTK_WIDGET(self)) - dx;
expose_rect.y = 0;
expose_rect.width = abs(dx);
expose_rect.height = GTK_WIDGET(self)->allocation.height;
expose_rect.height = gtk_widget_get_allocated_height(GTK_WIDGET(self));;

gdk_window_invalidate_rect(widget->window,
&expose_rect,
Expand All @@ -1722,8 +1722,8 @@ view_changed(DovImageViewer *self,
if (dy)
{
expose_rect.x = 0;
expose_rect.y = (dy < 0) ? 0 : GTK_WIDGET(self)->allocation.height - dy;;
expose_rect.width = GTK_WIDGET(self)->allocation.width;
expose_rect.y = (dy < 0) ? 0 : gtk_widget_get_allocated_height(GTK_WIDGET(self)); - dy;
expose_rect.width = gtk_widget_get_allocated_width(GTK_WIDGET(self));
expose_rect.height = abs(dy);

gdk_window_invalidate_rect(widget->window,
Expand All @@ -1750,8 +1750,8 @@ view_changed(DovImageViewer *self,

expose_rect.x = 0;
expose_rect.y = 0;
expose_rect.width = GTK_WIDGET(self)->allocation.width;
expose_rect.height = GTK_WIDGET(self)->allocation.height;
expose_rect.width = gtk_widget_get_allocated_width(GTK_WIDGET(self));
expose_rect.height = gtk_widget_get_allocated_height(GTK_WIDGET(self));

/* gdk_window_ref (expose_event.window); */
gdk_window_invalidate_rect(widget->window,
Expand Down

0 comments on commit 3af69ae

Please sign in to comment.