2008-07-01 22:57:50 +00:00
|
|
|
|
/* GTK - The GIMP Toolkit
|
1998-09-27 18:32:00 +00:00
|
|
|
|
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
|
|
|
|
*
|
|
|
|
|
* GTK Calendar Widget
|
2004-11-12 17:52:08 +00:00
|
|
|
|
* Copyright (C) 1998 Cesar Miquel, Shawn T. Amundson and Mattias Groenlund
|
2011-01-24 02:50:39 +00:00
|
|
|
|
*
|
1998-09-27 18:32:00 +00:00
|
|
|
|
* lib_date routines
|
|
|
|
|
* Copyright (c) 1995, 1996, 1997, 1998 by Steffen Beyer
|
|
|
|
|
*
|
|
|
|
|
* This library is free software; you can redistribute it and/or
|
2000-07-26 11:33:08 +00:00
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
1998-09-27 18:32:00 +00:00
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2011-01-24 02:50:39 +00:00
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
2000-07-26 11:33:08 +00:00
|
|
|
|
* Lesser General Public License for more details.
|
1998-09-27 18:32:00 +00:00
|
|
|
|
*
|
2000-07-26 11:33:08 +00:00
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
1998-09-27 18:32:00 +00:00
|
|
|
|
* License along with this library; if not, write to the Free
|
|
|
|
|
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
|
*/
|
|
|
|
|
|
1999-02-24 07:37:18 +00:00
|
|
|
|
/*
|
2000-03-14 19:57:25 +00:00
|
|
|
|
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
1999-02-24 07:37:18 +00:00
|
|
|
|
* file for a list of people on the GTK+ Team. See the ChangeLog
|
|
|
|
|
* files for a list of changes. These files are distributed with
|
2011-01-24 02:50:39 +00:00
|
|
|
|
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
1999-02-24 07:37:18 +00:00
|
|
|
|
*/
|
|
|
|
|
|
2010-07-06 20:06:34 +00:00
|
|
|
|
/**
|
|
|
|
|
* SECTION:gtkcalendar
|
|
|
|
|
* @Short_description: Displays a calendar and allows the user to select a date
|
|
|
|
|
* @Title: GtkCalendar
|
|
|
|
|
*
|
2011-01-04 16:36:42 +00:00
|
|
|
|
* #GtkCalendar is a widget that displays a Gregorian calendar, one month
|
|
|
|
|
* at a time. It can be created with gtk_calendar_new().
|
2010-07-06 20:06:34 +00:00
|
|
|
|
*
|
|
|
|
|
* The month and year currently displayed can be altered with
|
2011-01-04 16:36:42 +00:00
|
|
|
|
* gtk_calendar_select_month(). The exact day can be selected from the
|
|
|
|
|
* displayed month using gtk_calendar_select_day().
|
2010-07-06 20:06:34 +00:00
|
|
|
|
*
|
2011-01-04 16:36:42 +00:00
|
|
|
|
* To place a visual marker on a particular day, use gtk_calendar_mark_day()
|
|
|
|
|
* and to remove the marker, gtk_calendar_unmark_day(). Alternative, all
|
|
|
|
|
* marks can be cleared with gtk_calendar_clear_marks().
|
2010-07-06 20:06:34 +00:00
|
|
|
|
*
|
|
|
|
|
* The way in which the calendar itself is displayed can be altered using
|
|
|
|
|
* gtk_calendar_set_display_options().
|
|
|
|
|
*
|
|
|
|
|
* The selected date can be retrieved from a #GtkCalendar using
|
|
|
|
|
* gtk_calendar_get_date().
|
2011-01-04 16:36:42 +00:00
|
|
|
|
*
|
|
|
|
|
* Users should be aware that, although the Gregorian calendar is the legal
|
|
|
|
|
* calendar in most countries, it was adopted progressively between 1582 and
|
|
|
|
|
* 1929. Display before these dates is likely to be historically incorrect.
|
2010-07-06 20:06:34 +00:00
|
|
|
|
*/
|
|
|
|
|
|
2008-06-22 14:28:52 +00:00
|
|
|
|
#include "config.h"
|
This might seem like a large patch, but it isn't that bad, and nothing
should break on Unix/X11.
Win32 merge and general portability stuff:
* acconfig.h,configure.in: Check for <sys/time.h>.
* gdk/win32: New directory (actually, been there for a while).
* gtk/fnmatch.c: Include <glib.h> for G_DIR_SEPARATOR, WIN32 and
NATIVE_WIN32, and use these. Always case fold on Win32. No
backslashed escapes on native Win32.
* gtk/{gtk.def,makefile.msc}: New files.
* gtk/Makefile.am: Add above new files.
* gtk/{gtkaccelgroup,gtkbindings}.c: Include <string.h>
instead of <strings.h>.
* gtk/{gtkcalendar,gtkitemfactory,gtkpreview,gtkrc}.c: Include
config.h. Protect inclusion of <sys/param.h>, <sys/time.h>, and
<unistd.h> appropriately.
* gtk/gtkdnd.c: Merge in Win32 version (which doesn't do much).
Use ABS() (from <glib.h>) instead of abs().
* gtk/gtkfilesel.c: Moved Win32-specific includes after inclusion
of gtk (and thus glib) headers, so that WIN32 will be
defined. With MS C, include <direct.h> for mkdir prototype.
* gtk/gtkitemfactory.c (gtk_item_factory_callback_marshal): Add
some casts, needed by MS C.
* gtk/{gtklayout,gtkplug}.c: Merge in Win32 version (which isn't
implemented).
* gtk/gtkmain.c: Include gdk/gdkx.h for GDK_WINDOWING. Include
<X11/Xlocale.h> only on X11 platform, otherwise <locale.h>. Use
G_SEARCHPATH_SEPARATOR_S and g_module_build_path.
* gtk/gtkmain.h: Mark variables for export/import on Win32.
* gtk/gtkrange.c (gtk_range_motion_notify): Set mods also in case
the event is not a hint, or its window is not the slider. Needed
on Win32, at least.
* gtk/gtkrc.c: Include config.h and gdk/gdkx.h. Use <locale.h>
unless on X11. Skip \r chars, too. Use G_DIR_SEPARATOR and
G_SEARCHPATH_SEPARATOR(_S). Use g_path_is_absolute. On Win32, use
a subdirectory of the Windows directory as gtk system
configuration directory.
* gtk/gtkselection.c: No chunks on Win32.
* gtk/gtksocket.c: Not implemented on Win32.
* gtk/gtkthemes.c (gtk_theme_engine_get): Use g_module_build_path.
* gtk/makeenums.h: Include gdkprivate.h after gdk.h.
* gtk/testrgb.c: Use dynamically allocated buffer. Use GTimers.
1999-03-15 00:03:37 +00:00
|
|
|
|
|
|
|
|
|
#ifdef HAVE_SYS_TIME_H
|
1998-09-27 18:32:00 +00:00
|
|
|
|
#include <sys/time.h>
|
This might seem like a large patch, but it isn't that bad, and nothing
should break on Unix/X11.
Win32 merge and general portability stuff:
* acconfig.h,configure.in: Check for <sys/time.h>.
* gdk/win32: New directory (actually, been there for a while).
* gtk/fnmatch.c: Include <glib.h> for G_DIR_SEPARATOR, WIN32 and
NATIVE_WIN32, and use these. Always case fold on Win32. No
backslashed escapes on native Win32.
* gtk/{gtk.def,makefile.msc}: New files.
* gtk/Makefile.am: Add above new files.
* gtk/{gtkaccelgroup,gtkbindings}.c: Include <string.h>
instead of <strings.h>.
* gtk/{gtkcalendar,gtkitemfactory,gtkpreview,gtkrc}.c: Include
config.h. Protect inclusion of <sys/param.h>, <sys/time.h>, and
<unistd.h> appropriately.
* gtk/gtkdnd.c: Merge in Win32 version (which doesn't do much).
Use ABS() (from <glib.h>) instead of abs().
* gtk/gtkfilesel.c: Moved Win32-specific includes after inclusion
of gtk (and thus glib) headers, so that WIN32 will be
defined. With MS C, include <direct.h> for mkdir prototype.
* gtk/gtkitemfactory.c (gtk_item_factory_callback_marshal): Add
some casts, needed by MS C.
* gtk/{gtklayout,gtkplug}.c: Merge in Win32 version (which isn't
implemented).
* gtk/gtkmain.c: Include gdk/gdkx.h for GDK_WINDOWING. Include
<X11/Xlocale.h> only on X11 platform, otherwise <locale.h>. Use
G_SEARCHPATH_SEPARATOR_S and g_module_build_path.
* gtk/gtkmain.h: Mark variables for export/import on Win32.
* gtk/gtkrange.c (gtk_range_motion_notify): Set mods also in case
the event is not a hint, or its window is not the slider. Needed
on Win32, at least.
* gtk/gtkrc.c: Include config.h and gdk/gdkx.h. Use <locale.h>
unless on X11. Skip \r chars, too. Use G_DIR_SEPARATOR and
G_SEARCHPATH_SEPARATOR(_S). Use g_path_is_absolute. On Win32, use
a subdirectory of the Windows directory as gtk system
configuration directory.
* gtk/gtkselection.c: No chunks on Win32.
* gtk/gtksocket.c: Not implemented on Win32.
* gtk/gtkthemes.c (gtk_theme_engine_get): Use g_module_build_path.
* gtk/makeenums.h: Include gdkprivate.h after gdk.h.
* gtk/testrgb.c: Use dynamically allocated buffer. Use GTimers.
1999-03-15 00:03:37 +00:00
|
|
|
|
#endif
|
2005-01-14 13:43:54 +00:00
|
|
|
|
#ifdef HAVE__NL_TIME_FIRST_WEEKDAY
|
2005-01-13 19:37:54 +00:00
|
|
|
|
#include <langinfo.h>
|
|
|
|
|
#endif
|
1998-09-27 18:32:00 +00:00
|
|
|
|
#include <string.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <time.h>
|
2005-11-28 01:51:08 +00:00
|
|
|
|
|
|
|
|
|
#include <glib.h>
|
|
|
|
|
|
|
|
|
|
#ifdef G_OS_WIN32
|
|
|
|
|
#include <windows.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
1998-09-27 18:32:00 +00:00
|
|
|
|
#include "gtkcalendar.h"
|
2003-08-08 23:01:17 +00:00
|
|
|
|
#include "gtkdnd.h"
|
2003-05-08 00:25:51 +00:00
|
|
|
|
#include "gtkintl.h"
|
2003-05-20 22:37:57 +00:00
|
|
|
|
#include "gtkmain.h"
|
|
|
|
|
#include "gtkmarshalers.h"
|
2007-12-28 09:36:06 +00:00
|
|
|
|
#include "gtktooltip.h"
|
2005-03-22 02:14:55 +00:00
|
|
|
|
#include "gtkprivate.h"
|
1998-09-27 18:32:00 +00:00
|
|
|
|
|
|
|
|
|
/***************************************************************************/
|
2011-01-24 02:50:39 +00:00
|
|
|
|
/* The following date routines are taken from the lib_date package.
|
2005-12-06 17:07:55 +00:00
|
|
|
|
* They have been minimally edited to avoid conflict with types defined
|
|
|
|
|
* in win32 headers.
|
|
|
|
|
*/
|
1998-09-27 18:32:00 +00:00
|
|
|
|
|
2005-12-06 17:07:55 +00:00
|
|
|
|
static const guint month_length[2][13] =
|
1998-09-27 18:32:00 +00:00
|
|
|
|
{
|
1998-10-01 13:24:42 +00:00
|
|
|
|
{ 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 },
|
|
|
|
|
{ 0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
|
1998-09-27 18:32:00 +00:00
|
|
|
|
};
|
|
|
|
|
|
2005-12-06 17:07:55 +00:00
|
|
|
|
static const guint days_in_months[2][14] =
|
1998-09-27 18:32:00 +00:00
|
|
|
|
{
|
1998-10-01 13:24:42 +00:00
|
|
|
|
{ 0, 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 },
|
|
|
|
|
{ 0, 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 }
|
1998-09-27 18:32:00 +00:00
|
|
|
|
};
|
|
|
|
|
|
2005-12-06 17:07:55 +00:00
|
|
|
|
static glong calc_days(guint year, guint mm, guint dd);
|
|
|
|
|
static guint day_of_week(guint year, guint mm, guint dd);
|
|
|
|
|
static glong dates_difference(guint year1, guint mm1, guint dd1,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
guint year2, guint mm2, guint dd2);
|
2005-12-06 17:07:55 +00:00
|
|
|
|
static guint weeks_in_year(guint year);
|
1998-09-27 18:32:00 +00:00
|
|
|
|
|
2011-01-24 02:50:39 +00:00
|
|
|
|
static gboolean
|
2005-12-06 17:07:55 +00:00
|
|
|
|
leap (guint year)
|
1998-09-27 18:32:00 +00:00
|
|
|
|
{
|
2005-12-06 17:07:55 +00:00
|
|
|
|
return((((year % 4) == 0) && ((year % 100) != 0)) || ((year % 400) == 0));
|
1998-09-27 18:32:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-01-24 02:50:39 +00:00
|
|
|
|
static guint
|
2005-12-06 17:07:55 +00:00
|
|
|
|
day_of_week (guint year, guint mm, guint dd)
|
1998-09-27 18:32:00 +00:00
|
|
|
|
{
|
2005-12-06 17:07:55 +00:00
|
|
|
|
glong days;
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
1998-10-01 13:24:42 +00:00
|
|
|
|
days = calc_days(year, mm, dd);
|
|
|
|
|
if (days > 0L)
|
1998-09-27 18:32:00 +00:00
|
|
|
|
{
|
1998-10-01 13:24:42 +00:00
|
|
|
|
days--;
|
|
|
|
|
days %= 7L;
|
|
|
|
|
days++;
|
1998-09-27 18:32:00 +00:00
|
|
|
|
}
|
2005-12-06 17:07:55 +00:00
|
|
|
|
return( (guint) days );
|
1998-09-27 18:32:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
2005-12-06 17:07:55 +00:00
|
|
|
|
static guint weeks_in_year(guint year)
|
1998-09-27 18:32:00 +00:00
|
|
|
|
{
|
2005-12-06 17:07:55 +00:00
|
|
|
|
return(52 + ((day_of_week(year,1,1)==4) || (day_of_week(year,12,31)==4)));
|
1998-09-27 18:32:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-01-24 02:50:39 +00:00
|
|
|
|
static gboolean
|
2005-12-06 17:07:55 +00:00
|
|
|
|
check_date(guint year, guint mm, guint dd)
|
1998-09-27 18:32:00 +00:00
|
|
|
|
{
|
2005-12-06 17:07:55 +00:00
|
|
|
|
if (year < 1) return FALSE;
|
|
|
|
|
if ((mm < 1) || (mm > 12)) return FALSE;
|
|
|
|
|
if ((dd < 1) || (dd > month_length[leap(year)][mm])) return FALSE;
|
|
|
|
|
return TRUE;
|
1998-09-27 18:32:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-01-24 02:50:39 +00:00
|
|
|
|
static guint
|
2005-12-06 17:07:55 +00:00
|
|
|
|
week_number(guint year, guint mm, guint dd)
|
1998-09-27 18:32:00 +00:00
|
|
|
|
{
|
2005-12-06 17:07:55 +00:00
|
|
|
|
guint first;
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
1998-10-01 13:24:42 +00:00
|
|
|
|
first = day_of_week(year,1,1) - 1;
|
2005-12-06 17:07:55 +00:00
|
|
|
|
return( (guint) ( (dates_difference(year,1,1, year,mm,dd) + first) / 7L ) +
|
2011-01-24 02:50:39 +00:00
|
|
|
|
(first < 4) );
|
1998-09-27 18:32:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-01-24 02:50:39 +00:00
|
|
|
|
static glong
|
2005-12-06 17:07:55 +00:00
|
|
|
|
year_to_days(guint year)
|
1998-09-27 18:32:00 +00:00
|
|
|
|
{
|
1998-10-01 13:24:42 +00:00
|
|
|
|
return( year * 365L + (year / 4) - (year / 100) + (year / 400) );
|
1998-09-27 18:32:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2011-01-24 02:50:39 +00:00
|
|
|
|
static glong
|
2005-12-06 17:07:55 +00:00
|
|
|
|
calc_days(guint year, guint mm, guint dd)
|
1998-09-27 18:32:00 +00:00
|
|
|
|
{
|
2005-12-06 17:07:55 +00:00
|
|
|
|
gboolean lp;
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
1998-10-01 13:24:42 +00:00
|
|
|
|
if (year < 1) return(0L);
|
2005-12-06 17:07:55 +00:00
|
|
|
|
if ((mm < 1) || (mm > 12)) return(0L);
|
|
|
|
|
if ((dd < 1) || (dd > month_length[(lp = leap(year))][mm])) return(0L);
|
1998-10-01 13:24:42 +00:00
|
|
|
|
return( year_to_days(--year) + days_in_months[lp][mm] + dd );
|
1998-09-27 18:32:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-01-24 02:50:39 +00:00
|
|
|
|
static gboolean
|
2005-12-06 17:07:55 +00:00
|
|
|
|
week_of_year(guint *week, guint *year, guint mm, guint dd)
|
1998-09-27 18:32:00 +00:00
|
|
|
|
{
|
1998-10-01 13:24:42 +00:00
|
|
|
|
if (check_date(*year,mm,dd))
|
|
|
|
|
{
|
|
|
|
|
*week = week_number(*year,mm,dd);
|
2011-01-24 02:50:39 +00:00
|
|
|
|
if (*week == 0)
|
|
|
|
|
*week = weeks_in_year(--(*year));
|
1998-10-01 13:24:42 +00:00
|
|
|
|
else if (*week > weeks_in_year(*year))
|
2011-01-24 02:50:39 +00:00
|
|
|
|
{
|
|
|
|
|
*week = 1;
|
|
|
|
|
(*year)++;
|
|
|
|
|
}
|
2005-12-06 17:07:55 +00:00
|
|
|
|
return TRUE;
|
1998-10-01 13:24:42 +00:00
|
|
|
|
}
|
2005-12-06 17:07:55 +00:00
|
|
|
|
return FALSE;
|
1998-09-27 18:32:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-01-24 02:50:39 +00:00
|
|
|
|
static glong
|
2005-12-06 17:07:55 +00:00
|
|
|
|
dates_difference(guint year1, guint mm1, guint dd1,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
guint year2, guint mm2, guint dd2)
|
1998-09-27 18:32:00 +00:00
|
|
|
|
{
|
1998-10-01 13:24:42 +00:00
|
|
|
|
return( calc_days(year2, mm2, dd2) - calc_days(year1, mm1, dd1) );
|
1998-09-27 18:32:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-09-07 18:07:59 +00:00
|
|
|
|
/*** END OF lib_date routines ********************************************/
|
1998-09-27 18:32:00 +00:00
|
|
|
|
|
2002-02-14 05:05:45 +00:00
|
|
|
|
/* Spacing around day/week headers and main area, inside those windows */
|
2011-01-24 02:50:39 +00:00
|
|
|
|
#define CALENDAR_MARGIN 0
|
1998-09-27 18:32:00 +00:00
|
|
|
|
|
2011-01-24 02:50:39 +00:00
|
|
|
|
#define DAY_XSEP 0 /* not really good for small calendar */
|
|
|
|
|
#define DAY_YSEP 0 /* not really good for small calendar */
|
1998-09-27 18:32:00 +00:00
|
|
|
|
|
2006-07-17 12:55:12 +00:00
|
|
|
|
#define SCROLL_DELAY_FACTOR 5
|
|
|
|
|
|
1998-09-27 18:32:00 +00:00
|
|
|
|
enum {
|
|
|
|
|
ARROW_YEAR_LEFT,
|
|
|
|
|
ARROW_YEAR_RIGHT,
|
|
|
|
|
ARROW_MONTH_LEFT,
|
|
|
|
|
ARROW_MONTH_RIGHT
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum {
|
|
|
|
|
MONTH_PREV,
|
|
|
|
|
MONTH_CURRENT,
|
|
|
|
|
MONTH_NEXT
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum {
|
|
|
|
|
MONTH_CHANGED_SIGNAL,
|
|
|
|
|
DAY_SELECTED_SIGNAL,
|
|
|
|
|
DAY_SELECTED_DOUBLE_CLICK_SIGNAL,
|
|
|
|
|
PREV_MONTH_SIGNAL,
|
|
|
|
|
NEXT_MONTH_SIGNAL,
|
|
|
|
|
PREV_YEAR_SIGNAL,
|
|
|
|
|
NEXT_YEAR_SIGNAL,
|
|
|
|
|
LAST_SIGNAL
|
|
|
|
|
};
|
|
|
|
|
|
2003-05-08 00:25:51 +00:00
|
|
|
|
enum
|
|
|
|
|
{
|
|
|
|
|
PROP_0,
|
|
|
|
|
PROP_YEAR,
|
|
|
|
|
PROP_MONTH,
|
|
|
|
|
PROP_DAY,
|
|
|
|
|
PROP_SHOW_HEADING,
|
|
|
|
|
PROP_SHOW_DAY_NAMES,
|
|
|
|
|
PROP_NO_MONTH_CHANGE,
|
|
|
|
|
PROP_SHOW_WEEK_NUMBERS,
|
2007-12-28 09:39:34 +00:00
|
|
|
|
PROP_SHOW_DETAILS,
|
2007-12-27 20:41:08 +00:00
|
|
|
|
PROP_DETAIL_WIDTH_CHARS,
|
2008-05-21 11:30:06 +00:00
|
|
|
|
PROP_DETAIL_HEIGHT_ROWS
|
2003-05-08 00:25:51 +00:00
|
|
|
|
};
|
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
static guint gtk_calendar_signals[LAST_SIGNAL] = { 0 };
|
1998-10-04 23:07:04 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
struct _GtkCalendarPrivate
|
1998-10-04 23:07:04 +00:00
|
|
|
|
{
|
2010-08-12 15:14:51 +00:00
|
|
|
|
GtkCalendarDisplayOptions display_flags;
|
|
|
|
|
|
1998-10-04 23:07:04 +00:00
|
|
|
|
GdkWindow *main_win;
|
|
|
|
|
GdkWindow *arrow_win[4];
|
|
|
|
|
|
2010-08-12 15:14:51 +00:00
|
|
|
|
gchar grow_space [32];
|
|
|
|
|
|
|
|
|
|
gint month;
|
|
|
|
|
gint year;
|
|
|
|
|
gint selected_day;
|
|
|
|
|
|
|
|
|
|
gint day_month[6][7];
|
|
|
|
|
gint day[6][7];
|
|
|
|
|
|
|
|
|
|
gint num_marked_dates;
|
|
|
|
|
gint marked_date[31];
|
|
|
|
|
|
|
|
|
|
gint focus_row;
|
|
|
|
|
gint focus_col;
|
|
|
|
|
|
1998-11-28 01:56:09 +00:00
|
|
|
|
guint header_h;
|
|
|
|
|
guint day_name_h;
|
|
|
|
|
guint main_h;
|
1998-10-04 23:07:04 +00:00
|
|
|
|
|
2011-12-15 01:44:46 +00:00
|
|
|
|
guint arrow_prelight : 4;
|
2011-01-24 02:50:39 +00:00
|
|
|
|
guint arrow_width;
|
|
|
|
|
guint max_month_width;
|
|
|
|
|
guint max_year_width;
|
2010-08-12 15:14:51 +00:00
|
|
|
|
|
1998-10-04 23:07:04 +00:00
|
|
|
|
guint day_width;
|
|
|
|
|
guint week_width;
|
|
|
|
|
|
|
|
|
|
guint min_day_width;
|
|
|
|
|
guint max_day_char_width;
|
|
|
|
|
guint max_day_char_ascent;
|
|
|
|
|
guint max_day_char_descent;
|
|
|
|
|
guint max_label_char_ascent;
|
|
|
|
|
guint max_label_char_descent;
|
|
|
|
|
guint max_week_char_width;
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
1998-10-04 23:07:04 +00:00
|
|
|
|
/* flags */
|
2003-08-08 22:17:34 +00:00
|
|
|
|
guint year_before : 1;
|
|
|
|
|
|
2003-05-20 22:37:57 +00:00
|
|
|
|
guint need_timer : 1;
|
|
|
|
|
|
2003-08-08 23:01:17 +00:00
|
|
|
|
guint in_drag : 1;
|
|
|
|
|
guint drag_highlight : 1;
|
|
|
|
|
|
2003-05-20 22:37:57 +00:00
|
|
|
|
guint32 timer;
|
|
|
|
|
gint click_child;
|
2003-08-08 22:44:14 +00:00
|
|
|
|
|
|
|
|
|
gint week_start;
|
2003-08-08 23:01:17 +00:00
|
|
|
|
|
|
|
|
|
gint drag_start_x;
|
|
|
|
|
gint drag_start_y;
|
2007-12-27 20:41:08 +00:00
|
|
|
|
|
|
|
|
|
/* Optional callback, used to display extra information for each day. */
|
|
|
|
|
GtkCalendarDetailFunc detail_func;
|
|
|
|
|
gpointer detail_func_user_data;
|
|
|
|
|
GDestroyNotify detail_func_destroy;
|
|
|
|
|
|
|
|
|
|
/* Size requistion for details provided by the hook. */
|
|
|
|
|
gint detail_height_rows;
|
|
|
|
|
gint detail_width_chars;
|
2007-12-28 09:36:06 +00:00
|
|
|
|
gint detail_overflow[6];
|
1998-10-04 23:07:04 +00:00
|
|
|
|
};
|
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
#define GTK_CALENDAR_GET_PRIVATE(widget) (GTK_CALENDAR (widget)->priv)
|
|
|
|
|
|
|
|
|
|
static void gtk_calendar_finalize (GObject *calendar);
|
2010-09-18 23:55:42 +00:00
|
|
|
|
static void gtk_calendar_destroy (GtkWidget *widget);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
static void gtk_calendar_set_property (GObject *object,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
guint prop_id,
|
|
|
|
|
const GValue *value,
|
|
|
|
|
GParamSpec *pspec);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
static void gtk_calendar_get_property (GObject *object,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
guint prop_id,
|
|
|
|
|
GValue *value,
|
|
|
|
|
GParamSpec *pspec);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
|
|
|
|
|
static void gtk_calendar_realize (GtkWidget *widget);
|
|
|
|
|
static void gtk_calendar_unrealize (GtkWidget *widget);
|
2010-12-20 22:07:20 +00:00
|
|
|
|
static void gtk_calendar_map (GtkWidget *widget);
|
|
|
|
|
static void gtk_calendar_unmap (GtkWidget *widget);
|
2010-10-27 01:06:40 +00:00
|
|
|
|
static void gtk_calendar_get_preferred_width (GtkWidget *widget,
|
|
|
|
|
gint *minimum,
|
|
|
|
|
gint *natural);
|
|
|
|
|
static void gtk_calendar_get_preferred_height (GtkWidget *widget,
|
|
|
|
|
gint *minimum,
|
|
|
|
|
gint *natural);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
static void gtk_calendar_size_allocate (GtkWidget *widget,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
GtkAllocation *allocation);
|
2010-09-04 17:16:26 +00:00
|
|
|
|
static gboolean gtk_calendar_draw (GtkWidget *widget,
|
|
|
|
|
cairo_t *cr);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
static gboolean gtk_calendar_button_press (GtkWidget *widget,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
GdkEventButton *event);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
static gboolean gtk_calendar_button_release (GtkWidget *widget,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
GdkEventButton *event);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
static gboolean gtk_calendar_motion_notify (GtkWidget *widget,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
GdkEventMotion *event);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
static gboolean gtk_calendar_enter_notify (GtkWidget *widget,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
GdkEventCrossing *event);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
static gboolean gtk_calendar_leave_notify (GtkWidget *widget,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
GdkEventCrossing *event);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
static gboolean gtk_calendar_scroll (GtkWidget *widget,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
GdkEventScroll *event);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
static gboolean gtk_calendar_key_press (GtkWidget *widget,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
GdkEventKey *event);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
static gboolean gtk_calendar_focus_out (GtkWidget *widget,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
GdkEventFocus *event);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
static void gtk_calendar_grab_notify (GtkWidget *widget,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
gboolean was_grabbed);
|
2011-01-10 19:40:37 +00:00
|
|
|
|
static void gtk_calendar_state_flags_changed (GtkWidget *widget,
|
|
|
|
|
GtkStateFlags previous_state);
|
2007-12-28 09:36:06 +00:00
|
|
|
|
static gboolean gtk_calendar_query_tooltip (GtkWidget *widget,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
gint x,
|
|
|
|
|
gint y,
|
|
|
|
|
gboolean keyboard_mode,
|
|
|
|
|
GtkTooltip *tooltip);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
|
|
|
|
|
static void gtk_calendar_drag_data_get (GtkWidget *widget,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
GdkDragContext *context,
|
|
|
|
|
GtkSelectionData *selection_data,
|
|
|
|
|
guint info,
|
|
|
|
|
guint time);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
static void gtk_calendar_drag_data_received (GtkWidget *widget,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
GdkDragContext *context,
|
|
|
|
|
gint x,
|
|
|
|
|
gint y,
|
|
|
|
|
GtkSelectionData *selection_data,
|
|
|
|
|
guint info,
|
|
|
|
|
guint time);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
static gboolean gtk_calendar_drag_motion (GtkWidget *widget,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
GdkDragContext *context,
|
|
|
|
|
gint x,
|
|
|
|
|
gint y,
|
|
|
|
|
guint time);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
static void gtk_calendar_drag_leave (GtkWidget *widget,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
GdkDragContext *context,
|
|
|
|
|
guint time);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
static gboolean gtk_calendar_drag_drop (GtkWidget *widget,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
GdkDragContext *context,
|
|
|
|
|
gint x,
|
|
|
|
|
gint y,
|
|
|
|
|
guint time);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
|
2011-06-27 01:44:42 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
static void calendar_start_spinning (GtkCalendar *calendar,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
gint click_child);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
static void calendar_stop_spinning (GtkCalendar *calendar);
|
|
|
|
|
|
|
|
|
|
static void calendar_invalidate_day (GtkCalendar *widget,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
gint row,
|
|
|
|
|
gint col);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
static void calendar_invalidate_day_num (GtkCalendar *widget,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
gint day);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
static void calendar_invalidate_arrow (GtkCalendar *widget,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
guint arrow);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
|
|
|
|
|
static void calendar_compute_days (GtkCalendar *calendar);
|
2010-08-03 15:45:14 +00:00
|
|
|
|
static gint calendar_get_xsep (GtkCalendar *calendar);
|
|
|
|
|
static gint calendar_get_ysep (GtkCalendar *calendar);
|
2010-10-24 05:22:13 +00:00
|
|
|
|
static gint calendar_get_inner_border (GtkCalendar *calendar);
|
2010-08-03 15:45:14 +00:00
|
|
|
|
|
1998-09-27 18:32:00 +00:00
|
|
|
|
static char *default_abbreviated_dayname[7];
|
|
|
|
|
static char *default_monthname[12];
|
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
G_DEFINE_TYPE (GtkCalendar, gtk_calendar, GTK_TYPE_WIDGET)
|
1998-09-27 18:32:00 +00:00
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gtk_calendar_class_init (GtkCalendarClass *class)
|
|
|
|
|
{
|
2002-02-10 14:33:06 +00:00
|
|
|
|
GObjectClass *gobject_class;
|
1998-09-27 18:32:00 +00:00
|
|
|
|
GtkWidgetClass *widget_class;
|
2002-02-10 14:33:06 +00:00
|
|
|
|
|
|
|
|
|
gobject_class = (GObjectClass*) class;
|
1998-09-27 18:32:00 +00:00
|
|
|
|
widget_class = (GtkWidgetClass*) class;
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
2003-05-08 00:25:51 +00:00
|
|
|
|
gobject_class->set_property = gtk_calendar_set_property;
|
|
|
|
|
gobject_class->get_property = gtk_calendar_get_property;
|
2002-02-10 14:33:06 +00:00
|
|
|
|
gobject_class->finalize = gtk_calendar_finalize;
|
doh, this was broken beyond believe.
Tue Dec 12 23:46:44 2000 Tim Janik <timj@gtk.org>
* gtk/stock-icons/Makefile.am: doh, this was broken beyond believe.
* gtk/gtkbox.c: change property types from (u)long to (u)int for
::position and ::padding.
* gtk/gtkcontainer.c: make ::border_width an INT property.
* gtk/gtkpacker.c: make ::position an INT property.
* gtk/gtkscrolledwindow.c (gtk_scrolled_window_adjustment_changed):
guard against NULL h/v scrollbars, since this is used at construction
time.
* gtk/gtkclist.[hc]: nuked gtk_clist_construct(), implemented
internal gtk_clist_constructor().
* gtk/gtkctree.[hc]: nuked gtk_ctree_construct(), implemented
gtk_ctree_constructor().
* gtk/gtkprogressbar.c (gtk_progress_bar_class_init): property
::pulse_step should use ARG_PULSE_STEP, not ARG_FRACTION.
* docs/reference/Makefile.am: fun stuff, disabled docs generation
again, gtk-scan.c needs to introspec paramspecs, not GtkAgs.
* gtk/gtkwidget.[hc]:
removed gtk_widget_setv(), gtk_widget_getv(), gtk_widget_newv()
and gtk_widget_get().
(gtk_widget_new): use g_object_new_valist().
(gtk_widget_set): use g_object_set_valist().
* gtk/gtkobject.[hc]:
removed gtk_object_arg_get_info(), gtk_object_getv(),
gtk_object_query_args(), gtk_object_newv(),
gtk_object_class_add_signals(),
gtk_object_class_user_signal_new(),
gtk_object_class_user_signal_newv(),
gtk_object_arg_set(), gtk_object_arg_get(),
gtk_object_args_collect(),
gtk_object_default_construct(),
gtk_object_constructed(),
GTK_CONSTRUCTED and GTK_OBJECT_CONSTRUCTED().
removed nsignals, signals and n_args members from GtkObjectClass.
(gtk_object_new): use g_object_new_valist().
(gtk_object_set): use g_object_set_valist().
(gtk_object_get): use g_object_get_valist().
* gtk/gtkcompat.h: define gtk_object_default_construct().
* gtk/gtktypeutils.c (gtk_type_new): create constructed objects via
g_object_new().
* gtk/*.c: removed gtk_object_class_add_signals() from class_init()
fucntions, cleaned up method assignments (make sure your structures
are setup properly before calling out). removed all GTK_CONSTRUCTED
hacks ;)
2000-12-13 01:34:41 +00:00
|
|
|
|
|
2010-09-18 23:55:42 +00:00
|
|
|
|
widget_class->destroy = gtk_calendar_destroy;
|
1998-09-27 18:32:00 +00:00
|
|
|
|
widget_class->realize = gtk_calendar_realize;
|
|
|
|
|
widget_class->unrealize = gtk_calendar_unrealize;
|
2010-12-20 22:07:20 +00:00
|
|
|
|
widget_class->map = gtk_calendar_map;
|
|
|
|
|
widget_class->unmap = gtk_calendar_unmap;
|
2010-09-04 17:16:26 +00:00
|
|
|
|
widget_class->draw = gtk_calendar_draw;
|
2010-10-27 01:06:40 +00:00
|
|
|
|
widget_class->get_preferred_width = gtk_calendar_get_preferred_width;
|
|
|
|
|
widget_class->get_preferred_height = gtk_calendar_get_preferred_height;
|
1998-09-27 18:32:00 +00:00
|
|
|
|
widget_class->size_allocate = gtk_calendar_size_allocate;
|
|
|
|
|
widget_class->button_press_event = gtk_calendar_button_press;
|
2003-05-20 22:37:57 +00:00
|
|
|
|
widget_class->button_release_event = gtk_calendar_button_release;
|
1998-09-27 18:32:00 +00:00
|
|
|
|
widget_class->motion_notify_event = gtk_calendar_motion_notify;
|
|
|
|
|
widget_class->enter_notify_event = gtk_calendar_enter_notify;
|
|
|
|
|
widget_class->leave_notify_event = gtk_calendar_leave_notify;
|
|
|
|
|
widget_class->key_press_event = gtk_calendar_key_press;
|
2003-08-08 22:03:25 +00:00
|
|
|
|
widget_class->scroll_event = gtk_calendar_scroll;
|
2011-01-10 19:40:37 +00:00
|
|
|
|
widget_class->state_flags_changed = gtk_calendar_state_flags_changed;
|
2003-05-20 22:37:57 +00:00
|
|
|
|
widget_class->grab_notify = gtk_calendar_grab_notify;
|
2004-06-10 04:09:33 +00:00
|
|
|
|
widget_class->focus_out_event = gtk_calendar_focus_out;
|
2007-12-28 09:36:06 +00:00
|
|
|
|
widget_class->query_tooltip = gtk_calendar_query_tooltip;
|
2003-08-08 23:01:17 +00:00
|
|
|
|
|
|
|
|
|
widget_class->drag_data_get = gtk_calendar_drag_data_get;
|
|
|
|
|
widget_class->drag_motion = gtk_calendar_drag_motion;
|
|
|
|
|
widget_class->drag_leave = gtk_calendar_drag_leave;
|
|
|
|
|
widget_class->drag_drop = gtk_calendar_drag_drop;
|
|
|
|
|
widget_class->drag_data_received = gtk_calendar_drag_data_received;
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
2011-07-18 12:22:03 +00:00
|
|
|
|
gtk_widget_class_set_accessible_role (widget_class, ATK_ROLE_CALENDAR);
|
2011-06-27 01:44:42 +00:00
|
|
|
|
|
2007-12-28 19:36:16 +00:00
|
|
|
|
/**
|
|
|
|
|
* GtkCalendar:year:
|
|
|
|
|
*
|
2011-01-24 02:50:39 +00:00
|
|
|
|
* The selected year.
|
2007-12-28 19:36:16 +00:00
|
|
|
|
* This property gets initially set to the current year.
|
2011-01-24 02:50:39 +00:00
|
|
|
|
*/
|
2003-05-08 00:25:51 +00:00
|
|
|
|
g_object_class_install_property (gobject_class,
|
|
|
|
|
PROP_YEAR,
|
|
|
|
|
g_param_spec_int ("year",
|
2011-01-24 02:50:39 +00:00
|
|
|
|
P_("Year"),
|
|
|
|
|
P_("The selected year"),
|
|
|
|
|
0, G_MAXINT >> 9, 0,
|
|
|
|
|
GTK_PARAM_READWRITE));
|
2007-12-28 19:36:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GtkCalendar:month:
|
|
|
|
|
*
|
2011-01-24 02:50:39 +00:00
|
|
|
|
* The selected month (as a number between 0 and 11).
|
2007-12-28 19:36:16 +00:00
|
|
|
|
* This property gets initially set to the current month.
|
|
|
|
|
*/
|
2003-05-08 00:25:51 +00:00
|
|
|
|
g_object_class_install_property (gobject_class,
|
|
|
|
|
PROP_MONTH,
|
|
|
|
|
g_param_spec_int ("month",
|
2011-01-24 02:50:39 +00:00
|
|
|
|
P_("Month"),
|
|
|
|
|
P_("The selected month (as a number between 0 and 11)"),
|
|
|
|
|
0, 11, 0,
|
|
|
|
|
GTK_PARAM_READWRITE));
|
2007-12-28 19:36:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GtkCalendar:day:
|
|
|
|
|
*
|
2011-01-24 02:50:39 +00:00
|
|
|
|
* The selected day (as a number between 1 and 31, or 0
|
2007-12-28 19:36:16 +00:00
|
|
|
|
* to unselect the currently selected day).
|
|
|
|
|
* This property gets initially set to the current day.
|
|
|
|
|
*/
|
2003-05-08 00:25:51 +00:00
|
|
|
|
g_object_class_install_property (gobject_class,
|
|
|
|
|
PROP_DAY,
|
|
|
|
|
g_param_spec_int ("day",
|
2011-01-24 02:50:39 +00:00
|
|
|
|
P_("Day"),
|
|
|
|
|
P_("The selected day (as a number between 1 and 31, or 0 to unselect the currently selected day)"),
|
|
|
|
|
0, 31, 0,
|
|
|
|
|
GTK_PARAM_READWRITE));
|
2003-06-14 22:27:14 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GtkCalendar:show-heading:
|
|
|
|
|
*
|
|
|
|
|
* Determines whether a heading is displayed.
|
|
|
|
|
*
|
|
|
|
|
* Since: 2.4
|
|
|
|
|
*/
|
2003-05-08 00:25:51 +00:00
|
|
|
|
g_object_class_install_property (gobject_class,
|
|
|
|
|
PROP_SHOW_HEADING,
|
2005-03-09 06:15:13 +00:00
|
|
|
|
g_param_spec_boolean ("show-heading",
|
2011-01-24 02:50:39 +00:00
|
|
|
|
P_("Show Heading"),
|
|
|
|
|
P_("If TRUE, a heading is displayed"),
|
|
|
|
|
TRUE,
|
|
|
|
|
GTK_PARAM_READWRITE));
|
2003-06-14 22:27:14 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GtkCalendar:show-day-names:
|
|
|
|
|
*
|
|
|
|
|
* Determines whether day names are displayed.
|
|
|
|
|
*
|
|
|
|
|
* Since: 2.4
|
|
|
|
|
*/
|
2003-05-08 00:25:51 +00:00
|
|
|
|
g_object_class_install_property (gobject_class,
|
|
|
|
|
PROP_SHOW_DAY_NAMES,
|
2005-03-09 06:15:13 +00:00
|
|
|
|
g_param_spec_boolean ("show-day-names",
|
2011-01-24 02:50:39 +00:00
|
|
|
|
P_("Show Day Names"),
|
|
|
|
|
P_("If TRUE, day names are displayed"),
|
|
|
|
|
TRUE,
|
|
|
|
|
GTK_PARAM_READWRITE));
|
2003-06-14 22:27:14 +00:00
|
|
|
|
/**
|
|
|
|
|
* GtkCalendar:no-month-change:
|
|
|
|
|
*
|
|
|
|
|
* Determines whether the selected month can be changed.
|
|
|
|
|
*
|
|
|
|
|
* Since: 2.4
|
|
|
|
|
*/
|
2003-05-08 00:25:51 +00:00
|
|
|
|
g_object_class_install_property (gobject_class,
|
|
|
|
|
PROP_NO_MONTH_CHANGE,
|
2005-03-09 06:15:13 +00:00
|
|
|
|
g_param_spec_boolean ("no-month-change",
|
2011-01-24 02:50:39 +00:00
|
|
|
|
P_("No Month Change"),
|
|
|
|
|
P_("If TRUE, the selected month cannot be changed"),
|
|
|
|
|
FALSE,
|
|
|
|
|
GTK_PARAM_READWRITE));
|
2003-06-14 22:27:14 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GtkCalendar:show-week-numbers:
|
|
|
|
|
*
|
|
|
|
|
* Determines whether week numbers are displayed.
|
|
|
|
|
*
|
|
|
|
|
* Since: 2.4
|
|
|
|
|
*/
|
2003-05-08 00:25:51 +00:00
|
|
|
|
g_object_class_install_property (gobject_class,
|
|
|
|
|
PROP_SHOW_WEEK_NUMBERS,
|
2005-03-09 06:15:13 +00:00
|
|
|
|
g_param_spec_boolean ("show-week-numbers",
|
2011-01-24 02:50:39 +00:00
|
|
|
|
P_("Show Week Numbers"),
|
|
|
|
|
P_("If TRUE, week numbers are displayed"),
|
|
|
|
|
FALSE,
|
|
|
|
|
GTK_PARAM_READWRITE));
|
2003-06-14 22:27:14 +00:00
|
|
|
|
|
2007-12-27 20:41:08 +00:00
|
|
|
|
/**
|
|
|
|
|
* GtkCalendar:detail-width-chars:
|
|
|
|
|
*
|
|
|
|
|
* Width of a detail cell, in characters.
|
|
|
|
|
* A value of 0 allows any width. See gtk_calendar_set_detail_func().
|
|
|
|
|
*
|
2008-02-15 23:42:42 +00:00
|
|
|
|
* Since: 2.14
|
2007-12-27 20:41:08 +00:00
|
|
|
|
*/
|
|
|
|
|
g_object_class_install_property (gobject_class,
|
|
|
|
|
PROP_DETAIL_WIDTH_CHARS,
|
|
|
|
|
g_param_spec_int ("detail-width-chars",
|
2011-01-24 02:50:39 +00:00
|
|
|
|
P_("Details Width"),
|
|
|
|
|
P_("Details width in characters"),
|
|
|
|
|
0, 127, 0,
|
|
|
|
|
GTK_PARAM_READWRITE));
|
2007-12-27 20:41:08 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GtkCalendar:detail-height-rows:
|
|
|
|
|
*
|
|
|
|
|
* Height of a detail cell, in rows.
|
|
|
|
|
* A value of 0 allows any width. See gtk_calendar_set_detail_func().
|
|
|
|
|
*
|
2008-02-15 23:42:42 +00:00
|
|
|
|
* Since: 2.14
|
2007-12-27 20:41:08 +00:00
|
|
|
|
*/
|
|
|
|
|
g_object_class_install_property (gobject_class,
|
|
|
|
|
PROP_DETAIL_HEIGHT_ROWS,
|
|
|
|
|
g_param_spec_int ("detail-height-rows",
|
2011-01-24 02:50:39 +00:00
|
|
|
|
P_("Details Height"),
|
|
|
|
|
P_("Details height in rows"),
|
|
|
|
|
0, 127, 0,
|
|
|
|
|
GTK_PARAM_READWRITE));
|
2007-12-27 20:41:08 +00:00
|
|
|
|
|
2007-12-28 09:39:34 +00:00
|
|
|
|
/**
|
|
|
|
|
* GtkCalendar:show-details:
|
|
|
|
|
*
|
|
|
|
|
* Determines whether details are shown directly in the widget, or if they are
|
|
|
|
|
* available only as tooltip. When this property is set days with details are
|
|
|
|
|
* marked.
|
|
|
|
|
*
|
2008-02-15 23:42:42 +00:00
|
|
|
|
* Since: 2.14
|
2007-12-28 09:39:34 +00:00
|
|
|
|
*/
|
|
|
|
|
g_object_class_install_property (gobject_class,
|
|
|
|
|
PROP_SHOW_DETAILS,
|
|
|
|
|
g_param_spec_boolean ("show-details",
|
2011-01-24 02:50:39 +00:00
|
|
|
|
P_("Show Details"),
|
|
|
|
|
P_("If TRUE, details are shown"),
|
|
|
|
|
TRUE,
|
|
|
|
|
GTK_PARAM_READWRITE));
|
2007-12-28 09:39:34 +00:00
|
|
|
|
|
2010-08-03 15:45:14 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GtkCalendar:inner-border
|
|
|
|
|
*
|
|
|
|
|
* The spacing around the day/week headers and main area.
|
|
|
|
|
*/
|
|
|
|
|
gtk_widget_class_install_style_property (widget_class,
|
|
|
|
|
g_param_spec_int ("inner-border",
|
|
|
|
|
P_("Inner border"),
|
|
|
|
|
P_("Inner border space"),
|
|
|
|
|
0, G_MAXINT, 4,
|
|
|
|
|
GTK_PARAM_READABLE));
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GtkCalndar:vertical-separation
|
|
|
|
|
*
|
|
|
|
|
* Separation between day headers and main area.
|
|
|
|
|
*/
|
|
|
|
|
gtk_widget_class_install_style_property (widget_class,
|
|
|
|
|
g_param_spec_int ("vertical-separation",
|
|
|
|
|
P_("Vertical separation"),
|
|
|
|
|
P_("Space between day headers and main area"),
|
|
|
|
|
0, G_MAXINT, 4,
|
|
|
|
|
GTK_PARAM_READABLE));
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GtkCalendar:horizontal-separation
|
|
|
|
|
*
|
|
|
|
|
* Separation between week headers and main area.
|
|
|
|
|
*/
|
|
|
|
|
gtk_widget_class_install_style_property (widget_class,
|
|
|
|
|
g_param_spec_int ("horizontal-separation",
|
|
|
|
|
P_("Horizontal separation"),
|
|
|
|
|
P_("Space between week headers and main area"),
|
|
|
|
|
0, G_MAXINT, 4,
|
|
|
|
|
GTK_PARAM_READABLE));
|
|
|
|
|
|
2010-07-06 20:06:34 +00:00
|
|
|
|
/**
|
|
|
|
|
* GtkCalendar::month-changed:
|
|
|
|
|
* @calendar: the object which received the signal.
|
|
|
|
|
*
|
|
|
|
|
* Emitted when the user clicks a button to change the selected month on a
|
|
|
|
|
* calendar.
|
|
|
|
|
*/
|
1998-09-27 18:32:00 +00:00
|
|
|
|
gtk_calendar_signals[MONTH_CHANGED_SIGNAL] =
|
2008-08-11 13:07:18 +00:00
|
|
|
|
g_signal_new (I_("month-changed"),
|
2011-01-24 02:50:39 +00:00
|
|
|
|
G_OBJECT_CLASS_TYPE (gobject_class),
|
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
|
G_STRUCT_OFFSET (GtkCalendarClass, month_changed),
|
|
|
|
|
NULL, NULL,
|
|
|
|
|
_gtk_marshal_VOID__VOID,
|
|
|
|
|
G_TYPE_NONE, 0);
|
2010-07-06 20:06:34 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GtkCalendar::day-selected:
|
|
|
|
|
* @calendar: the object which received the signal.
|
|
|
|
|
*
|
|
|
|
|
* Emitted when the user selects a day.
|
|
|
|
|
*/
|
1998-09-27 18:32:00 +00:00
|
|
|
|
gtk_calendar_signals[DAY_SELECTED_SIGNAL] =
|
2008-08-11 13:07:18 +00:00
|
|
|
|
g_signal_new (I_("day-selected"),
|
2011-01-24 02:50:39 +00:00
|
|
|
|
G_OBJECT_CLASS_TYPE (gobject_class),
|
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
|
G_STRUCT_OFFSET (GtkCalendarClass, day_selected),
|
|
|
|
|
NULL, NULL,
|
|
|
|
|
_gtk_marshal_VOID__VOID,
|
|
|
|
|
G_TYPE_NONE, 0);
|
2010-07-06 20:06:34 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GtkCalendar::day-selected-double-click:
|
|
|
|
|
* @calendar: the object which received the signal.
|
|
|
|
|
*
|
|
|
|
|
* Emitted when the user double-clicks a day.
|
|
|
|
|
*/
|
1998-09-27 18:32:00 +00:00
|
|
|
|
gtk_calendar_signals[DAY_SELECTED_DOUBLE_CLICK_SIGNAL] =
|
2008-08-11 13:07:18 +00:00
|
|
|
|
g_signal_new (I_("day-selected-double-click"),
|
2011-01-24 02:50:39 +00:00
|
|
|
|
G_OBJECT_CLASS_TYPE (gobject_class),
|
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
|
G_STRUCT_OFFSET (GtkCalendarClass, day_selected_double_click),
|
|
|
|
|
NULL, NULL,
|
|
|
|
|
_gtk_marshal_VOID__VOID,
|
|
|
|
|
G_TYPE_NONE, 0);
|
2010-07-06 20:06:34 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GtkCalendar::prev-month:
|
|
|
|
|
* @calendar: the object which received the signal.
|
|
|
|
|
*
|
|
|
|
|
* Emitted when the user switched to the previous month.
|
|
|
|
|
*/
|
1998-09-27 18:32:00 +00:00
|
|
|
|
gtk_calendar_signals[PREV_MONTH_SIGNAL] =
|
2008-08-11 13:07:18 +00:00
|
|
|
|
g_signal_new (I_("prev-month"),
|
2011-01-24 02:50:39 +00:00
|
|
|
|
G_OBJECT_CLASS_TYPE (gobject_class),
|
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
|
G_STRUCT_OFFSET (GtkCalendarClass, prev_month),
|
|
|
|
|
NULL, NULL,
|
|
|
|
|
_gtk_marshal_VOID__VOID,
|
|
|
|
|
G_TYPE_NONE, 0);
|
2010-07-06 20:06:34 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GtkCalendar::next-month:
|
|
|
|
|
* @calendar: the object which received the signal.
|
|
|
|
|
*
|
|
|
|
|
* Emitted when the user switched to the next month.
|
|
|
|
|
*/
|
1998-09-27 18:32:00 +00:00
|
|
|
|
gtk_calendar_signals[NEXT_MONTH_SIGNAL] =
|
2008-08-11 13:07:18 +00:00
|
|
|
|
g_signal_new (I_("next-month"),
|
2011-01-24 02:50:39 +00:00
|
|
|
|
G_OBJECT_CLASS_TYPE (gobject_class),
|
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
|
G_STRUCT_OFFSET (GtkCalendarClass, next_month),
|
|
|
|
|
NULL, NULL,
|
|
|
|
|
_gtk_marshal_VOID__VOID,
|
|
|
|
|
G_TYPE_NONE, 0);
|
2010-07-06 20:06:34 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GtkCalendar::prev-year:
|
|
|
|
|
* @calendar: the object which received the signal.
|
|
|
|
|
*
|
|
|
|
|
* Emitted when user switched to the previous year.
|
|
|
|
|
*/
|
1998-09-27 18:32:00 +00:00
|
|
|
|
gtk_calendar_signals[PREV_YEAR_SIGNAL] =
|
2008-08-11 13:07:18 +00:00
|
|
|
|
g_signal_new (I_("prev-year"),
|
2011-01-24 02:50:39 +00:00
|
|
|
|
G_OBJECT_CLASS_TYPE (gobject_class),
|
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
|
G_STRUCT_OFFSET (GtkCalendarClass, prev_year),
|
|
|
|
|
NULL, NULL,
|
|
|
|
|
_gtk_marshal_VOID__VOID,
|
|
|
|
|
G_TYPE_NONE, 0);
|
2010-07-06 20:06:34 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GtkCalendar::next-year:
|
|
|
|
|
* @calendar: the object which received the signal.
|
|
|
|
|
*
|
|
|
|
|
* Emitted when user switched to the next year.
|
|
|
|
|
*/
|
1998-09-27 18:32:00 +00:00
|
|
|
|
gtk_calendar_signals[NEXT_YEAR_SIGNAL] =
|
2008-08-11 13:07:18 +00:00
|
|
|
|
g_signal_new (I_("next-year"),
|
2011-01-24 02:50:39 +00:00
|
|
|
|
G_OBJECT_CLASS_TYPE (gobject_class),
|
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
|
G_STRUCT_OFFSET (GtkCalendarClass, next_year),
|
|
|
|
|
NULL, NULL,
|
|
|
|
|
_gtk_marshal_VOID__VOID,
|
|
|
|
|
G_TYPE_NONE, 0);
|
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
g_type_class_add_private (gobject_class, sizeof (GtkCalendarPrivate));
|
1998-09-27 18:32:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gtk_calendar_init (GtkCalendar *calendar)
|
|
|
|
|
{
|
2005-05-11 19:16:19 +00:00
|
|
|
|
GtkWidget *widget = GTK_WIDGET (calendar);
|
1998-09-27 18:32:00 +00:00
|
|
|
|
time_t secs;
|
|
|
|
|
struct tm *tm;
|
|
|
|
|
gint i;
|
2005-11-28 01:51:08 +00:00
|
|
|
|
#ifdef G_OS_WIN32
|
|
|
|
|
wchar_t wbuffer[100];
|
|
|
|
|
#else
|
2006-10-07 21:32:53 +00:00
|
|
|
|
char buffer[255];
|
1998-09-27 18:32:00 +00:00
|
|
|
|
time_t tmp_time;
|
2005-11-28 01:51:08 +00:00
|
|
|
|
#endif
|
2005-05-11 19:16:19 +00:00
|
|
|
|
GtkCalendarPrivate *priv;
|
2003-08-08 22:17:34 +00:00
|
|
|
|
gchar *year_before;
|
2005-10-04 13:42:27 +00:00
|
|
|
|
#ifdef HAVE__NL_TIME_FIRST_WEEKDAY
|
2007-06-08 18:39:29 +00:00
|
|
|
|
union { unsigned int word; char *string; } langinfo;
|
2005-09-30 17:53:19 +00:00
|
|
|
|
gint week_1stday = 0;
|
|
|
|
|
gint first_weekday = 1;
|
2005-09-09 17:26:14 +00:00
|
|
|
|
guint week_origin;
|
2005-10-04 13:42:27 +00:00
|
|
|
|
#else
|
|
|
|
|
gchar *week_start;
|
|
|
|
|
#endif
|
2005-09-09 17:26:14 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
priv = calendar->priv = G_TYPE_INSTANCE_GET_PRIVATE (calendar,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
GTK_TYPE_CALENDAR,
|
|
|
|
|
GtkCalendarPrivate);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
|
2010-03-02 03:40:38 +00:00
|
|
|
|
gtk_widget_set_can_focus (widget, TRUE);
|
2010-10-24 05:22:13 +00:00
|
|
|
|
gtk_widget_set_has_window (widget, FALSE);
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
1998-09-27 18:32:00 +00:00
|
|
|
|
if (!default_abbreviated_dayname[0])
|
|
|
|
|
for (i=0; i<7; i++)
|
|
|
|
|
{
|
2005-11-28 01:51:08 +00:00
|
|
|
|
#ifndef G_OS_WIN32
|
2011-01-24 02:50:39 +00:00
|
|
|
|
tmp_time= (i+3)*86400;
|
|
|
|
|
strftime ( buffer, sizeof (buffer), "%a", gmtime (&tmp_time));
|
|
|
|
|
default_abbreviated_dayname[i] = g_locale_to_utf8 (buffer, -1, NULL, NULL, NULL);
|
2005-11-28 01:51:08 +00:00
|
|
|
|
#else
|
2011-01-24 02:50:39 +00:00
|
|
|
|
if (!GetLocaleInfoW (GetThreadLocale (), LOCALE_SABBREVDAYNAME1 + (i+6)%7,
|
|
|
|
|
wbuffer, G_N_ELEMENTS (wbuffer)))
|
|
|
|
|
default_abbreviated_dayname[i] = g_strdup_printf ("(%d)", i);
|
|
|
|
|
else
|
|
|
|
|
default_abbreviated_dayname[i] = g_utf16_to_utf8 (wbuffer, -1, NULL, NULL, NULL);
|
2005-11-28 01:51:08 +00:00
|
|
|
|
#endif
|
1998-09-27 18:32:00 +00:00
|
|
|
|
}
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
1998-09-27 18:32:00 +00:00
|
|
|
|
if (!default_monthname[0])
|
|
|
|
|
for (i=0; i<12; i++)
|
|
|
|
|
{
|
2005-11-28 01:51:08 +00:00
|
|
|
|
#ifndef G_OS_WIN32
|
2011-01-24 02:50:39 +00:00
|
|
|
|
tmp_time=i*2764800;
|
|
|
|
|
strftime ( buffer, sizeof (buffer), "%B", gmtime (&tmp_time));
|
|
|
|
|
default_monthname[i] = g_locale_to_utf8 (buffer, -1, NULL, NULL, NULL);
|
2005-11-28 01:51:08 +00:00
|
|
|
|
#else
|
2011-01-24 02:50:39 +00:00
|
|
|
|
if (!GetLocaleInfoW (GetThreadLocale (), LOCALE_SMONTHNAME1 + i,
|
|
|
|
|
wbuffer, G_N_ELEMENTS (wbuffer)))
|
|
|
|
|
default_monthname[i] = g_strdup_printf ("(%d)", i);
|
|
|
|
|
else
|
|
|
|
|
default_monthname[i] = g_utf16_to_utf8 (wbuffer, -1, NULL, NULL, NULL);
|
2005-11-28 01:51:08 +00:00
|
|
|
|
#endif
|
1998-09-27 18:32:00 +00:00
|
|
|
|
}
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
1998-09-27 18:32:00 +00:00
|
|
|
|
/* Set defaults */
|
|
|
|
|
secs = time (NULL);
|
|
|
|
|
tm = localtime (&secs);
|
2010-08-12 15:14:51 +00:00
|
|
|
|
priv->month = tm->tm_mon;
|
|
|
|
|
priv->year = 1900 + tm->tm_year;
|
2005-05-11 19:16:19 +00:00
|
|
|
|
|
1998-09-27 18:32:00 +00:00
|
|
|
|
for (i=0;i<31;i++)
|
2010-08-12 15:14:51 +00:00
|
|
|
|
priv->marked_date[i] = FALSE;
|
|
|
|
|
priv->num_marked_dates = 0;
|
|
|
|
|
priv->selected_day = tm->tm_mday;
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
2010-08-12 15:14:51 +00:00
|
|
|
|
priv->display_flags = (GTK_CALENDAR_SHOW_HEADING |
|
2011-01-24 02:50:39 +00:00
|
|
|
|
GTK_CALENDAR_SHOW_DAY_NAMES |
|
|
|
|
|
GTK_CALENDAR_SHOW_DETAILS);
|
|
|
|
|
|
2010-08-12 15:14:51 +00:00
|
|
|
|
priv->focus_row = -1;
|
|
|
|
|
priv->focus_col = -1;
|
1998-10-05 03:52:48 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
priv->max_year_width = 0;
|
|
|
|
|
priv->max_month_width = 0;
|
|
|
|
|
priv->max_day_char_width = 0;
|
|
|
|
|
priv->max_week_char_width = 0;
|
1998-10-04 23:07:04 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
priv->max_day_char_ascent = 0;
|
|
|
|
|
priv->max_day_char_descent = 0;
|
|
|
|
|
priv->max_label_char_ascent = 0;
|
|
|
|
|
priv->max_label_char_descent = 0;
|
1998-10-04 23:07:04 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
priv->arrow_width = 10;
|
1998-11-28 01:56:09 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
priv->need_timer = 0;
|
|
|
|
|
priv->timer = 0;
|
|
|
|
|
priv->click_child = -1;
|
2003-08-08 22:17:34 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
priv->in_drag = 0;
|
|
|
|
|
priv->drag_highlight = 0;
|
2003-08-08 23:01:17 +00:00
|
|
|
|
|
2004-07-21 16:53:55 +00:00
|
|
|
|
gtk_drag_dest_set (widget, 0, NULL, 0, GDK_ACTION_COPY);
|
|
|
|
|
gtk_drag_dest_add_text_targets (widget);
|
2003-08-08 23:01:17 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
priv->year_before = 0;
|
2003-08-08 22:17:34 +00:00
|
|
|
|
|
|
|
|
|
/* Translate to calendar:YM if you want years to be displayed
|
|
|
|
|
* before months; otherwise translate to calendar:MY.
|
|
|
|
|
* Do *not* translate it to anything else, if it
|
|
|
|
|
* it isn't calendar:YM or calendar:MY it will not work.
|
|
|
|
|
*
|
2009-07-07 15:37:07 +00:00
|
|
|
|
* Note that the ordering described here is logical order, which is
|
|
|
|
|
* further influenced by BIDI ordering. Thus, if you have a default
|
|
|
|
|
* text direction of RTL and specify "calendar:YM", then the year
|
|
|
|
|
* will appear to the right of the month.
|
2003-08-08 22:17:34 +00:00
|
|
|
|
*/
|
|
|
|
|
year_before = _("calendar:MY");
|
|
|
|
|
if (strcmp (year_before, "calendar:YM") == 0)
|
2005-05-11 19:16:19 +00:00
|
|
|
|
priv->year_before = 1;
|
2003-08-08 22:17:34 +00:00
|
|
|
|
else if (strcmp (year_before, "calendar:MY") != 0)
|
|
|
|
|
g_warning ("Whoever translated calendar:MY did so wrongly.\n");
|
2003-08-08 22:44:14 +00:00
|
|
|
|
|
2006-10-07 21:32:53 +00:00
|
|
|
|
#ifdef G_OS_WIN32
|
2006-10-10 21:51:11 +00:00
|
|
|
|
priv->week_start = 0;
|
|
|
|
|
week_start = NULL;
|
2006-10-07 21:32:53 +00:00
|
|
|
|
|
2006-10-10 21:51:11 +00:00
|
|
|
|
if (GetLocaleInfoW (GetThreadLocale (), LOCALE_IFIRSTDAYOFWEEK,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
wbuffer, G_N_ELEMENTS (wbuffer)))
|
2006-10-10 21:51:11 +00:00
|
|
|
|
week_start = g_utf16_to_utf8 (wbuffer, -1, NULL, NULL, NULL);
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
2006-10-10 21:51:11 +00:00
|
|
|
|
if (week_start != NULL)
|
2006-10-07 21:32:53 +00:00
|
|
|
|
{
|
2006-10-10 21:51:11 +00:00
|
|
|
|
priv->week_start = (week_start[0] - '0' + 1) % 7;
|
|
|
|
|
g_free(week_start);
|
|
|
|
|
}
|
|
|
|
|
#else
|
2005-01-14 13:43:54 +00:00
|
|
|
|
#ifdef HAVE__NL_TIME_FIRST_WEEKDAY
|
2007-06-08 18:39:29 +00:00
|
|
|
|
langinfo.string = nl_langinfo (_NL_TIME_FIRST_WEEKDAY);
|
|
|
|
|
first_weekday = langinfo.string[0];
|
|
|
|
|
langinfo.string = nl_langinfo (_NL_TIME_WEEK_1STDAY);
|
|
|
|
|
week_origin = langinfo.word;
|
2005-09-30 17:53:19 +00:00
|
|
|
|
if (week_origin == 19971130) /* Sunday */
|
|
|
|
|
week_1stday = 0;
|
|
|
|
|
else if (week_origin == 19971201) /* Monday */
|
|
|
|
|
week_1stday = 1;
|
2005-09-09 17:26:14 +00:00
|
|
|
|
else
|
|
|
|
|
g_warning ("Unknown value of _NL_TIME_WEEK_1STDAY.\n");
|
|
|
|
|
|
2005-09-30 17:53:19 +00:00
|
|
|
|
priv->week_start = (week_1stday + first_weekday - 1) % 7;
|
2005-01-13 19:37:54 +00:00
|
|
|
|
#else
|
2004-01-02 01:52:04 +00:00
|
|
|
|
/* Translate to calendar:week_start:0 if you want Sunday to be the
|
|
|
|
|
* first day of the week to calendar:week_start:1 if you want Monday
|
|
|
|
|
* to be the first day of the week, and so on.
|
2011-01-24 02:50:39 +00:00
|
|
|
|
*/
|
2004-01-02 01:52:04 +00:00
|
|
|
|
week_start = _("calendar:week_start:0");
|
|
|
|
|
|
|
|
|
|
if (strncmp (week_start, "calendar:week_start:", 20) == 0)
|
2005-05-11 19:16:19 +00:00
|
|
|
|
priv->week_start = *(week_start + 20) - '0';
|
2011-01-24 02:50:39 +00:00
|
|
|
|
else
|
2005-05-11 19:16:19 +00:00
|
|
|
|
priv->week_start = -1;
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
if (priv->week_start < 0 || priv->week_start > 6)
|
2004-01-02 01:52:04 +00:00
|
|
|
|
{
|
|
|
|
|
g_warning ("Whoever translated calendar:week_start:0 did so wrongly.\n");
|
2005-05-11 19:16:19 +00:00
|
|
|
|
priv->week_start = 0;
|
2004-01-02 01:52:04 +00:00
|
|
|
|
}
|
2005-01-13 19:37:54 +00:00
|
|
|
|
#endif
|
2006-10-07 21:32:53 +00:00
|
|
|
|
#endif
|
2005-10-04 03:28:36 +00:00
|
|
|
|
|
|
|
|
|
calendar_compute_days (calendar);
|
1998-09-27 18:32:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
|
|
|
|
|
/****************************************
|
|
|
|
|
* Utility Functions *
|
|
|
|
|
****************************************/
|
1998-09-27 18:32:00 +00:00
|
|
|
|
|
2007-12-28 09:26:38 +00:00
|
|
|
|
static void
|
|
|
|
|
calendar_queue_refresh (GtkCalendar *calendar)
|
|
|
|
|
{
|
|
|
|
|
GtkCalendarPrivate *priv = GTK_CALENDAR_GET_PRIVATE (calendar);
|
|
|
|
|
|
2007-12-28 09:39:34 +00:00
|
|
|
|
if (!(priv->detail_func) ||
|
2010-08-12 15:14:51 +00:00
|
|
|
|
!(priv->display_flags & GTK_CALENDAR_SHOW_DETAILS) ||
|
2007-12-28 09:39:34 +00:00
|
|
|
|
(priv->detail_width_chars && priv->detail_height_rows))
|
2007-12-28 09:26:38 +00:00
|
|
|
|
gtk_widget_queue_draw (GTK_WIDGET (calendar));
|
|
|
|
|
else
|
|
|
|
|
gtk_widget_queue_resize (GTK_WIDGET (calendar));
|
|
|
|
|
}
|
|
|
|
|
|
1998-09-27 18:32:00 +00:00
|
|
|
|
static void
|
2005-05-11 19:16:19 +00:00
|
|
|
|
calendar_set_month_next (GtkCalendar *calendar)
|
1998-09-27 18:32:00 +00:00
|
|
|
|
{
|
|
|
|
|
gint month_len;
|
2010-08-12 15:14:51 +00:00
|
|
|
|
GtkCalendarPrivate *priv = calendar->priv;
|
2008-02-07 15:50:39 +00:00
|
|
|
|
|
2010-08-12 15:14:51 +00:00
|
|
|
|
if (priv->display_flags & GTK_CALENDAR_NO_MONTH_CHANGE)
|
1998-09-27 18:32:00 +00:00
|
|
|
|
return;
|
2010-08-12 15:14:51 +00:00
|
|
|
|
|
|
|
|
|
if (priv->month == 11)
|
1998-09-27 18:32:00 +00:00
|
|
|
|
{
|
2010-08-12 15:14:51 +00:00
|
|
|
|
priv->month = 0;
|
|
|
|
|
priv->year++;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
priv->month++;
|
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
calendar_compute_days (calendar);
|
2002-10-09 22:11:08 +00:00
|
|
|
|
g_signal_emit (calendar,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
gtk_calendar_signals[NEXT_MONTH_SIGNAL],
|
|
|
|
|
0);
|
2002-10-09 22:11:08 +00:00
|
|
|
|
g_signal_emit (calendar,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
gtk_calendar_signals[MONTH_CHANGED_SIGNAL],
|
|
|
|
|
0);
|
2010-08-12 15:14:51 +00:00
|
|
|
|
|
|
|
|
|
month_len = month_length[leap (priv->year)][priv->month + 1];
|
|
|
|
|
|
|
|
|
|
if (month_len < priv->selected_day)
|
1998-09-27 18:32:00 +00:00
|
|
|
|
{
|
2010-08-12 15:14:51 +00:00
|
|
|
|
priv->selected_day = 0;
|
1998-09-27 18:32:00 +00:00
|
|
|
|
gtk_calendar_select_day (calendar, month_len);
|
|
|
|
|
}
|
|
|
|
|
else
|
2010-08-12 15:14:51 +00:00
|
|
|
|
gtk_calendar_select_day (calendar, priv->selected_day);
|
2001-12-03 15:24:25 +00:00
|
|
|
|
|
2007-12-28 09:26:38 +00:00
|
|
|
|
calendar_queue_refresh (calendar);
|
1998-09-27 18:32:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2005-05-11 19:16:19 +00:00
|
|
|
|
calendar_set_year_prev (GtkCalendar *calendar)
|
1998-09-27 18:32:00 +00:00
|
|
|
|
{
|
2010-08-12 15:14:51 +00:00
|
|
|
|
GtkCalendarPrivate *priv = calendar->priv;
|
1998-09-27 18:32:00 +00:00
|
|
|
|
gint month_len;
|
2008-02-07 15:50:39 +00:00
|
|
|
|
|
2010-08-12 15:14:51 +00:00
|
|
|
|
priv->year--;
|
2005-05-11 19:16:19 +00:00
|
|
|
|
calendar_compute_days (calendar);
|
2002-10-09 22:11:08 +00:00
|
|
|
|
g_signal_emit (calendar,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
gtk_calendar_signals[PREV_YEAR_SIGNAL],
|
|
|
|
|
0);
|
2002-10-09 22:11:08 +00:00
|
|
|
|
g_signal_emit (calendar,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
gtk_calendar_signals[MONTH_CHANGED_SIGNAL],
|
|
|
|
|
0);
|
2010-08-12 15:14:51 +00:00
|
|
|
|
|
|
|
|
|
month_len = month_length[leap (priv->year)][priv->month + 1];
|
|
|
|
|
|
|
|
|
|
if (month_len < priv->selected_day)
|
1998-09-27 18:32:00 +00:00
|
|
|
|
{
|
2010-08-12 15:14:51 +00:00
|
|
|
|
priv->selected_day = 0;
|
1998-09-27 18:32:00 +00:00
|
|
|
|
gtk_calendar_select_day (calendar, month_len);
|
|
|
|
|
}
|
|
|
|
|
else
|
2010-08-12 15:14:51 +00:00
|
|
|
|
gtk_calendar_select_day (calendar, priv->selected_day);
|
|
|
|
|
|
2007-12-28 09:26:38 +00:00
|
|
|
|
calendar_queue_refresh (calendar);
|
1998-09-27 18:32:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2005-05-11 19:16:19 +00:00
|
|
|
|
calendar_set_year_next (GtkCalendar *calendar)
|
1998-09-27 18:32:00 +00:00
|
|
|
|
{
|
2010-08-12 15:14:51 +00:00
|
|
|
|
GtkCalendarPrivate *priv = calendar->priv;
|
1998-09-27 18:32:00 +00:00
|
|
|
|
gint month_len;
|
2008-02-07 15:50:39 +00:00
|
|
|
|
|
2010-08-12 15:14:51 +00:00
|
|
|
|
priv->year++;
|
2005-05-11 19:16:19 +00:00
|
|
|
|
calendar_compute_days (calendar);
|
2002-10-09 22:11:08 +00:00
|
|
|
|
g_signal_emit (calendar,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
gtk_calendar_signals[NEXT_YEAR_SIGNAL],
|
|
|
|
|
0);
|
2002-10-09 22:11:08 +00:00
|
|
|
|
g_signal_emit (calendar,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
gtk_calendar_signals[MONTH_CHANGED_SIGNAL],
|
|
|
|
|
0);
|
2010-08-12 15:14:51 +00:00
|
|
|
|
|
|
|
|
|
month_len = month_length[leap (priv->year)][priv->month + 1];
|
|
|
|
|
|
|
|
|
|
if (month_len < priv->selected_day)
|
1998-09-27 18:32:00 +00:00
|
|
|
|
{
|
2010-08-12 15:14:51 +00:00
|
|
|
|
priv->selected_day = 0;
|
1998-09-27 18:32:00 +00:00
|
|
|
|
gtk_calendar_select_day (calendar, month_len);
|
|
|
|
|
}
|
|
|
|
|
else
|
2010-08-12 15:14:51 +00:00
|
|
|
|
gtk_calendar_select_day (calendar, priv->selected_day);
|
|
|
|
|
|
2007-12-28 09:26:38 +00:00
|
|
|
|
calendar_queue_refresh (calendar);
|
1998-09-27 18:32:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2005-05-11 19:16:19 +00:00
|
|
|
|
calendar_compute_days (GtkCalendar *calendar)
|
1998-09-27 18:32:00 +00:00
|
|
|
|
{
|
2010-08-12 15:14:51 +00:00
|
|
|
|
GtkCalendarPrivate *priv = calendar->priv;
|
2005-05-11 19:16:19 +00:00
|
|
|
|
gint month;
|
|
|
|
|
gint year;
|
|
|
|
|
gint ndays_in_month;
|
|
|
|
|
gint ndays_in_prev_month;
|
|
|
|
|
gint first_day;
|
|
|
|
|
gint row;
|
|
|
|
|
gint col;
|
2002-03-21 00:50:15 +00:00
|
|
|
|
gint day;
|
2005-05-11 19:16:19 +00:00
|
|
|
|
|
2010-08-12 15:14:51 +00:00
|
|
|
|
year = priv->year;
|
|
|
|
|
month = priv->month + 1;
|
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
ndays_in_month = month_length[leap (year)][month];
|
2010-08-12 15:14:51 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
first_day = day_of_week (year, month, 1);
|
|
|
|
|
first_day = (first_day + 7 - priv->week_start) % 7;
|
2010-08-12 15:14:51 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
/* Compute days of previous month */
|
|
|
|
|
if (month > 1)
|
|
|
|
|
ndays_in_prev_month = month_length[leap (year)][month-1];
|
|
|
|
|
else
|
|
|
|
|
ndays_in_prev_month = month_length[leap (year)][12];
|
|
|
|
|
day = ndays_in_prev_month - first_day + 1;
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
row = 0;
|
|
|
|
|
if (first_day > 0)
|
1998-09-27 18:32:00 +00:00
|
|
|
|
{
|
2005-05-11 19:16:19 +00:00
|
|
|
|
for (col = 0; col < first_day; col++)
|
2011-01-24 02:50:39 +00:00
|
|
|
|
{
|
|
|
|
|
priv->day[row][col] = day;
|
|
|
|
|
priv->day_month[row][col] = MONTH_PREV;
|
|
|
|
|
day++;
|
|
|
|
|
}
|
2005-05-11 19:16:19 +00:00
|
|
|
|
}
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
/* Compute days of current month */
|
|
|
|
|
col = first_day;
|
|
|
|
|
for (day = 1; day <= ndays_in_month; day++)
|
|
|
|
|
{
|
2010-08-12 15:14:51 +00:00
|
|
|
|
priv->day[row][col] = day;
|
|
|
|
|
priv->day_month[row][col] = MONTH_CURRENT;
|
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
col++;
|
|
|
|
|
if (col == 7)
|
2011-01-24 02:50:39 +00:00
|
|
|
|
{
|
|
|
|
|
row++;
|
|
|
|
|
col = 0;
|
|
|
|
|
}
|
2002-03-21 00:50:15 +00:00
|
|
|
|
}
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
/* Compute days of next month */
|
|
|
|
|
day = 1;
|
|
|
|
|
for (; row <= 5; row++)
|
2002-03-21 00:50:15 +00:00
|
|
|
|
{
|
2005-05-11 19:16:19 +00:00
|
|
|
|
for (; col <= 6; col++)
|
2011-01-24 02:50:39 +00:00
|
|
|
|
{
|
|
|
|
|
priv->day[row][col] = day;
|
|
|
|
|
priv->day_month[row][col] = MONTH_NEXT;
|
|
|
|
|
day++;
|
|
|
|
|
}
|
2005-05-11 19:16:19 +00:00
|
|
|
|
col = 0;
|
1998-09-27 18:32:00 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2005-05-11 19:16:19 +00:00
|
|
|
|
calendar_select_and_focus_day (GtkCalendar *calendar,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
guint day)
|
1998-09-27 18:32:00 +00:00
|
|
|
|
{
|
2010-08-12 15:14:51 +00:00
|
|
|
|
GtkCalendarPrivate *priv = calendar->priv;
|
|
|
|
|
gint old_focus_row = priv->focus_row;
|
|
|
|
|
gint old_focus_col = priv->focus_col;
|
2005-05-11 19:16:19 +00:00
|
|
|
|
gint row;
|
|
|
|
|
gint col;
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
for (row = 0; row < 6; row ++)
|
|
|
|
|
for (col = 0; col < 7; col++)
|
|
|
|
|
{
|
2011-01-24 02:50:39 +00:00
|
|
|
|
if (priv->day_month[row][col] == MONTH_CURRENT
|
|
|
|
|
&& priv->day[row][col] == day)
|
|
|
|
|
{
|
|
|
|
|
priv->focus_row = row;
|
|
|
|
|
priv->focus_col = col;
|
|
|
|
|
}
|
2005-05-11 19:16:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (old_focus_row != -1 && old_focus_col != -1)
|
|
|
|
|
calendar_invalidate_day (calendar, old_focus_row, old_focus_col);
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
gtk_calendar_select_day (calendar, day);
|
|
|
|
|
}
|
1998-10-04 23:07:04 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
|
|
|
|
|
/****************************************
|
|
|
|
|
* Layout computation utilities *
|
|
|
|
|
****************************************/
|
|
|
|
|
|
|
|
|
|
static gint
|
|
|
|
|
calendar_row_height (GtkCalendar *calendar)
|
|
|
|
|
{
|
2010-08-12 15:14:51 +00:00
|
|
|
|
GtkCalendarPrivate *priv = calendar->priv;
|
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
return (GTK_CALENDAR_GET_PRIVATE (calendar)->main_h - CALENDAR_MARGIN
|
2011-01-24 02:50:39 +00:00
|
|
|
|
- ((priv->display_flags & GTK_CALENDAR_SHOW_DAY_NAMES)
|
|
|
|
|
? calendar_get_ysep (calendar) : CALENDAR_MARGIN)) / 6;
|
1998-09-27 18:32:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
|
|
|
|
|
/* calendar_left_x_for_column: returns the x coordinate
|
|
|
|
|
* for the left of the column */
|
|
|
|
|
static gint
|
|
|
|
|
calendar_left_x_for_column (GtkCalendar *calendar,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
gint column)
|
1998-09-27 18:32:00 +00:00
|
|
|
|
{
|
2010-08-12 15:14:51 +00:00
|
|
|
|
GtkCalendarPrivate *priv = calendar->priv;
|
2005-05-11 19:16:19 +00:00
|
|
|
|
gint width;
|
|
|
|
|
gint x_left;
|
2010-10-24 05:22:13 +00:00
|
|
|
|
gint week_width;
|
2010-08-03 15:45:14 +00:00
|
|
|
|
gint calendar_xsep = calendar_get_xsep (calendar);
|
2011-01-10 19:40:37 +00:00
|
|
|
|
GtkStyleContext *context;
|
|
|
|
|
GtkStateFlags state;
|
2010-10-24 05:22:13 +00:00
|
|
|
|
gint inner_border = calendar_get_inner_border (calendar);
|
2011-01-10 19:40:37 +00:00
|
|
|
|
GtkBorder padding;
|
2010-10-24 05:22:13 +00:00
|
|
|
|
|
2011-01-10 19:40:37 +00:00
|
|
|
|
context = gtk_widget_get_style_context (GTK_WIDGET (calendar));
|
|
|
|
|
state = gtk_widget_get_state_flags (GTK_WIDGET (calendar));
|
|
|
|
|
gtk_style_context_get_padding (context, state, &padding);
|
2010-10-24 05:22:13 +00:00
|
|
|
|
|
2011-01-10 19:40:37 +00:00
|
|
|
|
week_width = priv->week_width + padding.left + inner_border;
|
2010-08-03 15:45:14 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
if (gtk_widget_get_direction (GTK_WIDGET (calendar)) == GTK_TEXT_DIR_RTL)
|
2010-10-24 05:22:13 +00:00
|
|
|
|
{
|
|
|
|
|
column = 6 - column;
|
|
|
|
|
week_width = 0;
|
|
|
|
|
}
|
2005-05-11 19:16:19 +00:00
|
|
|
|
|
|
|
|
|
width = GTK_CALENDAR_GET_PRIVATE (calendar)->day_width;
|
2010-08-12 15:14:51 +00:00
|
|
|
|
if (priv->display_flags & GTK_CALENDAR_SHOW_WEEK_NUMBERS)
|
2010-10-24 05:22:13 +00:00
|
|
|
|
x_left = week_width + calendar_xsep + (width + DAY_XSEP) * column;
|
2005-05-11 19:16:19 +00:00
|
|
|
|
else
|
2010-10-24 05:22:13 +00:00
|
|
|
|
x_left = week_width + CALENDAR_MARGIN + (width + DAY_XSEP) * column;
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
return x_left;
|
|
|
|
|
}
|
1998-10-04 23:07:04 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
/* column_from_x: returns the column 0-6 that the
|
|
|
|
|
* x pixel of the xwindow is in */
|
|
|
|
|
static gint
|
|
|
|
|
calendar_column_from_x (GtkCalendar *calendar,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
gint event_x)
|
2005-05-11 19:16:19 +00:00
|
|
|
|
{
|
|
|
|
|
gint c, column;
|
|
|
|
|
gint x_left, x_right;
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
column = -1;
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
for (c = 0; c < 7; c++)
|
1998-09-27 18:32:00 +00:00
|
|
|
|
{
|
2005-05-11 19:16:19 +00:00
|
|
|
|
x_left = calendar_left_x_for_column (calendar, c);
|
|
|
|
|
x_right = x_left + GTK_CALENDAR_GET_PRIVATE (calendar)->day_width;
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
if (event_x >= x_left && event_x < x_right)
|
2011-01-24 02:50:39 +00:00
|
|
|
|
{
|
|
|
|
|
column = c;
|
|
|
|
|
break;
|
|
|
|
|
}
|
1998-09-27 18:32:00 +00:00
|
|
|
|
}
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
return column;
|
1998-09-27 18:32:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
/* calendar_top_y_for_row: returns the y coordinate
|
|
|
|
|
* for the top of the row */
|
|
|
|
|
static gint
|
|
|
|
|
calendar_top_y_for_row (GtkCalendar *calendar,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
gint row)
|
1998-09-27 18:32:00 +00:00
|
|
|
|
{
|
2011-01-10 19:40:37 +00:00
|
|
|
|
GtkStyleContext *context;
|
2010-10-24 05:22:13 +00:00
|
|
|
|
GtkAllocation allocation;
|
|
|
|
|
gint inner_border = calendar_get_inner_border (calendar);
|
2011-01-10 19:40:37 +00:00
|
|
|
|
GtkStateFlags state;
|
|
|
|
|
GtkBorder padding;
|
2010-10-24 05:22:13 +00:00
|
|
|
|
|
|
|
|
|
gtk_widget_get_allocation (GTK_WIDGET (calendar), &allocation);
|
2011-01-10 19:40:37 +00:00
|
|
|
|
context = gtk_widget_get_style_context (GTK_WIDGET (calendar));
|
|
|
|
|
state = gtk_widget_get_state_flags (GTK_WIDGET (calendar));
|
|
|
|
|
|
|
|
|
|
gtk_style_context_get_padding (context, state, &padding);
|
|
|
|
|
|
2010-10-24 05:22:13 +00:00
|
|
|
|
return allocation.height
|
2011-01-10 19:40:37 +00:00
|
|
|
|
- padding.top - inner_border
|
2011-01-24 02:50:39 +00:00
|
|
|
|
- (CALENDAR_MARGIN + (6 - row)
|
|
|
|
|
* calendar_row_height (calendar));
|
2005-05-11 19:16:19 +00:00
|
|
|
|
}
|
1998-10-04 23:07:04 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
/* row_from_y: returns the row 0-5 that the
|
|
|
|
|
* y pixel of the xwindow is in */
|
|
|
|
|
static gint
|
|
|
|
|
calendar_row_from_y (GtkCalendar *calendar,
|
2010-10-24 05:22:13 +00:00
|
|
|
|
gint event_y)
|
2005-05-11 19:16:19 +00:00
|
|
|
|
{
|
|
|
|
|
gint r, row;
|
|
|
|
|
gint height;
|
|
|
|
|
gint y_top, y_bottom;
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
height = calendar_row_height (calendar);
|
|
|
|
|
row = -1;
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
for (r = 0; r < 6; r++)
|
1998-10-04 23:07:04 +00:00
|
|
|
|
{
|
2005-05-11 19:16:19 +00:00
|
|
|
|
y_top = calendar_top_y_for_row (calendar, r);
|
|
|
|
|
y_bottom = y_top + height;
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
if (event_y >= y_top && event_y < y_bottom)
|
2011-01-24 02:50:39 +00:00
|
|
|
|
{
|
|
|
|
|
row = r;
|
|
|
|
|
break;
|
|
|
|
|
}
|
1998-10-04 23:07:04 +00:00
|
|
|
|
}
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
return row;
|
1998-09-27 18:32:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2005-05-11 19:16:19 +00:00
|
|
|
|
calendar_arrow_rectangle (GtkCalendar *calendar,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
guint arrow,
|
|
|
|
|
GdkRectangle *rect)
|
1998-09-27 18:32:00 +00:00
|
|
|
|
{
|
2005-05-11 19:16:19 +00:00
|
|
|
|
GtkWidget *widget = GTK_WIDGET (calendar);
|
|
|
|
|
GtkCalendarPrivate *priv = GTK_CALENDAR_GET_PRIVATE (calendar);
|
2010-08-11 21:17:18 +00:00
|
|
|
|
GtkAllocation allocation;
|
2011-01-10 19:40:37 +00:00
|
|
|
|
GtkStyleContext *context;
|
|
|
|
|
GtkStateFlags state;
|
|
|
|
|
GtkBorder padding;
|
2005-05-11 19:16:19 +00:00
|
|
|
|
gboolean year_left;
|
1998-10-04 23:07:04 +00:00
|
|
|
|
|
2010-08-11 21:17:18 +00:00
|
|
|
|
gtk_widget_get_allocation (widget, &allocation);
|
2011-01-10 19:40:37 +00:00
|
|
|
|
context = gtk_widget_get_style_context (widget);
|
|
|
|
|
state = gtk_widget_get_state_flags (widget);
|
|
|
|
|
|
|
|
|
|
gtk_style_context_get_padding (context, state, &padding);
|
2010-08-11 21:17:18 +00:00
|
|
|
|
|
2010-10-24 05:22:13 +00:00
|
|
|
|
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR)
|
2005-05-11 19:16:19 +00:00
|
|
|
|
year_left = priv->year_before;
|
1998-09-27 18:32:00 +00:00
|
|
|
|
else
|
2005-05-11 19:16:19 +00:00
|
|
|
|
year_left = !priv->year_before;
|
2010-08-12 15:14:51 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
rect->y = 3;
|
|
|
|
|
rect->width = priv->arrow_width;
|
|
|
|
|
rect->height = priv->header_h - 7;
|
2010-08-12 15:14:51 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
switch (arrow)
|
1998-10-04 23:07:04 +00:00
|
|
|
|
{
|
2005-05-11 19:16:19 +00:00
|
|
|
|
case ARROW_MONTH_LEFT:
|
2010-10-24 05:22:13 +00:00
|
|
|
|
if (year_left)
|
2011-01-10 19:40:37 +00:00
|
|
|
|
rect->x = (allocation.width - padding.left - padding.right
|
2010-08-11 21:17:18 +00:00
|
|
|
|
- (3 + 2 * priv->arrow_width + priv->max_month_width));
|
2005-05-11 19:16:19 +00:00
|
|
|
|
else
|
2011-01-24 02:50:39 +00:00
|
|
|
|
rect->x = 3;
|
2005-05-11 19:16:19 +00:00
|
|
|
|
break;
|
|
|
|
|
case ARROW_MONTH_RIGHT:
|
2010-10-24 05:22:13 +00:00
|
|
|
|
if (year_left)
|
2011-01-10 19:40:37 +00:00
|
|
|
|
rect->x = (allocation.width - padding.left - padding.right
|
2011-01-24 02:50:39 +00:00
|
|
|
|
- 3 - priv->arrow_width);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
else
|
2011-01-24 02:50:39 +00:00
|
|
|
|
rect->x = (priv->arrow_width + priv->max_month_width);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
break;
|
|
|
|
|
case ARROW_YEAR_LEFT:
|
2010-10-24 05:22:13 +00:00
|
|
|
|
if (year_left)
|
2011-01-24 02:50:39 +00:00
|
|
|
|
rect->x = 3;
|
2005-05-11 19:16:19 +00:00
|
|
|
|
else
|
2011-01-10 19:40:37 +00:00
|
|
|
|
rect->x = (allocation.width - padding.left - padding.right
|
2010-08-11 21:17:18 +00:00
|
|
|
|
- (3 + 2 * priv->arrow_width + priv->max_year_width));
|
2005-05-11 19:16:19 +00:00
|
|
|
|
break;
|
|
|
|
|
case ARROW_YEAR_RIGHT:
|
2010-10-24 05:22:13 +00:00
|
|
|
|
if (year_left)
|
2010-08-12 15:14:51 +00:00
|
|
|
|
rect->x = (priv->arrow_width + priv->max_year_width);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
else
|
2011-01-10 19:40:37 +00:00
|
|
|
|
rect->x = (allocation.width - padding.left - padding.right
|
2011-01-24 02:50:39 +00:00
|
|
|
|
- 3 - priv->arrow_width);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
break;
|
1998-10-04 23:07:04 +00:00
|
|
|
|
}
|
2010-10-24 05:22:13 +00:00
|
|
|
|
|
2011-01-10 19:40:37 +00:00
|
|
|
|
rect->x += padding.left;
|
|
|
|
|
rect->y += padding.top;
|
1998-09-27 18:32:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2005-05-11 19:16:19 +00:00
|
|
|
|
calendar_day_rectangle (GtkCalendar *calendar,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
gint row,
|
|
|
|
|
gint col,
|
|
|
|
|
GdkRectangle *rect)
|
1998-09-27 18:32:00 +00:00
|
|
|
|
{
|
2005-05-11 19:16:19 +00:00
|
|
|
|
GtkCalendarPrivate *priv = GTK_CALENDAR_GET_PRIVATE (calendar);
|
1998-10-05 03:52:48 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
rect->x = calendar_left_x_for_column (calendar, col);
|
|
|
|
|
rect->y = calendar_top_y_for_row (calendar, row);
|
|
|
|
|
rect->height = calendar_row_height (calendar);
|
|
|
|
|
rect->width = priv->day_width;
|
1998-09-27 18:32:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2005-05-11 19:16:19 +00:00
|
|
|
|
calendar_set_month_prev (GtkCalendar *calendar)
|
1998-09-27 18:32:00 +00:00
|
|
|
|
{
|
2010-08-12 15:14:51 +00:00
|
|
|
|
GtkCalendarPrivate *priv = calendar->priv;
|
2005-05-11 19:16:19 +00:00
|
|
|
|
gint month_len;
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
2010-08-12 15:14:51 +00:00
|
|
|
|
if (priv->display_flags & GTK_CALENDAR_NO_MONTH_CHANGE)
|
2005-05-11 19:16:19 +00:00
|
|
|
|
return;
|
2010-08-12 15:14:51 +00:00
|
|
|
|
|
|
|
|
|
if (priv->month == 0)
|
1998-09-27 18:32:00 +00:00
|
|
|
|
{
|
2010-08-12 15:14:51 +00:00
|
|
|
|
priv->month = 11;
|
|
|
|
|
priv->year--;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
priv->month--;
|
|
|
|
|
|
|
|
|
|
month_len = month_length[leap (priv->year)][priv->month + 1];
|
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
calendar_compute_days (calendar);
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
g_signal_emit (calendar,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
gtk_calendar_signals[PREV_MONTH_SIGNAL],
|
|
|
|
|
0);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
g_signal_emit (calendar,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
gtk_calendar_signals[MONTH_CHANGED_SIGNAL],
|
|
|
|
|
0);
|
2010-08-12 15:14:51 +00:00
|
|
|
|
|
|
|
|
|
if (month_len < priv->selected_day)
|
1998-09-27 18:32:00 +00:00
|
|
|
|
{
|
2010-08-12 15:14:51 +00:00
|
|
|
|
priv->selected_day = 0;
|
2005-05-11 19:16:19 +00:00
|
|
|
|
gtk_calendar_select_day (calendar, month_len);
|
1998-09-27 18:32:00 +00:00
|
|
|
|
}
|
2005-05-11 19:16:19 +00:00
|
|
|
|
else
|
2000-11-18 16:48:39 +00:00
|
|
|
|
{
|
2010-08-12 15:14:51 +00:00
|
|
|
|
if (priv->selected_day < 0)
|
2011-01-24 02:50:39 +00:00
|
|
|
|
priv->selected_day = priv->selected_day + 1 + month_length[leap (priv->year)][priv->month + 1];
|
2010-08-12 15:14:51 +00:00
|
|
|
|
gtk_calendar_select_day (calendar, priv->selected_day);
|
2000-11-18 16:48:39 +00:00
|
|
|
|
}
|
2005-05-11 19:16:19 +00:00
|
|
|
|
|
2007-12-28 09:26:38 +00:00
|
|
|
|
calendar_queue_refresh (calendar);
|
1998-09-27 18:32:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
|
|
|
|
|
/****************************************
|
|
|
|
|
* Basic object methods *
|
|
|
|
|
****************************************/
|
|
|
|
|
|
1998-09-27 18:32:00 +00:00
|
|
|
|
static void
|
2005-05-11 19:16:19 +00:00
|
|
|
|
gtk_calendar_finalize (GObject *object)
|
1998-09-27 18:32:00 +00:00
|
|
|
|
{
|
2008-08-12 09:06:34 +00:00
|
|
|
|
G_OBJECT_CLASS (gtk_calendar_parent_class)->finalize (object);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
}
|
1998-10-04 23:07:04 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
static void
|
2010-09-18 23:55:42 +00:00
|
|
|
|
gtk_calendar_destroy (GtkWidget *widget)
|
2005-05-11 19:16:19 +00:00
|
|
|
|
{
|
2010-09-18 23:55:42 +00:00
|
|
|
|
GtkCalendarPrivate *priv = GTK_CALENDAR_GET_PRIVATE (widget);
|
2007-12-27 20:41:08 +00:00
|
|
|
|
|
2010-09-18 23:55:42 +00:00
|
|
|
|
calendar_stop_spinning (GTK_CALENDAR (widget));
|
2010-08-12 15:14:51 +00:00
|
|
|
|
|
2007-12-27 20:41:08 +00:00
|
|
|
|
/* Call the destroy function for the extra display callback: */
|
|
|
|
|
if (priv->detail_func_destroy && priv->detail_func_user_data)
|
|
|
|
|
{
|
|
|
|
|
priv->detail_func_destroy (priv->detail_func_user_data);
|
|
|
|
|
priv->detail_func_user_data = NULL;
|
|
|
|
|
priv->detail_func_destroy = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2010-09-18 23:55:42 +00:00
|
|
|
|
GTK_WIDGET_CLASS (gtk_calendar_parent_class)->destroy (widget);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
}
|
Remove all references to offscreen flag which was no longer used.
Thu Jun 1 23:05:13 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Remove all references to
offscreen flag which was no longer used.
* gtk/gtkprivate.h (enum): Remove unused flags and compress.
* gtk/gtkframe.c (gtk_frame_set_label_widget): Check
for non-null label_widget->parent.
* gtk/gtkentry.c: Get rid of code to deal with PangoAttribute
which no longer was used.
* gdk/gdkpango.c (gdk_pango_context_get_info): make static.
* gdk/gdkpango.c (gdk_draw_layout[_line]): Add checks
for null arguments.
* gdk/x11/gdkgeometry-x11.c (gdk_window_scroll): add
check for destroyed windows.
Thu Jun 1 13:48:45 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimmulticontext.c: Add a finalize method and unref
the slave context there.
* gtk/gtkinvisible.[ch]: Make reference counting behavior
identical to GtkWindow.
Thu Jun 1 01:54:11 2000 Owen Taylor <otaylor@redhat.com>
* Makefile.am gdk/gdkpango.c: Copy the layout render function from
pangox to here, so we can write them independent of rendering
system, using GDK primitives.
* gdk/gdkdrawable.h gdk/gdkdraw.c gdk/gdkwindow.c
gdk/x11/gdkdrawable-x11.c: Remove draw_layout() from the vtable,
since we have a rendering-system independent implementation in
terms of draw_glyphs().
* gdk/gdkpango.c gdkdrawable.h (gdk_draw_layout_line): New
function to render a single line.
* gdk/x11/gdkpango.c: Move the guts of this file mostly
into ../gdkpango.c, which simplifies things, since we
don't have to deal with raw X gc's.
Fri May 19 04:28:16 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.[ch]: Add get_log_attrs() function to
get the logical attributes for a given GtkTextLine.
Tue May 30 16:05:39 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkfont-x11.c (gdk_font_charset_for_locale): Track
g_locale_get_codeset() to g_get_codeset() change.
Tue May 30 15:03:19 2000 Owen Taylor <otaylor@redhat.com>
* gtk/testcalendar.c (calendar_font_selection_ok): Use font
descriptions.
* gtk/gtkentry.c (gtk_entry_draw_text): Center text within
the entry.
* gtk/gtkfontsel.c (gtk_font_selection_dialog_init): Start of
redoing (vastly simplifying) for Pango. Still needs quite
a bit of work. (Size selection is currently poor. List of
predefined sizes is not a good idea, since all of these
sizes won't necessarily be distinct.)
Tue May 30 13:50:19 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkfont-x11.c (gdk_font_charset_for_locale): Handle
CODESET results for LANG=C.
Mon May 29 15:49:10 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.[ch]: Add a 'font_name' declaration to RC
which takes a stringized pango font description;
ignore the older 'font' and 'fontset' declarations.
* gtk/gtkstyle.c gtk/gtkrc.c: Fill in the style->font
field with a GdkFont derived via gdk_font_from_description(),
for compatibility. (Should we just remove it entirely?
Probably too much compatibility breakage, but people
should be migrating to the new Pango stuff as quickly
as possible.)
Mon May 29 15:47:41 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c gtk/gtkclist.c: s/pango_font_unref/g_object_unref/.
Mon May 29 15:44:46 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcalender.c: Roughly pango-ized. Really needs
redoing; there are some bugs in size allocation right
now, the semi-existant distinction between header / day
fonts was removed, but, with Pango, could actually
be made functional in a nice way.
* gtk/testcalender: Move calender from examples into this
directory as a test program. (We really need to restrcture
testgtk into a whole directory full of tests for every
widget or functionality group, separated into multiple .c
files.)
Mon May 29 15:19:56 2000 Owen Taylor <otaylor@redhat.com>
* gtk/testgtk.c (file_exists): Fix stupid typo that
was keeping RC file from being loaded.
* gtk/testgtkrc gtk/testgtkrc2: Test new pango-ized
RC file font code.
Mon May 29 14:31:27 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkfont.h gdk/x11/gdkfont-x11.c (gdk_font_from_description):
Add function to load a GdkFont from a PangoFontDescription.
Fri May 26 17:16:40 2000 Owen Taylor <otaylor@redhat.com>
* gtk/frame.[ch] gtkaspectframe.c: Make frame widgets able
to have any widget for the label, use a GtkLabel widget
to display the text. (Based partially on a patch from
Anders Carlson.)
(Quite a bit of code reorganization - strip 90% of the
guts out of gtkaspectframe and add a single virtual
func to GtkFrameClass - compute_child_allocation.)
Fri May 26 12:00:02 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkctree.c gtk/gtkclist.[ch]: Pangoized.
(Removed clist->row_center_offset field because caching
it wasn't saving time or code, added private function
_gtk_clist_create_cell_layout()).
Wed May 24 15:59:37 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkaccellabel.c: Pangoized.
* gtk/[hv]ruler.c: Pangoized
Mon May 22 19:23:59 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c (gtk_file_selection_init):
Use gtk_clist_set_column_auto_resize() to remove need
need for manual column width computations.
Mon May 22 18:50:26 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktooltips.[ch]: Replace custom drawing with a GtkLabel,
ensuring Pango correctness, and considerably simplifying the
code.
* gtk/gtklabel.c gtk[hv]scale.c: 1000 => PANGO_SCALE.
* gtk/gtklabel.c (gtk_label_size_request): Fixed incorrect
getting of numbers of lines.
* gtk/gtklabel.c (gtk_label_size_request): Set the requisition
to the actual requested width of the lable, not to the wrap
width we set.
* gtk/gtktextchild.h: Remove extraneous include of gtk/gtk.h.
* gtk/gtktextbtree.c gtk/gtktextbuffer.c gtk/gtktextlayout.c
gtk/gtktextview.c gtk/gtktextview.[ch]: Fix up includes.
* gtk/gtktextview.c: Fix structure inheritance.
* gtk/gtkprogressbar.c: Pangoize.
Mon May 22 15:47:30 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextview.c (gtk_text_view_get_first_para_iter): Encapsulate
in a function.
* gtk/gtktextlayout.c (find_display_line_above): Fixed
bug with computing line tops.
* gtk/gtktextview.c (changed_handler): Fix < , <= confusion.
Thu May 18 18:53:31 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextdisplay.c (gtk_text_layout_draw): Fix up the x_offset
and y_offset coordinates to do what we need now. (The offset between
buffer and layout coordinates has been reintroduced, but is a
bit different than before.)
* gtk/gtktextview.[ch]: No longer inherit from GtkLayout; instead
handle the adjustments ourselves, and scroll as necessary using
the new gdk_window_scroll().
The advantage of this is that when we are incrementally revalidating,
we are essentially rearranging things around the visible portion
of the screen. With the old setup, the visible portion of the
screen was moved around in the layout, so scrolling and redrawing
to track that caused jumping of the display. Since we now
control the scrolling ourselves, we can suppress this and
only redraw when things actually change.
Thu May 18 18:47:25 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextbtree.c (redisplay_mark): We need to invalidate
the region not just redisplay it after-all, since we store the
cursors in the LineDisplay. (Ugly interactions here between
GtkLayout and GtkTextBTree here.)
* gtk/gtktextbtree.c (redisplay_region): Fixed reversed comparison.
Thu May 18 18:43:21 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.h gdk/x11/gdkgeometry-x11.c (gdk_window_scroll):
Added function to scroll contents of a window while keeping the
window constant. Works by XCopyArea or guffaw-scrolling depending
on the details of how the window is set up. (guffaw-scrolling
still needs to be filled in.)
Wed May 17 22:36:53 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextiter.c gtk/gtkmain.c: Add a debug key for the text widget,
move the debugging that was tied to a global variable
to that.
* gtk/gtkmarshal.list: Add NONE:INT,INT,INT
* gtk/gtktextbtree.[ch] gtk/gtktextlayout.c: Keep a separate
validated flag, in line data instead of setting height/width to
-1. This allows us to perform operations with partially invalid
buffer (using the old size for invalid lines) and thus to do
incremental vaidation. Keep height/width aggregates up to date
when deleting text and rebalancing the tree.
* gtk/gtktextbtree.[ch]: Add functions validate a line
(gtk_text_btree_validate_line), and to validate up
to a number of pixels (gtk_text_btree_validate).
* gtk/gtktextlayout.[ch]: Add an ::invalidated signal
that indicates that something is changed and a revalidation
pass is needed. Change ::need_repaint to ::changed, and
make it take old and new yranges instead of a rectangle.
* gtk/gtktextbtree.[ch] gtk/gtktextlayout.[ch]: Move
the line_data_destroy() function from
gtk_text_btree_add_view() to a virtual function in
GtkTextLayout
* gtk/gtktextbtree.[ch]: Remove gtk_text_btree_get_damage_range(),
since we are handling partial repaints in a different fashion
now.
* gtk/gtktextbtree.[ch]: Only repaint the changed portion
of the selection instead of queueing a repaint on the
entire widget.
* gtk/gtktextbuffer.[ch] gtk/gtktextbtree.[ch]: Move
get_selection_bounds() down to btree, make the function
in buffer a wrapper around the btree function.
* gtk/gtktextlayout.[ch]: Add functions to check if the
layout is valid and to recompute either a range of pixels
aroudn a line or a certain total number of pixels.
* gtk/gtktextlayout.[ch]: Cache a single line display;
now that we only redraw the needed portions, the hit rate
for this cache is quite high.
* gtk/gtktextview.[ch]: Keep track of the first paragraph
on the screen so that when re-laying-out the buffer, we can
keep the same place. This requires connecting to ::value_changed
on the adjustments
* gtk/gtktextview.[ch]: Add idle functions to revalidate
the buffer after we receive an ::invalidated signal.
Wed May 17 22:10:47 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.c (gtk_layout_size_allocate): Set upper
to max of allocation and layout size, not just to the
layout size.
* gtk/gtk[hv]scrollbar.c (gtk_[hv]scrollbar_calc_slider_size):
Invalidate window so it gets redrawn properly.
* gdk/gdkwindow.c (gdk_window_invalidate_rect): Allow rect == NULL
to mean the entire window.
* gdk/gdkevents.h: Move definition for GDK_PRIORITY_REDRAW
into public header.
Mon May 15 14:51:31 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextmark.c (gtk_text_mark_get_name): Add function
to get the name of a mark.
* gtk/gtktextlayout.c (gtk_text_layout_get_line_at_y): Add a function
to find the paragraph from a y position.
Thu May 11 12:57:20 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextbtree.c (gtk_text_btree_node_invalidate_upward): Valid
nodes have width/height >= 0, not > 0.
Tue May 9 21:29:06 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.[ch] gtk/gtktextdisplay.c (gtk_text_layout_get_line_display):
Add a size_only flag, so when we only need the size, we don't create
useless appearance attributes.
* gtk/gtktextview.c (gtk_text_view_ensure_layout): Remove
duplicate setting of font description.
* gtk/gtkscale.c: Use PANGO_SCALE instead of 1000
Wed Apr 26 01:53:23 2000 Owen Taylor <otaylor@redhat.com>
* gtk/Makefile.am (EXTRA_DIST): Add OLD_STAMP into
EXTRA_DIST. It does not work well when the file that
everything depends on is not in the tarball.
Wed Apr 26 00:56:14 2000 Owen Taylor <otaylor@redhat.com>
* gtk/testgtk.c: Some hacks and fixes so that it basically
works when not sitting in the GTK+ build tree.
2000-05-03 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (gtk_text_line_next_could_contain_tag):
Properly determine the ordering of the tag root and the current
line within the tree. Previous algorithm only worked if the tag
root's immediate parent was the common root of both the current
line and the tag root.
Wed Apr 26 00:43:00 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.c (set_para_values): Fix some bugs in
alignment.
* gtk/gtktextview.c (gtk_text_view_ensure_layout): Track
the widget text directional dynamically.
* gtk/gtktextview.[ch]: Added functions to get and set default
wrap mode.
Tue Apr 25 23:47:38 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.c (gtk_text_layout_get_iter_location): Fix bug
in cursor location computation.
Tue Apr 25 23:22:59 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.c (gtk_layout_set_size): Clamp hadjustment/
vadjusment values properly when layout gets smaller.
* gtk/gtktextview.c (need_repaint_handler): Areas being
passed in are far completely inaccurate, and sometimes
too small, so, for now, just queue a redraw on the
whole visible region.
2000-04-25 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (summary_destroy): new function to
destroy tag summary nodes
(gtk_text_line_next_could_contain_tag): this function was
totally broken if the line passed in wasn't below the tag
root. Fix it.
(gtk_text_btree_first_could_contain_tag): In the tag == NULL
"wildcard" case, we have to do a linear scan. Blah.
(gtk_text_btree_last_could_contain_tag): In tag == NULL case,
we have to do the linear scan
(tag_removed_cb): When a tag is removed from the tag table,
remove the GtkTextTagInfo node from the btree.
(gtk_text_btree_spew): Implement the spew function, for
our debugging pleasure.
Tue Apr 25 19:40:18 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.c (gtk_text_layout_set_buffer): Fix
a problem with referring to the wrong buffer.
* gtk/gtkentry.c: Fix focus-in/focus-out confusion.
* gtk/gtkrc.c gtk/gtkstyle.c: Moving setting default
font description to gtk_style_new() - otherwise things
don't work without a .gtkrc file.
* gtk/gtktextbuffer.c (gtk_text_buffer_new): Sink the
tags table if we create it ourself, too.
* gdk/gdktypes.h (enum): Move GDK_RELEASE_MASK, since
it was conflicting with XKB modifiers.
* gtk/gtktextview.[ch]: Add simple support for
GtkIMContext.
Mon Apr 24 19:34:18 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_move_cursor_visually): Fix problem
with deletion from last commit.
Mon Apr 24 19:29:40 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_create_pango_context): Set the language
in the context from the current locale.
* gtk/gtkentry.c (gtk_entry_size_request): Use language from the
context, not hardcoded value.
* gtk/gtkentry.c (gtk_entry_move_cursor): Make character movement visual,
not logical.
Sun Apr 23 23:39:18 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c gtk/gtktextdisplay.c: Don't handle selections as
attributes - that doesn't handle partial-glyph selection
properly. Instead use new pango_layout_line_get_x_ranges()
functionality to draw the selection.
* gtk/gtkentry.c: Simplify code since pango_layout_line_index_to_x()
now properly handles out-of-range coordinates.
* gtk/gtktextbuffer.c: Emit "mark_set" when the cursor is moved.
* gtk/gtktextiter.h gtk/gtktextiterprivate.h: Make gtk_text_iter_get_line_byte()
public.
* gtk/gtktextlayout.[ch]: Properly set the direction in the PangoContext
for paragraphs opposite to the base direction of the widget.
* gtk/gtktextlayout.[ch] gtk/gtktextdisplay.c: Fixes for alignment.
* gtk/gtktextlayout.c: Don't split segments on marks, since that
causes Arabic words to reshape as you cursor through.
* gtk/gtktextlayout.[ch] gtk/gtktextview.[ch]: Implement virtual
cursor position when moving vertically with the arrow keys and
scrolling with page-up/page-down. (Arrow keys save only the X,
scrolling saves both X and Y.)
This means you can line-up / line-down or page-up / page-down
without losing your place, and also that moving vertically
with the cursor keys keeps the same X position, not the same
character count:
* gtk/gtktextlayout.[ch] gtk/gtktextview.[ch]: Make vertical
arrow keys move by display lines, not paragraphs.
Tue Apr 18 14:16:50 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.c: Make sure that the bin window is at least
as big as the allocation. (Should we also make sure that the
bin window is big enough to completely cover widget->window?)
* gtk/gtktextview.c (gtk_text_view_get_visible_rect): Add
function to get the onscreen rectangle.
* gdk/x11/gdkwindow-x11.c (gdk_window_get_pointer): Correctly account
for offsets in window coordinates.
Sun Apr 16 16:13:27 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_get_cursor_locations): Fix index/offset
confusion.
* gtk/gtktextview.c (gtk_text_view_ensure_layout): Set the default direction
from the widget direction.
* gtk/gtktexttag.c gtk/gtktexttagprivate.h (gtk_text_tag_set_arg):
Add a "direction" attribute.
* gtk/gtktextview.c: global s/tkxt/text_view/.
* gtk/testtext.c: Added long block of text in Arabic, to test out
the direction attributes. (Some problems with the shaping system
for arabic become obvious - like the fact the cursor splits words
into unjoined pieces.)
Fri Apr 14 12:54:34 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextdisplay.c (render_layout): Add overstrike handling.
* gtk/gtktextlayout.c: Fix up alignment.
* gtk/testtext.c: Add some tests for centering, wrapping.
Fri Apr 14 09:26:22 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkdrawable.h gdk/gdkdraw.c gdk/gdkwindow.c gdk/x11/gdkdrawable-x11.c:
Add a draw_glyphs() operation to the drawable vtable and gdk_draw_glyphs().
If we wrote GTK+-specific layout-render function this could just replace
the draw_layout() operation in the vtable.
* gtk/gtkentry.c: Move guts of gtk_entry_get_cursor_locations to
pango_layout_get_cursor_pos() and use that function.
* gtk/gtktextchild.[ch]: add gtk_ onto pixmap_segment_new(), since it
is a non-static symbol.
* gtk/gtktextbtree.[ch]: Replace gtk_text_btree_find_line_data_by_y()
with gtk_text_btree_find_line_by_y()
* gtk/gtktextdisplay.c: Rewrote for Pango - uses a custom layout
renderer that handles GtkTextAppearance attributes.
* gtk/gtktexttag.[ch] gtk/gtktexttagprivate.h:
- Move the values in the style that don't affect geometry into a
GtkTextAppearance structure.
- Change underline to take a PangoUnderline and "font" a string
representation of a font description
- Add a "font_desc" attribute which takes a FontDescription structure.
* gtk/gtktextlayout.[ch]:
- Get rid of the display-line list per each line. Instead, we
generate, on demand, a GtkTextLineDisplay structure which]
contains a PangoLayout * and other necesary information
(offsets, cursor locations) for displaying a paragraph.
- Get rid of the code to wrap lines, create display chunks,
etc. Instead, we just go through a paragraph and convert
it into the necessary inputs to a PangoLayout.
- Implement a new attribute type, GtkTextAttrAppearance. This
holds a GtkTextAppearance, and is used to pass colors,
stipple, etc, through from the layout to the display without
having to use lots and lots of individual attributes.
- Reimplement gtk_layout_get_iter_at_pixel() gtk_layout_get_iter_pos()
in terms of PangoLayout functions.
* gtk/gtktextview.c:
- Handle passing the necessary PangoContext to the layout
- Some fixups in painting to deal with the automatic backing store
and offsetting of GTK+-1.4
- Add a style_set handler so that the default style reacts
properly to theme changes.
* gtk/gtktext?*.[ch]: Random code-style fixes.
* gtk/testtext.c: Substitute in languages that Pango handles now for Thai
Mon Apr 10 10:33:45 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktext?*.[ch]: Check in Havoc's port of the Tk text widget,
in original form preparatory to Pango-ization and gdkimcontext-ization.
Thu Apr 6 19:25:39 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimcontext.c: Move default implementations to real_* vfuncs,
so that we can derive from gtkimcontext in language bindings properly.
Thu Apr 6 16:02:52 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimcontextsimple.[ch]: Use gdk_keyval_to_unicode to gdk_unicode_to_keyval.
Add a compose table including (almost) all the compose combinations
from X. This is 6k of static, shared data as opposed to 50k or so of dynamic
data in the XIM implementation.
* gdk/gdk.h gdk/gdkkeyuni.c gdk/win32/gdkevents-win32.c (gdk_keyval_to_unicode, gdk_unicode_to_keyval):
Moved functions to convert keyvalues from and to unicode here from
the win32 port and made them public.
Wed Apr 5 16:37:29 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkeditable.c (gtk_editable_insert_text): Allow new_text_length == -1.
Wed Apr 5 16:27:45 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimcontext.[ch]: Base class for new input context system
* gtk/gtkimmulticontext.[ch]: Proxy input context that allows
the real input context implementation to be loaded from modules
and switched on the fly.
* gtk/gtkcontextsimple.[ch]: Simple implementation of an input
context that just does direct keysymbol => unicode translation.
* gtk/gtkentry.[ch]: Start switching editing over to using
GtkInputContext. (No handling of preedit yet.)
Wed Apr 5 15:48:41 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktypeutils.h (GTK_CHECK_GET_CLASS): Fix problem with one too
many substitutions. (klass should not be subsituted.)
Wed Apr 5 00:18:14 2000 Owen Taylor <otaylor@redhat.com>
* configure.in: Add checks for Pango
* configure.in docs/Makefile.am: Add test for sgml2html
and allow 'make dist' without building html, but print out
warnings in that case. (For making snapshots)
* gdk/Makefile.am gdk/x11/Makefile.am gtk/Makefile.am:
Add Pango libraries and C flags
* gdk/gdkdraw.c gdk/gdkdrawable.h gdkwindow.c gdk/x11/gdkdrawable-x11.c:
Add function (gdk_draw_layout) to draw a pango layout.
* gdk/gdkpango.h gdk/x11/gdkpango-x11.c: New file with functions
for getting Pango contexts for GDK.
* gtk/gtkeditable.c: Get rid of dead code gtk_editable_parent_set()
* gtk/gtkentry.[ch]: Complete rewrite to use Pango, add bidirectional
editing.
* gtk/gtkentry.c: Hack in simple Hebrew input with direct
keysym => unicode translations. More languages can be added
here, but real input-method support is needed.
* docs/Changes-1.4.txt: Added note about entry behavior.
* gtk/gtkenums.h gtk/gtkwidget.[ch] testgtk.c gtkprivate.h: Add functions
to set the reading direction for a widget and the global direction.
Add test which allows toggling the global direction. Two private
flags are used to store the direction. (GTK_DIRECTION_SET + GTK_DIRECTION_LTR)
* gtk/gtkcheckbutton.c gtk/gtkframe.c gtk/gtkhbbox.c gtk/gtkhbox.c
gtk/gtkradiobutton.c gtk/gtkspinbutton.c gtk/gtktable.c
* gtk/gtk[hv]scale.c gtk/gtkscale.[ch]: Draw numbers using Pango
* gtk/gtklabel.[ch]: Moved to Pango and considerably rewritten. Line breaking,
underlining now handled by Pango.
* gtk/gtkstyle.[ch] gtk/gtkrc.[ch]: Add a PangoFontDescription
to RCStyle and Style. (Having both this and the old font name and GdkFont
is temporary.)
* gtk/gtkwidget.[ch] (gtk_widget_create_pango_{context,layout}): Added
convenience functions for creating contexts and layouts for widgets.
* gtk/testgtk.c: Enhance label tests with multilingual labels.
2000-06-02 03:14:07 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
calendar_set_display_option (GtkCalendar *calendar,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
GtkCalendarDisplayOptions flag,
|
|
|
|
|
gboolean setting)
|
2005-05-11 19:16:19 +00:00
|
|
|
|
{
|
2010-08-12 15:14:51 +00:00
|
|
|
|
GtkCalendarPrivate *priv = calendar->priv;
|
2005-05-11 19:16:19 +00:00
|
|
|
|
GtkCalendarDisplayOptions flags;
|
2010-08-12 15:14:51 +00:00
|
|
|
|
|
|
|
|
|
if (setting)
|
|
|
|
|
flags = priv->display_flags | flag;
|
2005-05-11 19:16:19 +00:00
|
|
|
|
else
|
2010-08-12 15:14:51 +00:00
|
|
|
|
flags = priv->display_flags & ~flag;
|
2008-08-04 16:12:23 +00:00
|
|
|
|
gtk_calendar_set_display_options (calendar, flags);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
|
calendar_get_display_option (GtkCalendar *calendar,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
GtkCalendarDisplayOptions flag)
|
2005-05-11 19:16:19 +00:00
|
|
|
|
{
|
2010-08-12 15:14:51 +00:00
|
|
|
|
GtkCalendarPrivate *priv = calendar->priv;
|
|
|
|
|
|
|
|
|
|
return (priv->display_flags & flag) != 0;
|
2005-05-11 19:16:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-01-24 02:50:39 +00:00
|
|
|
|
static void
|
2005-05-11 19:16:19 +00:00
|
|
|
|
gtk_calendar_set_property (GObject *object,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
guint prop_id,
|
|
|
|
|
const GValue *value,
|
|
|
|
|
GParamSpec *pspec)
|
2005-05-11 19:16:19 +00:00
|
|
|
|
{
|
2010-08-12 15:14:51 +00:00
|
|
|
|
GtkCalendar *calendar = GTK_CALENDAR (object);
|
|
|
|
|
GtkCalendarPrivate *priv = calendar->priv;
|
2005-05-11 19:16:19 +00:00
|
|
|
|
|
2011-01-24 02:50:39 +00:00
|
|
|
|
switch (prop_id)
|
2005-05-11 19:16:19 +00:00
|
|
|
|
{
|
|
|
|
|
case PROP_YEAR:
|
|
|
|
|
gtk_calendar_select_month (calendar,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
priv->month,
|
|
|
|
|
g_value_get_int (value));
|
2005-05-11 19:16:19 +00:00
|
|
|
|
break;
|
|
|
|
|
case PROP_MONTH:
|
|
|
|
|
gtk_calendar_select_month (calendar,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
g_value_get_int (value),
|
|
|
|
|
priv->year);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
break;
|
|
|
|
|
case PROP_DAY:
|
|
|
|
|
gtk_calendar_select_day (calendar,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
g_value_get_int (value));
|
2005-05-11 19:16:19 +00:00
|
|
|
|
break;
|
|
|
|
|
case PROP_SHOW_HEADING:
|
|
|
|
|
calendar_set_display_option (calendar,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
GTK_CALENDAR_SHOW_HEADING,
|
|
|
|
|
g_value_get_boolean (value));
|
2005-05-11 19:16:19 +00:00
|
|
|
|
break;
|
|
|
|
|
case PROP_SHOW_DAY_NAMES:
|
|
|
|
|
calendar_set_display_option (calendar,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
GTK_CALENDAR_SHOW_DAY_NAMES,
|
|
|
|
|
g_value_get_boolean (value));
|
2005-05-11 19:16:19 +00:00
|
|
|
|
break;
|
|
|
|
|
case PROP_NO_MONTH_CHANGE:
|
|
|
|
|
calendar_set_display_option (calendar,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
GTK_CALENDAR_NO_MONTH_CHANGE,
|
|
|
|
|
g_value_get_boolean (value));
|
2005-05-11 19:16:19 +00:00
|
|
|
|
break;
|
|
|
|
|
case PROP_SHOW_WEEK_NUMBERS:
|
|
|
|
|
calendar_set_display_option (calendar,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
GTK_CALENDAR_SHOW_WEEK_NUMBERS,
|
|
|
|
|
g_value_get_boolean (value));
|
2005-05-11 19:16:19 +00:00
|
|
|
|
break;
|
2007-12-28 09:39:34 +00:00
|
|
|
|
case PROP_SHOW_DETAILS:
|
|
|
|
|
calendar_set_display_option (calendar,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
GTK_CALENDAR_SHOW_DETAILS,
|
|
|
|
|
g_value_get_boolean (value));
|
2007-12-28 09:39:34 +00:00
|
|
|
|
break;
|
2007-12-27 20:41:08 +00:00
|
|
|
|
case PROP_DETAIL_WIDTH_CHARS:
|
|
|
|
|
gtk_calendar_set_detail_width_chars (calendar,
|
|
|
|
|
g_value_get_int (value));
|
|
|
|
|
break;
|
|
|
|
|
case PROP_DETAIL_HEIGHT_ROWS:
|
|
|
|
|
gtk_calendar_set_detail_height_rows (calendar,
|
|
|
|
|
g_value_get_int (value));
|
|
|
|
|
break;
|
2005-05-11 19:16:19 +00:00
|
|
|
|
default:
|
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-01-24 02:50:39 +00:00
|
|
|
|
static void
|
2005-05-11 19:16:19 +00:00
|
|
|
|
gtk_calendar_get_property (GObject *object,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
guint prop_id,
|
|
|
|
|
GValue *value,
|
|
|
|
|
GParamSpec *pspec)
|
2005-05-11 19:16:19 +00:00
|
|
|
|
{
|
2007-12-27 20:41:08 +00:00
|
|
|
|
GtkCalendar *calendar = GTK_CALENDAR (object);
|
2010-08-12 15:14:51 +00:00
|
|
|
|
GtkCalendarPrivate *priv = calendar->priv;
|
2005-05-11 19:16:19 +00:00
|
|
|
|
|
2011-01-24 02:50:39 +00:00
|
|
|
|
switch (prop_id)
|
2005-05-11 19:16:19 +00:00
|
|
|
|
{
|
|
|
|
|
case PROP_YEAR:
|
2010-08-12 15:14:51 +00:00
|
|
|
|
g_value_set_int (value, priv->year);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
break;
|
|
|
|
|
case PROP_MONTH:
|
2010-08-12 15:14:51 +00:00
|
|
|
|
g_value_set_int (value, priv->month);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
break;
|
|
|
|
|
case PROP_DAY:
|
2010-08-12 15:14:51 +00:00
|
|
|
|
g_value_set_int (value, priv->selected_day);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
break;
|
|
|
|
|
case PROP_SHOW_HEADING:
|
|
|
|
|
g_value_set_boolean (value, calendar_get_display_option (calendar,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
GTK_CALENDAR_SHOW_HEADING));
|
2005-05-11 19:16:19 +00:00
|
|
|
|
break;
|
|
|
|
|
case PROP_SHOW_DAY_NAMES:
|
|
|
|
|
g_value_set_boolean (value, calendar_get_display_option (calendar,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
GTK_CALENDAR_SHOW_DAY_NAMES));
|
2005-05-11 19:16:19 +00:00
|
|
|
|
break;
|
|
|
|
|
case PROP_NO_MONTH_CHANGE:
|
|
|
|
|
g_value_set_boolean (value, calendar_get_display_option (calendar,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
GTK_CALENDAR_NO_MONTH_CHANGE));
|
2005-05-11 19:16:19 +00:00
|
|
|
|
break;
|
|
|
|
|
case PROP_SHOW_WEEK_NUMBERS:
|
|
|
|
|
g_value_set_boolean (value, calendar_get_display_option (calendar,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
GTK_CALENDAR_SHOW_WEEK_NUMBERS));
|
2005-05-11 19:16:19 +00:00
|
|
|
|
break;
|
2007-12-28 09:39:34 +00:00
|
|
|
|
case PROP_SHOW_DETAILS:
|
|
|
|
|
g_value_set_boolean (value, calendar_get_display_option (calendar,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
GTK_CALENDAR_SHOW_DETAILS));
|
2007-12-28 09:39:34 +00:00
|
|
|
|
break;
|
2007-12-27 20:41:08 +00:00
|
|
|
|
case PROP_DETAIL_WIDTH_CHARS:
|
|
|
|
|
g_value_set_int (value, priv->detail_width_chars);
|
|
|
|
|
break;
|
|
|
|
|
case PROP_DETAIL_HEIGHT_ROWS:
|
|
|
|
|
g_value_set_int (value, priv->detail_height_rows);
|
|
|
|
|
break;
|
2005-05-11 19:16:19 +00:00
|
|
|
|
default:
|
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/****************************************
|
|
|
|
|
* Realization *
|
|
|
|
|
****************************************/
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
calendar_realize_arrows (GtkCalendar *calendar)
|
|
|
|
|
{
|
|
|
|
|
GtkWidget *widget = GTK_WIDGET (calendar);
|
|
|
|
|
GtkCalendarPrivate *priv = GTK_CALENDAR_GET_PRIVATE (calendar);
|
|
|
|
|
GdkWindowAttr attributes;
|
|
|
|
|
gint attributes_mask;
|
|
|
|
|
gint i;
|
2010-10-24 05:22:13 +00:00
|
|
|
|
GtkAllocation allocation;
|
|
|
|
|
|
2010-08-12 15:14:51 +00:00
|
|
|
|
if (! (priv->display_flags & GTK_CALENDAR_NO_MONTH_CHANGE)
|
|
|
|
|
&& (priv->display_flags & GTK_CALENDAR_SHOW_HEADING))
|
1998-09-27 18:32:00 +00:00
|
|
|
|
{
|
2010-10-24 05:22:13 +00:00
|
|
|
|
gtk_widget_get_allocation (widget, &allocation);
|
|
|
|
|
|
|
|
|
|
attributes.wclass = GDK_INPUT_ONLY;
|
2005-05-11 19:16:19 +00:00
|
|
|
|
attributes.window_type = GDK_WINDOW_CHILD;
|
2010-10-24 05:22:13 +00:00
|
|
|
|
attributes.event_mask = (gtk_widget_get_events (widget)
|
|
|
|
|
| GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
|
|
|
|
|
| GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK);
|
|
|
|
|
attributes_mask = GDK_WA_X | GDK_WA_Y;
|
2005-05-11 19:16:19 +00:00
|
|
|
|
for (i = 0; i < 4; i++)
|
2011-01-24 02:50:39 +00:00
|
|
|
|
{
|
|
|
|
|
GdkRectangle rect;
|
|
|
|
|
calendar_arrow_rectangle (calendar, i, &rect);
|
|
|
|
|
|
|
|
|
|
attributes.x = allocation.x + rect.x;
|
|
|
|
|
attributes.y = allocation.y + rect.y;
|
|
|
|
|
attributes.width = rect.width;
|
|
|
|
|
attributes.height = rect.height;
|
|
|
|
|
priv->arrow_win[i] = gdk_window_new (gtk_widget_get_window (widget),
|
|
|
|
|
&attributes,
|
|
|
|
|
attributes_mask);
|
|
|
|
|
|
|
|
|
|
gdk_window_set_user_data (priv->arrow_win[i], widget);
|
|
|
|
|
}
|
2011-12-15 01:44:46 +00:00
|
|
|
|
priv->arrow_prelight = 0x0;
|
1998-09-27 18:32:00 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2005-05-11 19:16:19 +00:00
|
|
|
|
for (i = 0; i < 4; i++)
|
2011-01-24 02:50:39 +00:00
|
|
|
|
priv->arrow_win[i] = NULL;
|
1998-09-27 18:32:00 +00:00
|
|
|
|
}
|
2005-05-11 19:16:19 +00:00
|
|
|
|
}
|
Remove all references to offscreen flag which was no longer used.
Thu Jun 1 23:05:13 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Remove all references to
offscreen flag which was no longer used.
* gtk/gtkprivate.h (enum): Remove unused flags and compress.
* gtk/gtkframe.c (gtk_frame_set_label_widget): Check
for non-null label_widget->parent.
* gtk/gtkentry.c: Get rid of code to deal with PangoAttribute
which no longer was used.
* gdk/gdkpango.c (gdk_pango_context_get_info): make static.
* gdk/gdkpango.c (gdk_draw_layout[_line]): Add checks
for null arguments.
* gdk/x11/gdkgeometry-x11.c (gdk_window_scroll): add
check for destroyed windows.
Thu Jun 1 13:48:45 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimmulticontext.c: Add a finalize method and unref
the slave context there.
* gtk/gtkinvisible.[ch]: Make reference counting behavior
identical to GtkWindow.
Thu Jun 1 01:54:11 2000 Owen Taylor <otaylor@redhat.com>
* Makefile.am gdk/gdkpango.c: Copy the layout render function from
pangox to here, so we can write them independent of rendering
system, using GDK primitives.
* gdk/gdkdrawable.h gdk/gdkdraw.c gdk/gdkwindow.c
gdk/x11/gdkdrawable-x11.c: Remove draw_layout() from the vtable,
since we have a rendering-system independent implementation in
terms of draw_glyphs().
* gdk/gdkpango.c gdkdrawable.h (gdk_draw_layout_line): New
function to render a single line.
* gdk/x11/gdkpango.c: Move the guts of this file mostly
into ../gdkpango.c, which simplifies things, since we
don't have to deal with raw X gc's.
Fri May 19 04:28:16 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.[ch]: Add get_log_attrs() function to
get the logical attributes for a given GtkTextLine.
Tue May 30 16:05:39 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkfont-x11.c (gdk_font_charset_for_locale): Track
g_locale_get_codeset() to g_get_codeset() change.
Tue May 30 15:03:19 2000 Owen Taylor <otaylor@redhat.com>
* gtk/testcalendar.c (calendar_font_selection_ok): Use font
descriptions.
* gtk/gtkentry.c (gtk_entry_draw_text): Center text within
the entry.
* gtk/gtkfontsel.c (gtk_font_selection_dialog_init): Start of
redoing (vastly simplifying) for Pango. Still needs quite
a bit of work. (Size selection is currently poor. List of
predefined sizes is not a good idea, since all of these
sizes won't necessarily be distinct.)
Tue May 30 13:50:19 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkfont-x11.c (gdk_font_charset_for_locale): Handle
CODESET results for LANG=C.
Mon May 29 15:49:10 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.[ch]: Add a 'font_name' declaration to RC
which takes a stringized pango font description;
ignore the older 'font' and 'fontset' declarations.
* gtk/gtkstyle.c gtk/gtkrc.c: Fill in the style->font
field with a GdkFont derived via gdk_font_from_description(),
for compatibility. (Should we just remove it entirely?
Probably too much compatibility breakage, but people
should be migrating to the new Pango stuff as quickly
as possible.)
Mon May 29 15:47:41 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c gtk/gtkclist.c: s/pango_font_unref/g_object_unref/.
Mon May 29 15:44:46 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcalender.c: Roughly pango-ized. Really needs
redoing; there are some bugs in size allocation right
now, the semi-existant distinction between header / day
fonts was removed, but, with Pango, could actually
be made functional in a nice way.
* gtk/testcalender: Move calender from examples into this
directory as a test program. (We really need to restrcture
testgtk into a whole directory full of tests for every
widget or functionality group, separated into multiple .c
files.)
Mon May 29 15:19:56 2000 Owen Taylor <otaylor@redhat.com>
* gtk/testgtk.c (file_exists): Fix stupid typo that
was keeping RC file from being loaded.
* gtk/testgtkrc gtk/testgtkrc2: Test new pango-ized
RC file font code.
Mon May 29 14:31:27 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkfont.h gdk/x11/gdkfont-x11.c (gdk_font_from_description):
Add function to load a GdkFont from a PangoFontDescription.
Fri May 26 17:16:40 2000 Owen Taylor <otaylor@redhat.com>
* gtk/frame.[ch] gtkaspectframe.c: Make frame widgets able
to have any widget for the label, use a GtkLabel widget
to display the text. (Based partially on a patch from
Anders Carlson.)
(Quite a bit of code reorganization - strip 90% of the
guts out of gtkaspectframe and add a single virtual
func to GtkFrameClass - compute_child_allocation.)
Fri May 26 12:00:02 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkctree.c gtk/gtkclist.[ch]: Pangoized.
(Removed clist->row_center_offset field because caching
it wasn't saving time or code, added private function
_gtk_clist_create_cell_layout()).
Wed May 24 15:59:37 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkaccellabel.c: Pangoized.
* gtk/[hv]ruler.c: Pangoized
Mon May 22 19:23:59 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c (gtk_file_selection_init):
Use gtk_clist_set_column_auto_resize() to remove need
need for manual column width computations.
Mon May 22 18:50:26 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktooltips.[ch]: Replace custom drawing with a GtkLabel,
ensuring Pango correctness, and considerably simplifying the
code.
* gtk/gtklabel.c gtk[hv]scale.c: 1000 => PANGO_SCALE.
* gtk/gtklabel.c (gtk_label_size_request): Fixed incorrect
getting of numbers of lines.
* gtk/gtklabel.c (gtk_label_size_request): Set the requisition
to the actual requested width of the lable, not to the wrap
width we set.
* gtk/gtktextchild.h: Remove extraneous include of gtk/gtk.h.
* gtk/gtktextbtree.c gtk/gtktextbuffer.c gtk/gtktextlayout.c
gtk/gtktextview.c gtk/gtktextview.[ch]: Fix up includes.
* gtk/gtktextview.c: Fix structure inheritance.
* gtk/gtkprogressbar.c: Pangoize.
Mon May 22 15:47:30 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextview.c (gtk_text_view_get_first_para_iter): Encapsulate
in a function.
* gtk/gtktextlayout.c (find_display_line_above): Fixed
bug with computing line tops.
* gtk/gtktextview.c (changed_handler): Fix < , <= confusion.
Thu May 18 18:53:31 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextdisplay.c (gtk_text_layout_draw): Fix up the x_offset
and y_offset coordinates to do what we need now. (The offset between
buffer and layout coordinates has been reintroduced, but is a
bit different than before.)
* gtk/gtktextview.[ch]: No longer inherit from GtkLayout; instead
handle the adjustments ourselves, and scroll as necessary using
the new gdk_window_scroll().
The advantage of this is that when we are incrementally revalidating,
we are essentially rearranging things around the visible portion
of the screen. With the old setup, the visible portion of the
screen was moved around in the layout, so scrolling and redrawing
to track that caused jumping of the display. Since we now
control the scrolling ourselves, we can suppress this and
only redraw when things actually change.
Thu May 18 18:47:25 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextbtree.c (redisplay_mark): We need to invalidate
the region not just redisplay it after-all, since we store the
cursors in the LineDisplay. (Ugly interactions here between
GtkLayout and GtkTextBTree here.)
* gtk/gtktextbtree.c (redisplay_region): Fixed reversed comparison.
Thu May 18 18:43:21 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.h gdk/x11/gdkgeometry-x11.c (gdk_window_scroll):
Added function to scroll contents of a window while keeping the
window constant. Works by XCopyArea or guffaw-scrolling depending
on the details of how the window is set up. (guffaw-scrolling
still needs to be filled in.)
Wed May 17 22:36:53 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextiter.c gtk/gtkmain.c: Add a debug key for the text widget,
move the debugging that was tied to a global variable
to that.
* gtk/gtkmarshal.list: Add NONE:INT,INT,INT
* gtk/gtktextbtree.[ch] gtk/gtktextlayout.c: Keep a separate
validated flag, in line data instead of setting height/width to
-1. This allows us to perform operations with partially invalid
buffer (using the old size for invalid lines) and thus to do
incremental vaidation. Keep height/width aggregates up to date
when deleting text and rebalancing the tree.
* gtk/gtktextbtree.[ch]: Add functions validate a line
(gtk_text_btree_validate_line), and to validate up
to a number of pixels (gtk_text_btree_validate).
* gtk/gtktextlayout.[ch]: Add an ::invalidated signal
that indicates that something is changed and a revalidation
pass is needed. Change ::need_repaint to ::changed, and
make it take old and new yranges instead of a rectangle.
* gtk/gtktextbtree.[ch] gtk/gtktextlayout.[ch]: Move
the line_data_destroy() function from
gtk_text_btree_add_view() to a virtual function in
GtkTextLayout
* gtk/gtktextbtree.[ch]: Remove gtk_text_btree_get_damage_range(),
since we are handling partial repaints in a different fashion
now.
* gtk/gtktextbtree.[ch]: Only repaint the changed portion
of the selection instead of queueing a repaint on the
entire widget.
* gtk/gtktextbuffer.[ch] gtk/gtktextbtree.[ch]: Move
get_selection_bounds() down to btree, make the function
in buffer a wrapper around the btree function.
* gtk/gtktextlayout.[ch]: Add functions to check if the
layout is valid and to recompute either a range of pixels
aroudn a line or a certain total number of pixels.
* gtk/gtktextlayout.[ch]: Cache a single line display;
now that we only redraw the needed portions, the hit rate
for this cache is quite high.
* gtk/gtktextview.[ch]: Keep track of the first paragraph
on the screen so that when re-laying-out the buffer, we can
keep the same place. This requires connecting to ::value_changed
on the adjustments
* gtk/gtktextview.[ch]: Add idle functions to revalidate
the buffer after we receive an ::invalidated signal.
Wed May 17 22:10:47 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.c (gtk_layout_size_allocate): Set upper
to max of allocation and layout size, not just to the
layout size.
* gtk/gtk[hv]scrollbar.c (gtk_[hv]scrollbar_calc_slider_size):
Invalidate window so it gets redrawn properly.
* gdk/gdkwindow.c (gdk_window_invalidate_rect): Allow rect == NULL
to mean the entire window.
* gdk/gdkevents.h: Move definition for GDK_PRIORITY_REDRAW
into public header.
Mon May 15 14:51:31 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextmark.c (gtk_text_mark_get_name): Add function
to get the name of a mark.
* gtk/gtktextlayout.c (gtk_text_layout_get_line_at_y): Add a function
to find the paragraph from a y position.
Thu May 11 12:57:20 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextbtree.c (gtk_text_btree_node_invalidate_upward): Valid
nodes have width/height >= 0, not > 0.
Tue May 9 21:29:06 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.[ch] gtk/gtktextdisplay.c (gtk_text_layout_get_line_display):
Add a size_only flag, so when we only need the size, we don't create
useless appearance attributes.
* gtk/gtktextview.c (gtk_text_view_ensure_layout): Remove
duplicate setting of font description.
* gtk/gtkscale.c: Use PANGO_SCALE instead of 1000
Wed Apr 26 01:53:23 2000 Owen Taylor <otaylor@redhat.com>
* gtk/Makefile.am (EXTRA_DIST): Add OLD_STAMP into
EXTRA_DIST. It does not work well when the file that
everything depends on is not in the tarball.
Wed Apr 26 00:56:14 2000 Owen Taylor <otaylor@redhat.com>
* gtk/testgtk.c: Some hacks and fixes so that it basically
works when not sitting in the GTK+ build tree.
2000-05-03 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (gtk_text_line_next_could_contain_tag):
Properly determine the ordering of the tag root and the current
line within the tree. Previous algorithm only worked if the tag
root's immediate parent was the common root of both the current
line and the tag root.
Wed Apr 26 00:43:00 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.c (set_para_values): Fix some bugs in
alignment.
* gtk/gtktextview.c (gtk_text_view_ensure_layout): Track
the widget text directional dynamically.
* gtk/gtktextview.[ch]: Added functions to get and set default
wrap mode.
Tue Apr 25 23:47:38 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.c (gtk_text_layout_get_iter_location): Fix bug
in cursor location computation.
Tue Apr 25 23:22:59 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.c (gtk_layout_set_size): Clamp hadjustment/
vadjusment values properly when layout gets smaller.
* gtk/gtktextview.c (need_repaint_handler): Areas being
passed in are far completely inaccurate, and sometimes
too small, so, for now, just queue a redraw on the
whole visible region.
2000-04-25 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (summary_destroy): new function to
destroy tag summary nodes
(gtk_text_line_next_could_contain_tag): this function was
totally broken if the line passed in wasn't below the tag
root. Fix it.
(gtk_text_btree_first_could_contain_tag): In the tag == NULL
"wildcard" case, we have to do a linear scan. Blah.
(gtk_text_btree_last_could_contain_tag): In tag == NULL case,
we have to do the linear scan
(tag_removed_cb): When a tag is removed from the tag table,
remove the GtkTextTagInfo node from the btree.
(gtk_text_btree_spew): Implement the spew function, for
our debugging pleasure.
Tue Apr 25 19:40:18 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.c (gtk_text_layout_set_buffer): Fix
a problem with referring to the wrong buffer.
* gtk/gtkentry.c: Fix focus-in/focus-out confusion.
* gtk/gtkrc.c gtk/gtkstyle.c: Moving setting default
font description to gtk_style_new() - otherwise things
don't work without a .gtkrc file.
* gtk/gtktextbuffer.c (gtk_text_buffer_new): Sink the
tags table if we create it ourself, too.
* gdk/gdktypes.h (enum): Move GDK_RELEASE_MASK, since
it was conflicting with XKB modifiers.
* gtk/gtktextview.[ch]: Add simple support for
GtkIMContext.
Mon Apr 24 19:34:18 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_move_cursor_visually): Fix problem
with deletion from last commit.
Mon Apr 24 19:29:40 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_create_pango_context): Set the language
in the context from the current locale.
* gtk/gtkentry.c (gtk_entry_size_request): Use language from the
context, not hardcoded value.
* gtk/gtkentry.c (gtk_entry_move_cursor): Make character movement visual,
not logical.
Sun Apr 23 23:39:18 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c gtk/gtktextdisplay.c: Don't handle selections as
attributes - that doesn't handle partial-glyph selection
properly. Instead use new pango_layout_line_get_x_ranges()
functionality to draw the selection.
* gtk/gtkentry.c: Simplify code since pango_layout_line_index_to_x()
now properly handles out-of-range coordinates.
* gtk/gtktextbuffer.c: Emit "mark_set" when the cursor is moved.
* gtk/gtktextiter.h gtk/gtktextiterprivate.h: Make gtk_text_iter_get_line_byte()
public.
* gtk/gtktextlayout.[ch]: Properly set the direction in the PangoContext
for paragraphs opposite to the base direction of the widget.
* gtk/gtktextlayout.[ch] gtk/gtktextdisplay.c: Fixes for alignment.
* gtk/gtktextlayout.c: Don't split segments on marks, since that
causes Arabic words to reshape as you cursor through.
* gtk/gtktextlayout.[ch] gtk/gtktextview.[ch]: Implement virtual
cursor position when moving vertically with the arrow keys and
scrolling with page-up/page-down. (Arrow keys save only the X,
scrolling saves both X and Y.)
This means you can line-up / line-down or page-up / page-down
without losing your place, and also that moving vertically
with the cursor keys keeps the same X position, not the same
character count:
* gtk/gtktextlayout.[ch] gtk/gtktextview.[ch]: Make vertical
arrow keys move by display lines, not paragraphs.
Tue Apr 18 14:16:50 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.c: Make sure that the bin window is at least
as big as the allocation. (Should we also make sure that the
bin window is big enough to completely cover widget->window?)
* gtk/gtktextview.c (gtk_text_view_get_visible_rect): Add
function to get the onscreen rectangle.
* gdk/x11/gdkwindow-x11.c (gdk_window_get_pointer): Correctly account
for offsets in window coordinates.
Sun Apr 16 16:13:27 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_get_cursor_locations): Fix index/offset
confusion.
* gtk/gtktextview.c (gtk_text_view_ensure_layout): Set the default direction
from the widget direction.
* gtk/gtktexttag.c gtk/gtktexttagprivate.h (gtk_text_tag_set_arg):
Add a "direction" attribute.
* gtk/gtktextview.c: global s/tkxt/text_view/.
* gtk/testtext.c: Added long block of text in Arabic, to test out
the direction attributes. (Some problems with the shaping system
for arabic become obvious - like the fact the cursor splits words
into unjoined pieces.)
Fri Apr 14 12:54:34 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextdisplay.c (render_layout): Add overstrike handling.
* gtk/gtktextlayout.c: Fix up alignment.
* gtk/testtext.c: Add some tests for centering, wrapping.
Fri Apr 14 09:26:22 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkdrawable.h gdk/gdkdraw.c gdk/gdkwindow.c gdk/x11/gdkdrawable-x11.c:
Add a draw_glyphs() operation to the drawable vtable and gdk_draw_glyphs().
If we wrote GTK+-specific layout-render function this could just replace
the draw_layout() operation in the vtable.
* gtk/gtkentry.c: Move guts of gtk_entry_get_cursor_locations to
pango_layout_get_cursor_pos() and use that function.
* gtk/gtktextchild.[ch]: add gtk_ onto pixmap_segment_new(), since it
is a non-static symbol.
* gtk/gtktextbtree.[ch]: Replace gtk_text_btree_find_line_data_by_y()
with gtk_text_btree_find_line_by_y()
* gtk/gtktextdisplay.c: Rewrote for Pango - uses a custom layout
renderer that handles GtkTextAppearance attributes.
* gtk/gtktexttag.[ch] gtk/gtktexttagprivate.h:
- Move the values in the style that don't affect geometry into a
GtkTextAppearance structure.
- Change underline to take a PangoUnderline and "font" a string
representation of a font description
- Add a "font_desc" attribute which takes a FontDescription structure.
* gtk/gtktextlayout.[ch]:
- Get rid of the display-line list per each line. Instead, we
generate, on demand, a GtkTextLineDisplay structure which]
contains a PangoLayout * and other necesary information
(offsets, cursor locations) for displaying a paragraph.
- Get rid of the code to wrap lines, create display chunks,
etc. Instead, we just go through a paragraph and convert
it into the necessary inputs to a PangoLayout.
- Implement a new attribute type, GtkTextAttrAppearance. This
holds a GtkTextAppearance, and is used to pass colors,
stipple, etc, through from the layout to the display without
having to use lots and lots of individual attributes.
- Reimplement gtk_layout_get_iter_at_pixel() gtk_layout_get_iter_pos()
in terms of PangoLayout functions.
* gtk/gtktextview.c:
- Handle passing the necessary PangoContext to the layout
- Some fixups in painting to deal with the automatic backing store
and offsetting of GTK+-1.4
- Add a style_set handler so that the default style reacts
properly to theme changes.
* gtk/gtktext?*.[ch]: Random code-style fixes.
* gtk/testtext.c: Substitute in languages that Pango handles now for Thai
Mon Apr 10 10:33:45 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktext?*.[ch]: Check in Havoc's port of the Tk text widget,
in original form preparatory to Pango-ization and gdkimcontext-ization.
Thu Apr 6 19:25:39 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimcontext.c: Move default implementations to real_* vfuncs,
so that we can derive from gtkimcontext in language bindings properly.
Thu Apr 6 16:02:52 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimcontextsimple.[ch]: Use gdk_keyval_to_unicode to gdk_unicode_to_keyval.
Add a compose table including (almost) all the compose combinations
from X. This is 6k of static, shared data as opposed to 50k or so of dynamic
data in the XIM implementation.
* gdk/gdk.h gdk/gdkkeyuni.c gdk/win32/gdkevents-win32.c (gdk_keyval_to_unicode, gdk_unicode_to_keyval):
Moved functions to convert keyvalues from and to unicode here from
the win32 port and made them public.
Wed Apr 5 16:37:29 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkeditable.c (gtk_editable_insert_text): Allow new_text_length == -1.
Wed Apr 5 16:27:45 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimcontext.[ch]: Base class for new input context system
* gtk/gtkimmulticontext.[ch]: Proxy input context that allows
the real input context implementation to be loaded from modules
and switched on the fly.
* gtk/gtkcontextsimple.[ch]: Simple implementation of an input
context that just does direct keysymbol => unicode translation.
* gtk/gtkentry.[ch]: Start switching editing over to using
GtkInputContext. (No handling of preedit yet.)
Wed Apr 5 15:48:41 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktypeutils.h (GTK_CHECK_GET_CLASS): Fix problem with one too
many substitutions. (klass should not be subsituted.)
Wed Apr 5 00:18:14 2000 Owen Taylor <otaylor@redhat.com>
* configure.in: Add checks for Pango
* configure.in docs/Makefile.am: Add test for sgml2html
and allow 'make dist' without building html, but print out
warnings in that case. (For making snapshots)
* gdk/Makefile.am gdk/x11/Makefile.am gtk/Makefile.am:
Add Pango libraries and C flags
* gdk/gdkdraw.c gdk/gdkdrawable.h gdkwindow.c gdk/x11/gdkdrawable-x11.c:
Add function (gdk_draw_layout) to draw a pango layout.
* gdk/gdkpango.h gdk/x11/gdkpango-x11.c: New file with functions
for getting Pango contexts for GDK.
* gtk/gtkeditable.c: Get rid of dead code gtk_editable_parent_set()
* gtk/gtkentry.[ch]: Complete rewrite to use Pango, add bidirectional
editing.
* gtk/gtkentry.c: Hack in simple Hebrew input with direct
keysym => unicode translations. More languages can be added
here, but real input-method support is needed.
* docs/Changes-1.4.txt: Added note about entry behavior.
* gtk/gtkenums.h gtk/gtkwidget.[ch] testgtk.c gtkprivate.h: Add functions
to set the reading direction for a widget and the global direction.
Add test which allows toggling the global direction. Two private
flags are used to store the direction. (GTK_DIRECTION_SET + GTK_DIRECTION_LTR)
* gtk/gtkcheckbutton.c gtk/gtkframe.c gtk/gtkhbbox.c gtk/gtkhbox.c
gtk/gtkradiobutton.c gtk/gtkspinbutton.c gtk/gtktable.c
* gtk/gtk[hv]scale.c gtk/gtkscale.[ch]: Draw numbers using Pango
* gtk/gtklabel.[ch]: Moved to Pango and considerably rewritten. Line breaking,
underlining now handled by Pango.
* gtk/gtkstyle.[ch] gtk/gtkrc.[ch]: Add a PangoFontDescription
to RCStyle and Style. (Having both this and the old font name and GdkFont
is temporary.)
* gtk/gtkwidget.[ch] (gtk_widget_create_pango_{context,layout}): Added
convenience functions for creating contexts and layouts for widgets.
* gtk/testgtk.c: Enhance label tests with multilingual labels.
2000-06-02 03:14:07 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
static void
|
2010-10-24 05:22:13 +00:00
|
|
|
|
calendar_unrealize_arrows (GtkCalendar *calendar)
|
2005-05-11 19:16:19 +00:00
|
|
|
|
{
|
|
|
|
|
GtkCalendarPrivate *priv = GTK_CALENDAR_GET_PRIVATE (calendar);
|
2010-10-24 05:22:13 +00:00
|
|
|
|
gint i;
|
2010-08-11 21:17:18 +00:00
|
|
|
|
|
2010-10-24 05:22:13 +00:00
|
|
|
|
for (i = 0; i < 4; i++)
|
1998-10-04 23:07:04 +00:00
|
|
|
|
{
|
2010-10-24 05:22:13 +00:00
|
|
|
|
if (priv->arrow_win[i])
|
|
|
|
|
{
|
|
|
|
|
gdk_window_set_user_data (priv->arrow_win[i], NULL);
|
|
|
|
|
gdk_window_destroy (priv->arrow_win[i]);
|
|
|
|
|
priv->arrow_win[i] = NULL;
|
|
|
|
|
}
|
1998-10-04 23:07:04 +00:00
|
|
|
|
}
|
2010-10-24 05:22:13 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-08-03 15:45:14 +00:00
|
|
|
|
static gint
|
|
|
|
|
calendar_get_inner_border (GtkCalendar *calendar)
|
|
|
|
|
{
|
|
|
|
|
gint inner_border;
|
|
|
|
|
|
|
|
|
|
gtk_widget_style_get (GTK_WIDGET (calendar),
|
|
|
|
|
"inner-border", &inner_border,
|
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
|
|
return inner_border;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gint
|
|
|
|
|
calendar_get_xsep (GtkCalendar *calendar)
|
|
|
|
|
{
|
|
|
|
|
gint xsep;
|
|
|
|
|
|
|
|
|
|
gtk_widget_style_get (GTK_WIDGET (calendar),
|
|
|
|
|
"horizontal-separation", &xsep,
|
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
|
|
return xsep;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gint
|
|
|
|
|
calendar_get_ysep (GtkCalendar *calendar)
|
|
|
|
|
{
|
|
|
|
|
gint ysep;
|
|
|
|
|
|
|
|
|
|
gtk_widget_style_get (GTK_WIDGET (calendar),
|
|
|
|
|
"vertical-separation", &ysep,
|
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
|
|
return ysep;
|
|
|
|
|
}
|
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_calendar_realize (GtkWidget *widget)
|
|
|
|
|
{
|
|
|
|
|
GtkCalendarPrivate *priv = GTK_CALENDAR_GET_PRIVATE (widget);
|
|
|
|
|
GdkWindowAttr attributes;
|
|
|
|
|
gint attributes_mask;
|
2010-10-24 05:22:13 +00:00
|
|
|
|
gint inner_border = calendar_get_inner_border (GTK_CALENDAR (widget));
|
2011-01-10 19:40:37 +00:00
|
|
|
|
GtkStyleContext *context;
|
2010-10-24 05:22:13 +00:00
|
|
|
|
GtkAllocation allocation;
|
2011-01-10 19:40:37 +00:00
|
|
|
|
GtkStateFlags state = 0;
|
|
|
|
|
GtkBorder padding;
|
|
|
|
|
|
|
|
|
|
context = gtk_widget_get_style_context (widget);
|
|
|
|
|
state = gtk_widget_get_state_flags (widget);
|
|
|
|
|
gtk_style_context_get_padding (context, state, &padding);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
|
2010-08-11 21:17:18 +00:00
|
|
|
|
gtk_widget_get_allocation (widget, &allocation);
|
|
|
|
|
|
2010-10-24 05:22:13 +00:00
|
|
|
|
GTK_WIDGET_CLASS (gtk_calendar_parent_class)->realize (widget);
|
2010-08-11 21:17:18 +00:00
|
|
|
|
|
2010-10-24 05:22:13 +00:00
|
|
|
|
attributes.wclass = GDK_INPUT_ONLY;
|
2005-05-11 19:16:19 +00:00
|
|
|
|
attributes.window_type = GDK_WINDOW_CHILD;
|
2010-10-24 05:22:13 +00:00
|
|
|
|
attributes.event_mask = (gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK
|
|
|
|
|
| GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
|
|
|
|
|
| GDK_POINTER_MOTION_MASK | GDK_LEAVE_NOTIFY_MASK);
|
|
|
|
|
|
|
|
|
|
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR)
|
2011-01-10 19:40:37 +00:00
|
|
|
|
attributes.x = priv->week_width + padding.left + inner_border;
|
2008-09-06 21:31:30 +00:00
|
|
|
|
else
|
2011-01-10 19:40:37 +00:00
|
|
|
|
attributes.x = padding.left + inner_border;
|
2010-08-11 21:17:18 +00:00
|
|
|
|
|
2011-01-10 19:40:37 +00:00
|
|
|
|
attributes.y = priv->header_h + priv->day_name_h + padding.top + inner_border;
|
|
|
|
|
attributes.width = allocation.width - attributes.x - (padding.right + inner_border);
|
2008-09-06 21:31:30 +00:00
|
|
|
|
|
|
|
|
|
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
|
|
|
|
|
attributes.width -= priv->week_width;
|
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
attributes.height = priv->main_h;
|
2010-10-24 05:22:13 +00:00
|
|
|
|
attributes_mask = GDK_WA_X | GDK_WA_Y;
|
|
|
|
|
|
|
|
|
|
attributes.x += allocation.x;
|
|
|
|
|
attributes.y += allocation.y;
|
|
|
|
|
|
|
|
|
|
priv->main_win = gdk_window_new (gtk_widget_get_window (widget),
|
|
|
|
|
&attributes, attributes_mask);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
gdk_window_set_user_data (priv->main_win, widget);
|
2010-10-24 05:22:13 +00:00
|
|
|
|
|
|
|
|
|
calendar_realize_arrows (GTK_CALENDAR (widget));
|
2005-05-11 19:16:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gtk_calendar_unrealize (GtkWidget *widget)
|
|
|
|
|
{
|
|
|
|
|
GtkCalendarPrivate *priv = GTK_CALENDAR_GET_PRIVATE (widget);
|
2010-10-24 05:22:13 +00:00
|
|
|
|
|
|
|
|
|
calendar_unrealize_arrows (GTK_CALENDAR (widget));
|
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
if (priv->main_win)
|
|
|
|
|
{
|
|
|
|
|
gdk_window_set_user_data (priv->main_win, NULL);
|
|
|
|
|
gdk_window_destroy (priv->main_win);
|
2010-10-24 05:22:13 +00:00
|
|
|
|
priv->main_win = NULL;
|
2005-05-11 19:16:19 +00:00
|
|
|
|
}
|
2008-08-12 09:06:34 +00:00
|
|
|
|
|
2008-08-12 09:44:32 +00:00
|
|
|
|
GTK_WIDGET_CLASS (gtk_calendar_parent_class)->unrealize (widget);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-12-20 22:07:20 +00:00
|
|
|
|
static void
|
|
|
|
|
calendar_map_arrows (GtkCalendar *calendar)
|
|
|
|
|
{
|
|
|
|
|
GtkCalendarPrivate *priv = GTK_CALENDAR_GET_PRIVATE (calendar);
|
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 4; i++)
|
|
|
|
|
{
|
|
|
|
|
if (priv->arrow_win[i])
|
|
|
|
|
gdk_window_show (priv->arrow_win[i]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
calendar_unmap_arrows (GtkCalendar *calendar)
|
|
|
|
|
{
|
|
|
|
|
GtkCalendarPrivate *priv = GTK_CALENDAR_GET_PRIVATE (calendar);
|
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 4; i++)
|
|
|
|
|
{
|
|
|
|
|
if (priv->arrow_win[i])
|
|
|
|
|
gdk_window_hide (priv->arrow_win[i]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gtk_calendar_map (GtkWidget *widget)
|
|
|
|
|
{
|
|
|
|
|
GtkCalendarPrivate *priv = GTK_CALENDAR_GET_PRIVATE (widget);
|
|
|
|
|
|
|
|
|
|
GTK_WIDGET_CLASS (gtk_calendar_parent_class)->map (widget);
|
|
|
|
|
|
|
|
|
|
gdk_window_show (priv->main_win);
|
|
|
|
|
|
|
|
|
|
calendar_map_arrows (GTK_CALENDAR (widget));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gtk_calendar_unmap (GtkWidget *widget)
|
|
|
|
|
{
|
|
|
|
|
GtkCalendarPrivate *priv = GTK_CALENDAR_GET_PRIVATE (widget);
|
|
|
|
|
|
|
|
|
|
calendar_unmap_arrows (GTK_CALENDAR (widget));
|
|
|
|
|
|
|
|
|
|
gdk_window_hide (priv->main_win);
|
|
|
|
|
|
|
|
|
|
GTK_WIDGET_CLASS (gtk_calendar_parent_class)->unmap (widget);
|
|
|
|
|
}
|
|
|
|
|
|
2008-01-17 16:42:04 +00:00
|
|
|
|
static gchar*
|
2007-12-28 09:26:20 +00:00
|
|
|
|
gtk_calendar_get_detail (GtkCalendar *calendar,
|
|
|
|
|
gint row,
|
|
|
|
|
gint column)
|
|
|
|
|
{
|
|
|
|
|
GtkCalendarPrivate *priv = GTK_CALENDAR_GET_PRIVATE (calendar);
|
|
|
|
|
gint year, month;
|
|
|
|
|
|
2010-02-09 02:18:13 +00:00
|
|
|
|
if (priv->detail_func == NULL)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
2010-08-12 15:14:51 +00:00
|
|
|
|
year = priv->year;
|
|
|
|
|
month = priv->month + priv->day_month[row][column] - MONTH_CURRENT;
|
2007-12-28 09:26:20 +00:00
|
|
|
|
|
|
|
|
|
if (month < 0)
|
|
|
|
|
{
|
|
|
|
|
month += 12;
|
|
|
|
|
year -= 1;
|
|
|
|
|
}
|
|
|
|
|
else if (month > 11)
|
|
|
|
|
{
|
|
|
|
|
month -= 12;
|
|
|
|
|
year += 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return priv->detail_func (calendar,
|
|
|
|
|
year, month,
|
2010-08-12 15:14:51 +00:00
|
|
|
|
priv->day[row][column],
|
2007-12-28 09:26:20 +00:00
|
|
|
|
priv->detail_func_user_data);
|
|
|
|
|
}
|
|
|
|
|
|
2007-12-28 09:36:06 +00:00
|
|
|
|
static gboolean
|
|
|
|
|
gtk_calendar_query_tooltip (GtkWidget *widget,
|
|
|
|
|
gint x,
|
|
|
|
|
gint y,
|
|
|
|
|
gboolean keyboard_mode,
|
|
|
|
|
GtkTooltip *tooltip)
|
|
|
|
|
{
|
|
|
|
|
GtkCalendarPrivate *priv = GTK_CALENDAR_GET_PRIVATE (widget);
|
|
|
|
|
GtkCalendar *calendar = GTK_CALENDAR (widget);
|
2008-01-17 16:42:04 +00:00
|
|
|
|
gchar *detail = NULL;
|
2007-12-28 09:36:06 +00:00
|
|
|
|
GdkRectangle day_rect;
|
2010-10-24 05:22:13 +00:00
|
|
|
|
gint row, col;
|
2007-12-28 09:36:06 +00:00
|
|
|
|
|
2010-10-24 05:22:13 +00:00
|
|
|
|
col = calendar_column_from_x (calendar, x);
|
|
|
|
|
row = calendar_row_from_y (calendar, y);
|
2007-12-28 09:36:06 +00:00
|
|
|
|
|
2010-10-24 05:22:13 +00:00
|
|
|
|
if (col != -1 && row != -1 &&
|
|
|
|
|
(0 != (priv->detail_overflow[row] & (1 << col)) ||
|
|
|
|
|
0 == (priv->display_flags & GTK_CALENDAR_SHOW_DETAILS)))
|
|
|
|
|
{
|
|
|
|
|
detail = gtk_calendar_get_detail (calendar, row, col);
|
|
|
|
|
calendar_day_rectangle (calendar, row, col, &day_rect);
|
2007-12-28 09:36:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (detail)
|
|
|
|
|
{
|
|
|
|
|
gtk_tooltip_set_tip_area (tooltip, &day_rect);
|
|
|
|
|
gtk_tooltip_set_markup (tooltip, detail);
|
|
|
|
|
|
2008-01-17 16:42:04 +00:00
|
|
|
|
g_free (detail);
|
|
|
|
|
|
2007-12-28 09:36:06 +00:00
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (GTK_WIDGET_CLASS (gtk_calendar_parent_class)->query_tooltip)
|
|
|
|
|
return GTK_WIDGET_CLASS (gtk_calendar_parent_class)->query_tooltip (widget, x, y, keyboard_mode, tooltip);
|
|
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
|
|
|
|
|
/****************************************
|
|
|
|
|
* Size Request and Allocate *
|
|
|
|
|
****************************************/
|
|
|
|
|
|
|
|
|
|
static void
|
2011-01-24 02:50:39 +00:00
|
|
|
|
gtk_calendar_size_request (GtkWidget *widget,
|
|
|
|
|
GtkRequisition *requisition)
|
2005-05-11 19:16:19 +00:00
|
|
|
|
{
|
|
|
|
|
GtkCalendar *calendar = GTK_CALENDAR (widget);
|
|
|
|
|
GtkCalendarPrivate *priv = GTK_CALENDAR_GET_PRIVATE (widget);
|
2011-01-10 19:40:37 +00:00
|
|
|
|
GtkStyleContext *context;
|
|
|
|
|
GtkStateFlags state;
|
|
|
|
|
GtkBorder padding;
|
2005-05-11 19:16:19 +00:00
|
|
|
|
PangoLayout *layout;
|
|
|
|
|
PangoRectangle logical_rect;
|
|
|
|
|
|
|
|
|
|
gint height;
|
2007-12-28 09:26:20 +00:00
|
|
|
|
gint i, r, c;
|
2005-05-11 19:16:19 +00:00
|
|
|
|
gint calendar_margin = CALENDAR_MARGIN;
|
|
|
|
|
gint header_width, main_width;
|
|
|
|
|
gint max_header_height = 0;
|
|
|
|
|
gint focus_width;
|
|
|
|
|
gint focus_padding;
|
2007-12-28 22:11:35 +00:00
|
|
|
|
gint max_detail_height;
|
2010-08-03 15:45:14 +00:00
|
|
|
|
gint inner_border = calendar_get_inner_border (calendar);
|
|
|
|
|
gint calendar_ysep = calendar_get_ysep (calendar);
|
|
|
|
|
gint calendar_xsep = calendar_get_xsep (calendar);
|
2007-12-28 22:11:35 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
gtk_widget_style_get (GTK_WIDGET (widget),
|
2011-01-24 02:50:39 +00:00
|
|
|
|
"focus-line-width", &focus_width,
|
|
|
|
|
"focus-padding", &focus_padding,
|
|
|
|
|
NULL);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
|
|
|
|
|
layout = gtk_widget_create_pango_layout (widget, NULL);
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
/*
|
2011-01-24 02:50:39 +00:00
|
|
|
|
* Calculate the requisition width for the widget.
|
2005-05-11 19:16:19 +00:00
|
|
|
|
*/
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
/* Header width */
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
2010-08-12 15:14:51 +00:00
|
|
|
|
if (priv->display_flags & GTK_CALENDAR_SHOW_HEADING)
|
2005-05-11 19:16:19 +00:00
|
|
|
|
{
|
|
|
|
|
priv->max_month_width = 0;
|
|
|
|
|
for (i = 0; i < 12; i++)
|
2011-01-24 02:50:39 +00:00
|
|
|
|
{
|
|
|
|
|
pango_layout_set_text (layout, default_monthname[i], -1);
|
|
|
|
|
pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
|
|
|
|
|
priv->max_month_width = MAX (priv->max_month_width,
|
|
|
|
|
logical_rect.width + 8);
|
|
|
|
|
max_header_height = MAX (max_header_height, logical_rect.height);
|
|
|
|
|
}
|
2005-06-12 06:59:43 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
priv->max_year_width = 0;
|
2005-06-12 06:59:43 +00:00
|
|
|
|
/* Translators: This is a text measurement template.
|
2008-10-27 01:42:28 +00:00
|
|
|
|
* Translate it to the widest year text
|
2005-06-12 06:59:43 +00:00
|
|
|
|
*
|
|
|
|
|
* If you don't understand this, leave it as "2000"
|
|
|
|
|
*/
|
2011-01-24 02:50:39 +00:00
|
|
|
|
pango_layout_set_text (layout, C_("year measurement template", "2000"), -1);
|
2005-06-12 06:59:43 +00:00
|
|
|
|
pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
|
|
|
|
|
priv->max_year_width = MAX (priv->max_year_width,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
logical_rect.width + 8);
|
|
|
|
|
max_header_height = MAX (max_header_height, logical_rect.height);
|
|
|
|
|
}
|
|
|
|
|
else
|
2005-05-11 19:16:19 +00:00
|
|
|
|
{
|
|
|
|
|
priv->max_month_width = 0;
|
|
|
|
|
priv->max_year_width = 0;
|
|
|
|
|
}
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
2010-08-12 15:14:51 +00:00
|
|
|
|
if (priv->display_flags & GTK_CALENDAR_NO_MONTH_CHANGE)
|
2011-01-24 02:50:39 +00:00
|
|
|
|
header_width = (priv->max_month_width
|
|
|
|
|
+ priv->max_year_width
|
|
|
|
|
+ 3 * 3);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
else
|
2011-01-24 02:50:39 +00:00
|
|
|
|
header_width = (priv->max_month_width
|
|
|
|
|
+ priv->max_year_width
|
|
|
|
|
+ 4 * priv->arrow_width + 3 * 3);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
|
|
|
|
|
/* Mainwindow labels width */
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
priv->max_day_char_width = 0;
|
2006-01-26 20:40:18 +00:00
|
|
|
|
priv->max_day_char_ascent = 0;
|
|
|
|
|
priv->max_day_char_descent = 0;
|
2005-05-11 19:16:19 +00:00
|
|
|
|
priv->min_day_width = 0;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 9; i++)
|
|
|
|
|
{
|
2006-01-26 20:40:18 +00:00
|
|
|
|
gchar buffer[32];
|
2008-10-27 01:42:28 +00:00
|
|
|
|
g_snprintf (buffer, sizeof (buffer), C_("calendar:day:digits", "%d"), i * 11);
|
2011-01-24 02:50:39 +00:00
|
|
|
|
pango_layout_set_text (layout, buffer, -1);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
|
|
|
|
|
priv->min_day_width = MAX (priv->min_day_width,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
logical_rect.width);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
|
2006-01-26 20:40:18 +00:00
|
|
|
|
priv->max_day_char_ascent = MAX (priv->max_day_char_ascent,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
PANGO_ASCENT (logical_rect));
|
|
|
|
|
priv->max_day_char_descent = MAX (priv->max_day_char_descent,
|
|
|
|
|
PANGO_DESCENT (logical_rect));
|
2005-05-11 19:16:19 +00:00
|
|
|
|
}
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
2006-01-26 20:40:18 +00:00
|
|
|
|
priv->max_label_char_ascent = 0;
|
|
|
|
|
priv->max_label_char_descent = 0;
|
2010-08-12 15:14:51 +00:00
|
|
|
|
if (priv->display_flags & GTK_CALENDAR_SHOW_DAY_NAMES)
|
2005-05-11 19:16:19 +00:00
|
|
|
|
for (i = 0; i < 7; i++)
|
|
|
|
|
{
|
2011-01-24 02:50:39 +00:00
|
|
|
|
pango_layout_set_text (layout, default_abbreviated_dayname[i], -1);
|
|
|
|
|
pango_layout_line_get_pixel_extents (pango_layout_get_lines_readonly (layout)->data, NULL, &logical_rect);
|
|
|
|
|
|
|
|
|
|
priv->min_day_width = MAX (priv->min_day_width, logical_rect.width);
|
|
|
|
|
priv->max_label_char_ascent = MAX (priv->max_label_char_ascent,
|
|
|
|
|
PANGO_ASCENT (logical_rect));
|
|
|
|
|
priv->max_label_char_descent = MAX (priv->max_label_char_descent,
|
|
|
|
|
PANGO_DESCENT (logical_rect));
|
2005-05-11 19:16:19 +00:00
|
|
|
|
}
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
priv->max_week_char_width = 0;
|
2010-08-12 15:14:51 +00:00
|
|
|
|
if (priv->display_flags & GTK_CALENDAR_SHOW_WEEK_NUMBERS)
|
2005-05-11 19:16:19 +00:00
|
|
|
|
for (i = 0; i < 9; i++)
|
|
|
|
|
{
|
2011-01-24 02:50:39 +00:00
|
|
|
|
gchar buffer[32];
|
|
|
|
|
g_snprintf (buffer, sizeof (buffer), C_("calendar:week:digits", "%d"), i * 11);
|
|
|
|
|
pango_layout_set_text (layout, buffer, -1);
|
|
|
|
|
pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
|
|
|
|
|
priv->max_week_char_width = MAX (priv->max_week_char_width,
|
|
|
|
|
logical_rect.width / 2);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
}
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
2007-12-28 09:26:20 +00:00
|
|
|
|
/* Calculate detail extents. Do this as late as possible since
|
|
|
|
|
* pango_layout_set_markup is called which alters font settings. */
|
2007-12-28 22:11:35 +00:00
|
|
|
|
max_detail_height = 0;
|
2007-12-28 09:26:20 +00:00
|
|
|
|
|
2010-08-12 15:14:51 +00:00
|
|
|
|
if (priv->detail_func && (priv->display_flags & GTK_CALENDAR_SHOW_DETAILS))
|
2007-12-28 09:26:20 +00:00
|
|
|
|
{
|
|
|
|
|
gchar *markup, *tail;
|
|
|
|
|
|
|
|
|
|
if (priv->detail_width_chars || priv->detail_height_rows)
|
|
|
|
|
{
|
|
|
|
|
gint rows = MAX (1, priv->detail_height_rows) - 1;
|
|
|
|
|
gsize len = priv->detail_width_chars + rows + 16;
|
|
|
|
|
|
|
|
|
|
markup = tail = g_alloca (len);
|
|
|
|
|
|
|
|
|
|
memcpy (tail, "<small>", 7);
|
|
|
|
|
tail += 7;
|
|
|
|
|
|
|
|
|
|
memset (tail, 'm', priv->detail_width_chars);
|
|
|
|
|
tail += priv->detail_width_chars;
|
|
|
|
|
|
|
|
|
|
memset (tail, '\n', rows);
|
|
|
|
|
tail += rows;
|
|
|
|
|
|
|
|
|
|
memcpy (tail, "</small>", 9);
|
|
|
|
|
tail += 9;
|
|
|
|
|
|
|
|
|
|
g_assert (len == (tail - markup));
|
|
|
|
|
|
|
|
|
|
pango_layout_set_markup (layout, markup, -1);
|
|
|
|
|
pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
|
|
|
|
|
|
|
|
|
|
if (priv->detail_width_chars)
|
|
|
|
|
priv->min_day_width = MAX (priv->min_day_width, logical_rect.width);
|
|
|
|
|
if (priv->detail_height_rows)
|
2007-12-28 22:11:35 +00:00
|
|
|
|
max_detail_height = MAX (max_detail_height, logical_rect.height);
|
2007-12-28 09:26:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!priv->detail_width_chars || !priv->detail_height_rows)
|
|
|
|
|
for (r = 0; r < 6; r++)
|
|
|
|
|
for (c = 0; c < 7; c++)
|
|
|
|
|
{
|
2008-01-17 16:42:04 +00:00
|
|
|
|
gchar *detail = gtk_calendar_get_detail (calendar, r, c);
|
2007-12-28 09:26:20 +00:00
|
|
|
|
|
|
|
|
|
if (detail)
|
|
|
|
|
{
|
|
|
|
|
markup = g_strconcat ("<small>", detail, "</small>", NULL);
|
|
|
|
|
pango_layout_set_markup (layout, markup, -1);
|
|
|
|
|
|
|
|
|
|
if (priv->detail_width_chars)
|
|
|
|
|
{
|
|
|
|
|
pango_layout_set_wrap (layout, PANGO_WRAP_WORD_CHAR);
|
|
|
|
|
pango_layout_set_width (layout, PANGO_SCALE * priv->min_day_width);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
|
|
|
|
|
|
|
|
|
|
if (!priv->detail_width_chars)
|
|
|
|
|
priv->min_day_width = MAX (priv->min_day_width, logical_rect.width);
|
|
|
|
|
if (!priv->detail_height_rows)
|
2007-12-28 22:11:35 +00:00
|
|
|
|
max_detail_height = MAX (max_detail_height, logical_rect.height);
|
2007-12-28 09:26:20 +00:00
|
|
|
|
|
|
|
|
|
g_free (markup);
|
2008-01-17 16:42:04 +00:00
|
|
|
|
g_free (detail);
|
2007-12-28 09:26:20 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* We add one to max_day_char_width to be able to make the marked day "bold" */
|
|
|
|
|
priv->max_day_char_width = priv->min_day_width / 2 + 1;
|
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
main_width = (7 * (priv->min_day_width + (focus_padding + focus_width) * 2) + (DAY_XSEP * 6) + CALENDAR_MARGIN * 2
|
2011-01-24 02:50:39 +00:00
|
|
|
|
+ (priv->max_week_char_width
|
|
|
|
|
? priv->max_week_char_width * 2 + (focus_padding + focus_width) * 2 + calendar_xsep * 2
|
|
|
|
|
: 0));
|
2010-08-11 21:17:18 +00:00
|
|
|
|
|
2011-01-10 19:40:37 +00:00
|
|
|
|
context = gtk_widget_get_style_context (widget);
|
|
|
|
|
state = gtk_widget_get_state_flags (widget);
|
|
|
|
|
gtk_style_context_get_padding (context, state, &padding);
|
2010-08-11 21:17:18 +00:00
|
|
|
|
|
2011-01-10 19:40:37 +00:00
|
|
|
|
requisition->width = MAX (header_width, main_width + inner_border * 2) + padding.left + padding.right;
|
2010-08-11 21:17:18 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
/*
|
|
|
|
|
* Calculate the requisition height for the widget.
|
|
|
|
|
*/
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
2010-08-12 15:14:51 +00:00
|
|
|
|
if (priv->display_flags & GTK_CALENDAR_SHOW_HEADING)
|
2005-05-11 19:16:19 +00:00
|
|
|
|
{
|
2010-08-03 15:45:14 +00:00
|
|
|
|
priv->header_h = (max_header_height + calendar_ysep * 2);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
priv->header_h = 0;
|
|
|
|
|
}
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
2010-08-12 15:14:51 +00:00
|
|
|
|
if (priv->display_flags & GTK_CALENDAR_SHOW_DAY_NAMES)
|
2005-05-11 19:16:19 +00:00
|
|
|
|
{
|
|
|
|
|
priv->day_name_h = (priv->max_label_char_ascent
|
2011-01-24 02:50:39 +00:00
|
|
|
|
+ priv->max_label_char_descent
|
|
|
|
|
+ 2 * (focus_padding + focus_width) + calendar_margin);
|
2010-08-03 15:45:14 +00:00
|
|
|
|
calendar_margin = calendar_ysep;
|
2011-01-24 02:50:39 +00:00
|
|
|
|
}
|
2005-05-11 19:16:19 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
priv->day_name_h = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
priv->main_h = (CALENDAR_MARGIN + calendar_margin
|
2011-01-24 02:50:39 +00:00
|
|
|
|
+ 6 * (priv->max_day_char_ascent
|
|
|
|
|
+ priv->max_day_char_descent
|
2007-12-28 22:11:35 +00:00
|
|
|
|
+ max_detail_height
|
2011-01-24 02:50:39 +00:00
|
|
|
|
+ 2 * (focus_padding + focus_width))
|
|
|
|
|
+ DAY_YSEP * 5);
|
2010-10-24 05:22:13 +00:00
|
|
|
|
|
|
|
|
|
height = priv->header_h + priv->day_name_h + priv->main_h;
|
2010-08-11 21:17:18 +00:00
|
|
|
|
|
2011-01-10 19:40:37 +00:00
|
|
|
|
requisition->height = height + padding.top + padding.bottom + (inner_border * 2);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
|
|
|
|
|
g_object_unref (layout);
|
|
|
|
|
}
|
2003-08-08 22:17:34 +00:00
|
|
|
|
|
2010-10-27 01:06:40 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_calendar_get_preferred_width (GtkWidget *widget,
|
|
|
|
|
gint *minimum,
|
|
|
|
|
gint *natural)
|
|
|
|
|
{
|
|
|
|
|
GtkRequisition requisition;
|
|
|
|
|
|
|
|
|
|
gtk_calendar_size_request (widget, &requisition);
|
|
|
|
|
|
|
|
|
|
*minimum = *natural = requisition.width;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gtk_calendar_get_preferred_height (GtkWidget *widget,
|
|
|
|
|
gint *minimum,
|
|
|
|
|
gint *natural)
|
|
|
|
|
{
|
|
|
|
|
GtkRequisition requisition;
|
|
|
|
|
|
|
|
|
|
gtk_calendar_size_request (widget, &requisition);
|
|
|
|
|
|
|
|
|
|
*minimum = *natural = requisition.height;
|
|
|
|
|
}
|
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
static void
|
2011-01-24 02:50:39 +00:00
|
|
|
|
gtk_calendar_size_allocate (GtkWidget *widget,
|
|
|
|
|
GtkAllocation *allocation)
|
2005-05-11 19:16:19 +00:00
|
|
|
|
{
|
|
|
|
|
GtkCalendar *calendar = GTK_CALENDAR (widget);
|
|
|
|
|
GtkCalendarPrivate *priv = GTK_CALENDAR_GET_PRIVATE (widget);
|
2011-01-10 19:40:37 +00:00
|
|
|
|
GtkStyleContext *context;
|
|
|
|
|
GtkStateFlags state;
|
|
|
|
|
GtkBorder padding;
|
2005-05-11 19:16:19 +00:00
|
|
|
|
guint i;
|
2010-08-03 15:45:14 +00:00
|
|
|
|
gint inner_border = calendar_get_inner_border (calendar);
|
|
|
|
|
gint calendar_xsep = calendar_get_xsep (calendar);
|
|
|
|
|
|
2011-01-10 19:40:37 +00:00
|
|
|
|
context = gtk_widget_get_style_context (widget);
|
|
|
|
|
state = gtk_widget_get_state_flags (widget);
|
|
|
|
|
gtk_style_context_get_padding (context, state, &padding);
|
2010-08-11 21:17:18 +00:00
|
|
|
|
|
|
|
|
|
gtk_widget_set_allocation (widget, allocation);
|
|
|
|
|
|
2010-08-12 15:14:51 +00:00
|
|
|
|
if (priv->display_flags & GTK_CALENDAR_SHOW_WEEK_NUMBERS)
|
1998-09-27 18:32:00 +00:00
|
|
|
|
{
|
2005-05-11 19:16:19 +00:00
|
|
|
|
priv->day_width = (priv->min_day_width
|
2011-01-24 02:50:39 +00:00
|
|
|
|
* ((allocation->width - (inner_border * 2) - padding.left - padding.right
|
|
|
|
|
- (CALENDAR_MARGIN * 2) - (DAY_XSEP * 6) - calendar_xsep * 2))
|
|
|
|
|
/ (7 * priv->min_day_width + priv->max_week_char_width * 2));
|
2011-01-10 19:40:37 +00:00
|
|
|
|
priv->week_width = ((allocation->width - (inner_border * 2) - padding.left - padding.right
|
2011-01-24 02:50:39 +00:00
|
|
|
|
- (CALENDAR_MARGIN * 2) - (DAY_XSEP * 6) - calendar_xsep * 2 )
|
|
|
|
|
- priv->day_width * 7 + CALENDAR_MARGIN + calendar_xsep);
|
|
|
|
|
}
|
|
|
|
|
else
|
1998-09-27 18:32:00 +00:00
|
|
|
|
{
|
2005-05-11 19:16:19 +00:00
|
|
|
|
priv->day_width = (allocation->width
|
2011-01-24 02:50:39 +00:00
|
|
|
|
- (inner_border * 2)
|
2011-01-10 19:40:37 +00:00
|
|
|
|
- padding.left - padding.right
|
2011-01-24 02:50:39 +00:00
|
|
|
|
- (CALENDAR_MARGIN * 2)
|
|
|
|
|
- (DAY_XSEP * 6))/7;
|
2005-05-11 19:16:19 +00:00
|
|
|
|
priv->week_width = 0;
|
1998-09-27 18:32:00 +00:00
|
|
|
|
}
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
2010-03-02 06:16:02 +00:00
|
|
|
|
if (gtk_widget_get_realized (widget))
|
1998-09-27 18:32:00 +00:00
|
|
|
|
{
|
2010-10-24 05:22:13 +00:00
|
|
|
|
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR)
|
|
|
|
|
gdk_window_move_resize (priv->main_win,
|
2010-12-20 22:07:20 +00:00
|
|
|
|
allocation->x
|
2011-01-10 19:40:37 +00:00
|
|
|
|
+ priv->week_width + padding.left + inner_border,
|
2010-12-20 22:07:20 +00:00
|
|
|
|
allocation->y
|
|
|
|
|
+ priv->header_h + priv->day_name_h
|
2011-01-10 19:40:37 +00:00
|
|
|
|
+ (padding.top + inner_border),
|
2010-10-24 05:22:13 +00:00
|
|
|
|
allocation->width - priv->week_width
|
2011-01-10 19:40:37 +00:00
|
|
|
|
- (inner_border * 2) - padding.left - padding.right,
|
2010-10-24 05:22:13 +00:00
|
|
|
|
priv->main_h);
|
|
|
|
|
else
|
|
|
|
|
gdk_window_move_resize (priv->main_win,
|
2010-12-20 22:07:20 +00:00
|
|
|
|
allocation->x
|
2011-01-10 19:40:37 +00:00
|
|
|
|
+ padding.left + inner_border,
|
2010-12-20 22:07:20 +00:00
|
|
|
|
allocation->y
|
|
|
|
|
+ priv->header_h + priv->day_name_h
|
2011-01-10 19:40:37 +00:00
|
|
|
|
+ padding.top + inner_border,
|
2010-10-24 05:22:13 +00:00
|
|
|
|
allocation->width - priv->week_width
|
2011-01-10 19:40:37 +00:00
|
|
|
|
- (inner_border * 2) - padding.left - padding.right,
|
2010-10-24 05:22:13 +00:00
|
|
|
|
priv->main_h);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
|
|
|
|
|
for (i = 0 ; i < 4 ; i++)
|
2010-10-24 05:22:13 +00:00
|
|
|
|
{
|
|
|
|
|
if (priv->arrow_win[i])
|
|
|
|
|
{
|
|
|
|
|
GdkRectangle rect;
|
|
|
|
|
calendar_arrow_rectangle (calendar, i, &rect);
|
|
|
|
|
|
|
|
|
|
gdk_window_move_resize (priv->arrow_win[i],
|
|
|
|
|
allocation->x + rect.x,
|
|
|
|
|
allocation->y + rect.y,
|
|
|
|
|
rect.width, rect.height);
|
|
|
|
|
}
|
|
|
|
|
}
|
1998-09-27 18:32:00 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
|
|
|
|
|
/****************************************
|
|
|
|
|
* Repainting *
|
|
|
|
|
****************************************/
|
|
|
|
|
|
|
|
|
|
static void
|
2010-09-04 17:07:39 +00:00
|
|
|
|
calendar_paint_header (GtkCalendar *calendar, cairo_t *cr)
|
1998-09-27 18:32:00 +00:00
|
|
|
|
{
|
2005-05-11 19:16:19 +00:00
|
|
|
|
GtkWidget *widget = GTK_WIDGET (calendar);
|
|
|
|
|
GtkCalendarPrivate *priv = GTK_CALENDAR_GET_PRIVATE (calendar);
|
2010-08-11 21:17:18 +00:00
|
|
|
|
GtkAllocation allocation;
|
2011-01-10 19:40:37 +00:00
|
|
|
|
GtkStyleContext *context;
|
|
|
|
|
GtkStateFlags state;
|
|
|
|
|
GtkBorder padding;
|
2005-05-11 19:16:19 +00:00
|
|
|
|
char buffer[255];
|
2010-09-23 09:53:54 +00:00
|
|
|
|
gint x, y;
|
2005-09-13 19:57:42 +00:00
|
|
|
|
gint header_width;
|
2005-05-11 19:16:19 +00:00
|
|
|
|
gint max_month_width;
|
|
|
|
|
gint max_year_width;
|
|
|
|
|
PangoLayout *layout;
|
|
|
|
|
PangoRectangle logical_rect;
|
|
|
|
|
gboolean year_left;
|
2005-06-12 06:59:43 +00:00
|
|
|
|
time_t tmp_time;
|
|
|
|
|
struct tm *tm;
|
|
|
|
|
gchar *str;
|
1998-10-04 23:07:04 +00:00
|
|
|
|
|
2011-01-10 19:40:37 +00:00
|
|
|
|
context = gtk_widget_get_style_context (widget);
|
|
|
|
|
state = gtk_widget_get_state_flags (widget);
|
|
|
|
|
gtk_style_context_get_padding (context, state, &padding);
|
2010-10-24 05:22:13 +00:00
|
|
|
|
|
2010-09-04 17:16:26 +00:00
|
|
|
|
cairo_save (cr);
|
2011-01-10 19:40:37 +00:00
|
|
|
|
cairo_translate (cr, padding.left, padding.top);
|
2010-09-04 17:16:26 +00:00
|
|
|
|
|
2010-10-24 05:22:13 +00:00
|
|
|
|
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR)
|
2005-05-11 19:16:19 +00:00
|
|
|
|
year_left = priv->year_before;
|
|
|
|
|
else
|
|
|
|
|
year_left = !priv->year_before;
|
|
|
|
|
|
2010-08-11 21:17:18 +00:00
|
|
|
|
gtk_widget_get_allocation (widget, &allocation);
|
|
|
|
|
|
2011-01-10 19:40:37 +00:00
|
|
|
|
header_width = allocation.width - padding.left - padding.right;
|
2010-08-11 21:17:18 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
max_month_width = priv->max_month_width;
|
|
|
|
|
max_year_width = priv->max_year_width;
|
2010-08-11 21:17:18 +00:00
|
|
|
|
|
2011-01-10 19:40:37 +00:00
|
|
|
|
gtk_style_context_save (context);
|
|
|
|
|
gtk_style_context_add_class (context, GTK_STYLE_CLASS_HEADER);
|
2010-10-24 05:22:13 +00:00
|
|
|
|
|
2011-01-10 19:40:37 +00:00
|
|
|
|
gtk_render_background (context, cr, 0, 0, header_width, priv->header_h);
|
|
|
|
|
gtk_render_frame (context, cr, 0, 0, header_width, priv->header_h);
|
2005-06-12 06:59:43 +00:00
|
|
|
|
|
|
|
|
|
tmp_time = 1; /* Jan 1 1970, 00:00:01 UTC */
|
|
|
|
|
tm = gmtime (&tmp_time);
|
2010-08-12 15:14:51 +00:00
|
|
|
|
tm->tm_year = priv->year - 1900;
|
2005-06-12 06:59:43 +00:00
|
|
|
|
|
|
|
|
|
/* Translators: This dictates how the year is displayed in
|
|
|
|
|
* gtkcalendar widget. See strftime() manual for the format.
|
|
|
|
|
* Use only ASCII in the translation.
|
|
|
|
|
*
|
2008-10-27 01:42:28 +00:00
|
|
|
|
* Also look for the msgid "2000".
|
2005-06-12 06:59:43 +00:00
|
|
|
|
* Translate that entry to a year with the widest output of this
|
2008-10-27 01:42:28 +00:00
|
|
|
|
* msgid.
|
|
|
|
|
*
|
|
|
|
|
* "%Y" is appropriate for most locales.
|
2005-06-12 06:59:43 +00:00
|
|
|
|
*/
|
2008-10-27 01:42:28 +00:00
|
|
|
|
strftime (buffer, sizeof (buffer), C_("calendar year format", "%Y"), tm);
|
2005-06-12 06:59:43 +00:00
|
|
|
|
str = g_locale_to_utf8 (buffer, -1, NULL, NULL, NULL);
|
|
|
|
|
layout = gtk_widget_create_pango_layout (widget, str);
|
|
|
|
|
g_free (str);
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
2000-07-02 21:32:56 +00:00
|
|
|
|
pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
1998-09-27 18:32:00 +00:00
|
|
|
|
/* Draw title */
|
2005-05-11 19:16:19 +00:00
|
|
|
|
y = (priv->header_h - logical_rect.height) / 2;
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
1998-09-27 18:32:00 +00:00
|
|
|
|
/* Draw year and its arrows */
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
2010-08-12 15:14:51 +00:00
|
|
|
|
if (priv->display_flags & GTK_CALENDAR_NO_MONTH_CHANGE)
|
2003-08-08 22:17:34 +00:00
|
|
|
|
if (year_left)
|
|
|
|
|
x = 3 + (max_year_width - logical_rect.width)/2;
|
|
|
|
|
else
|
|
|
|
|
x = header_width - (3 + max_year_width
|
2011-01-24 02:50:39 +00:00
|
|
|
|
- (max_year_width - logical_rect.width)/2);
|
1998-09-27 18:32:00 +00:00
|
|
|
|
else
|
2003-08-08 22:17:34 +00:00
|
|
|
|
if (year_left)
|
2005-05-11 19:16:19 +00:00
|
|
|
|
x = 3 + priv->arrow_width + (max_year_width - logical_rect.width)/2;
|
2003-08-08 22:17:34 +00:00
|
|
|
|
else
|
2005-05-11 19:16:19 +00:00
|
|
|
|
x = header_width - (3 + priv->arrow_width + max_year_width
|
2011-01-24 02:50:39 +00:00
|
|
|
|
- (max_year_width - logical_rect.width)/2);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
|
2011-01-10 19:40:37 +00:00
|
|
|
|
gtk_render_layout (context, cr, x, y, layout);
|
|
|
|
|
|
1998-09-27 18:32:00 +00:00
|
|
|
|
/* Draw month */
|
2010-08-12 15:14:51 +00:00
|
|
|
|
g_snprintf (buffer, sizeof (buffer), "%s", default_monthname[priv->month]);
|
Remove all references to offscreen flag which was no longer used.
Thu Jun 1 23:05:13 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Remove all references to
offscreen flag which was no longer used.
* gtk/gtkprivate.h (enum): Remove unused flags and compress.
* gtk/gtkframe.c (gtk_frame_set_label_widget): Check
for non-null label_widget->parent.
* gtk/gtkentry.c: Get rid of code to deal with PangoAttribute
which no longer was used.
* gdk/gdkpango.c (gdk_pango_context_get_info): make static.
* gdk/gdkpango.c (gdk_draw_layout[_line]): Add checks
for null arguments.
* gdk/x11/gdkgeometry-x11.c (gdk_window_scroll): add
check for destroyed windows.
Thu Jun 1 13:48:45 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimmulticontext.c: Add a finalize method and unref
the slave context there.
* gtk/gtkinvisible.[ch]: Make reference counting behavior
identical to GtkWindow.
Thu Jun 1 01:54:11 2000 Owen Taylor <otaylor@redhat.com>
* Makefile.am gdk/gdkpango.c: Copy the layout render function from
pangox to here, so we can write them independent of rendering
system, using GDK primitives.
* gdk/gdkdrawable.h gdk/gdkdraw.c gdk/gdkwindow.c
gdk/x11/gdkdrawable-x11.c: Remove draw_layout() from the vtable,
since we have a rendering-system independent implementation in
terms of draw_glyphs().
* gdk/gdkpango.c gdkdrawable.h (gdk_draw_layout_line): New
function to render a single line.
* gdk/x11/gdkpango.c: Move the guts of this file mostly
into ../gdkpango.c, which simplifies things, since we
don't have to deal with raw X gc's.
Fri May 19 04:28:16 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.[ch]: Add get_log_attrs() function to
get the logical attributes for a given GtkTextLine.
Tue May 30 16:05:39 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkfont-x11.c (gdk_font_charset_for_locale): Track
g_locale_get_codeset() to g_get_codeset() change.
Tue May 30 15:03:19 2000 Owen Taylor <otaylor@redhat.com>
* gtk/testcalendar.c (calendar_font_selection_ok): Use font
descriptions.
* gtk/gtkentry.c (gtk_entry_draw_text): Center text within
the entry.
* gtk/gtkfontsel.c (gtk_font_selection_dialog_init): Start of
redoing (vastly simplifying) for Pango. Still needs quite
a bit of work. (Size selection is currently poor. List of
predefined sizes is not a good idea, since all of these
sizes won't necessarily be distinct.)
Tue May 30 13:50:19 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkfont-x11.c (gdk_font_charset_for_locale): Handle
CODESET results for LANG=C.
Mon May 29 15:49:10 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.[ch]: Add a 'font_name' declaration to RC
which takes a stringized pango font description;
ignore the older 'font' and 'fontset' declarations.
* gtk/gtkstyle.c gtk/gtkrc.c: Fill in the style->font
field with a GdkFont derived via gdk_font_from_description(),
for compatibility. (Should we just remove it entirely?
Probably too much compatibility breakage, but people
should be migrating to the new Pango stuff as quickly
as possible.)
Mon May 29 15:47:41 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c gtk/gtkclist.c: s/pango_font_unref/g_object_unref/.
Mon May 29 15:44:46 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcalender.c: Roughly pango-ized. Really needs
redoing; there are some bugs in size allocation right
now, the semi-existant distinction between header / day
fonts was removed, but, with Pango, could actually
be made functional in a nice way.
* gtk/testcalender: Move calender from examples into this
directory as a test program. (We really need to restrcture
testgtk into a whole directory full of tests for every
widget or functionality group, separated into multiple .c
files.)
Mon May 29 15:19:56 2000 Owen Taylor <otaylor@redhat.com>
* gtk/testgtk.c (file_exists): Fix stupid typo that
was keeping RC file from being loaded.
* gtk/testgtkrc gtk/testgtkrc2: Test new pango-ized
RC file font code.
Mon May 29 14:31:27 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkfont.h gdk/x11/gdkfont-x11.c (gdk_font_from_description):
Add function to load a GdkFont from a PangoFontDescription.
Fri May 26 17:16:40 2000 Owen Taylor <otaylor@redhat.com>
* gtk/frame.[ch] gtkaspectframe.c: Make frame widgets able
to have any widget for the label, use a GtkLabel widget
to display the text. (Based partially on a patch from
Anders Carlson.)
(Quite a bit of code reorganization - strip 90% of the
guts out of gtkaspectframe and add a single virtual
func to GtkFrameClass - compute_child_allocation.)
Fri May 26 12:00:02 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkctree.c gtk/gtkclist.[ch]: Pangoized.
(Removed clist->row_center_offset field because caching
it wasn't saving time or code, added private function
_gtk_clist_create_cell_layout()).
Wed May 24 15:59:37 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkaccellabel.c: Pangoized.
* gtk/[hv]ruler.c: Pangoized
Mon May 22 19:23:59 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c (gtk_file_selection_init):
Use gtk_clist_set_column_auto_resize() to remove need
need for manual column width computations.
Mon May 22 18:50:26 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktooltips.[ch]: Replace custom drawing with a GtkLabel,
ensuring Pango correctness, and considerably simplifying the
code.
* gtk/gtklabel.c gtk[hv]scale.c: 1000 => PANGO_SCALE.
* gtk/gtklabel.c (gtk_label_size_request): Fixed incorrect
getting of numbers of lines.
* gtk/gtklabel.c (gtk_label_size_request): Set the requisition
to the actual requested width of the lable, not to the wrap
width we set.
* gtk/gtktextchild.h: Remove extraneous include of gtk/gtk.h.
* gtk/gtktextbtree.c gtk/gtktextbuffer.c gtk/gtktextlayout.c
gtk/gtktextview.c gtk/gtktextview.[ch]: Fix up includes.
* gtk/gtktextview.c: Fix structure inheritance.
* gtk/gtkprogressbar.c: Pangoize.
Mon May 22 15:47:30 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextview.c (gtk_text_view_get_first_para_iter): Encapsulate
in a function.
* gtk/gtktextlayout.c (find_display_line_above): Fixed
bug with computing line tops.
* gtk/gtktextview.c (changed_handler): Fix < , <= confusion.
Thu May 18 18:53:31 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextdisplay.c (gtk_text_layout_draw): Fix up the x_offset
and y_offset coordinates to do what we need now. (The offset between
buffer and layout coordinates has been reintroduced, but is a
bit different than before.)
* gtk/gtktextview.[ch]: No longer inherit from GtkLayout; instead
handle the adjustments ourselves, and scroll as necessary using
the new gdk_window_scroll().
The advantage of this is that when we are incrementally revalidating,
we are essentially rearranging things around the visible portion
of the screen. With the old setup, the visible portion of the
screen was moved around in the layout, so scrolling and redrawing
to track that caused jumping of the display. Since we now
control the scrolling ourselves, we can suppress this and
only redraw when things actually change.
Thu May 18 18:47:25 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextbtree.c (redisplay_mark): We need to invalidate
the region not just redisplay it after-all, since we store the
cursors in the LineDisplay. (Ugly interactions here between
GtkLayout and GtkTextBTree here.)
* gtk/gtktextbtree.c (redisplay_region): Fixed reversed comparison.
Thu May 18 18:43:21 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.h gdk/x11/gdkgeometry-x11.c (gdk_window_scroll):
Added function to scroll contents of a window while keeping the
window constant. Works by XCopyArea or guffaw-scrolling depending
on the details of how the window is set up. (guffaw-scrolling
still needs to be filled in.)
Wed May 17 22:36:53 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextiter.c gtk/gtkmain.c: Add a debug key for the text widget,
move the debugging that was tied to a global variable
to that.
* gtk/gtkmarshal.list: Add NONE:INT,INT,INT
* gtk/gtktextbtree.[ch] gtk/gtktextlayout.c: Keep a separate
validated flag, in line data instead of setting height/width to
-1. This allows us to perform operations with partially invalid
buffer (using the old size for invalid lines) and thus to do
incremental vaidation. Keep height/width aggregates up to date
when deleting text and rebalancing the tree.
* gtk/gtktextbtree.[ch]: Add functions validate a line
(gtk_text_btree_validate_line), and to validate up
to a number of pixels (gtk_text_btree_validate).
* gtk/gtktextlayout.[ch]: Add an ::invalidated signal
that indicates that something is changed and a revalidation
pass is needed. Change ::need_repaint to ::changed, and
make it take old and new yranges instead of a rectangle.
* gtk/gtktextbtree.[ch] gtk/gtktextlayout.[ch]: Move
the line_data_destroy() function from
gtk_text_btree_add_view() to a virtual function in
GtkTextLayout
* gtk/gtktextbtree.[ch]: Remove gtk_text_btree_get_damage_range(),
since we are handling partial repaints in a different fashion
now.
* gtk/gtktextbtree.[ch]: Only repaint the changed portion
of the selection instead of queueing a repaint on the
entire widget.
* gtk/gtktextbuffer.[ch] gtk/gtktextbtree.[ch]: Move
get_selection_bounds() down to btree, make the function
in buffer a wrapper around the btree function.
* gtk/gtktextlayout.[ch]: Add functions to check if the
layout is valid and to recompute either a range of pixels
aroudn a line or a certain total number of pixels.
* gtk/gtktextlayout.[ch]: Cache a single line display;
now that we only redraw the needed portions, the hit rate
for this cache is quite high.
* gtk/gtktextview.[ch]: Keep track of the first paragraph
on the screen so that when re-laying-out the buffer, we can
keep the same place. This requires connecting to ::value_changed
on the adjustments
* gtk/gtktextview.[ch]: Add idle functions to revalidate
the buffer after we receive an ::invalidated signal.
Wed May 17 22:10:47 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.c (gtk_layout_size_allocate): Set upper
to max of allocation and layout size, not just to the
layout size.
* gtk/gtk[hv]scrollbar.c (gtk_[hv]scrollbar_calc_slider_size):
Invalidate window so it gets redrawn properly.
* gdk/gdkwindow.c (gdk_window_invalidate_rect): Allow rect == NULL
to mean the entire window.
* gdk/gdkevents.h: Move definition for GDK_PRIORITY_REDRAW
into public header.
Mon May 15 14:51:31 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextmark.c (gtk_text_mark_get_name): Add function
to get the name of a mark.
* gtk/gtktextlayout.c (gtk_text_layout_get_line_at_y): Add a function
to find the paragraph from a y position.
Thu May 11 12:57:20 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextbtree.c (gtk_text_btree_node_invalidate_upward): Valid
nodes have width/height >= 0, not > 0.
Tue May 9 21:29:06 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.[ch] gtk/gtktextdisplay.c (gtk_text_layout_get_line_display):
Add a size_only flag, so when we only need the size, we don't create
useless appearance attributes.
* gtk/gtktextview.c (gtk_text_view_ensure_layout): Remove
duplicate setting of font description.
* gtk/gtkscale.c: Use PANGO_SCALE instead of 1000
Wed Apr 26 01:53:23 2000 Owen Taylor <otaylor@redhat.com>
* gtk/Makefile.am (EXTRA_DIST): Add OLD_STAMP into
EXTRA_DIST. It does not work well when the file that
everything depends on is not in the tarball.
Wed Apr 26 00:56:14 2000 Owen Taylor <otaylor@redhat.com>
* gtk/testgtk.c: Some hacks and fixes so that it basically
works when not sitting in the GTK+ build tree.
2000-05-03 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (gtk_text_line_next_could_contain_tag):
Properly determine the ordering of the tag root and the current
line within the tree. Previous algorithm only worked if the tag
root's immediate parent was the common root of both the current
line and the tag root.
Wed Apr 26 00:43:00 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.c (set_para_values): Fix some bugs in
alignment.
* gtk/gtktextview.c (gtk_text_view_ensure_layout): Track
the widget text directional dynamically.
* gtk/gtktextview.[ch]: Added functions to get and set default
wrap mode.
Tue Apr 25 23:47:38 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.c (gtk_text_layout_get_iter_location): Fix bug
in cursor location computation.
Tue Apr 25 23:22:59 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.c (gtk_layout_set_size): Clamp hadjustment/
vadjusment values properly when layout gets smaller.
* gtk/gtktextview.c (need_repaint_handler): Areas being
passed in are far completely inaccurate, and sometimes
too small, so, for now, just queue a redraw on the
whole visible region.
2000-04-25 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (summary_destroy): new function to
destroy tag summary nodes
(gtk_text_line_next_could_contain_tag): this function was
totally broken if the line passed in wasn't below the tag
root. Fix it.
(gtk_text_btree_first_could_contain_tag): In the tag == NULL
"wildcard" case, we have to do a linear scan. Blah.
(gtk_text_btree_last_could_contain_tag): In tag == NULL case,
we have to do the linear scan
(tag_removed_cb): When a tag is removed from the tag table,
remove the GtkTextTagInfo node from the btree.
(gtk_text_btree_spew): Implement the spew function, for
our debugging pleasure.
Tue Apr 25 19:40:18 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.c (gtk_text_layout_set_buffer): Fix
a problem with referring to the wrong buffer.
* gtk/gtkentry.c: Fix focus-in/focus-out confusion.
* gtk/gtkrc.c gtk/gtkstyle.c: Moving setting default
font description to gtk_style_new() - otherwise things
don't work without a .gtkrc file.
* gtk/gtktextbuffer.c (gtk_text_buffer_new): Sink the
tags table if we create it ourself, too.
* gdk/gdktypes.h (enum): Move GDK_RELEASE_MASK, since
it was conflicting with XKB modifiers.
* gtk/gtktextview.[ch]: Add simple support for
GtkIMContext.
Mon Apr 24 19:34:18 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_move_cursor_visually): Fix problem
with deletion from last commit.
Mon Apr 24 19:29:40 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_create_pango_context): Set the language
in the context from the current locale.
* gtk/gtkentry.c (gtk_entry_size_request): Use language from the
context, not hardcoded value.
* gtk/gtkentry.c (gtk_entry_move_cursor): Make character movement visual,
not logical.
Sun Apr 23 23:39:18 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c gtk/gtktextdisplay.c: Don't handle selections as
attributes - that doesn't handle partial-glyph selection
properly. Instead use new pango_layout_line_get_x_ranges()
functionality to draw the selection.
* gtk/gtkentry.c: Simplify code since pango_layout_line_index_to_x()
now properly handles out-of-range coordinates.
* gtk/gtktextbuffer.c: Emit "mark_set" when the cursor is moved.
* gtk/gtktextiter.h gtk/gtktextiterprivate.h: Make gtk_text_iter_get_line_byte()
public.
* gtk/gtktextlayout.[ch]: Properly set the direction in the PangoContext
for paragraphs opposite to the base direction of the widget.
* gtk/gtktextlayout.[ch] gtk/gtktextdisplay.c: Fixes for alignment.
* gtk/gtktextlayout.c: Don't split segments on marks, since that
causes Arabic words to reshape as you cursor through.
* gtk/gtktextlayout.[ch] gtk/gtktextview.[ch]: Implement virtual
cursor position when moving vertically with the arrow keys and
scrolling with page-up/page-down. (Arrow keys save only the X,
scrolling saves both X and Y.)
This means you can line-up / line-down or page-up / page-down
without losing your place, and also that moving vertically
with the cursor keys keeps the same X position, not the same
character count:
* gtk/gtktextlayout.[ch] gtk/gtktextview.[ch]: Make vertical
arrow keys move by display lines, not paragraphs.
Tue Apr 18 14:16:50 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.c: Make sure that the bin window is at least
as big as the allocation. (Should we also make sure that the
bin window is big enough to completely cover widget->window?)
* gtk/gtktextview.c (gtk_text_view_get_visible_rect): Add
function to get the onscreen rectangle.
* gdk/x11/gdkwindow-x11.c (gdk_window_get_pointer): Correctly account
for offsets in window coordinates.
Sun Apr 16 16:13:27 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_get_cursor_locations): Fix index/offset
confusion.
* gtk/gtktextview.c (gtk_text_view_ensure_layout): Set the default direction
from the widget direction.
* gtk/gtktexttag.c gtk/gtktexttagprivate.h (gtk_text_tag_set_arg):
Add a "direction" attribute.
* gtk/gtktextview.c: global s/tkxt/text_view/.
* gtk/testtext.c: Added long block of text in Arabic, to test out
the direction attributes. (Some problems with the shaping system
for arabic become obvious - like the fact the cursor splits words
into unjoined pieces.)
Fri Apr 14 12:54:34 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextdisplay.c (render_layout): Add overstrike handling.
* gtk/gtktextlayout.c: Fix up alignment.
* gtk/testtext.c: Add some tests for centering, wrapping.
Fri Apr 14 09:26:22 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkdrawable.h gdk/gdkdraw.c gdk/gdkwindow.c gdk/x11/gdkdrawable-x11.c:
Add a draw_glyphs() operation to the drawable vtable and gdk_draw_glyphs().
If we wrote GTK+-specific layout-render function this could just replace
the draw_layout() operation in the vtable.
* gtk/gtkentry.c: Move guts of gtk_entry_get_cursor_locations to
pango_layout_get_cursor_pos() and use that function.
* gtk/gtktextchild.[ch]: add gtk_ onto pixmap_segment_new(), since it
is a non-static symbol.
* gtk/gtktextbtree.[ch]: Replace gtk_text_btree_find_line_data_by_y()
with gtk_text_btree_find_line_by_y()
* gtk/gtktextdisplay.c: Rewrote for Pango - uses a custom layout
renderer that handles GtkTextAppearance attributes.
* gtk/gtktexttag.[ch] gtk/gtktexttagprivate.h:
- Move the values in the style that don't affect geometry into a
GtkTextAppearance structure.
- Change underline to take a PangoUnderline and "font" a string
representation of a font description
- Add a "font_desc" attribute which takes a FontDescription structure.
* gtk/gtktextlayout.[ch]:
- Get rid of the display-line list per each line. Instead, we
generate, on demand, a GtkTextLineDisplay structure which]
contains a PangoLayout * and other necesary information
(offsets, cursor locations) for displaying a paragraph.
- Get rid of the code to wrap lines, create display chunks,
etc. Instead, we just go through a paragraph and convert
it into the necessary inputs to a PangoLayout.
- Implement a new attribute type, GtkTextAttrAppearance. This
holds a GtkTextAppearance, and is used to pass colors,
stipple, etc, through from the layout to the display without
having to use lots and lots of individual attributes.
- Reimplement gtk_layout_get_iter_at_pixel() gtk_layout_get_iter_pos()
in terms of PangoLayout functions.
* gtk/gtktextview.c:
- Handle passing the necessary PangoContext to the layout
- Some fixups in painting to deal with the automatic backing store
and offsetting of GTK+-1.4
- Add a style_set handler so that the default style reacts
properly to theme changes.
* gtk/gtktext?*.[ch]: Random code-style fixes.
* gtk/testtext.c: Substitute in languages that Pango handles now for Thai
Mon Apr 10 10:33:45 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktext?*.[ch]: Check in Havoc's port of the Tk text widget,
in original form preparatory to Pango-ization and gdkimcontext-ization.
Thu Apr 6 19:25:39 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimcontext.c: Move default implementations to real_* vfuncs,
so that we can derive from gtkimcontext in language bindings properly.
Thu Apr 6 16:02:52 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimcontextsimple.[ch]: Use gdk_keyval_to_unicode to gdk_unicode_to_keyval.
Add a compose table including (almost) all the compose combinations
from X. This is 6k of static, shared data as opposed to 50k or so of dynamic
data in the XIM implementation.
* gdk/gdk.h gdk/gdkkeyuni.c gdk/win32/gdkevents-win32.c (gdk_keyval_to_unicode, gdk_unicode_to_keyval):
Moved functions to convert keyvalues from and to unicode here from
the win32 port and made them public.
Wed Apr 5 16:37:29 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkeditable.c (gtk_editable_insert_text): Allow new_text_length == -1.
Wed Apr 5 16:27:45 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimcontext.[ch]: Base class for new input context system
* gtk/gtkimmulticontext.[ch]: Proxy input context that allows
the real input context implementation to be loaded from modules
and switched on the fly.
* gtk/gtkcontextsimple.[ch]: Simple implementation of an input
context that just does direct keysymbol => unicode translation.
* gtk/gtkentry.[ch]: Start switching editing over to using
GtkInputContext. (No handling of preedit yet.)
Wed Apr 5 15:48:41 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktypeutils.h (GTK_CHECK_GET_CLASS): Fix problem with one too
many substitutions. (klass should not be subsituted.)
Wed Apr 5 00:18:14 2000 Owen Taylor <otaylor@redhat.com>
* configure.in: Add checks for Pango
* configure.in docs/Makefile.am: Add test for sgml2html
and allow 'make dist' without building html, but print out
warnings in that case. (For making snapshots)
* gdk/Makefile.am gdk/x11/Makefile.am gtk/Makefile.am:
Add Pango libraries and C flags
* gdk/gdkdraw.c gdk/gdkdrawable.h gdkwindow.c gdk/x11/gdkdrawable-x11.c:
Add function (gdk_draw_layout) to draw a pango layout.
* gdk/gdkpango.h gdk/x11/gdkpango-x11.c: New file with functions
for getting Pango contexts for GDK.
* gtk/gtkeditable.c: Get rid of dead code gtk_editable_parent_set()
* gtk/gtkentry.[ch]: Complete rewrite to use Pango, add bidirectional
editing.
* gtk/gtkentry.c: Hack in simple Hebrew input with direct
keysym => unicode translations. More languages can be added
here, but real input-method support is needed.
* docs/Changes-1.4.txt: Added note about entry behavior.
* gtk/gtkenums.h gtk/gtkwidget.[ch] testgtk.c gtkprivate.h: Add functions
to set the reading direction for a widget and the global direction.
Add test which allows toggling the global direction. Two private
flags are used to store the direction. (GTK_DIRECTION_SET + GTK_DIRECTION_LTR)
* gtk/gtkcheckbutton.c gtk/gtkframe.c gtk/gtkhbbox.c gtk/gtkhbox.c
gtk/gtkradiobutton.c gtk/gtkspinbutton.c gtk/gtktable.c
* gtk/gtk[hv]scale.c gtk/gtkscale.[ch]: Draw numbers using Pango
* gtk/gtklabel.[ch]: Moved to Pango and considerably rewritten. Line breaking,
underlining now handled by Pango.
* gtk/gtkstyle.[ch] gtk/gtkrc.[ch]: Add a PangoFontDescription
to RCStyle and Style. (Having both this and the old font name and GdkFont
is temporary.)
* gtk/gtkwidget.[ch] (gtk_widget_create_pango_{context,layout}): Added
convenience functions for creating contexts and layouts for widgets.
* gtk/testgtk.c: Enhance label tests with multilingual labels.
2000-06-02 03:14:07 +00:00
|
|
|
|
pango_layout_set_text (layout, buffer, -1);
|
2000-07-02 21:32:56 +00:00
|
|
|
|
pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
|
Remove all references to offscreen flag which was no longer used.
Thu Jun 1 23:05:13 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Remove all references to
offscreen flag which was no longer used.
* gtk/gtkprivate.h (enum): Remove unused flags and compress.
* gtk/gtkframe.c (gtk_frame_set_label_widget): Check
for non-null label_widget->parent.
* gtk/gtkentry.c: Get rid of code to deal with PangoAttribute
which no longer was used.
* gdk/gdkpango.c (gdk_pango_context_get_info): make static.
* gdk/gdkpango.c (gdk_draw_layout[_line]): Add checks
for null arguments.
* gdk/x11/gdkgeometry-x11.c (gdk_window_scroll): add
check for destroyed windows.
Thu Jun 1 13:48:45 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimmulticontext.c: Add a finalize method and unref
the slave context there.
* gtk/gtkinvisible.[ch]: Make reference counting behavior
identical to GtkWindow.
Thu Jun 1 01:54:11 2000 Owen Taylor <otaylor@redhat.com>
* Makefile.am gdk/gdkpango.c: Copy the layout render function from
pangox to here, so we can write them independent of rendering
system, using GDK primitives.
* gdk/gdkdrawable.h gdk/gdkdraw.c gdk/gdkwindow.c
gdk/x11/gdkdrawable-x11.c: Remove draw_layout() from the vtable,
since we have a rendering-system independent implementation in
terms of draw_glyphs().
* gdk/gdkpango.c gdkdrawable.h (gdk_draw_layout_line): New
function to render a single line.
* gdk/x11/gdkpango.c: Move the guts of this file mostly
into ../gdkpango.c, which simplifies things, since we
don't have to deal with raw X gc's.
Fri May 19 04:28:16 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.[ch]: Add get_log_attrs() function to
get the logical attributes for a given GtkTextLine.
Tue May 30 16:05:39 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkfont-x11.c (gdk_font_charset_for_locale): Track
g_locale_get_codeset() to g_get_codeset() change.
Tue May 30 15:03:19 2000 Owen Taylor <otaylor@redhat.com>
* gtk/testcalendar.c (calendar_font_selection_ok): Use font
descriptions.
* gtk/gtkentry.c (gtk_entry_draw_text): Center text within
the entry.
* gtk/gtkfontsel.c (gtk_font_selection_dialog_init): Start of
redoing (vastly simplifying) for Pango. Still needs quite
a bit of work. (Size selection is currently poor. List of
predefined sizes is not a good idea, since all of these
sizes won't necessarily be distinct.)
Tue May 30 13:50:19 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkfont-x11.c (gdk_font_charset_for_locale): Handle
CODESET results for LANG=C.
Mon May 29 15:49:10 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.[ch]: Add a 'font_name' declaration to RC
which takes a stringized pango font description;
ignore the older 'font' and 'fontset' declarations.
* gtk/gtkstyle.c gtk/gtkrc.c: Fill in the style->font
field with a GdkFont derived via gdk_font_from_description(),
for compatibility. (Should we just remove it entirely?
Probably too much compatibility breakage, but people
should be migrating to the new Pango stuff as quickly
as possible.)
Mon May 29 15:47:41 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c gtk/gtkclist.c: s/pango_font_unref/g_object_unref/.
Mon May 29 15:44:46 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcalender.c: Roughly pango-ized. Really needs
redoing; there are some bugs in size allocation right
now, the semi-existant distinction between header / day
fonts was removed, but, with Pango, could actually
be made functional in a nice way.
* gtk/testcalender: Move calender from examples into this
directory as a test program. (We really need to restrcture
testgtk into a whole directory full of tests for every
widget or functionality group, separated into multiple .c
files.)
Mon May 29 15:19:56 2000 Owen Taylor <otaylor@redhat.com>
* gtk/testgtk.c (file_exists): Fix stupid typo that
was keeping RC file from being loaded.
* gtk/testgtkrc gtk/testgtkrc2: Test new pango-ized
RC file font code.
Mon May 29 14:31:27 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkfont.h gdk/x11/gdkfont-x11.c (gdk_font_from_description):
Add function to load a GdkFont from a PangoFontDescription.
Fri May 26 17:16:40 2000 Owen Taylor <otaylor@redhat.com>
* gtk/frame.[ch] gtkaspectframe.c: Make frame widgets able
to have any widget for the label, use a GtkLabel widget
to display the text. (Based partially on a patch from
Anders Carlson.)
(Quite a bit of code reorganization - strip 90% of the
guts out of gtkaspectframe and add a single virtual
func to GtkFrameClass - compute_child_allocation.)
Fri May 26 12:00:02 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkctree.c gtk/gtkclist.[ch]: Pangoized.
(Removed clist->row_center_offset field because caching
it wasn't saving time or code, added private function
_gtk_clist_create_cell_layout()).
Wed May 24 15:59:37 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkaccellabel.c: Pangoized.
* gtk/[hv]ruler.c: Pangoized
Mon May 22 19:23:59 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c (gtk_file_selection_init):
Use gtk_clist_set_column_auto_resize() to remove need
need for manual column width computations.
Mon May 22 18:50:26 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktooltips.[ch]: Replace custom drawing with a GtkLabel,
ensuring Pango correctness, and considerably simplifying the
code.
* gtk/gtklabel.c gtk[hv]scale.c: 1000 => PANGO_SCALE.
* gtk/gtklabel.c (gtk_label_size_request): Fixed incorrect
getting of numbers of lines.
* gtk/gtklabel.c (gtk_label_size_request): Set the requisition
to the actual requested width of the lable, not to the wrap
width we set.
* gtk/gtktextchild.h: Remove extraneous include of gtk/gtk.h.
* gtk/gtktextbtree.c gtk/gtktextbuffer.c gtk/gtktextlayout.c
gtk/gtktextview.c gtk/gtktextview.[ch]: Fix up includes.
* gtk/gtktextview.c: Fix structure inheritance.
* gtk/gtkprogressbar.c: Pangoize.
Mon May 22 15:47:30 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextview.c (gtk_text_view_get_first_para_iter): Encapsulate
in a function.
* gtk/gtktextlayout.c (find_display_line_above): Fixed
bug with computing line tops.
* gtk/gtktextview.c (changed_handler): Fix < , <= confusion.
Thu May 18 18:53:31 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextdisplay.c (gtk_text_layout_draw): Fix up the x_offset
and y_offset coordinates to do what we need now. (The offset between
buffer and layout coordinates has been reintroduced, but is a
bit different than before.)
* gtk/gtktextview.[ch]: No longer inherit from GtkLayout; instead
handle the adjustments ourselves, and scroll as necessary using
the new gdk_window_scroll().
The advantage of this is that when we are incrementally revalidating,
we are essentially rearranging things around the visible portion
of the screen. With the old setup, the visible portion of the
screen was moved around in the layout, so scrolling and redrawing
to track that caused jumping of the display. Since we now
control the scrolling ourselves, we can suppress this and
only redraw when things actually change.
Thu May 18 18:47:25 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextbtree.c (redisplay_mark): We need to invalidate
the region not just redisplay it after-all, since we store the
cursors in the LineDisplay. (Ugly interactions here between
GtkLayout and GtkTextBTree here.)
* gtk/gtktextbtree.c (redisplay_region): Fixed reversed comparison.
Thu May 18 18:43:21 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.h gdk/x11/gdkgeometry-x11.c (gdk_window_scroll):
Added function to scroll contents of a window while keeping the
window constant. Works by XCopyArea or guffaw-scrolling depending
on the details of how the window is set up. (guffaw-scrolling
still needs to be filled in.)
Wed May 17 22:36:53 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextiter.c gtk/gtkmain.c: Add a debug key for the text widget,
move the debugging that was tied to a global variable
to that.
* gtk/gtkmarshal.list: Add NONE:INT,INT,INT
* gtk/gtktextbtree.[ch] gtk/gtktextlayout.c: Keep a separate
validated flag, in line data instead of setting height/width to
-1. This allows us to perform operations with partially invalid
buffer (using the old size for invalid lines) and thus to do
incremental vaidation. Keep height/width aggregates up to date
when deleting text and rebalancing the tree.
* gtk/gtktextbtree.[ch]: Add functions validate a line
(gtk_text_btree_validate_line), and to validate up
to a number of pixels (gtk_text_btree_validate).
* gtk/gtktextlayout.[ch]: Add an ::invalidated signal
that indicates that something is changed and a revalidation
pass is needed. Change ::need_repaint to ::changed, and
make it take old and new yranges instead of a rectangle.
* gtk/gtktextbtree.[ch] gtk/gtktextlayout.[ch]: Move
the line_data_destroy() function from
gtk_text_btree_add_view() to a virtual function in
GtkTextLayout
* gtk/gtktextbtree.[ch]: Remove gtk_text_btree_get_damage_range(),
since we are handling partial repaints in a different fashion
now.
* gtk/gtktextbtree.[ch]: Only repaint the changed portion
of the selection instead of queueing a repaint on the
entire widget.
* gtk/gtktextbuffer.[ch] gtk/gtktextbtree.[ch]: Move
get_selection_bounds() down to btree, make the function
in buffer a wrapper around the btree function.
* gtk/gtktextlayout.[ch]: Add functions to check if the
layout is valid and to recompute either a range of pixels
aroudn a line or a certain total number of pixels.
* gtk/gtktextlayout.[ch]: Cache a single line display;
now that we only redraw the needed portions, the hit rate
for this cache is quite high.
* gtk/gtktextview.[ch]: Keep track of the first paragraph
on the screen so that when re-laying-out the buffer, we can
keep the same place. This requires connecting to ::value_changed
on the adjustments
* gtk/gtktextview.[ch]: Add idle functions to revalidate
the buffer after we receive an ::invalidated signal.
Wed May 17 22:10:47 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.c (gtk_layout_size_allocate): Set upper
to max of allocation and layout size, not just to the
layout size.
* gtk/gtk[hv]scrollbar.c (gtk_[hv]scrollbar_calc_slider_size):
Invalidate window so it gets redrawn properly.
* gdk/gdkwindow.c (gdk_window_invalidate_rect): Allow rect == NULL
to mean the entire window.
* gdk/gdkevents.h: Move definition for GDK_PRIORITY_REDRAW
into public header.
Mon May 15 14:51:31 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextmark.c (gtk_text_mark_get_name): Add function
to get the name of a mark.
* gtk/gtktextlayout.c (gtk_text_layout_get_line_at_y): Add a function
to find the paragraph from a y position.
Thu May 11 12:57:20 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextbtree.c (gtk_text_btree_node_invalidate_upward): Valid
nodes have width/height >= 0, not > 0.
Tue May 9 21:29:06 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.[ch] gtk/gtktextdisplay.c (gtk_text_layout_get_line_display):
Add a size_only flag, so when we only need the size, we don't create
useless appearance attributes.
* gtk/gtktextview.c (gtk_text_view_ensure_layout): Remove
duplicate setting of font description.
* gtk/gtkscale.c: Use PANGO_SCALE instead of 1000
Wed Apr 26 01:53:23 2000 Owen Taylor <otaylor@redhat.com>
* gtk/Makefile.am (EXTRA_DIST): Add OLD_STAMP into
EXTRA_DIST. It does not work well when the file that
everything depends on is not in the tarball.
Wed Apr 26 00:56:14 2000 Owen Taylor <otaylor@redhat.com>
* gtk/testgtk.c: Some hacks and fixes so that it basically
works when not sitting in the GTK+ build tree.
2000-05-03 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (gtk_text_line_next_could_contain_tag):
Properly determine the ordering of the tag root and the current
line within the tree. Previous algorithm only worked if the tag
root's immediate parent was the common root of both the current
line and the tag root.
Wed Apr 26 00:43:00 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.c (set_para_values): Fix some bugs in
alignment.
* gtk/gtktextview.c (gtk_text_view_ensure_layout): Track
the widget text directional dynamically.
* gtk/gtktextview.[ch]: Added functions to get and set default
wrap mode.
Tue Apr 25 23:47:38 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.c (gtk_text_layout_get_iter_location): Fix bug
in cursor location computation.
Tue Apr 25 23:22:59 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.c (gtk_layout_set_size): Clamp hadjustment/
vadjusment values properly when layout gets smaller.
* gtk/gtktextview.c (need_repaint_handler): Areas being
passed in are far completely inaccurate, and sometimes
too small, so, for now, just queue a redraw on the
whole visible region.
2000-04-25 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (summary_destroy): new function to
destroy tag summary nodes
(gtk_text_line_next_could_contain_tag): this function was
totally broken if the line passed in wasn't below the tag
root. Fix it.
(gtk_text_btree_first_could_contain_tag): In the tag == NULL
"wildcard" case, we have to do a linear scan. Blah.
(gtk_text_btree_last_could_contain_tag): In tag == NULL case,
we have to do the linear scan
(tag_removed_cb): When a tag is removed from the tag table,
remove the GtkTextTagInfo node from the btree.
(gtk_text_btree_spew): Implement the spew function, for
our debugging pleasure.
Tue Apr 25 19:40:18 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.c (gtk_text_layout_set_buffer): Fix
a problem with referring to the wrong buffer.
* gtk/gtkentry.c: Fix focus-in/focus-out confusion.
* gtk/gtkrc.c gtk/gtkstyle.c: Moving setting default
font description to gtk_style_new() - otherwise things
don't work without a .gtkrc file.
* gtk/gtktextbuffer.c (gtk_text_buffer_new): Sink the
tags table if we create it ourself, too.
* gdk/gdktypes.h (enum): Move GDK_RELEASE_MASK, since
it was conflicting with XKB modifiers.
* gtk/gtktextview.[ch]: Add simple support for
GtkIMContext.
Mon Apr 24 19:34:18 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_move_cursor_visually): Fix problem
with deletion from last commit.
Mon Apr 24 19:29:40 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_create_pango_context): Set the language
in the context from the current locale.
* gtk/gtkentry.c (gtk_entry_size_request): Use language from the
context, not hardcoded value.
* gtk/gtkentry.c (gtk_entry_move_cursor): Make character movement visual,
not logical.
Sun Apr 23 23:39:18 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c gtk/gtktextdisplay.c: Don't handle selections as
attributes - that doesn't handle partial-glyph selection
properly. Instead use new pango_layout_line_get_x_ranges()
functionality to draw the selection.
* gtk/gtkentry.c: Simplify code since pango_layout_line_index_to_x()
now properly handles out-of-range coordinates.
* gtk/gtktextbuffer.c: Emit "mark_set" when the cursor is moved.
* gtk/gtktextiter.h gtk/gtktextiterprivate.h: Make gtk_text_iter_get_line_byte()
public.
* gtk/gtktextlayout.[ch]: Properly set the direction in the PangoContext
for paragraphs opposite to the base direction of the widget.
* gtk/gtktextlayout.[ch] gtk/gtktextdisplay.c: Fixes for alignment.
* gtk/gtktextlayout.c: Don't split segments on marks, since that
causes Arabic words to reshape as you cursor through.
* gtk/gtktextlayout.[ch] gtk/gtktextview.[ch]: Implement virtual
cursor position when moving vertically with the arrow keys and
scrolling with page-up/page-down. (Arrow keys save only the X,
scrolling saves both X and Y.)
This means you can line-up / line-down or page-up / page-down
without losing your place, and also that moving vertically
with the cursor keys keeps the same X position, not the same
character count:
* gtk/gtktextlayout.[ch] gtk/gtktextview.[ch]: Make vertical
arrow keys move by display lines, not paragraphs.
Tue Apr 18 14:16:50 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.c: Make sure that the bin window is at least
as big as the allocation. (Should we also make sure that the
bin window is big enough to completely cover widget->window?)
* gtk/gtktextview.c (gtk_text_view_get_visible_rect): Add
function to get the onscreen rectangle.
* gdk/x11/gdkwindow-x11.c (gdk_window_get_pointer): Correctly account
for offsets in window coordinates.
Sun Apr 16 16:13:27 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_get_cursor_locations): Fix index/offset
confusion.
* gtk/gtktextview.c (gtk_text_view_ensure_layout): Set the default direction
from the widget direction.
* gtk/gtktexttag.c gtk/gtktexttagprivate.h (gtk_text_tag_set_arg):
Add a "direction" attribute.
* gtk/gtktextview.c: global s/tkxt/text_view/.
* gtk/testtext.c: Added long block of text in Arabic, to test out
the direction attributes. (Some problems with the shaping system
for arabic become obvious - like the fact the cursor splits words
into unjoined pieces.)
Fri Apr 14 12:54:34 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextdisplay.c (render_layout): Add overstrike handling.
* gtk/gtktextlayout.c: Fix up alignment.
* gtk/testtext.c: Add some tests for centering, wrapping.
Fri Apr 14 09:26:22 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkdrawable.h gdk/gdkdraw.c gdk/gdkwindow.c gdk/x11/gdkdrawable-x11.c:
Add a draw_glyphs() operation to the drawable vtable and gdk_draw_glyphs().
If we wrote GTK+-specific layout-render function this could just replace
the draw_layout() operation in the vtable.
* gtk/gtkentry.c: Move guts of gtk_entry_get_cursor_locations to
pango_layout_get_cursor_pos() and use that function.
* gtk/gtktextchild.[ch]: add gtk_ onto pixmap_segment_new(), since it
is a non-static symbol.
* gtk/gtktextbtree.[ch]: Replace gtk_text_btree_find_line_data_by_y()
with gtk_text_btree_find_line_by_y()
* gtk/gtktextdisplay.c: Rewrote for Pango - uses a custom layout
renderer that handles GtkTextAppearance attributes.
* gtk/gtktexttag.[ch] gtk/gtktexttagprivate.h:
- Move the values in the style that don't affect geometry into a
GtkTextAppearance structure.
- Change underline to take a PangoUnderline and "font" a string
representation of a font description
- Add a "font_desc" attribute which takes a FontDescription structure.
* gtk/gtktextlayout.[ch]:
- Get rid of the display-line list per each line. Instead, we
generate, on demand, a GtkTextLineDisplay structure which]
contains a PangoLayout * and other necesary information
(offsets, cursor locations) for displaying a paragraph.
- Get rid of the code to wrap lines, create display chunks,
etc. Instead, we just go through a paragraph and convert
it into the necessary inputs to a PangoLayout.
- Implement a new attribute type, GtkTextAttrAppearance. This
holds a GtkTextAppearance, and is used to pass colors,
stipple, etc, through from the layout to the display without
having to use lots and lots of individual attributes.
- Reimplement gtk_layout_get_iter_at_pixel() gtk_layout_get_iter_pos()
in terms of PangoLayout functions.
* gtk/gtktextview.c:
- Handle passing the necessary PangoContext to the layout
- Some fixups in painting to deal with the automatic backing store
and offsetting of GTK+-1.4
- Add a style_set handler so that the default style reacts
properly to theme changes.
* gtk/gtktext?*.[ch]: Random code-style fixes.
* gtk/testtext.c: Substitute in languages that Pango handles now for Thai
Mon Apr 10 10:33:45 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktext?*.[ch]: Check in Havoc's port of the Tk text widget,
in original form preparatory to Pango-ization and gdkimcontext-ization.
Thu Apr 6 19:25:39 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimcontext.c: Move default implementations to real_* vfuncs,
so that we can derive from gtkimcontext in language bindings properly.
Thu Apr 6 16:02:52 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimcontextsimple.[ch]: Use gdk_keyval_to_unicode to gdk_unicode_to_keyval.
Add a compose table including (almost) all the compose combinations
from X. This is 6k of static, shared data as opposed to 50k or so of dynamic
data in the XIM implementation.
* gdk/gdk.h gdk/gdkkeyuni.c gdk/win32/gdkevents-win32.c (gdk_keyval_to_unicode, gdk_unicode_to_keyval):
Moved functions to convert keyvalues from and to unicode here from
the win32 port and made them public.
Wed Apr 5 16:37:29 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkeditable.c (gtk_editable_insert_text): Allow new_text_length == -1.
Wed Apr 5 16:27:45 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimcontext.[ch]: Base class for new input context system
* gtk/gtkimmulticontext.[ch]: Proxy input context that allows
the real input context implementation to be loaded from modules
and switched on the fly.
* gtk/gtkcontextsimple.[ch]: Simple implementation of an input
context that just does direct keysymbol => unicode translation.
* gtk/gtkentry.[ch]: Start switching editing over to using
GtkInputContext. (No handling of preedit yet.)
Wed Apr 5 15:48:41 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktypeutils.h (GTK_CHECK_GET_CLASS): Fix problem with one too
many substitutions. (klass should not be subsituted.)
Wed Apr 5 00:18:14 2000 Owen Taylor <otaylor@redhat.com>
* configure.in: Add checks for Pango
* configure.in docs/Makefile.am: Add test for sgml2html
and allow 'make dist' without building html, but print out
warnings in that case. (For making snapshots)
* gdk/Makefile.am gdk/x11/Makefile.am gtk/Makefile.am:
Add Pango libraries and C flags
* gdk/gdkdraw.c gdk/gdkdrawable.h gdkwindow.c gdk/x11/gdkdrawable-x11.c:
Add function (gdk_draw_layout) to draw a pango layout.
* gdk/gdkpango.h gdk/x11/gdkpango-x11.c: New file with functions
for getting Pango contexts for GDK.
* gtk/gtkeditable.c: Get rid of dead code gtk_editable_parent_set()
* gtk/gtkentry.[ch]: Complete rewrite to use Pango, add bidirectional
editing.
* gtk/gtkentry.c: Hack in simple Hebrew input with direct
keysym => unicode translations. More languages can be added
here, but real input-method support is needed.
* docs/Changes-1.4.txt: Added note about entry behavior.
* gtk/gtkenums.h gtk/gtkwidget.[ch] testgtk.c gtkprivate.h: Add functions
to set the reading direction for a widget and the global direction.
Add test which allows toggling the global direction. Two private
flags are used to store the direction. (GTK_DIRECTION_SET + GTK_DIRECTION_LTR)
* gtk/gtkcheckbutton.c gtk/gtkframe.c gtk/gtkhbbox.c gtk/gtkhbox.c
gtk/gtkradiobutton.c gtk/gtkspinbutton.c gtk/gtktable.c
* gtk/gtk[hv]scale.c gtk/gtkscale.[ch]: Draw numbers using Pango
* gtk/gtklabel.[ch]: Moved to Pango and considerably rewritten. Line breaking,
underlining now handled by Pango.
* gtk/gtkstyle.[ch] gtk/gtkrc.[ch]: Add a PangoFontDescription
to RCStyle and Style. (Having both this and the old font name and GdkFont
is temporary.)
* gtk/gtkwidget.[ch] (gtk_widget_create_pango_{context,layout}): Added
convenience functions for creating contexts and layouts for widgets.
* gtk/testgtk.c: Enhance label tests with multilingual labels.
2000-06-02 03:14:07 +00:00
|
|
|
|
|
2010-08-12 15:14:51 +00:00
|
|
|
|
if (priv->display_flags & GTK_CALENDAR_NO_MONTH_CHANGE)
|
2003-08-08 22:17:34 +00:00
|
|
|
|
if (year_left)
|
|
|
|
|
x = header_width - (3 + max_month_width
|
2011-01-24 02:50:39 +00:00
|
|
|
|
- (max_month_width - logical_rect.width)/2);
|
2003-08-08 22:17:34 +00:00
|
|
|
|
else
|
2000-07-02 21:32:56 +00:00
|
|
|
|
x = 3 + (max_month_width - logical_rect.width) / 2;
|
1998-09-27 18:32:00 +00:00
|
|
|
|
else
|
2003-08-08 22:17:34 +00:00
|
|
|
|
if (year_left)
|
2005-05-11 19:16:19 +00:00
|
|
|
|
x = header_width - (3 + priv->arrow_width + max_month_width
|
2011-01-24 02:50:39 +00:00
|
|
|
|
- (max_month_width - logical_rect.width)/2);
|
2003-08-08 22:17:34 +00:00
|
|
|
|
else
|
2005-05-11 19:16:19 +00:00
|
|
|
|
x = 3 + priv->arrow_width + (max_month_width - logical_rect.width)/2;
|
Remove all references to offscreen flag which was no longer used.
Thu Jun 1 23:05:13 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Remove all references to
offscreen flag which was no longer used.
* gtk/gtkprivate.h (enum): Remove unused flags and compress.
* gtk/gtkframe.c (gtk_frame_set_label_widget): Check
for non-null label_widget->parent.
* gtk/gtkentry.c: Get rid of code to deal with PangoAttribute
which no longer was used.
* gdk/gdkpango.c (gdk_pango_context_get_info): make static.
* gdk/gdkpango.c (gdk_draw_layout[_line]): Add checks
for null arguments.
* gdk/x11/gdkgeometry-x11.c (gdk_window_scroll): add
check for destroyed windows.
Thu Jun 1 13:48:45 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimmulticontext.c: Add a finalize method and unref
the slave context there.
* gtk/gtkinvisible.[ch]: Make reference counting behavior
identical to GtkWindow.
Thu Jun 1 01:54:11 2000 Owen Taylor <otaylor@redhat.com>
* Makefile.am gdk/gdkpango.c: Copy the layout render function from
pangox to here, so we can write them independent of rendering
system, using GDK primitives.
* gdk/gdkdrawable.h gdk/gdkdraw.c gdk/gdkwindow.c
gdk/x11/gdkdrawable-x11.c: Remove draw_layout() from the vtable,
since we have a rendering-system independent implementation in
terms of draw_glyphs().
* gdk/gdkpango.c gdkdrawable.h (gdk_draw_layout_line): New
function to render a single line.
* gdk/x11/gdkpango.c: Move the guts of this file mostly
into ../gdkpango.c, which simplifies things, since we
don't have to deal with raw X gc's.
Fri May 19 04:28:16 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.[ch]: Add get_log_attrs() function to
get the logical attributes for a given GtkTextLine.
Tue May 30 16:05:39 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkfont-x11.c (gdk_font_charset_for_locale): Track
g_locale_get_codeset() to g_get_codeset() change.
Tue May 30 15:03:19 2000 Owen Taylor <otaylor@redhat.com>
* gtk/testcalendar.c (calendar_font_selection_ok): Use font
descriptions.
* gtk/gtkentry.c (gtk_entry_draw_text): Center text within
the entry.
* gtk/gtkfontsel.c (gtk_font_selection_dialog_init): Start of
redoing (vastly simplifying) for Pango. Still needs quite
a bit of work. (Size selection is currently poor. List of
predefined sizes is not a good idea, since all of these
sizes won't necessarily be distinct.)
Tue May 30 13:50:19 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkfont-x11.c (gdk_font_charset_for_locale): Handle
CODESET results for LANG=C.
Mon May 29 15:49:10 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.[ch]: Add a 'font_name' declaration to RC
which takes a stringized pango font description;
ignore the older 'font' and 'fontset' declarations.
* gtk/gtkstyle.c gtk/gtkrc.c: Fill in the style->font
field with a GdkFont derived via gdk_font_from_description(),
for compatibility. (Should we just remove it entirely?
Probably too much compatibility breakage, but people
should be migrating to the new Pango stuff as quickly
as possible.)
Mon May 29 15:47:41 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c gtk/gtkclist.c: s/pango_font_unref/g_object_unref/.
Mon May 29 15:44:46 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcalender.c: Roughly pango-ized. Really needs
redoing; there are some bugs in size allocation right
now, the semi-existant distinction between header / day
fonts was removed, but, with Pango, could actually
be made functional in a nice way.
* gtk/testcalender: Move calender from examples into this
directory as a test program. (We really need to restrcture
testgtk into a whole directory full of tests for every
widget or functionality group, separated into multiple .c
files.)
Mon May 29 15:19:56 2000 Owen Taylor <otaylor@redhat.com>
* gtk/testgtk.c (file_exists): Fix stupid typo that
was keeping RC file from being loaded.
* gtk/testgtkrc gtk/testgtkrc2: Test new pango-ized
RC file font code.
Mon May 29 14:31:27 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkfont.h gdk/x11/gdkfont-x11.c (gdk_font_from_description):
Add function to load a GdkFont from a PangoFontDescription.
Fri May 26 17:16:40 2000 Owen Taylor <otaylor@redhat.com>
* gtk/frame.[ch] gtkaspectframe.c: Make frame widgets able
to have any widget for the label, use a GtkLabel widget
to display the text. (Based partially on a patch from
Anders Carlson.)
(Quite a bit of code reorganization - strip 90% of the
guts out of gtkaspectframe and add a single virtual
func to GtkFrameClass - compute_child_allocation.)
Fri May 26 12:00:02 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkctree.c gtk/gtkclist.[ch]: Pangoized.
(Removed clist->row_center_offset field because caching
it wasn't saving time or code, added private function
_gtk_clist_create_cell_layout()).
Wed May 24 15:59:37 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkaccellabel.c: Pangoized.
* gtk/[hv]ruler.c: Pangoized
Mon May 22 19:23:59 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c (gtk_file_selection_init):
Use gtk_clist_set_column_auto_resize() to remove need
need for manual column width computations.
Mon May 22 18:50:26 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktooltips.[ch]: Replace custom drawing with a GtkLabel,
ensuring Pango correctness, and considerably simplifying the
code.
* gtk/gtklabel.c gtk[hv]scale.c: 1000 => PANGO_SCALE.
* gtk/gtklabel.c (gtk_label_size_request): Fixed incorrect
getting of numbers of lines.
* gtk/gtklabel.c (gtk_label_size_request): Set the requisition
to the actual requested width of the lable, not to the wrap
width we set.
* gtk/gtktextchild.h: Remove extraneous include of gtk/gtk.h.
* gtk/gtktextbtree.c gtk/gtktextbuffer.c gtk/gtktextlayout.c
gtk/gtktextview.c gtk/gtktextview.[ch]: Fix up includes.
* gtk/gtktextview.c: Fix structure inheritance.
* gtk/gtkprogressbar.c: Pangoize.
Mon May 22 15:47:30 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextview.c (gtk_text_view_get_first_para_iter): Encapsulate
in a function.
* gtk/gtktextlayout.c (find_display_line_above): Fixed
bug with computing line tops.
* gtk/gtktextview.c (changed_handler): Fix < , <= confusion.
Thu May 18 18:53:31 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextdisplay.c (gtk_text_layout_draw): Fix up the x_offset
and y_offset coordinates to do what we need now. (The offset between
buffer and layout coordinates has been reintroduced, but is a
bit different than before.)
* gtk/gtktextview.[ch]: No longer inherit from GtkLayout; instead
handle the adjustments ourselves, and scroll as necessary using
the new gdk_window_scroll().
The advantage of this is that when we are incrementally revalidating,
we are essentially rearranging things around the visible portion
of the screen. With the old setup, the visible portion of the
screen was moved around in the layout, so scrolling and redrawing
to track that caused jumping of the display. Since we now
control the scrolling ourselves, we can suppress this and
only redraw when things actually change.
Thu May 18 18:47:25 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextbtree.c (redisplay_mark): We need to invalidate
the region not just redisplay it after-all, since we store the
cursors in the LineDisplay. (Ugly interactions here between
GtkLayout and GtkTextBTree here.)
* gtk/gtktextbtree.c (redisplay_region): Fixed reversed comparison.
Thu May 18 18:43:21 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.h gdk/x11/gdkgeometry-x11.c (gdk_window_scroll):
Added function to scroll contents of a window while keeping the
window constant. Works by XCopyArea or guffaw-scrolling depending
on the details of how the window is set up. (guffaw-scrolling
still needs to be filled in.)
Wed May 17 22:36:53 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextiter.c gtk/gtkmain.c: Add a debug key for the text widget,
move the debugging that was tied to a global variable
to that.
* gtk/gtkmarshal.list: Add NONE:INT,INT,INT
* gtk/gtktextbtree.[ch] gtk/gtktextlayout.c: Keep a separate
validated flag, in line data instead of setting height/width to
-1. This allows us to perform operations with partially invalid
buffer (using the old size for invalid lines) and thus to do
incremental vaidation. Keep height/width aggregates up to date
when deleting text and rebalancing the tree.
* gtk/gtktextbtree.[ch]: Add functions validate a line
(gtk_text_btree_validate_line), and to validate up
to a number of pixels (gtk_text_btree_validate).
* gtk/gtktextlayout.[ch]: Add an ::invalidated signal
that indicates that something is changed and a revalidation
pass is needed. Change ::need_repaint to ::changed, and
make it take old and new yranges instead of a rectangle.
* gtk/gtktextbtree.[ch] gtk/gtktextlayout.[ch]: Move
the line_data_destroy() function from
gtk_text_btree_add_view() to a virtual function in
GtkTextLayout
* gtk/gtktextbtree.[ch]: Remove gtk_text_btree_get_damage_range(),
since we are handling partial repaints in a different fashion
now.
* gtk/gtktextbtree.[ch]: Only repaint the changed portion
of the selection instead of queueing a repaint on the
entire widget.
* gtk/gtktextbuffer.[ch] gtk/gtktextbtree.[ch]: Move
get_selection_bounds() down to btree, make the function
in buffer a wrapper around the btree function.
* gtk/gtktextlayout.[ch]: Add functions to check if the
layout is valid and to recompute either a range of pixels
aroudn a line or a certain total number of pixels.
* gtk/gtktextlayout.[ch]: Cache a single line display;
now that we only redraw the needed portions, the hit rate
for this cache is quite high.
* gtk/gtktextview.[ch]: Keep track of the first paragraph
on the screen so that when re-laying-out the buffer, we can
keep the same place. This requires connecting to ::value_changed
on the adjustments
* gtk/gtktextview.[ch]: Add idle functions to revalidate
the buffer after we receive an ::invalidated signal.
Wed May 17 22:10:47 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.c (gtk_layout_size_allocate): Set upper
to max of allocation and layout size, not just to the
layout size.
* gtk/gtk[hv]scrollbar.c (gtk_[hv]scrollbar_calc_slider_size):
Invalidate window so it gets redrawn properly.
* gdk/gdkwindow.c (gdk_window_invalidate_rect): Allow rect == NULL
to mean the entire window.
* gdk/gdkevents.h: Move definition for GDK_PRIORITY_REDRAW
into public header.
Mon May 15 14:51:31 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextmark.c (gtk_text_mark_get_name): Add function
to get the name of a mark.
* gtk/gtktextlayout.c (gtk_text_layout_get_line_at_y): Add a function
to find the paragraph from a y position.
Thu May 11 12:57:20 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextbtree.c (gtk_text_btree_node_invalidate_upward): Valid
nodes have width/height >= 0, not > 0.
Tue May 9 21:29:06 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.[ch] gtk/gtktextdisplay.c (gtk_text_layout_get_line_display):
Add a size_only flag, so when we only need the size, we don't create
useless appearance attributes.
* gtk/gtktextview.c (gtk_text_view_ensure_layout): Remove
duplicate setting of font description.
* gtk/gtkscale.c: Use PANGO_SCALE instead of 1000
Wed Apr 26 01:53:23 2000 Owen Taylor <otaylor@redhat.com>
* gtk/Makefile.am (EXTRA_DIST): Add OLD_STAMP into
EXTRA_DIST. It does not work well when the file that
everything depends on is not in the tarball.
Wed Apr 26 00:56:14 2000 Owen Taylor <otaylor@redhat.com>
* gtk/testgtk.c: Some hacks and fixes so that it basically
works when not sitting in the GTK+ build tree.
2000-05-03 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (gtk_text_line_next_could_contain_tag):
Properly determine the ordering of the tag root and the current
line within the tree. Previous algorithm only worked if the tag
root's immediate parent was the common root of both the current
line and the tag root.
Wed Apr 26 00:43:00 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.c (set_para_values): Fix some bugs in
alignment.
* gtk/gtktextview.c (gtk_text_view_ensure_layout): Track
the widget text directional dynamically.
* gtk/gtktextview.[ch]: Added functions to get and set default
wrap mode.
Tue Apr 25 23:47:38 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.c (gtk_text_layout_get_iter_location): Fix bug
in cursor location computation.
Tue Apr 25 23:22:59 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.c (gtk_layout_set_size): Clamp hadjustment/
vadjusment values properly when layout gets smaller.
* gtk/gtktextview.c (need_repaint_handler): Areas being
passed in are far completely inaccurate, and sometimes
too small, so, for now, just queue a redraw on the
whole visible region.
2000-04-25 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (summary_destroy): new function to
destroy tag summary nodes
(gtk_text_line_next_could_contain_tag): this function was
totally broken if the line passed in wasn't below the tag
root. Fix it.
(gtk_text_btree_first_could_contain_tag): In the tag == NULL
"wildcard" case, we have to do a linear scan. Blah.
(gtk_text_btree_last_could_contain_tag): In tag == NULL case,
we have to do the linear scan
(tag_removed_cb): When a tag is removed from the tag table,
remove the GtkTextTagInfo node from the btree.
(gtk_text_btree_spew): Implement the spew function, for
our debugging pleasure.
Tue Apr 25 19:40:18 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.c (gtk_text_layout_set_buffer): Fix
a problem with referring to the wrong buffer.
* gtk/gtkentry.c: Fix focus-in/focus-out confusion.
* gtk/gtkrc.c gtk/gtkstyle.c: Moving setting default
font description to gtk_style_new() - otherwise things
don't work without a .gtkrc file.
* gtk/gtktextbuffer.c (gtk_text_buffer_new): Sink the
tags table if we create it ourself, too.
* gdk/gdktypes.h (enum): Move GDK_RELEASE_MASK, since
it was conflicting with XKB modifiers.
* gtk/gtktextview.[ch]: Add simple support for
GtkIMContext.
Mon Apr 24 19:34:18 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_move_cursor_visually): Fix problem
with deletion from last commit.
Mon Apr 24 19:29:40 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_create_pango_context): Set the language
in the context from the current locale.
* gtk/gtkentry.c (gtk_entry_size_request): Use language from the
context, not hardcoded value.
* gtk/gtkentry.c (gtk_entry_move_cursor): Make character movement visual,
not logical.
Sun Apr 23 23:39:18 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c gtk/gtktextdisplay.c: Don't handle selections as
attributes - that doesn't handle partial-glyph selection
properly. Instead use new pango_layout_line_get_x_ranges()
functionality to draw the selection.
* gtk/gtkentry.c: Simplify code since pango_layout_line_index_to_x()
now properly handles out-of-range coordinates.
* gtk/gtktextbuffer.c: Emit "mark_set" when the cursor is moved.
* gtk/gtktextiter.h gtk/gtktextiterprivate.h: Make gtk_text_iter_get_line_byte()
public.
* gtk/gtktextlayout.[ch]: Properly set the direction in the PangoContext
for paragraphs opposite to the base direction of the widget.
* gtk/gtktextlayout.[ch] gtk/gtktextdisplay.c: Fixes for alignment.
* gtk/gtktextlayout.c: Don't split segments on marks, since that
causes Arabic words to reshape as you cursor through.
* gtk/gtktextlayout.[ch] gtk/gtktextview.[ch]: Implement virtual
cursor position when moving vertically with the arrow keys and
scrolling with page-up/page-down. (Arrow keys save only the X,
scrolling saves both X and Y.)
This means you can line-up / line-down or page-up / page-down
without losing your place, and also that moving vertically
with the cursor keys keeps the same X position, not the same
character count:
* gtk/gtktextlayout.[ch] gtk/gtktextview.[ch]: Make vertical
arrow keys move by display lines, not paragraphs.
Tue Apr 18 14:16:50 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.c: Make sure that the bin window is at least
as big as the allocation. (Should we also make sure that the
bin window is big enough to completely cover widget->window?)
* gtk/gtktextview.c (gtk_text_view_get_visible_rect): Add
function to get the onscreen rectangle.
* gdk/x11/gdkwindow-x11.c (gdk_window_get_pointer): Correctly account
for offsets in window coordinates.
Sun Apr 16 16:13:27 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_get_cursor_locations): Fix index/offset
confusion.
* gtk/gtktextview.c (gtk_text_view_ensure_layout): Set the default direction
from the widget direction.
* gtk/gtktexttag.c gtk/gtktexttagprivate.h (gtk_text_tag_set_arg):
Add a "direction" attribute.
* gtk/gtktextview.c: global s/tkxt/text_view/.
* gtk/testtext.c: Added long block of text in Arabic, to test out
the direction attributes. (Some problems with the shaping system
for arabic become obvious - like the fact the cursor splits words
into unjoined pieces.)
Fri Apr 14 12:54:34 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextdisplay.c (render_layout): Add overstrike handling.
* gtk/gtktextlayout.c: Fix up alignment.
* gtk/testtext.c: Add some tests for centering, wrapping.
Fri Apr 14 09:26:22 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkdrawable.h gdk/gdkdraw.c gdk/gdkwindow.c gdk/x11/gdkdrawable-x11.c:
Add a draw_glyphs() operation to the drawable vtable and gdk_draw_glyphs().
If we wrote GTK+-specific layout-render function this could just replace
the draw_layout() operation in the vtable.
* gtk/gtkentry.c: Move guts of gtk_entry_get_cursor_locations to
pango_layout_get_cursor_pos() and use that function.
* gtk/gtktextchild.[ch]: add gtk_ onto pixmap_segment_new(), since it
is a non-static symbol.
* gtk/gtktextbtree.[ch]: Replace gtk_text_btree_find_line_data_by_y()
with gtk_text_btree_find_line_by_y()
* gtk/gtktextdisplay.c: Rewrote for Pango - uses a custom layout
renderer that handles GtkTextAppearance attributes.
* gtk/gtktexttag.[ch] gtk/gtktexttagprivate.h:
- Move the values in the style that don't affect geometry into a
GtkTextAppearance structure.
- Change underline to take a PangoUnderline and "font" a string
representation of a font description
- Add a "font_desc" attribute which takes a FontDescription structure.
* gtk/gtktextlayout.[ch]:
- Get rid of the display-line list per each line. Instead, we
generate, on demand, a GtkTextLineDisplay structure which]
contains a PangoLayout * and other necesary information
(offsets, cursor locations) for displaying a paragraph.
- Get rid of the code to wrap lines, create display chunks,
etc. Instead, we just go through a paragraph and convert
it into the necessary inputs to a PangoLayout.
- Implement a new attribute type, GtkTextAttrAppearance. This
holds a GtkTextAppearance, and is used to pass colors,
stipple, etc, through from the layout to the display without
having to use lots and lots of individual attributes.
- Reimplement gtk_layout_get_iter_at_pixel() gtk_layout_get_iter_pos()
in terms of PangoLayout functions.
* gtk/gtktextview.c:
- Handle passing the necessary PangoContext to the layout
- Some fixups in painting to deal with the automatic backing store
and offsetting of GTK+-1.4
- Add a style_set handler so that the default style reacts
properly to theme changes.
* gtk/gtktext?*.[ch]: Random code-style fixes.
* gtk/testtext.c: Substitute in languages that Pango handles now for Thai
Mon Apr 10 10:33:45 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktext?*.[ch]: Check in Havoc's port of the Tk text widget,
in original form preparatory to Pango-ization and gdkimcontext-ization.
Thu Apr 6 19:25:39 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimcontext.c: Move default implementations to real_* vfuncs,
so that we can derive from gtkimcontext in language bindings properly.
Thu Apr 6 16:02:52 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimcontextsimple.[ch]: Use gdk_keyval_to_unicode to gdk_unicode_to_keyval.
Add a compose table including (almost) all the compose combinations
from X. This is 6k of static, shared data as opposed to 50k or so of dynamic
data in the XIM implementation.
* gdk/gdk.h gdk/gdkkeyuni.c gdk/win32/gdkevents-win32.c (gdk_keyval_to_unicode, gdk_unicode_to_keyval):
Moved functions to convert keyvalues from and to unicode here from
the win32 port and made them public.
Wed Apr 5 16:37:29 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkeditable.c (gtk_editable_insert_text): Allow new_text_length == -1.
Wed Apr 5 16:27:45 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimcontext.[ch]: Base class for new input context system
* gtk/gtkimmulticontext.[ch]: Proxy input context that allows
the real input context implementation to be loaded from modules
and switched on the fly.
* gtk/gtkcontextsimple.[ch]: Simple implementation of an input
context that just does direct keysymbol => unicode translation.
* gtk/gtkentry.[ch]: Start switching editing over to using
GtkInputContext. (No handling of preedit yet.)
Wed Apr 5 15:48:41 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktypeutils.h (GTK_CHECK_GET_CLASS): Fix problem with one too
many substitutions. (klass should not be subsituted.)
Wed Apr 5 00:18:14 2000 Owen Taylor <otaylor@redhat.com>
* configure.in: Add checks for Pango
* configure.in docs/Makefile.am: Add test for sgml2html
and allow 'make dist' without building html, but print out
warnings in that case. (For making snapshots)
* gdk/Makefile.am gdk/x11/Makefile.am gtk/Makefile.am:
Add Pango libraries and C flags
* gdk/gdkdraw.c gdk/gdkdrawable.h gdkwindow.c gdk/x11/gdkdrawable-x11.c:
Add function (gdk_draw_layout) to draw a pango layout.
* gdk/gdkpango.h gdk/x11/gdkpango-x11.c: New file with functions
for getting Pango contexts for GDK.
* gtk/gtkeditable.c: Get rid of dead code gtk_editable_parent_set()
* gtk/gtkentry.[ch]: Complete rewrite to use Pango, add bidirectional
editing.
* gtk/gtkentry.c: Hack in simple Hebrew input with direct
keysym => unicode translations. More languages can be added
here, but real input-method support is needed.
* docs/Changes-1.4.txt: Added note about entry behavior.
* gtk/gtkenums.h gtk/gtkwidget.[ch] testgtk.c gtkprivate.h: Add functions
to set the reading direction for a widget and the global direction.
Add test which allows toggling the global direction. Two private
flags are used to store the direction. (GTK_DIRECTION_SET + GTK_DIRECTION_LTR)
* gtk/gtkcheckbutton.c gtk/gtkframe.c gtk/gtkhbbox.c gtk/gtkhbox.c
gtk/gtkradiobutton.c gtk/gtkspinbutton.c gtk/gtktable.c
* gtk/gtk[hv]scale.c gtk/gtkscale.[ch]: Draw numbers using Pango
* gtk/gtklabel.[ch]: Moved to Pango and considerably rewritten. Line breaking,
underlining now handled by Pango.
* gtk/gtkstyle.[ch] gtk/gtkrc.[ch]: Add a PangoFontDescription
to RCStyle and Style. (Having both this and the old font name and GdkFont
is temporary.)
* gtk/gtkwidget.[ch] (gtk_widget_create_pango_{context,layout}): Added
convenience functions for creating contexts and layouts for widgets.
* gtk/testgtk.c: Enhance label tests with multilingual labels.
2000-06-02 03:14:07 +00:00
|
|
|
|
|
2011-01-10 19:40:37 +00:00
|
|
|
|
gtk_render_layout (context, cr, x, y, layout);
|
2002-10-09 22:11:08 +00:00
|
|
|
|
g_object_unref (layout);
|
2010-09-04 17:16:26 +00:00
|
|
|
|
|
2011-01-10 19:40:37 +00:00
|
|
|
|
gtk_style_context_restore (context);
|
2010-09-04 17:16:26 +00:00
|
|
|
|
cairo_restore (cr);
|
1998-09-27 18:32:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
1998-10-01 13:24:42 +00:00
|
|
|
|
static void
|
2010-09-04 17:07:39 +00:00
|
|
|
|
calendar_paint_day_names (GtkCalendar *calendar,
|
|
|
|
|
cairo_t *cr)
|
1998-09-27 18:32:00 +00:00
|
|
|
|
{
|
2005-05-11 19:16:19 +00:00
|
|
|
|
GtkWidget *widget = GTK_WIDGET (calendar);
|
|
|
|
|
GtkCalendarPrivate *priv = GTK_CALENDAR_GET_PRIVATE (calendar);
|
2011-01-10 19:40:37 +00:00
|
|
|
|
GtkStyleContext *context;
|
|
|
|
|
GtkStateFlags state;
|
|
|
|
|
GtkBorder padding;
|
2010-08-11 21:17:18 +00:00
|
|
|
|
GtkAllocation allocation;
|
1998-09-27 18:32:00 +00:00
|
|
|
|
char buffer[255];
|
|
|
|
|
int day,i;
|
|
|
|
|
int day_width, cal_width;
|
|
|
|
|
int day_wid_sep;
|
Remove all references to offscreen flag which was no longer used.
Thu Jun 1 23:05:13 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Remove all references to
offscreen flag which was no longer used.
* gtk/gtkprivate.h (enum): Remove unused flags and compress.
* gtk/gtkframe.c (gtk_frame_set_label_widget): Check
for non-null label_widget->parent.
* gtk/gtkentry.c: Get rid of code to deal with PangoAttribute
which no longer was used.
* gdk/gdkpango.c (gdk_pango_context_get_info): make static.
* gdk/gdkpango.c (gdk_draw_layout[_line]): Add checks
for null arguments.
* gdk/x11/gdkgeometry-x11.c (gdk_window_scroll): add
check for destroyed windows.
Thu Jun 1 13:48:45 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimmulticontext.c: Add a finalize method and unref
the slave context there.
* gtk/gtkinvisible.[ch]: Make reference counting behavior
identical to GtkWindow.
Thu Jun 1 01:54:11 2000 Owen Taylor <otaylor@redhat.com>
* Makefile.am gdk/gdkpango.c: Copy the layout render function from
pangox to here, so we can write them independent of rendering
system, using GDK primitives.
* gdk/gdkdrawable.h gdk/gdkdraw.c gdk/gdkwindow.c
gdk/x11/gdkdrawable-x11.c: Remove draw_layout() from the vtable,
since we have a rendering-system independent implementation in
terms of draw_glyphs().
* gdk/gdkpango.c gdkdrawable.h (gdk_draw_layout_line): New
function to render a single line.
* gdk/x11/gdkpango.c: Move the guts of this file mostly
into ../gdkpango.c, which simplifies things, since we
don't have to deal with raw X gc's.
Fri May 19 04:28:16 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.[ch]: Add get_log_attrs() function to
get the logical attributes for a given GtkTextLine.
Tue May 30 16:05:39 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkfont-x11.c (gdk_font_charset_for_locale): Track
g_locale_get_codeset() to g_get_codeset() change.
Tue May 30 15:03:19 2000 Owen Taylor <otaylor@redhat.com>
* gtk/testcalendar.c (calendar_font_selection_ok): Use font
descriptions.
* gtk/gtkentry.c (gtk_entry_draw_text): Center text within
the entry.
* gtk/gtkfontsel.c (gtk_font_selection_dialog_init): Start of
redoing (vastly simplifying) for Pango. Still needs quite
a bit of work. (Size selection is currently poor. List of
predefined sizes is not a good idea, since all of these
sizes won't necessarily be distinct.)
Tue May 30 13:50:19 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkfont-x11.c (gdk_font_charset_for_locale): Handle
CODESET results for LANG=C.
Mon May 29 15:49:10 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.[ch]: Add a 'font_name' declaration to RC
which takes a stringized pango font description;
ignore the older 'font' and 'fontset' declarations.
* gtk/gtkstyle.c gtk/gtkrc.c: Fill in the style->font
field with a GdkFont derived via gdk_font_from_description(),
for compatibility. (Should we just remove it entirely?
Probably too much compatibility breakage, but people
should be migrating to the new Pango stuff as quickly
as possible.)
Mon May 29 15:47:41 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c gtk/gtkclist.c: s/pango_font_unref/g_object_unref/.
Mon May 29 15:44:46 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcalender.c: Roughly pango-ized. Really needs
redoing; there are some bugs in size allocation right
now, the semi-existant distinction between header / day
fonts was removed, but, with Pango, could actually
be made functional in a nice way.
* gtk/testcalender: Move calender from examples into this
directory as a test program. (We really need to restrcture
testgtk into a whole directory full of tests for every
widget or functionality group, separated into multiple .c
files.)
Mon May 29 15:19:56 2000 Owen Taylor <otaylor@redhat.com>
* gtk/testgtk.c (file_exists): Fix stupid typo that
was keeping RC file from being loaded.
* gtk/testgtkrc gtk/testgtkrc2: Test new pango-ized
RC file font code.
Mon May 29 14:31:27 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkfont.h gdk/x11/gdkfont-x11.c (gdk_font_from_description):
Add function to load a GdkFont from a PangoFontDescription.
Fri May 26 17:16:40 2000 Owen Taylor <otaylor@redhat.com>
* gtk/frame.[ch] gtkaspectframe.c: Make frame widgets able
to have any widget for the label, use a GtkLabel widget
to display the text. (Based partially on a patch from
Anders Carlson.)
(Quite a bit of code reorganization - strip 90% of the
guts out of gtkaspectframe and add a single virtual
func to GtkFrameClass - compute_child_allocation.)
Fri May 26 12:00:02 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkctree.c gtk/gtkclist.[ch]: Pangoized.
(Removed clist->row_center_offset field because caching
it wasn't saving time or code, added private function
_gtk_clist_create_cell_layout()).
Wed May 24 15:59:37 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkaccellabel.c: Pangoized.
* gtk/[hv]ruler.c: Pangoized
Mon May 22 19:23:59 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c (gtk_file_selection_init):
Use gtk_clist_set_column_auto_resize() to remove need
need for manual column width computations.
Mon May 22 18:50:26 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktooltips.[ch]: Replace custom drawing with a GtkLabel,
ensuring Pango correctness, and considerably simplifying the
code.
* gtk/gtklabel.c gtk[hv]scale.c: 1000 => PANGO_SCALE.
* gtk/gtklabel.c (gtk_label_size_request): Fixed incorrect
getting of numbers of lines.
* gtk/gtklabel.c (gtk_label_size_request): Set the requisition
to the actual requested width of the lable, not to the wrap
width we set.
* gtk/gtktextchild.h: Remove extraneous include of gtk/gtk.h.
* gtk/gtktextbtree.c gtk/gtktextbuffer.c gtk/gtktextlayout.c
gtk/gtktextview.c gtk/gtktextview.[ch]: Fix up includes.
* gtk/gtktextview.c: Fix structure inheritance.
* gtk/gtkprogressbar.c: Pangoize.
Mon May 22 15:47:30 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextview.c (gtk_text_view_get_first_para_iter): Encapsulate
in a function.
* gtk/gtktextlayout.c (find_display_line_above): Fixed
bug with computing line tops.
* gtk/gtktextview.c (changed_handler): Fix < , <= confusion.
Thu May 18 18:53:31 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextdisplay.c (gtk_text_layout_draw): Fix up the x_offset
and y_offset coordinates to do what we need now. (The offset between
buffer and layout coordinates has been reintroduced, but is a
bit different than before.)
* gtk/gtktextview.[ch]: No longer inherit from GtkLayout; instead
handle the adjustments ourselves, and scroll as necessary using
the new gdk_window_scroll().
The advantage of this is that when we are incrementally revalidating,
we are essentially rearranging things around the visible portion
of the screen. With the old setup, the visible portion of the
screen was moved around in the layout, so scrolling and redrawing
to track that caused jumping of the display. Since we now
control the scrolling ourselves, we can suppress this and
only redraw when things actually change.
Thu May 18 18:47:25 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextbtree.c (redisplay_mark): We need to invalidate
the region not just redisplay it after-all, since we store the
cursors in the LineDisplay. (Ugly interactions here between
GtkLayout and GtkTextBTree here.)
* gtk/gtktextbtree.c (redisplay_region): Fixed reversed comparison.
Thu May 18 18:43:21 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.h gdk/x11/gdkgeometry-x11.c (gdk_window_scroll):
Added function to scroll contents of a window while keeping the
window constant. Works by XCopyArea or guffaw-scrolling depending
on the details of how the window is set up. (guffaw-scrolling
still needs to be filled in.)
Wed May 17 22:36:53 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextiter.c gtk/gtkmain.c: Add a debug key for the text widget,
move the debugging that was tied to a global variable
to that.
* gtk/gtkmarshal.list: Add NONE:INT,INT,INT
* gtk/gtktextbtree.[ch] gtk/gtktextlayout.c: Keep a separate
validated flag, in line data instead of setting height/width to
-1. This allows us to perform operations with partially invalid
buffer (using the old size for invalid lines) and thus to do
incremental vaidation. Keep height/width aggregates up to date
when deleting text and rebalancing the tree.
* gtk/gtktextbtree.[ch]: Add functions validate a line
(gtk_text_btree_validate_line), and to validate up
to a number of pixels (gtk_text_btree_validate).
* gtk/gtktextlayout.[ch]: Add an ::invalidated signal
that indicates that something is changed and a revalidation
pass is needed. Change ::need_repaint to ::changed, and
make it take old and new yranges instead of a rectangle.
* gtk/gtktextbtree.[ch] gtk/gtktextlayout.[ch]: Move
the line_data_destroy() function from
gtk_text_btree_add_view() to a virtual function in
GtkTextLayout
* gtk/gtktextbtree.[ch]: Remove gtk_text_btree_get_damage_range(),
since we are handling partial repaints in a different fashion
now.
* gtk/gtktextbtree.[ch]: Only repaint the changed portion
of the selection instead of queueing a repaint on the
entire widget.
* gtk/gtktextbuffer.[ch] gtk/gtktextbtree.[ch]: Move
get_selection_bounds() down to btree, make the function
in buffer a wrapper around the btree function.
* gtk/gtktextlayout.[ch]: Add functions to check if the
layout is valid and to recompute either a range of pixels
aroudn a line or a certain total number of pixels.
* gtk/gtktextlayout.[ch]: Cache a single line display;
now that we only redraw the needed portions, the hit rate
for this cache is quite high.
* gtk/gtktextview.[ch]: Keep track of the first paragraph
on the screen so that when re-laying-out the buffer, we can
keep the same place. This requires connecting to ::value_changed
on the adjustments
* gtk/gtktextview.[ch]: Add idle functions to revalidate
the buffer after we receive an ::invalidated signal.
Wed May 17 22:10:47 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.c (gtk_layout_size_allocate): Set upper
to max of allocation and layout size, not just to the
layout size.
* gtk/gtk[hv]scrollbar.c (gtk_[hv]scrollbar_calc_slider_size):
Invalidate window so it gets redrawn properly.
* gdk/gdkwindow.c (gdk_window_invalidate_rect): Allow rect == NULL
to mean the entire window.
* gdk/gdkevents.h: Move definition for GDK_PRIORITY_REDRAW
into public header.
Mon May 15 14:51:31 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextmark.c (gtk_text_mark_get_name): Add function
to get the name of a mark.
* gtk/gtktextlayout.c (gtk_text_layout_get_line_at_y): Add a function
to find the paragraph from a y position.
Thu May 11 12:57:20 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextbtree.c (gtk_text_btree_node_invalidate_upward): Valid
nodes have width/height >= 0, not > 0.
Tue May 9 21:29:06 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.[ch] gtk/gtktextdisplay.c (gtk_text_layout_get_line_display):
Add a size_only flag, so when we only need the size, we don't create
useless appearance attributes.
* gtk/gtktextview.c (gtk_text_view_ensure_layout): Remove
duplicate setting of font description.
* gtk/gtkscale.c: Use PANGO_SCALE instead of 1000
Wed Apr 26 01:53:23 2000 Owen Taylor <otaylor@redhat.com>
* gtk/Makefile.am (EXTRA_DIST): Add OLD_STAMP into
EXTRA_DIST. It does not work well when the file that
everything depends on is not in the tarball.
Wed Apr 26 00:56:14 2000 Owen Taylor <otaylor@redhat.com>
* gtk/testgtk.c: Some hacks and fixes so that it basically
works when not sitting in the GTK+ build tree.
2000-05-03 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (gtk_text_line_next_could_contain_tag):
Properly determine the ordering of the tag root and the current
line within the tree. Previous algorithm only worked if the tag
root's immediate parent was the common root of both the current
line and the tag root.
Wed Apr 26 00:43:00 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.c (set_para_values): Fix some bugs in
alignment.
* gtk/gtktextview.c (gtk_text_view_ensure_layout): Track
the widget text directional dynamically.
* gtk/gtktextview.[ch]: Added functions to get and set default
wrap mode.
Tue Apr 25 23:47:38 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.c (gtk_text_layout_get_iter_location): Fix bug
in cursor location computation.
Tue Apr 25 23:22:59 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.c (gtk_layout_set_size): Clamp hadjustment/
vadjusment values properly when layout gets smaller.
* gtk/gtktextview.c (need_repaint_handler): Areas being
passed in are far completely inaccurate, and sometimes
too small, so, for now, just queue a redraw on the
whole visible region.
2000-04-25 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (summary_destroy): new function to
destroy tag summary nodes
(gtk_text_line_next_could_contain_tag): this function was
totally broken if the line passed in wasn't below the tag
root. Fix it.
(gtk_text_btree_first_could_contain_tag): In the tag == NULL
"wildcard" case, we have to do a linear scan. Blah.
(gtk_text_btree_last_could_contain_tag): In tag == NULL case,
we have to do the linear scan
(tag_removed_cb): When a tag is removed from the tag table,
remove the GtkTextTagInfo node from the btree.
(gtk_text_btree_spew): Implement the spew function, for
our debugging pleasure.
Tue Apr 25 19:40:18 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.c (gtk_text_layout_set_buffer): Fix
a problem with referring to the wrong buffer.
* gtk/gtkentry.c: Fix focus-in/focus-out confusion.
* gtk/gtkrc.c gtk/gtkstyle.c: Moving setting default
font description to gtk_style_new() - otherwise things
don't work without a .gtkrc file.
* gtk/gtktextbuffer.c (gtk_text_buffer_new): Sink the
tags table if we create it ourself, too.
* gdk/gdktypes.h (enum): Move GDK_RELEASE_MASK, since
it was conflicting with XKB modifiers.
* gtk/gtktextview.[ch]: Add simple support for
GtkIMContext.
Mon Apr 24 19:34:18 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_move_cursor_visually): Fix problem
with deletion from last commit.
Mon Apr 24 19:29:40 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_create_pango_context): Set the language
in the context from the current locale.
* gtk/gtkentry.c (gtk_entry_size_request): Use language from the
context, not hardcoded value.
* gtk/gtkentry.c (gtk_entry_move_cursor): Make character movement visual,
not logical.
Sun Apr 23 23:39:18 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c gtk/gtktextdisplay.c: Don't handle selections as
attributes - that doesn't handle partial-glyph selection
properly. Instead use new pango_layout_line_get_x_ranges()
functionality to draw the selection.
* gtk/gtkentry.c: Simplify code since pango_layout_line_index_to_x()
now properly handles out-of-range coordinates.
* gtk/gtktextbuffer.c: Emit "mark_set" when the cursor is moved.
* gtk/gtktextiter.h gtk/gtktextiterprivate.h: Make gtk_text_iter_get_line_byte()
public.
* gtk/gtktextlayout.[ch]: Properly set the direction in the PangoContext
for paragraphs opposite to the base direction of the widget.
* gtk/gtktextlayout.[ch] gtk/gtktextdisplay.c: Fixes for alignment.
* gtk/gtktextlayout.c: Don't split segments on marks, since that
causes Arabic words to reshape as you cursor through.
* gtk/gtktextlayout.[ch] gtk/gtktextview.[ch]: Implement virtual
cursor position when moving vertically with the arrow keys and
scrolling with page-up/page-down. (Arrow keys save only the X,
scrolling saves both X and Y.)
This means you can line-up / line-down or page-up / page-down
without losing your place, and also that moving vertically
with the cursor keys keeps the same X position, not the same
character count:
* gtk/gtktextlayout.[ch] gtk/gtktextview.[ch]: Make vertical
arrow keys move by display lines, not paragraphs.
Tue Apr 18 14:16:50 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.c: Make sure that the bin window is at least
as big as the allocation. (Should we also make sure that the
bin window is big enough to completely cover widget->window?)
* gtk/gtktextview.c (gtk_text_view_get_visible_rect): Add
function to get the onscreen rectangle.
* gdk/x11/gdkwindow-x11.c (gdk_window_get_pointer): Correctly account
for offsets in window coordinates.
Sun Apr 16 16:13:27 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_get_cursor_locations): Fix index/offset
confusion.
* gtk/gtktextview.c (gtk_text_view_ensure_layout): Set the default direction
from the widget direction.
* gtk/gtktexttag.c gtk/gtktexttagprivate.h (gtk_text_tag_set_arg):
Add a "direction" attribute.
* gtk/gtktextview.c: global s/tkxt/text_view/.
* gtk/testtext.c: Added long block of text in Arabic, to test out
the direction attributes. (Some problems with the shaping system
for arabic become obvious - like the fact the cursor splits words
into unjoined pieces.)
Fri Apr 14 12:54:34 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextdisplay.c (render_layout): Add overstrike handling.
* gtk/gtktextlayout.c: Fix up alignment.
* gtk/testtext.c: Add some tests for centering, wrapping.
Fri Apr 14 09:26:22 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkdrawable.h gdk/gdkdraw.c gdk/gdkwindow.c gdk/x11/gdkdrawable-x11.c:
Add a draw_glyphs() operation to the drawable vtable and gdk_draw_glyphs().
If we wrote GTK+-specific layout-render function this could just replace
the draw_layout() operation in the vtable.
* gtk/gtkentry.c: Move guts of gtk_entry_get_cursor_locations to
pango_layout_get_cursor_pos() and use that function.
* gtk/gtktextchild.[ch]: add gtk_ onto pixmap_segment_new(), since it
is a non-static symbol.
* gtk/gtktextbtree.[ch]: Replace gtk_text_btree_find_line_data_by_y()
with gtk_text_btree_find_line_by_y()
* gtk/gtktextdisplay.c: Rewrote for Pango - uses a custom layout
renderer that handles GtkTextAppearance attributes.
* gtk/gtktexttag.[ch] gtk/gtktexttagprivate.h:
- Move the values in the style that don't affect geometry into a
GtkTextAppearance structure.
- Change underline to take a PangoUnderline and "font" a string
representation of a font description
- Add a "font_desc" attribute which takes a FontDescription structure.
* gtk/gtktextlayout.[ch]:
- Get rid of the display-line list per each line. Instead, we
generate, on demand, a GtkTextLineDisplay structure which]
contains a PangoLayout * and other necesary information
(offsets, cursor locations) for displaying a paragraph.
- Get rid of the code to wrap lines, create display chunks,
etc. Instead, we just go through a paragraph and convert
it into the necessary inputs to a PangoLayout.
- Implement a new attribute type, GtkTextAttrAppearance. This
holds a GtkTextAppearance, and is used to pass colors,
stipple, etc, through from the layout to the display without
having to use lots and lots of individual attributes.
- Reimplement gtk_layout_get_iter_at_pixel() gtk_layout_get_iter_pos()
in terms of PangoLayout functions.
* gtk/gtktextview.c:
- Handle passing the necessary PangoContext to the layout
- Some fixups in painting to deal with the automatic backing store
and offsetting of GTK+-1.4
- Add a style_set handler so that the default style reacts
properly to theme changes.
* gtk/gtktext?*.[ch]: Random code-style fixes.
* gtk/testtext.c: Substitute in languages that Pango handles now for Thai
Mon Apr 10 10:33:45 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktext?*.[ch]: Check in Havoc's port of the Tk text widget,
in original form preparatory to Pango-ization and gdkimcontext-ization.
Thu Apr 6 19:25:39 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimcontext.c: Move default implementations to real_* vfuncs,
so that we can derive from gtkimcontext in language bindings properly.
Thu Apr 6 16:02:52 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimcontextsimple.[ch]: Use gdk_keyval_to_unicode to gdk_unicode_to_keyval.
Add a compose table including (almost) all the compose combinations
from X. This is 6k of static, shared data as opposed to 50k or so of dynamic
data in the XIM implementation.
* gdk/gdk.h gdk/gdkkeyuni.c gdk/win32/gdkevents-win32.c (gdk_keyval_to_unicode, gdk_unicode_to_keyval):
Moved functions to convert keyvalues from and to unicode here from
the win32 port and made them public.
Wed Apr 5 16:37:29 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkeditable.c (gtk_editable_insert_text): Allow new_text_length == -1.
Wed Apr 5 16:27:45 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimcontext.[ch]: Base class for new input context system
* gtk/gtkimmulticontext.[ch]: Proxy input context that allows
the real input context implementation to be loaded from modules
and switched on the fly.
* gtk/gtkcontextsimple.[ch]: Simple implementation of an input
context that just does direct keysymbol => unicode translation.
* gtk/gtkentry.[ch]: Start switching editing over to using
GtkInputContext. (No handling of preedit yet.)
Wed Apr 5 15:48:41 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktypeutils.h (GTK_CHECK_GET_CLASS): Fix problem with one too
many substitutions. (klass should not be subsituted.)
Wed Apr 5 00:18:14 2000 Owen Taylor <otaylor@redhat.com>
* configure.in: Add checks for Pango
* configure.in docs/Makefile.am: Add test for sgml2html
and allow 'make dist' without building html, but print out
warnings in that case. (For making snapshots)
* gdk/Makefile.am gdk/x11/Makefile.am gtk/Makefile.am:
Add Pango libraries and C flags
* gdk/gdkdraw.c gdk/gdkdrawable.h gdkwindow.c gdk/x11/gdkdrawable-x11.c:
Add function (gdk_draw_layout) to draw a pango layout.
* gdk/gdkpango.h gdk/x11/gdkpango-x11.c: New file with functions
for getting Pango contexts for GDK.
* gtk/gtkeditable.c: Get rid of dead code gtk_editable_parent_set()
* gtk/gtkentry.[ch]: Complete rewrite to use Pango, add bidirectional
editing.
* gtk/gtkentry.c: Hack in simple Hebrew input with direct
keysym => unicode translations. More languages can be added
here, but real input-method support is needed.
* docs/Changes-1.4.txt: Added note about entry behavior.
* gtk/gtkenums.h gtk/gtkwidget.[ch] testgtk.c gtkprivate.h: Add functions
to set the reading direction for a widget and the global direction.
Add test which allows toggling the global direction. Two private
flags are used to store the direction. (GTK_DIRECTION_SET + GTK_DIRECTION_LTR)
* gtk/gtkcheckbutton.c gtk/gtkframe.c gtk/gtkhbbox.c gtk/gtkhbox.c
gtk/gtkradiobutton.c gtk/gtkspinbutton.c gtk/gtktable.c
* gtk/gtk[hv]scale.c gtk/gtkscale.[ch]: Draw numbers using Pango
* gtk/gtklabel.[ch]: Moved to Pango and considerably rewritten. Line breaking,
underlining now handled by Pango.
* gtk/gtkstyle.[ch] gtk/gtkrc.[ch]: Add a PangoFontDescription
to RCStyle and Style. (Having both this and the old font name and GdkFont
is temporary.)
* gtk/gtkwidget.[ch] (gtk_widget_create_pango_{context,layout}): Added
convenience functions for creating contexts and layouts for widgets.
* gtk/testgtk.c: Enhance label tests with multilingual labels.
2000-06-02 03:14:07 +00:00
|
|
|
|
PangoLayout *layout;
|
|
|
|
|
PangoRectangle logical_rect;
|
2002-02-14 05:05:45 +00:00
|
|
|
|
gint focus_padding;
|
|
|
|
|
gint focus_width;
|
2010-08-03 15:45:14 +00:00
|
|
|
|
gint calendar_ysep = calendar_get_ysep (calendar);
|
|
|
|
|
gint calendar_xsep = calendar_get_xsep (calendar);
|
2010-10-24 05:22:13 +00:00
|
|
|
|
gint inner_border = calendar_get_inner_border (calendar);
|
|
|
|
|
|
2011-01-10 19:40:37 +00:00
|
|
|
|
context = gtk_widget_get_style_context (widget);
|
|
|
|
|
state = gtk_widget_get_state_flags (widget);
|
|
|
|
|
gtk_style_context_get_padding (context, state, &padding);
|
2010-09-04 17:16:26 +00:00
|
|
|
|
|
|
|
|
|
cairo_save (cr);
|
2010-10-24 05:22:13 +00:00
|
|
|
|
|
|
|
|
|
cairo_translate (cr,
|
2011-01-10 19:40:37 +00:00
|
|
|
|
padding.left + inner_border,
|
|
|
|
|
priv->header_h + padding.top + inner_border);
|
2010-08-03 15:45:14 +00:00
|
|
|
|
|
2002-02-14 05:05:45 +00:00
|
|
|
|
gtk_widget_style_get (GTK_WIDGET (widget),
|
2011-01-24 02:50:39 +00:00
|
|
|
|
"focus-line-width", &focus_width,
|
|
|
|
|
"focus-padding", &focus_padding,
|
|
|
|
|
NULL);
|
2010-08-11 21:17:18 +00:00
|
|
|
|
|
|
|
|
|
gtk_widget_get_allocation (widget, &allocation);
|
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
day_width = priv->day_width;
|
2011-01-10 19:40:37 +00:00
|
|
|
|
cal_width = allocation.width - (inner_border * 2) - padding.left - padding.right;
|
1998-09-27 18:32:00 +00:00
|
|
|
|
day_wid_sep = day_width + DAY_XSEP;
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
1998-09-27 18:32:00 +00:00
|
|
|
|
/*
|
|
|
|
|
* Draw rectangles as inverted background for the labels.
|
|
|
|
|
*/
|
2005-05-11 19:16:19 +00:00
|
|
|
|
|
2011-01-10 19:40:37 +00:00
|
|
|
|
gtk_style_context_save (context);
|
|
|
|
|
gtk_style_context_add_class (context, GTK_STYLE_CLASS_HIGHLIGHT);
|
|
|
|
|
|
|
|
|
|
gtk_render_background (context, cr,
|
|
|
|
|
CALENDAR_MARGIN, CALENDAR_MARGIN,
|
|
|
|
|
cal_width - CALENDAR_MARGIN * 2,
|
|
|
|
|
priv->day_name_h - CALENDAR_MARGIN);
|
2010-10-24 05:22:13 +00:00
|
|
|
|
|
2010-08-12 15:14:51 +00:00
|
|
|
|
if (priv->display_flags & GTK_CALENDAR_SHOW_WEEK_NUMBERS)
|
2011-01-10 19:40:37 +00:00
|
|
|
|
gtk_render_background (context, cr,
|
|
|
|
|
CALENDAR_MARGIN,
|
|
|
|
|
priv->day_name_h - calendar_ysep,
|
|
|
|
|
priv->week_width - calendar_ysep - CALENDAR_MARGIN,
|
|
|
|
|
calendar_ysep);
|
2010-10-24 05:22:13 +00:00
|
|
|
|
|
1998-09-27 18:32:00 +00:00
|
|
|
|
/*
|
|
|
|
|
* Write the labels
|
|
|
|
|
*/
|
2000-07-02 22:30:54 +00:00
|
|
|
|
layout = gtk_widget_create_pango_layout (widget, NULL);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
|
1998-09-27 18:32:00 +00:00
|
|
|
|
for (i = 0; i < 7; i++)
|
|
|
|
|
{
|
2000-11-12 22:15:43 +00:00
|
|
|
|
if (gtk_widget_get_direction (GTK_WIDGET (calendar)) == GTK_TEXT_DIR_RTL)
|
2011-01-24 02:50:39 +00:00
|
|
|
|
day = 6 - i;
|
2000-11-12 22:15:43 +00:00
|
|
|
|
else
|
2011-01-24 02:50:39 +00:00
|
|
|
|
day = i;
|
2005-05-11 19:16:19 +00:00
|
|
|
|
day = (day + priv->week_start) % 7;
|
2002-12-15 01:49:01 +00:00
|
|
|
|
g_snprintf (buffer, sizeof (buffer), "%s", default_abbreviated_dayname[day]);
|
Remove all references to offscreen flag which was no longer used.
Thu Jun 1 23:05:13 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Remove all references to
offscreen flag which was no longer used.
* gtk/gtkprivate.h (enum): Remove unused flags and compress.
* gtk/gtkframe.c (gtk_frame_set_label_widget): Check
for non-null label_widget->parent.
* gtk/gtkentry.c: Get rid of code to deal with PangoAttribute
which no longer was used.
* gdk/gdkpango.c (gdk_pango_context_get_info): make static.
* gdk/gdkpango.c (gdk_draw_layout[_line]): Add checks
for null arguments.
* gdk/x11/gdkgeometry-x11.c (gdk_window_scroll): add
check for destroyed windows.
Thu Jun 1 13:48:45 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimmulticontext.c: Add a finalize method and unref
the slave context there.
* gtk/gtkinvisible.[ch]: Make reference counting behavior
identical to GtkWindow.
Thu Jun 1 01:54:11 2000 Owen Taylor <otaylor@redhat.com>
* Makefile.am gdk/gdkpango.c: Copy the layout render function from
pangox to here, so we can write them independent of rendering
system, using GDK primitives.
* gdk/gdkdrawable.h gdk/gdkdraw.c gdk/gdkwindow.c
gdk/x11/gdkdrawable-x11.c: Remove draw_layout() from the vtable,
since we have a rendering-system independent implementation in
terms of draw_glyphs().
* gdk/gdkpango.c gdkdrawable.h (gdk_draw_layout_line): New
function to render a single line.
* gdk/x11/gdkpango.c: Move the guts of this file mostly
into ../gdkpango.c, which simplifies things, since we
don't have to deal with raw X gc's.
Fri May 19 04:28:16 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.[ch]: Add get_log_attrs() function to
get the logical attributes for a given GtkTextLine.
Tue May 30 16:05:39 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkfont-x11.c (gdk_font_charset_for_locale): Track
g_locale_get_codeset() to g_get_codeset() change.
Tue May 30 15:03:19 2000 Owen Taylor <otaylor@redhat.com>
* gtk/testcalendar.c (calendar_font_selection_ok): Use font
descriptions.
* gtk/gtkentry.c (gtk_entry_draw_text): Center text within
the entry.
* gtk/gtkfontsel.c (gtk_font_selection_dialog_init): Start of
redoing (vastly simplifying) for Pango. Still needs quite
a bit of work. (Size selection is currently poor. List of
predefined sizes is not a good idea, since all of these
sizes won't necessarily be distinct.)
Tue May 30 13:50:19 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkfont-x11.c (gdk_font_charset_for_locale): Handle
CODESET results for LANG=C.
Mon May 29 15:49:10 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.[ch]: Add a 'font_name' declaration to RC
which takes a stringized pango font description;
ignore the older 'font' and 'fontset' declarations.
* gtk/gtkstyle.c gtk/gtkrc.c: Fill in the style->font
field with a GdkFont derived via gdk_font_from_description(),
for compatibility. (Should we just remove it entirely?
Probably too much compatibility breakage, but people
should be migrating to the new Pango stuff as quickly
as possible.)
Mon May 29 15:47:41 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c gtk/gtkclist.c: s/pango_font_unref/g_object_unref/.
Mon May 29 15:44:46 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcalender.c: Roughly pango-ized. Really needs
redoing; there are some bugs in size allocation right
now, the semi-existant distinction between header / day
fonts was removed, but, with Pango, could actually
be made functional in a nice way.
* gtk/testcalender: Move calender from examples into this
directory as a test program. (We really need to restrcture
testgtk into a whole directory full of tests for every
widget or functionality group, separated into multiple .c
files.)
Mon May 29 15:19:56 2000 Owen Taylor <otaylor@redhat.com>
* gtk/testgtk.c (file_exists): Fix stupid typo that
was keeping RC file from being loaded.
* gtk/testgtkrc gtk/testgtkrc2: Test new pango-ized
RC file font code.
Mon May 29 14:31:27 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkfont.h gdk/x11/gdkfont-x11.c (gdk_font_from_description):
Add function to load a GdkFont from a PangoFontDescription.
Fri May 26 17:16:40 2000 Owen Taylor <otaylor@redhat.com>
* gtk/frame.[ch] gtkaspectframe.c: Make frame widgets able
to have any widget for the label, use a GtkLabel widget
to display the text. (Based partially on a patch from
Anders Carlson.)
(Quite a bit of code reorganization - strip 90% of the
guts out of gtkaspectframe and add a single virtual
func to GtkFrameClass - compute_child_allocation.)
Fri May 26 12:00:02 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkctree.c gtk/gtkclist.[ch]: Pangoized.
(Removed clist->row_center_offset field because caching
it wasn't saving time or code, added private function
_gtk_clist_create_cell_layout()).
Wed May 24 15:59:37 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkaccellabel.c: Pangoized.
* gtk/[hv]ruler.c: Pangoized
Mon May 22 19:23:59 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c (gtk_file_selection_init):
Use gtk_clist_set_column_auto_resize() to remove need
need for manual column width computations.
Mon May 22 18:50:26 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktooltips.[ch]: Replace custom drawing with a GtkLabel,
ensuring Pango correctness, and considerably simplifying the
code.
* gtk/gtklabel.c gtk[hv]scale.c: 1000 => PANGO_SCALE.
* gtk/gtklabel.c (gtk_label_size_request): Fixed incorrect
getting of numbers of lines.
* gtk/gtklabel.c (gtk_label_size_request): Set the requisition
to the actual requested width of the lable, not to the wrap
width we set.
* gtk/gtktextchild.h: Remove extraneous include of gtk/gtk.h.
* gtk/gtktextbtree.c gtk/gtktextbuffer.c gtk/gtktextlayout.c
gtk/gtktextview.c gtk/gtktextview.[ch]: Fix up includes.
* gtk/gtktextview.c: Fix structure inheritance.
* gtk/gtkprogressbar.c: Pangoize.
Mon May 22 15:47:30 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextview.c (gtk_text_view_get_first_para_iter): Encapsulate
in a function.
* gtk/gtktextlayout.c (find_display_line_above): Fixed
bug with computing line tops.
* gtk/gtktextview.c (changed_handler): Fix < , <= confusion.
Thu May 18 18:53:31 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextdisplay.c (gtk_text_layout_draw): Fix up the x_offset
and y_offset coordinates to do what we need now. (The offset between
buffer and layout coordinates has been reintroduced, but is a
bit different than before.)
* gtk/gtktextview.[ch]: No longer inherit from GtkLayout; instead
handle the adjustments ourselves, and scroll as necessary using
the new gdk_window_scroll().
The advantage of this is that when we are incrementally revalidating,
we are essentially rearranging things around the visible portion
of the screen. With the old setup, the visible portion of the
screen was moved around in the layout, so scrolling and redrawing
to track that caused jumping of the display. Since we now
control the scrolling ourselves, we can suppress this and
only redraw when things actually change.
Thu May 18 18:47:25 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextbtree.c (redisplay_mark): We need to invalidate
the region not just redisplay it after-all, since we store the
cursors in the LineDisplay. (Ugly interactions here between
GtkLayout and GtkTextBTree here.)
* gtk/gtktextbtree.c (redisplay_region): Fixed reversed comparison.
Thu May 18 18:43:21 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.h gdk/x11/gdkgeometry-x11.c (gdk_window_scroll):
Added function to scroll contents of a window while keeping the
window constant. Works by XCopyArea or guffaw-scrolling depending
on the details of how the window is set up. (guffaw-scrolling
still needs to be filled in.)
Wed May 17 22:36:53 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextiter.c gtk/gtkmain.c: Add a debug key for the text widget,
move the debugging that was tied to a global variable
to that.
* gtk/gtkmarshal.list: Add NONE:INT,INT,INT
* gtk/gtktextbtree.[ch] gtk/gtktextlayout.c: Keep a separate
validated flag, in line data instead of setting height/width to
-1. This allows us to perform operations with partially invalid
buffer (using the old size for invalid lines) and thus to do
incremental vaidation. Keep height/width aggregates up to date
when deleting text and rebalancing the tree.
* gtk/gtktextbtree.[ch]: Add functions validate a line
(gtk_text_btree_validate_line), and to validate up
to a number of pixels (gtk_text_btree_validate).
* gtk/gtktextlayout.[ch]: Add an ::invalidated signal
that indicates that something is changed and a revalidation
pass is needed. Change ::need_repaint to ::changed, and
make it take old and new yranges instead of a rectangle.
* gtk/gtktextbtree.[ch] gtk/gtktextlayout.[ch]: Move
the line_data_destroy() function from
gtk_text_btree_add_view() to a virtual function in
GtkTextLayout
* gtk/gtktextbtree.[ch]: Remove gtk_text_btree_get_damage_range(),
since we are handling partial repaints in a different fashion
now.
* gtk/gtktextbtree.[ch]: Only repaint the changed portion
of the selection instead of queueing a repaint on the
entire widget.
* gtk/gtktextbuffer.[ch] gtk/gtktextbtree.[ch]: Move
get_selection_bounds() down to btree, make the function
in buffer a wrapper around the btree function.
* gtk/gtktextlayout.[ch]: Add functions to check if the
layout is valid and to recompute either a range of pixels
aroudn a line or a certain total number of pixels.
* gtk/gtktextlayout.[ch]: Cache a single line display;
now that we only redraw the needed portions, the hit rate
for this cache is quite high.
* gtk/gtktextview.[ch]: Keep track of the first paragraph
on the screen so that when re-laying-out the buffer, we can
keep the same place. This requires connecting to ::value_changed
on the adjustments
* gtk/gtktextview.[ch]: Add idle functions to revalidate
the buffer after we receive an ::invalidated signal.
Wed May 17 22:10:47 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.c (gtk_layout_size_allocate): Set upper
to max of allocation and layout size, not just to the
layout size.
* gtk/gtk[hv]scrollbar.c (gtk_[hv]scrollbar_calc_slider_size):
Invalidate window so it gets redrawn properly.
* gdk/gdkwindow.c (gdk_window_invalidate_rect): Allow rect == NULL
to mean the entire window.
* gdk/gdkevents.h: Move definition for GDK_PRIORITY_REDRAW
into public header.
Mon May 15 14:51:31 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextmark.c (gtk_text_mark_get_name): Add function
to get the name of a mark.
* gtk/gtktextlayout.c (gtk_text_layout_get_line_at_y): Add a function
to find the paragraph from a y position.
Thu May 11 12:57:20 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextbtree.c (gtk_text_btree_node_invalidate_upward): Valid
nodes have width/height >= 0, not > 0.
Tue May 9 21:29:06 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.[ch] gtk/gtktextdisplay.c (gtk_text_layout_get_line_display):
Add a size_only flag, so when we only need the size, we don't create
useless appearance attributes.
* gtk/gtktextview.c (gtk_text_view_ensure_layout): Remove
duplicate setting of font description.
* gtk/gtkscale.c: Use PANGO_SCALE instead of 1000
Wed Apr 26 01:53:23 2000 Owen Taylor <otaylor@redhat.com>
* gtk/Makefile.am (EXTRA_DIST): Add OLD_STAMP into
EXTRA_DIST. It does not work well when the file that
everything depends on is not in the tarball.
Wed Apr 26 00:56:14 2000 Owen Taylor <otaylor@redhat.com>
* gtk/testgtk.c: Some hacks and fixes so that it basically
works when not sitting in the GTK+ build tree.
2000-05-03 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (gtk_text_line_next_could_contain_tag):
Properly determine the ordering of the tag root and the current
line within the tree. Previous algorithm only worked if the tag
root's immediate parent was the common root of both the current
line and the tag root.
Wed Apr 26 00:43:00 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.c (set_para_values): Fix some bugs in
alignment.
* gtk/gtktextview.c (gtk_text_view_ensure_layout): Track
the widget text directional dynamically.
* gtk/gtktextview.[ch]: Added functions to get and set default
wrap mode.
Tue Apr 25 23:47:38 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.c (gtk_text_layout_get_iter_location): Fix bug
in cursor location computation.
Tue Apr 25 23:22:59 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.c (gtk_layout_set_size): Clamp hadjustment/
vadjusment values properly when layout gets smaller.
* gtk/gtktextview.c (need_repaint_handler): Areas being
passed in are far completely inaccurate, and sometimes
too small, so, for now, just queue a redraw on the
whole visible region.
2000-04-25 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (summary_destroy): new function to
destroy tag summary nodes
(gtk_text_line_next_could_contain_tag): this function was
totally broken if the line passed in wasn't below the tag
root. Fix it.
(gtk_text_btree_first_could_contain_tag): In the tag == NULL
"wildcard" case, we have to do a linear scan. Blah.
(gtk_text_btree_last_could_contain_tag): In tag == NULL case,
we have to do the linear scan
(tag_removed_cb): When a tag is removed from the tag table,
remove the GtkTextTagInfo node from the btree.
(gtk_text_btree_spew): Implement the spew function, for
our debugging pleasure.
Tue Apr 25 19:40:18 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.c (gtk_text_layout_set_buffer): Fix
a problem with referring to the wrong buffer.
* gtk/gtkentry.c: Fix focus-in/focus-out confusion.
* gtk/gtkrc.c gtk/gtkstyle.c: Moving setting default
font description to gtk_style_new() - otherwise things
don't work without a .gtkrc file.
* gtk/gtktextbuffer.c (gtk_text_buffer_new): Sink the
tags table if we create it ourself, too.
* gdk/gdktypes.h (enum): Move GDK_RELEASE_MASK, since
it was conflicting with XKB modifiers.
* gtk/gtktextview.[ch]: Add simple support for
GtkIMContext.
Mon Apr 24 19:34:18 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_move_cursor_visually): Fix problem
with deletion from last commit.
Mon Apr 24 19:29:40 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_create_pango_context): Set the language
in the context from the current locale.
* gtk/gtkentry.c (gtk_entry_size_request): Use language from the
context, not hardcoded value.
* gtk/gtkentry.c (gtk_entry_move_cursor): Make character movement visual,
not logical.
Sun Apr 23 23:39:18 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c gtk/gtktextdisplay.c: Don't handle selections as
attributes - that doesn't handle partial-glyph selection
properly. Instead use new pango_layout_line_get_x_ranges()
functionality to draw the selection.
* gtk/gtkentry.c: Simplify code since pango_layout_line_index_to_x()
now properly handles out-of-range coordinates.
* gtk/gtktextbuffer.c: Emit "mark_set" when the cursor is moved.
* gtk/gtktextiter.h gtk/gtktextiterprivate.h: Make gtk_text_iter_get_line_byte()
public.
* gtk/gtktextlayout.[ch]: Properly set the direction in the PangoContext
for paragraphs opposite to the base direction of the widget.
* gtk/gtktextlayout.[ch] gtk/gtktextdisplay.c: Fixes for alignment.
* gtk/gtktextlayout.c: Don't split segments on marks, since that
causes Arabic words to reshape as you cursor through.
* gtk/gtktextlayout.[ch] gtk/gtktextview.[ch]: Implement virtual
cursor position when moving vertically with the arrow keys and
scrolling with page-up/page-down. (Arrow keys save only the X,
scrolling saves both X and Y.)
This means you can line-up / line-down or page-up / page-down
without losing your place, and also that moving vertically
with the cursor keys keeps the same X position, not the same
character count:
* gtk/gtktextlayout.[ch] gtk/gtktextview.[ch]: Make vertical
arrow keys move by display lines, not paragraphs.
Tue Apr 18 14:16:50 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.c: Make sure that the bin window is at least
as big as the allocation. (Should we also make sure that the
bin window is big enough to completely cover widget->window?)
* gtk/gtktextview.c (gtk_text_view_get_visible_rect): Add
function to get the onscreen rectangle.
* gdk/x11/gdkwindow-x11.c (gdk_window_get_pointer): Correctly account
for offsets in window coordinates.
Sun Apr 16 16:13:27 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_get_cursor_locations): Fix index/offset
confusion.
* gtk/gtktextview.c (gtk_text_view_ensure_layout): Set the default direction
from the widget direction.
* gtk/gtktexttag.c gtk/gtktexttagprivate.h (gtk_text_tag_set_arg):
Add a "direction" attribute.
* gtk/gtktextview.c: global s/tkxt/text_view/.
* gtk/testtext.c: Added long block of text in Arabic, to test out
the direction attributes. (Some problems with the shaping system
for arabic become obvious - like the fact the cursor splits words
into unjoined pieces.)
Fri Apr 14 12:54:34 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextdisplay.c (render_layout): Add overstrike handling.
* gtk/gtktextlayout.c: Fix up alignment.
* gtk/testtext.c: Add some tests for centering, wrapping.
Fri Apr 14 09:26:22 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkdrawable.h gdk/gdkdraw.c gdk/gdkwindow.c gdk/x11/gdkdrawable-x11.c:
Add a draw_glyphs() operation to the drawable vtable and gdk_draw_glyphs().
If we wrote GTK+-specific layout-render function this could just replace
the draw_layout() operation in the vtable.
* gtk/gtkentry.c: Move guts of gtk_entry_get_cursor_locations to
pango_layout_get_cursor_pos() and use that function.
* gtk/gtktextchild.[ch]: add gtk_ onto pixmap_segment_new(), since it
is a non-static symbol.
* gtk/gtktextbtree.[ch]: Replace gtk_text_btree_find_line_data_by_y()
with gtk_text_btree_find_line_by_y()
* gtk/gtktextdisplay.c: Rewrote for Pango - uses a custom layout
renderer that handles GtkTextAppearance attributes.
* gtk/gtktexttag.[ch] gtk/gtktexttagprivate.h:
- Move the values in the style that don't affect geometry into a
GtkTextAppearance structure.
- Change underline to take a PangoUnderline and "font" a string
representation of a font description
- Add a "font_desc" attribute which takes a FontDescription structure.
* gtk/gtktextlayout.[ch]:
- Get rid of the display-line list per each line. Instead, we
generate, on demand, a GtkTextLineDisplay structure which]
contains a PangoLayout * and other necesary information
(offsets, cursor locations) for displaying a paragraph.
- Get rid of the code to wrap lines, create display chunks,
etc. Instead, we just go through a paragraph and convert
it into the necessary inputs to a PangoLayout.
- Implement a new attribute type, GtkTextAttrAppearance. This
holds a GtkTextAppearance, and is used to pass colors,
stipple, etc, through from the layout to the display without
having to use lots and lots of individual attributes.
- Reimplement gtk_layout_get_iter_at_pixel() gtk_layout_get_iter_pos()
in terms of PangoLayout functions.
* gtk/gtktextview.c:
- Handle passing the necessary PangoContext to the layout
- Some fixups in painting to deal with the automatic backing store
and offsetting of GTK+-1.4
- Add a style_set handler so that the default style reacts
properly to theme changes.
* gtk/gtktext?*.[ch]: Random code-style fixes.
* gtk/testtext.c: Substitute in languages that Pango handles now for Thai
Mon Apr 10 10:33:45 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktext?*.[ch]: Check in Havoc's port of the Tk text widget,
in original form preparatory to Pango-ization and gdkimcontext-ization.
Thu Apr 6 19:25:39 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimcontext.c: Move default implementations to real_* vfuncs,
so that we can derive from gtkimcontext in language bindings properly.
Thu Apr 6 16:02:52 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimcontextsimple.[ch]: Use gdk_keyval_to_unicode to gdk_unicode_to_keyval.
Add a compose table including (almost) all the compose combinations
from X. This is 6k of static, shared data as opposed to 50k or so of dynamic
data in the XIM implementation.
* gdk/gdk.h gdk/gdkkeyuni.c gdk/win32/gdkevents-win32.c (gdk_keyval_to_unicode, gdk_unicode_to_keyval):
Moved functions to convert keyvalues from and to unicode here from
the win32 port and made them public.
Wed Apr 5 16:37:29 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkeditable.c (gtk_editable_insert_text): Allow new_text_length == -1.
Wed Apr 5 16:27:45 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimcontext.[ch]: Base class for new input context system
* gtk/gtkimmulticontext.[ch]: Proxy input context that allows
the real input context implementation to be loaded from modules
and switched on the fly.
* gtk/gtkcontextsimple.[ch]: Simple implementation of an input
context that just does direct keysymbol => unicode translation.
* gtk/gtkentry.[ch]: Start switching editing over to using
GtkInputContext. (No handling of preedit yet.)
Wed Apr 5 15:48:41 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktypeutils.h (GTK_CHECK_GET_CLASS): Fix problem with one too
many substitutions. (klass should not be subsituted.)
Wed Apr 5 00:18:14 2000 Owen Taylor <otaylor@redhat.com>
* configure.in: Add checks for Pango
* configure.in docs/Makefile.am: Add test for sgml2html
and allow 'make dist' without building html, but print out
warnings in that case. (For making snapshots)
* gdk/Makefile.am gdk/x11/Makefile.am gtk/Makefile.am:
Add Pango libraries and C flags
* gdk/gdkdraw.c gdk/gdkdrawable.h gdkwindow.c gdk/x11/gdkdrawable-x11.c:
Add function (gdk_draw_layout) to draw a pango layout.
* gdk/gdkpango.h gdk/x11/gdkpango-x11.c: New file with functions
for getting Pango contexts for GDK.
* gtk/gtkeditable.c: Get rid of dead code gtk_editable_parent_set()
* gtk/gtkentry.[ch]: Complete rewrite to use Pango, add bidirectional
editing.
* gtk/gtkentry.c: Hack in simple Hebrew input with direct
keysym => unicode translations. More languages can be added
here, but real input-method support is needed.
* docs/Changes-1.4.txt: Added note about entry behavior.
* gtk/gtkenums.h gtk/gtkwidget.[ch] testgtk.c gtkprivate.h: Add functions
to set the reading direction for a widget and the global direction.
Add test which allows toggling the global direction. Two private
flags are used to store the direction. (GTK_DIRECTION_SET + GTK_DIRECTION_LTR)
* gtk/gtkcheckbutton.c gtk/gtkframe.c gtk/gtkhbbox.c gtk/gtkhbox.c
gtk/gtkradiobutton.c gtk/gtkspinbutton.c gtk/gtktable.c
* gtk/gtk[hv]scale.c gtk/gtkscale.[ch]: Draw numbers using Pango
* gtk/gtklabel.[ch]: Moved to Pango and considerably rewritten. Line breaking,
underlining now handled by Pango.
* gtk/gtkstyle.[ch] gtk/gtkrc.[ch]: Add a PangoFontDescription
to RCStyle and Style. (Having both this and the old font name and GdkFont
is temporary.)
* gtk/gtkwidget.[ch] (gtk_widget_create_pango_{context,layout}): Added
convenience functions for creating contexts and layouts for widgets.
* gtk/testgtk.c: Enhance label tests with multilingual labels.
2000-06-02 03:14:07 +00:00
|
|
|
|
|
|
|
|
|
pango_layout_set_text (layout, buffer, -1);
|
2000-07-02 21:32:56 +00:00
|
|
|
|
pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
|
Remove all references to offscreen flag which was no longer used.
Thu Jun 1 23:05:13 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Remove all references to
offscreen flag which was no longer used.
* gtk/gtkprivate.h (enum): Remove unused flags and compress.
* gtk/gtkframe.c (gtk_frame_set_label_widget): Check
for non-null label_widget->parent.
* gtk/gtkentry.c: Get rid of code to deal with PangoAttribute
which no longer was used.
* gdk/gdkpango.c (gdk_pango_context_get_info): make static.
* gdk/gdkpango.c (gdk_draw_layout[_line]): Add checks
for null arguments.
* gdk/x11/gdkgeometry-x11.c (gdk_window_scroll): add
check for destroyed windows.
Thu Jun 1 13:48:45 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimmulticontext.c: Add a finalize method and unref
the slave context there.
* gtk/gtkinvisible.[ch]: Make reference counting behavior
identical to GtkWindow.
Thu Jun 1 01:54:11 2000 Owen Taylor <otaylor@redhat.com>
* Makefile.am gdk/gdkpango.c: Copy the layout render function from
pangox to here, so we can write them independent of rendering
system, using GDK primitives.
* gdk/gdkdrawable.h gdk/gdkdraw.c gdk/gdkwindow.c
gdk/x11/gdkdrawable-x11.c: Remove draw_layout() from the vtable,
since we have a rendering-system independent implementation in
terms of draw_glyphs().
* gdk/gdkpango.c gdkdrawable.h (gdk_draw_layout_line): New
function to render a single line.
* gdk/x11/gdkpango.c: Move the guts of this file mostly
into ../gdkpango.c, which simplifies things, since we
don't have to deal with raw X gc's.
Fri May 19 04:28:16 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.[ch]: Add get_log_attrs() function to
get the logical attributes for a given GtkTextLine.
Tue May 30 16:05:39 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkfont-x11.c (gdk_font_charset_for_locale): Track
g_locale_get_codeset() to g_get_codeset() change.
Tue May 30 15:03:19 2000 Owen Taylor <otaylor@redhat.com>
* gtk/testcalendar.c (calendar_font_selection_ok): Use font
descriptions.
* gtk/gtkentry.c (gtk_entry_draw_text): Center text within
the entry.
* gtk/gtkfontsel.c (gtk_font_selection_dialog_init): Start of
redoing (vastly simplifying) for Pango. Still needs quite
a bit of work. (Size selection is currently poor. List of
predefined sizes is not a good idea, since all of these
sizes won't necessarily be distinct.)
Tue May 30 13:50:19 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkfont-x11.c (gdk_font_charset_for_locale): Handle
CODESET results for LANG=C.
Mon May 29 15:49:10 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.[ch]: Add a 'font_name' declaration to RC
which takes a stringized pango font description;
ignore the older 'font' and 'fontset' declarations.
* gtk/gtkstyle.c gtk/gtkrc.c: Fill in the style->font
field with a GdkFont derived via gdk_font_from_description(),
for compatibility. (Should we just remove it entirely?
Probably too much compatibility breakage, but people
should be migrating to the new Pango stuff as quickly
as possible.)
Mon May 29 15:47:41 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c gtk/gtkclist.c: s/pango_font_unref/g_object_unref/.
Mon May 29 15:44:46 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcalender.c: Roughly pango-ized. Really needs
redoing; there are some bugs in size allocation right
now, the semi-existant distinction between header / day
fonts was removed, but, with Pango, could actually
be made functional in a nice way.
* gtk/testcalender: Move calender from examples into this
directory as a test program. (We really need to restrcture
testgtk into a whole directory full of tests for every
widget or functionality group, separated into multiple .c
files.)
Mon May 29 15:19:56 2000 Owen Taylor <otaylor@redhat.com>
* gtk/testgtk.c (file_exists): Fix stupid typo that
was keeping RC file from being loaded.
* gtk/testgtkrc gtk/testgtkrc2: Test new pango-ized
RC file font code.
Mon May 29 14:31:27 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkfont.h gdk/x11/gdkfont-x11.c (gdk_font_from_description):
Add function to load a GdkFont from a PangoFontDescription.
Fri May 26 17:16:40 2000 Owen Taylor <otaylor@redhat.com>
* gtk/frame.[ch] gtkaspectframe.c: Make frame widgets able
to have any widget for the label, use a GtkLabel widget
to display the text. (Based partially on a patch from
Anders Carlson.)
(Quite a bit of code reorganization - strip 90% of the
guts out of gtkaspectframe and add a single virtual
func to GtkFrameClass - compute_child_allocation.)
Fri May 26 12:00:02 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkctree.c gtk/gtkclist.[ch]: Pangoized.
(Removed clist->row_center_offset field because caching
it wasn't saving time or code, added private function
_gtk_clist_create_cell_layout()).
Wed May 24 15:59:37 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkaccellabel.c: Pangoized.
* gtk/[hv]ruler.c: Pangoized
Mon May 22 19:23:59 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c (gtk_file_selection_init):
Use gtk_clist_set_column_auto_resize() to remove need
need for manual column width computations.
Mon May 22 18:50:26 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktooltips.[ch]: Replace custom drawing with a GtkLabel,
ensuring Pango correctness, and considerably simplifying the
code.
* gtk/gtklabel.c gtk[hv]scale.c: 1000 => PANGO_SCALE.
* gtk/gtklabel.c (gtk_label_size_request): Fixed incorrect
getting of numbers of lines.
* gtk/gtklabel.c (gtk_label_size_request): Set the requisition
to the actual requested width of the lable, not to the wrap
width we set.
* gtk/gtktextchild.h: Remove extraneous include of gtk/gtk.h.
* gtk/gtktextbtree.c gtk/gtktextbuffer.c gtk/gtktextlayout.c
gtk/gtktextview.c gtk/gtktextview.[ch]: Fix up includes.
* gtk/gtktextview.c: Fix structure inheritance.
* gtk/gtkprogressbar.c: Pangoize.
Mon May 22 15:47:30 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextview.c (gtk_text_view_get_first_para_iter): Encapsulate
in a function.
* gtk/gtktextlayout.c (find_display_line_above): Fixed
bug with computing line tops.
* gtk/gtktextview.c (changed_handler): Fix < , <= confusion.
Thu May 18 18:53:31 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextdisplay.c (gtk_text_layout_draw): Fix up the x_offset
and y_offset coordinates to do what we need now. (The offset between
buffer and layout coordinates has been reintroduced, but is a
bit different than before.)
* gtk/gtktextview.[ch]: No longer inherit from GtkLayout; instead
handle the adjustments ourselves, and scroll as necessary using
the new gdk_window_scroll().
The advantage of this is that when we are incrementally revalidating,
we are essentially rearranging things around the visible portion
of the screen. With the old setup, the visible portion of the
screen was moved around in the layout, so scrolling and redrawing
to track that caused jumping of the display. Since we now
control the scrolling ourselves, we can suppress this and
only redraw when things actually change.
Thu May 18 18:47:25 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextbtree.c (redisplay_mark): We need to invalidate
the region not just redisplay it after-all, since we store the
cursors in the LineDisplay. (Ugly interactions here between
GtkLayout and GtkTextBTree here.)
* gtk/gtktextbtree.c (redisplay_region): Fixed reversed comparison.
Thu May 18 18:43:21 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.h gdk/x11/gdkgeometry-x11.c (gdk_window_scroll):
Added function to scroll contents of a window while keeping the
window constant. Works by XCopyArea or guffaw-scrolling depending
on the details of how the window is set up. (guffaw-scrolling
still needs to be filled in.)
Wed May 17 22:36:53 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextiter.c gtk/gtkmain.c: Add a debug key for the text widget,
move the debugging that was tied to a global variable
to that.
* gtk/gtkmarshal.list: Add NONE:INT,INT,INT
* gtk/gtktextbtree.[ch] gtk/gtktextlayout.c: Keep a separate
validated flag, in line data instead of setting height/width to
-1. This allows us to perform operations with partially invalid
buffer (using the old size for invalid lines) and thus to do
incremental vaidation. Keep height/width aggregates up to date
when deleting text and rebalancing the tree.
* gtk/gtktextbtree.[ch]: Add functions validate a line
(gtk_text_btree_validate_line), and to validate up
to a number of pixels (gtk_text_btree_validate).
* gtk/gtktextlayout.[ch]: Add an ::invalidated signal
that indicates that something is changed and a revalidation
pass is needed. Change ::need_repaint to ::changed, and
make it take old and new yranges instead of a rectangle.
* gtk/gtktextbtree.[ch] gtk/gtktextlayout.[ch]: Move
the line_data_destroy() function from
gtk_text_btree_add_view() to a virtual function in
GtkTextLayout
* gtk/gtktextbtree.[ch]: Remove gtk_text_btree_get_damage_range(),
since we are handling partial repaints in a different fashion
now.
* gtk/gtktextbtree.[ch]: Only repaint the changed portion
of the selection instead of queueing a repaint on the
entire widget.
* gtk/gtktextbuffer.[ch] gtk/gtktextbtree.[ch]: Move
get_selection_bounds() down to btree, make the function
in buffer a wrapper around the btree function.
* gtk/gtktextlayout.[ch]: Add functions to check if the
layout is valid and to recompute either a range of pixels
aroudn a line or a certain total number of pixels.
* gtk/gtktextlayout.[ch]: Cache a single line display;
now that we only redraw the needed portions, the hit rate
for this cache is quite high.
* gtk/gtktextview.[ch]: Keep track of the first paragraph
on the screen so that when re-laying-out the buffer, we can
keep the same place. This requires connecting to ::value_changed
on the adjustments
* gtk/gtktextview.[ch]: Add idle functions to revalidate
the buffer after we receive an ::invalidated signal.
Wed May 17 22:10:47 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.c (gtk_layout_size_allocate): Set upper
to max of allocation and layout size, not just to the
layout size.
* gtk/gtk[hv]scrollbar.c (gtk_[hv]scrollbar_calc_slider_size):
Invalidate window so it gets redrawn properly.
* gdk/gdkwindow.c (gdk_window_invalidate_rect): Allow rect == NULL
to mean the entire window.
* gdk/gdkevents.h: Move definition for GDK_PRIORITY_REDRAW
into public header.
Mon May 15 14:51:31 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextmark.c (gtk_text_mark_get_name): Add function
to get the name of a mark.
* gtk/gtktextlayout.c (gtk_text_layout_get_line_at_y): Add a function
to find the paragraph from a y position.
Thu May 11 12:57:20 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextbtree.c (gtk_text_btree_node_invalidate_upward): Valid
nodes have width/height >= 0, not > 0.
Tue May 9 21:29:06 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.[ch] gtk/gtktextdisplay.c (gtk_text_layout_get_line_display):
Add a size_only flag, so when we only need the size, we don't create
useless appearance attributes.
* gtk/gtktextview.c (gtk_text_view_ensure_layout): Remove
duplicate setting of font description.
* gtk/gtkscale.c: Use PANGO_SCALE instead of 1000
Wed Apr 26 01:53:23 2000 Owen Taylor <otaylor@redhat.com>
* gtk/Makefile.am (EXTRA_DIST): Add OLD_STAMP into
EXTRA_DIST. It does not work well when the file that
everything depends on is not in the tarball.
Wed Apr 26 00:56:14 2000 Owen Taylor <otaylor@redhat.com>
* gtk/testgtk.c: Some hacks and fixes so that it basically
works when not sitting in the GTK+ build tree.
2000-05-03 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (gtk_text_line_next_could_contain_tag):
Properly determine the ordering of the tag root and the current
line within the tree. Previous algorithm only worked if the tag
root's immediate parent was the common root of both the current
line and the tag root.
Wed Apr 26 00:43:00 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.c (set_para_values): Fix some bugs in
alignment.
* gtk/gtktextview.c (gtk_text_view_ensure_layout): Track
the widget text directional dynamically.
* gtk/gtktextview.[ch]: Added functions to get and set default
wrap mode.
Tue Apr 25 23:47:38 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.c (gtk_text_layout_get_iter_location): Fix bug
in cursor location computation.
Tue Apr 25 23:22:59 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.c (gtk_layout_set_size): Clamp hadjustment/
vadjusment values properly when layout gets smaller.
* gtk/gtktextview.c (need_repaint_handler): Areas being
passed in are far completely inaccurate, and sometimes
too small, so, for now, just queue a redraw on the
whole visible region.
2000-04-25 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (summary_destroy): new function to
destroy tag summary nodes
(gtk_text_line_next_could_contain_tag): this function was
totally broken if the line passed in wasn't below the tag
root. Fix it.
(gtk_text_btree_first_could_contain_tag): In the tag == NULL
"wildcard" case, we have to do a linear scan. Blah.
(gtk_text_btree_last_could_contain_tag): In tag == NULL case,
we have to do the linear scan
(tag_removed_cb): When a tag is removed from the tag table,
remove the GtkTextTagInfo node from the btree.
(gtk_text_btree_spew): Implement the spew function, for
our debugging pleasure.
Tue Apr 25 19:40:18 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.c (gtk_text_layout_set_buffer): Fix
a problem with referring to the wrong buffer.
* gtk/gtkentry.c: Fix focus-in/focus-out confusion.
* gtk/gtkrc.c gtk/gtkstyle.c: Moving setting default
font description to gtk_style_new() - otherwise things
don't work without a .gtkrc file.
* gtk/gtktextbuffer.c (gtk_text_buffer_new): Sink the
tags table if we create it ourself, too.
* gdk/gdktypes.h (enum): Move GDK_RELEASE_MASK, since
it was conflicting with XKB modifiers.
* gtk/gtktextview.[ch]: Add simple support for
GtkIMContext.
Mon Apr 24 19:34:18 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_move_cursor_visually): Fix problem
with deletion from last commit.
Mon Apr 24 19:29:40 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_create_pango_context): Set the language
in the context from the current locale.
* gtk/gtkentry.c (gtk_entry_size_request): Use language from the
context, not hardcoded value.
* gtk/gtkentry.c (gtk_entry_move_cursor): Make character movement visual,
not logical.
Sun Apr 23 23:39:18 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c gtk/gtktextdisplay.c: Don't handle selections as
attributes - that doesn't handle partial-glyph selection
properly. Instead use new pango_layout_line_get_x_ranges()
functionality to draw the selection.
* gtk/gtkentry.c: Simplify code since pango_layout_line_index_to_x()
now properly handles out-of-range coordinates.
* gtk/gtktextbuffer.c: Emit "mark_set" when the cursor is moved.
* gtk/gtktextiter.h gtk/gtktextiterprivate.h: Make gtk_text_iter_get_line_byte()
public.
* gtk/gtktextlayout.[ch]: Properly set the direction in the PangoContext
for paragraphs opposite to the base direction of the widget.
* gtk/gtktextlayout.[ch] gtk/gtktextdisplay.c: Fixes for alignment.
* gtk/gtktextlayout.c: Don't split segments on marks, since that
causes Arabic words to reshape as you cursor through.
* gtk/gtktextlayout.[ch] gtk/gtktextview.[ch]: Implement virtual
cursor position when moving vertically with the arrow keys and
scrolling with page-up/page-down. (Arrow keys save only the X,
scrolling saves both X and Y.)
This means you can line-up / line-down or page-up / page-down
without losing your place, and also that moving vertically
with the cursor keys keeps the same X position, not the same
character count:
* gtk/gtktextlayout.[ch] gtk/gtktextview.[ch]: Make vertical
arrow keys move by display lines, not paragraphs.
Tue Apr 18 14:16:50 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.c: Make sure that the bin window is at least
as big as the allocation. (Should we also make sure that the
bin window is big enough to completely cover widget->window?)
* gtk/gtktextview.c (gtk_text_view_get_visible_rect): Add
function to get the onscreen rectangle.
* gdk/x11/gdkwindow-x11.c (gdk_window_get_pointer): Correctly account
for offsets in window coordinates.
Sun Apr 16 16:13:27 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_get_cursor_locations): Fix index/offset
confusion.
* gtk/gtktextview.c (gtk_text_view_ensure_layout): Set the default direction
from the widget direction.
* gtk/gtktexttag.c gtk/gtktexttagprivate.h (gtk_text_tag_set_arg):
Add a "direction" attribute.
* gtk/gtktextview.c: global s/tkxt/text_view/.
* gtk/testtext.c: Added long block of text in Arabic, to test out
the direction attributes. (Some problems with the shaping system
for arabic become obvious - like the fact the cursor splits words
into unjoined pieces.)
Fri Apr 14 12:54:34 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextdisplay.c (render_layout): Add overstrike handling.
* gtk/gtktextlayout.c: Fix up alignment.
* gtk/testtext.c: Add some tests for centering, wrapping.
Fri Apr 14 09:26:22 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkdrawable.h gdk/gdkdraw.c gdk/gdkwindow.c gdk/x11/gdkdrawable-x11.c:
Add a draw_glyphs() operation to the drawable vtable and gdk_draw_glyphs().
If we wrote GTK+-specific layout-render function this could just replace
the draw_layout() operation in the vtable.
* gtk/gtkentry.c: Move guts of gtk_entry_get_cursor_locations to
pango_layout_get_cursor_pos() and use that function.
* gtk/gtktextchild.[ch]: add gtk_ onto pixmap_segment_new(), since it
is a non-static symbol.
* gtk/gtktextbtree.[ch]: Replace gtk_text_btree_find_line_data_by_y()
with gtk_text_btree_find_line_by_y()
* gtk/gtktextdisplay.c: Rewrote for Pango - uses a custom layout
renderer that handles GtkTextAppearance attributes.
* gtk/gtktexttag.[ch] gtk/gtktexttagprivate.h:
- Move the values in the style that don't affect geometry into a
GtkTextAppearance structure.
- Change underline to take a PangoUnderline and "font" a string
representation of a font description
- Add a "font_desc" attribute which takes a FontDescription structure.
* gtk/gtktextlayout.[ch]:
- Get rid of the display-line list per each line. Instead, we
generate, on demand, a GtkTextLineDisplay structure which]
contains a PangoLayout * and other necesary information
(offsets, cursor locations) for displaying a paragraph.
- Get rid of the code to wrap lines, create display chunks,
etc. Instead, we just go through a paragraph and convert
it into the necessary inputs to a PangoLayout.
- Implement a new attribute type, GtkTextAttrAppearance. This
holds a GtkTextAppearance, and is used to pass colors,
stipple, etc, through from the layout to the display without
having to use lots and lots of individual attributes.
- Reimplement gtk_layout_get_iter_at_pixel() gtk_layout_get_iter_pos()
in terms of PangoLayout functions.
* gtk/gtktextview.c:
- Handle passing the necessary PangoContext to the layout
- Some fixups in painting to deal with the automatic backing store
and offsetting of GTK+-1.4
- Add a style_set handler so that the default style reacts
properly to theme changes.
* gtk/gtktext?*.[ch]: Random code-style fixes.
* gtk/testtext.c: Substitute in languages that Pango handles now for Thai
Mon Apr 10 10:33:45 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktext?*.[ch]: Check in Havoc's port of the Tk text widget,
in original form preparatory to Pango-ization and gdkimcontext-ization.
Thu Apr 6 19:25:39 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimcontext.c: Move default implementations to real_* vfuncs,
so that we can derive from gtkimcontext in language bindings properly.
Thu Apr 6 16:02:52 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimcontextsimple.[ch]: Use gdk_keyval_to_unicode to gdk_unicode_to_keyval.
Add a compose table including (almost) all the compose combinations
from X. This is 6k of static, shared data as opposed to 50k or so of dynamic
data in the XIM implementation.
* gdk/gdk.h gdk/gdkkeyuni.c gdk/win32/gdkevents-win32.c (gdk_keyval_to_unicode, gdk_unicode_to_keyval):
Moved functions to convert keyvalues from and to unicode here from
the win32 port and made them public.
Wed Apr 5 16:37:29 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkeditable.c (gtk_editable_insert_text): Allow new_text_length == -1.
Wed Apr 5 16:27:45 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimcontext.[ch]: Base class for new input context system
* gtk/gtkimmulticontext.[ch]: Proxy input context that allows
the real input context implementation to be loaded from modules
and switched on the fly.
* gtk/gtkcontextsimple.[ch]: Simple implementation of an input
context that just does direct keysymbol => unicode translation.
* gtk/gtkentry.[ch]: Start switching editing over to using
GtkInputContext. (No handling of preedit yet.)
Wed Apr 5 15:48:41 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktypeutils.h (GTK_CHECK_GET_CLASS): Fix problem with one too
many substitutions. (klass should not be subsituted.)
Wed Apr 5 00:18:14 2000 Owen Taylor <otaylor@redhat.com>
* configure.in: Add checks for Pango
* configure.in docs/Makefile.am: Add test for sgml2html
and allow 'make dist' without building html, but print out
warnings in that case. (For making snapshots)
* gdk/Makefile.am gdk/x11/Makefile.am gtk/Makefile.am:
Add Pango libraries and C flags
* gdk/gdkdraw.c gdk/gdkdrawable.h gdkwindow.c gdk/x11/gdkdrawable-x11.c:
Add function (gdk_draw_layout) to draw a pango layout.
* gdk/gdkpango.h gdk/x11/gdkpango-x11.c: New file with functions
for getting Pango contexts for GDK.
* gtk/gtkeditable.c: Get rid of dead code gtk_editable_parent_set()
* gtk/gtkentry.[ch]: Complete rewrite to use Pango, add bidirectional
editing.
* gtk/gtkentry.c: Hack in simple Hebrew input with direct
keysym => unicode translations. More languages can be added
here, but real input-method support is needed.
* docs/Changes-1.4.txt: Added note about entry behavior.
* gtk/gtkenums.h gtk/gtkwidget.[ch] testgtk.c gtkprivate.h: Add functions
to set the reading direction for a widget and the global direction.
Add test which allows toggling the global direction. Two private
flags are used to store the direction. (GTK_DIRECTION_SET + GTK_DIRECTION_LTR)
* gtk/gtkcheckbutton.c gtk/gtkframe.c gtk/gtkhbbox.c gtk/gtkhbox.c
gtk/gtkradiobutton.c gtk/gtkspinbutton.c gtk/gtktable.c
* gtk/gtk[hv]scale.c gtk/gtkscale.[ch]: Draw numbers using Pango
* gtk/gtklabel.[ch]: Moved to Pango and considerably rewritten. Line breaking,
underlining now handled by Pango.
* gtk/gtkstyle.[ch] gtk/gtkrc.[ch]: Add a PangoFontDescription
to RCStyle and Style. (Having both this and the old font name and GdkFont
is temporary.)
* gtk/gtkwidget.[ch] (gtk_widget_create_pango_{context,layout}): Added
convenience functions for creating contexts and layouts for widgets.
* gtk/testgtk.c: Enhance label tests with multilingual labels.
2000-06-02 03:14:07 +00:00
|
|
|
|
|
2011-01-10 19:40:37 +00:00
|
|
|
|
gtk_render_layout (context, cr,
|
|
|
|
|
(CALENDAR_MARGIN +
|
|
|
|
|
+ (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR ?
|
|
|
|
|
(priv->week_width + (priv->week_width ? calendar_xsep : 0))
|
|
|
|
|
: 0)
|
|
|
|
|
+ day_wid_sep * i
|
|
|
|
|
+ (day_width - logical_rect.width)/2),
|
|
|
|
|
CALENDAR_MARGIN + focus_width + focus_padding + logical_rect.y,
|
|
|
|
|
layout);
|
1998-09-27 18:32:00 +00:00
|
|
|
|
}
|
2010-10-24 05:22:13 +00:00
|
|
|
|
|
2002-10-09 22:11:08 +00:00
|
|
|
|
g_object_unref (layout);
|
2010-09-04 17:16:26 +00:00
|
|
|
|
|
2011-01-10 19:40:37 +00:00
|
|
|
|
gtk_style_context_restore (context);
|
2010-09-04 17:16:26 +00:00
|
|
|
|
cairo_restore (cr);
|
1998-09-27 18:32:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
1998-10-01 13:24:42 +00:00
|
|
|
|
static void
|
2010-09-04 17:07:39 +00:00
|
|
|
|
calendar_paint_week_numbers (GtkCalendar *calendar,
|
|
|
|
|
cairo_t *cr)
|
1998-09-27 18:32:00 +00:00
|
|
|
|
{
|
2005-05-11 19:16:19 +00:00
|
|
|
|
GtkWidget *widget = GTK_WIDGET (calendar);
|
|
|
|
|
GtkCalendarPrivate *priv = GTK_CALENDAR_GET_PRIVATE (calendar);
|
2011-01-10 19:40:37 +00:00
|
|
|
|
GtkStyleContext *context;
|
|
|
|
|
GtkStateFlags state;
|
|
|
|
|
GtkBorder padding;
|
2007-12-19 22:57:01 +00:00
|
|
|
|
guint week = 0, year;
|
|
|
|
|
gint row, x_loc, y_loc;
|
|
|
|
|
gint day_height;
|
2006-01-26 20:40:18 +00:00
|
|
|
|
char buffer[32];
|
Remove all references to offscreen flag which was no longer used.
Thu Jun 1 23:05:13 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Remove all references to
offscreen flag which was no longer used.
* gtk/gtkprivate.h (enum): Remove unused flags and compress.
* gtk/gtkframe.c (gtk_frame_set_label_widget): Check
for non-null label_widget->parent.
* gtk/gtkentry.c: Get rid of code to deal with PangoAttribute
which no longer was used.
* gdk/gdkpango.c (gdk_pango_context_get_info): make static.
* gdk/gdkpango.c (gdk_draw_layout[_line]): Add checks
for null arguments.
* gdk/x11/gdkgeometry-x11.c (gdk_window_scroll): add
check for destroyed windows.
Thu Jun 1 13:48:45 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimmulticontext.c: Add a finalize method and unref
the slave context there.
* gtk/gtkinvisible.[ch]: Make reference counting behavior
identical to GtkWindow.
Thu Jun 1 01:54:11 2000 Owen Taylor <otaylor@redhat.com>
* Makefile.am gdk/gdkpango.c: Copy the layout render function from
pangox to here, so we can write them independent of rendering
system, using GDK primitives.
* gdk/gdkdrawable.h gdk/gdkdraw.c gdk/gdkwindow.c
gdk/x11/gdkdrawable-x11.c: Remove draw_layout() from the vtable,
since we have a rendering-system independent implementation in
terms of draw_glyphs().
* gdk/gdkpango.c gdkdrawable.h (gdk_draw_layout_line): New
function to render a single line.
* gdk/x11/gdkpango.c: Move the guts of this file mostly
into ../gdkpango.c, which simplifies things, since we
don't have to deal with raw X gc's.
Fri May 19 04:28:16 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.[ch]: Add get_log_attrs() function to
get the logical attributes for a given GtkTextLine.
Tue May 30 16:05:39 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkfont-x11.c (gdk_font_charset_for_locale): Track
g_locale_get_codeset() to g_get_codeset() change.
Tue May 30 15:03:19 2000 Owen Taylor <otaylor@redhat.com>
* gtk/testcalendar.c (calendar_font_selection_ok): Use font
descriptions.
* gtk/gtkentry.c (gtk_entry_draw_text): Center text within
the entry.
* gtk/gtkfontsel.c (gtk_font_selection_dialog_init): Start of
redoing (vastly simplifying) for Pango. Still needs quite
a bit of work. (Size selection is currently poor. List of
predefined sizes is not a good idea, since all of these
sizes won't necessarily be distinct.)
Tue May 30 13:50:19 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkfont-x11.c (gdk_font_charset_for_locale): Handle
CODESET results for LANG=C.
Mon May 29 15:49:10 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.[ch]: Add a 'font_name' declaration to RC
which takes a stringized pango font description;
ignore the older 'font' and 'fontset' declarations.
* gtk/gtkstyle.c gtk/gtkrc.c: Fill in the style->font
field with a GdkFont derived via gdk_font_from_description(),
for compatibility. (Should we just remove it entirely?
Probably too much compatibility breakage, but people
should be migrating to the new Pango stuff as quickly
as possible.)
Mon May 29 15:47:41 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c gtk/gtkclist.c: s/pango_font_unref/g_object_unref/.
Mon May 29 15:44:46 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcalender.c: Roughly pango-ized. Really needs
redoing; there are some bugs in size allocation right
now, the semi-existant distinction between header / day
fonts was removed, but, with Pango, could actually
be made functional in a nice way.
* gtk/testcalender: Move calender from examples into this
directory as a test program. (We really need to restrcture
testgtk into a whole directory full of tests for every
widget or functionality group, separated into multiple .c
files.)
Mon May 29 15:19:56 2000 Owen Taylor <otaylor@redhat.com>
* gtk/testgtk.c (file_exists): Fix stupid typo that
was keeping RC file from being loaded.
* gtk/testgtkrc gtk/testgtkrc2: Test new pango-ized
RC file font code.
Mon May 29 14:31:27 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkfont.h gdk/x11/gdkfont-x11.c (gdk_font_from_description):
Add function to load a GdkFont from a PangoFontDescription.
Fri May 26 17:16:40 2000 Owen Taylor <otaylor@redhat.com>
* gtk/frame.[ch] gtkaspectframe.c: Make frame widgets able
to have any widget for the label, use a GtkLabel widget
to display the text. (Based partially on a patch from
Anders Carlson.)
(Quite a bit of code reorganization - strip 90% of the
guts out of gtkaspectframe and add a single virtual
func to GtkFrameClass - compute_child_allocation.)
Fri May 26 12:00:02 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkctree.c gtk/gtkclist.[ch]: Pangoized.
(Removed clist->row_center_offset field because caching
it wasn't saving time or code, added private function
_gtk_clist_create_cell_layout()).
Wed May 24 15:59:37 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkaccellabel.c: Pangoized.
* gtk/[hv]ruler.c: Pangoized
Mon May 22 19:23:59 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c (gtk_file_selection_init):
Use gtk_clist_set_column_auto_resize() to remove need
need for manual column width computations.
Mon May 22 18:50:26 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktooltips.[ch]: Replace custom drawing with a GtkLabel,
ensuring Pango correctness, and considerably simplifying the
code.
* gtk/gtklabel.c gtk[hv]scale.c: 1000 => PANGO_SCALE.
* gtk/gtklabel.c (gtk_label_size_request): Fixed incorrect
getting of numbers of lines.
* gtk/gtklabel.c (gtk_label_size_request): Set the requisition
to the actual requested width of the lable, not to the wrap
width we set.
* gtk/gtktextchild.h: Remove extraneous include of gtk/gtk.h.
* gtk/gtktextbtree.c gtk/gtktextbuffer.c gtk/gtktextlayout.c
gtk/gtktextview.c gtk/gtktextview.[ch]: Fix up includes.
* gtk/gtktextview.c: Fix structure inheritance.
* gtk/gtkprogressbar.c: Pangoize.
Mon May 22 15:47:30 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextview.c (gtk_text_view_get_first_para_iter): Encapsulate
in a function.
* gtk/gtktextlayout.c (find_display_line_above): Fixed
bug with computing line tops.
* gtk/gtktextview.c (changed_handler): Fix < , <= confusion.
Thu May 18 18:53:31 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextdisplay.c (gtk_text_layout_draw): Fix up the x_offset
and y_offset coordinates to do what we need now. (The offset between
buffer and layout coordinates has been reintroduced, but is a
bit different than before.)
* gtk/gtktextview.[ch]: No longer inherit from GtkLayout; instead
handle the adjustments ourselves, and scroll as necessary using
the new gdk_window_scroll().
The advantage of this is that when we are incrementally revalidating,
we are essentially rearranging things around the visible portion
of the screen. With the old setup, the visible portion of the
screen was moved around in the layout, so scrolling and redrawing
to track that caused jumping of the display. Since we now
control the scrolling ourselves, we can suppress this and
only redraw when things actually change.
Thu May 18 18:47:25 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextbtree.c (redisplay_mark): We need to invalidate
the region not just redisplay it after-all, since we store the
cursors in the LineDisplay. (Ugly interactions here between
GtkLayout and GtkTextBTree here.)
* gtk/gtktextbtree.c (redisplay_region): Fixed reversed comparison.
Thu May 18 18:43:21 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.h gdk/x11/gdkgeometry-x11.c (gdk_window_scroll):
Added function to scroll contents of a window while keeping the
window constant. Works by XCopyArea or guffaw-scrolling depending
on the details of how the window is set up. (guffaw-scrolling
still needs to be filled in.)
Wed May 17 22:36:53 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextiter.c gtk/gtkmain.c: Add a debug key for the text widget,
move the debugging that was tied to a global variable
to that.
* gtk/gtkmarshal.list: Add NONE:INT,INT,INT
* gtk/gtktextbtree.[ch] gtk/gtktextlayout.c: Keep a separate
validated flag, in line data instead of setting height/width to
-1. This allows us to perform operations with partially invalid
buffer (using the old size for invalid lines) and thus to do
incremental vaidation. Keep height/width aggregates up to date
when deleting text and rebalancing the tree.
* gtk/gtktextbtree.[ch]: Add functions validate a line
(gtk_text_btree_validate_line), and to validate up
to a number of pixels (gtk_text_btree_validate).
* gtk/gtktextlayout.[ch]: Add an ::invalidated signal
that indicates that something is changed and a revalidation
pass is needed. Change ::need_repaint to ::changed, and
make it take old and new yranges instead of a rectangle.
* gtk/gtktextbtree.[ch] gtk/gtktextlayout.[ch]: Move
the line_data_destroy() function from
gtk_text_btree_add_view() to a virtual function in
GtkTextLayout
* gtk/gtktextbtree.[ch]: Remove gtk_text_btree_get_damage_range(),
since we are handling partial repaints in a different fashion
now.
* gtk/gtktextbtree.[ch]: Only repaint the changed portion
of the selection instead of queueing a repaint on the
entire widget.
* gtk/gtktextbuffer.[ch] gtk/gtktextbtree.[ch]: Move
get_selection_bounds() down to btree, make the function
in buffer a wrapper around the btree function.
* gtk/gtktextlayout.[ch]: Add functions to check if the
layout is valid and to recompute either a range of pixels
aroudn a line or a certain total number of pixels.
* gtk/gtktextlayout.[ch]: Cache a single line display;
now that we only redraw the needed portions, the hit rate
for this cache is quite high.
* gtk/gtktextview.[ch]: Keep track of the first paragraph
on the screen so that when re-laying-out the buffer, we can
keep the same place. This requires connecting to ::value_changed
on the adjustments
* gtk/gtktextview.[ch]: Add idle functions to revalidate
the buffer after we receive an ::invalidated signal.
Wed May 17 22:10:47 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.c (gtk_layout_size_allocate): Set upper
to max of allocation and layout size, not just to the
layout size.
* gtk/gtk[hv]scrollbar.c (gtk_[hv]scrollbar_calc_slider_size):
Invalidate window so it gets redrawn properly.
* gdk/gdkwindow.c (gdk_window_invalidate_rect): Allow rect == NULL
to mean the entire window.
* gdk/gdkevents.h: Move definition for GDK_PRIORITY_REDRAW
into public header.
Mon May 15 14:51:31 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextmark.c (gtk_text_mark_get_name): Add function
to get the name of a mark.
* gtk/gtktextlayout.c (gtk_text_layout_get_line_at_y): Add a function
to find the paragraph from a y position.
Thu May 11 12:57:20 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextbtree.c (gtk_text_btree_node_invalidate_upward): Valid
nodes have width/height >= 0, not > 0.
Tue May 9 21:29:06 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.[ch] gtk/gtktextdisplay.c (gtk_text_layout_get_line_display):
Add a size_only flag, so when we only need the size, we don't create
useless appearance attributes.
* gtk/gtktextview.c (gtk_text_view_ensure_layout): Remove
duplicate setting of font description.
* gtk/gtkscale.c: Use PANGO_SCALE instead of 1000
Wed Apr 26 01:53:23 2000 Owen Taylor <otaylor@redhat.com>
* gtk/Makefile.am (EXTRA_DIST): Add OLD_STAMP into
EXTRA_DIST. It does not work well when the file that
everything depends on is not in the tarball.
Wed Apr 26 00:56:14 2000 Owen Taylor <otaylor@redhat.com>
* gtk/testgtk.c: Some hacks and fixes so that it basically
works when not sitting in the GTK+ build tree.
2000-05-03 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (gtk_text_line_next_could_contain_tag):
Properly determine the ordering of the tag root and the current
line within the tree. Previous algorithm only worked if the tag
root's immediate parent was the common root of both the current
line and the tag root.
Wed Apr 26 00:43:00 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.c (set_para_values): Fix some bugs in
alignment.
* gtk/gtktextview.c (gtk_text_view_ensure_layout): Track
the widget text directional dynamically.
* gtk/gtktextview.[ch]: Added functions to get and set default
wrap mode.
Tue Apr 25 23:47:38 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.c (gtk_text_layout_get_iter_location): Fix bug
in cursor location computation.
Tue Apr 25 23:22:59 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.c (gtk_layout_set_size): Clamp hadjustment/
vadjusment values properly when layout gets smaller.
* gtk/gtktextview.c (need_repaint_handler): Areas being
passed in are far completely inaccurate, and sometimes
too small, so, for now, just queue a redraw on the
whole visible region.
2000-04-25 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (summary_destroy): new function to
destroy tag summary nodes
(gtk_text_line_next_could_contain_tag): this function was
totally broken if the line passed in wasn't below the tag
root. Fix it.
(gtk_text_btree_first_could_contain_tag): In the tag == NULL
"wildcard" case, we have to do a linear scan. Blah.
(gtk_text_btree_last_could_contain_tag): In tag == NULL case,
we have to do the linear scan
(tag_removed_cb): When a tag is removed from the tag table,
remove the GtkTextTagInfo node from the btree.
(gtk_text_btree_spew): Implement the spew function, for
our debugging pleasure.
Tue Apr 25 19:40:18 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.c (gtk_text_layout_set_buffer): Fix
a problem with referring to the wrong buffer.
* gtk/gtkentry.c: Fix focus-in/focus-out confusion.
* gtk/gtkrc.c gtk/gtkstyle.c: Moving setting default
font description to gtk_style_new() - otherwise things
don't work without a .gtkrc file.
* gtk/gtktextbuffer.c (gtk_text_buffer_new): Sink the
tags table if we create it ourself, too.
* gdk/gdktypes.h (enum): Move GDK_RELEASE_MASK, since
it was conflicting with XKB modifiers.
* gtk/gtktextview.[ch]: Add simple support for
GtkIMContext.
Mon Apr 24 19:34:18 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_move_cursor_visually): Fix problem
with deletion from last commit.
Mon Apr 24 19:29:40 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_create_pango_context): Set the language
in the context from the current locale.
* gtk/gtkentry.c (gtk_entry_size_request): Use language from the
context, not hardcoded value.
* gtk/gtkentry.c (gtk_entry_move_cursor): Make character movement visual,
not logical.
Sun Apr 23 23:39:18 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c gtk/gtktextdisplay.c: Don't handle selections as
attributes - that doesn't handle partial-glyph selection
properly. Instead use new pango_layout_line_get_x_ranges()
functionality to draw the selection.
* gtk/gtkentry.c: Simplify code since pango_layout_line_index_to_x()
now properly handles out-of-range coordinates.
* gtk/gtktextbuffer.c: Emit "mark_set" when the cursor is moved.
* gtk/gtktextiter.h gtk/gtktextiterprivate.h: Make gtk_text_iter_get_line_byte()
public.
* gtk/gtktextlayout.[ch]: Properly set the direction in the PangoContext
for paragraphs opposite to the base direction of the widget.
* gtk/gtktextlayout.[ch] gtk/gtktextdisplay.c: Fixes for alignment.
* gtk/gtktextlayout.c: Don't split segments on marks, since that
causes Arabic words to reshape as you cursor through.
* gtk/gtktextlayout.[ch] gtk/gtktextview.[ch]: Implement virtual
cursor position when moving vertically with the arrow keys and
scrolling with page-up/page-down. (Arrow keys save only the X,
scrolling saves both X and Y.)
This means you can line-up / line-down or page-up / page-down
without losing your place, and also that moving vertically
with the cursor keys keeps the same X position, not the same
character count:
* gtk/gtktextlayout.[ch] gtk/gtktextview.[ch]: Make vertical
arrow keys move by display lines, not paragraphs.
Tue Apr 18 14:16:50 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.c: Make sure that the bin window is at least
as big as the allocation. (Should we also make sure that the
bin window is big enough to completely cover widget->window?)
* gtk/gtktextview.c (gtk_text_view_get_visible_rect): Add
function to get the onscreen rectangle.
* gdk/x11/gdkwindow-x11.c (gdk_window_get_pointer): Correctly account
for offsets in window coordinates.
Sun Apr 16 16:13:27 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_get_cursor_locations): Fix index/offset
confusion.
* gtk/gtktextview.c (gtk_text_view_ensure_layout): Set the default direction
from the widget direction.
* gtk/gtktexttag.c gtk/gtktexttagprivate.h (gtk_text_tag_set_arg):
Add a "direction" attribute.
* gtk/gtktextview.c: global s/tkxt/text_view/.
* gtk/testtext.c: Added long block of text in Arabic, to test out
the direction attributes. (Some problems with the shaping system
for arabic become obvious - like the fact the cursor splits words
into unjoined pieces.)
Fri Apr 14 12:54:34 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextdisplay.c (render_layout): Add overstrike handling.
* gtk/gtktextlayout.c: Fix up alignment.
* gtk/testtext.c: Add some tests for centering, wrapping.
Fri Apr 14 09:26:22 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkdrawable.h gdk/gdkdraw.c gdk/gdkwindow.c gdk/x11/gdkdrawable-x11.c:
Add a draw_glyphs() operation to the drawable vtable and gdk_draw_glyphs().
If we wrote GTK+-specific layout-render function this could just replace
the draw_layout() operation in the vtable.
* gtk/gtkentry.c: Move guts of gtk_entry_get_cursor_locations to
pango_layout_get_cursor_pos() and use that function.
* gtk/gtktextchild.[ch]: add gtk_ onto pixmap_segment_new(), since it
is a non-static symbol.
* gtk/gtktextbtree.[ch]: Replace gtk_text_btree_find_line_data_by_y()
with gtk_text_btree_find_line_by_y()
* gtk/gtktextdisplay.c: Rewrote for Pango - uses a custom layout
renderer that handles GtkTextAppearance attributes.
* gtk/gtktexttag.[ch] gtk/gtktexttagprivate.h:
- Move the values in the style that don't affect geometry into a
GtkTextAppearance structure.
- Change underline to take a PangoUnderline and "font" a string
representation of a font description
- Add a "font_desc" attribute which takes a FontDescription structure.
* gtk/gtktextlayout.[ch]:
- Get rid of the display-line list per each line. Instead, we
generate, on demand, a GtkTextLineDisplay structure which]
contains a PangoLayout * and other necesary information
(offsets, cursor locations) for displaying a paragraph.
- Get rid of the code to wrap lines, create display chunks,
etc. Instead, we just go through a paragraph and convert
it into the necessary inputs to a PangoLayout.
- Implement a new attribute type, GtkTextAttrAppearance. This
holds a GtkTextAppearance, and is used to pass colors,
stipple, etc, through from the layout to the display without
having to use lots and lots of individual attributes.
- Reimplement gtk_layout_get_iter_at_pixel() gtk_layout_get_iter_pos()
in terms of PangoLayout functions.
* gtk/gtktextview.c:
- Handle passing the necessary PangoContext to the layout
- Some fixups in painting to deal with the automatic backing store
and offsetting of GTK+-1.4
- Add a style_set handler so that the default style reacts
properly to theme changes.
* gtk/gtktext?*.[ch]: Random code-style fixes.
* gtk/testtext.c: Substitute in languages that Pango handles now for Thai
Mon Apr 10 10:33:45 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktext?*.[ch]: Check in Havoc's port of the Tk text widget,
in original form preparatory to Pango-ization and gdkimcontext-ization.
Thu Apr 6 19:25:39 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimcontext.c: Move default implementations to real_* vfuncs,
so that we can derive from gtkimcontext in language bindings properly.
Thu Apr 6 16:02:52 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimcontextsimple.[ch]: Use gdk_keyval_to_unicode to gdk_unicode_to_keyval.
Add a compose table including (almost) all the compose combinations
from X. This is 6k of static, shared data as opposed to 50k or so of dynamic
data in the XIM implementation.
* gdk/gdk.h gdk/gdkkeyuni.c gdk/win32/gdkevents-win32.c (gdk_keyval_to_unicode, gdk_unicode_to_keyval):
Moved functions to convert keyvalues from and to unicode here from
the win32 port and made them public.
Wed Apr 5 16:37:29 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkeditable.c (gtk_editable_insert_text): Allow new_text_length == -1.
Wed Apr 5 16:27:45 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimcontext.[ch]: Base class for new input context system
* gtk/gtkimmulticontext.[ch]: Proxy input context that allows
the real input context implementation to be loaded from modules
and switched on the fly.
* gtk/gtkcontextsimple.[ch]: Simple implementation of an input
context that just does direct keysymbol => unicode translation.
* gtk/gtkentry.[ch]: Start switching editing over to using
GtkInputContext. (No handling of preedit yet.)
Wed Apr 5 15:48:41 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktypeutils.h (GTK_CHECK_GET_CLASS): Fix problem with one too
many substitutions. (klass should not be subsituted.)
Wed Apr 5 00:18:14 2000 Owen Taylor <otaylor@redhat.com>
* configure.in: Add checks for Pango
* configure.in docs/Makefile.am: Add test for sgml2html
and allow 'make dist' without building html, but print out
warnings in that case. (For making snapshots)
* gdk/Makefile.am gdk/x11/Makefile.am gtk/Makefile.am:
Add Pango libraries and C flags
* gdk/gdkdraw.c gdk/gdkdrawable.h gdkwindow.c gdk/x11/gdkdrawable-x11.c:
Add function (gdk_draw_layout) to draw a pango layout.
* gdk/gdkpango.h gdk/x11/gdkpango-x11.c: New file with functions
for getting Pango contexts for GDK.
* gtk/gtkeditable.c: Get rid of dead code gtk_editable_parent_set()
* gtk/gtkentry.[ch]: Complete rewrite to use Pango, add bidirectional
editing.
* gtk/gtkentry.c: Hack in simple Hebrew input with direct
keysym => unicode translations. More languages can be added
here, but real input-method support is needed.
* docs/Changes-1.4.txt: Added note about entry behavior.
* gtk/gtkenums.h gtk/gtkwidget.[ch] testgtk.c gtkprivate.h: Add functions
to set the reading direction for a widget and the global direction.
Add test which allows toggling the global direction. Two private
flags are used to store the direction. (GTK_DIRECTION_SET + GTK_DIRECTION_LTR)
* gtk/gtkcheckbutton.c gtk/gtkframe.c gtk/gtkhbbox.c gtk/gtkhbox.c
gtk/gtkradiobutton.c gtk/gtkspinbutton.c gtk/gtktable.c
* gtk/gtk[hv]scale.c gtk/gtkscale.[ch]: Draw numbers using Pango
* gtk/gtklabel.[ch]: Moved to Pango and considerably rewritten. Line breaking,
underlining now handled by Pango.
* gtk/gtkstyle.[ch] gtk/gtkrc.[ch]: Add a PangoFontDescription
to RCStyle and Style. (Having both this and the old font name and GdkFont
is temporary.)
* gtk/gtkwidget.[ch] (gtk_widget_create_pango_{context,layout}): Added
convenience functions for creating contexts and layouts for widgets.
* gtk/testgtk.c: Enhance label tests with multilingual labels.
2000-06-02 03:14:07 +00:00
|
|
|
|
PangoLayout *layout;
|
|
|
|
|
PangoRectangle logical_rect;
|
2002-02-14 05:05:45 +00:00
|
|
|
|
gint focus_padding;
|
|
|
|
|
gint focus_width;
|
2010-08-03 15:45:14 +00:00
|
|
|
|
gint calendar_xsep = calendar_get_xsep (calendar);
|
2010-10-24 05:22:13 +00:00
|
|
|
|
gint inner_border = calendar_get_inner_border (calendar);
|
|
|
|
|
gint x, y;
|
|
|
|
|
|
2011-01-10 19:40:37 +00:00
|
|
|
|
context = gtk_widget_get_style_context (widget);
|
|
|
|
|
state = gtk_widget_get_state_flags (widget);
|
|
|
|
|
gtk_style_context_get_padding (context, state, &padding);
|
2010-09-04 17:16:26 +00:00
|
|
|
|
|
|
|
|
|
cairo_save (cr);
|
2010-10-24 05:22:13 +00:00
|
|
|
|
|
2011-01-10 19:40:37 +00:00
|
|
|
|
y = priv->header_h + priv->day_name_h + (padding.top + inner_border);
|
2010-10-24 05:22:13 +00:00
|
|
|
|
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR)
|
2011-01-10 19:40:37 +00:00
|
|
|
|
x = padding.left + inner_border;
|
2010-10-24 05:22:13 +00:00
|
|
|
|
else
|
2011-01-10 19:40:37 +00:00
|
|
|
|
x = gtk_widget_get_allocated_width (widget) - priv->week_width - (padding.right + inner_border);
|
2010-08-03 15:45:14 +00:00
|
|
|
|
|
2002-02-14 05:05:45 +00:00
|
|
|
|
gtk_widget_style_get (GTK_WIDGET (widget),
|
2011-01-24 02:50:39 +00:00
|
|
|
|
"focus-line-width", &focus_width,
|
|
|
|
|
"focus-padding", &focus_padding,
|
|
|
|
|
NULL);
|
2010-10-24 05:22:13 +00:00
|
|
|
|
|
2011-01-10 19:40:37 +00:00
|
|
|
|
gtk_style_context_save (context);
|
|
|
|
|
gtk_style_context_add_class (context, GTK_STYLE_CLASS_HIGHLIGHT);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
|
2010-10-24 05:22:13 +00:00
|
|
|
|
if (priv->display_flags & GTK_CALENDAR_SHOW_DAY_NAMES)
|
2011-01-10 19:40:37 +00:00
|
|
|
|
gtk_render_background (context, cr,
|
|
|
|
|
x + CALENDAR_MARGIN, y,
|
|
|
|
|
priv->week_width - CALENDAR_MARGIN,
|
|
|
|
|
priv->main_h - CALENDAR_MARGIN);
|
1998-09-27 18:32:00 +00:00
|
|
|
|
else
|
2011-01-10 19:40:37 +00:00
|
|
|
|
gtk_render_background (context, cr,
|
|
|
|
|
x + CALENDAR_MARGIN,
|
|
|
|
|
y + CALENDAR_MARGIN,
|
|
|
|
|
priv->week_width - CALENDAR_MARGIN,
|
|
|
|
|
priv->main_h - 2 * CALENDAR_MARGIN);
|
2010-10-24 05:22:13 +00:00
|
|
|
|
|
1998-09-27 18:32:00 +00:00
|
|
|
|
/*
|
|
|
|
|
* Write the labels
|
|
|
|
|
*/
|
2010-10-24 05:22:13 +00:00
|
|
|
|
|
2000-07-02 22:30:54 +00:00
|
|
|
|
layout = gtk_widget_create_pango_layout (widget, NULL);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
day_height = calendar_row_height (calendar);
|
2011-01-10 19:40:37 +00:00
|
|
|
|
|
1998-09-27 18:32:00 +00:00
|
|
|
|
for (row = 0; row < 6; row++)
|
|
|
|
|
{
|
2005-05-11 19:16:19 +00:00
|
|
|
|
gboolean result;
|
2010-10-24 05:22:13 +00:00
|
|
|
|
|
2010-08-12 15:14:51 +00:00
|
|
|
|
year = priv->year;
|
|
|
|
|
if (priv->day[row][6] < 15 && row > 3 && priv->month == 11)
|
2011-01-24 02:50:39 +00:00
|
|
|
|
year++;
|
Remove all references to offscreen flag which was no longer used.
Thu Jun 1 23:05:13 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Remove all references to
offscreen flag which was no longer used.
* gtk/gtkprivate.h (enum): Remove unused flags and compress.
* gtk/gtkframe.c (gtk_frame_set_label_widget): Check
for non-null label_widget->parent.
* gtk/gtkentry.c: Get rid of code to deal with PangoAttribute
which no longer was used.
* gdk/gdkpango.c (gdk_pango_context_get_info): make static.
* gdk/gdkpango.c (gdk_draw_layout[_line]): Add checks
for null arguments.
* gdk/x11/gdkgeometry-x11.c (gdk_window_scroll): add
check for destroyed windows.
Thu Jun 1 13:48:45 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimmulticontext.c: Add a finalize method and unref
the slave context there.
* gtk/gtkinvisible.[ch]: Make reference counting behavior
identical to GtkWindow.
Thu Jun 1 01:54:11 2000 Owen Taylor <otaylor@redhat.com>
* Makefile.am gdk/gdkpango.c: Copy the layout render function from
pangox to here, so we can write them independent of rendering
system, using GDK primitives.
* gdk/gdkdrawable.h gdk/gdkdraw.c gdk/gdkwindow.c
gdk/x11/gdkdrawable-x11.c: Remove draw_layout() from the vtable,
since we have a rendering-system independent implementation in
terms of draw_glyphs().
* gdk/gdkpango.c gdkdrawable.h (gdk_draw_layout_line): New
function to render a single line.
* gdk/x11/gdkpango.c: Move the guts of this file mostly
into ../gdkpango.c, which simplifies things, since we
don't have to deal with raw X gc's.
Fri May 19 04:28:16 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.[ch]: Add get_log_attrs() function to
get the logical attributes for a given GtkTextLine.
Tue May 30 16:05:39 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkfont-x11.c (gdk_font_charset_for_locale): Track
g_locale_get_codeset() to g_get_codeset() change.
Tue May 30 15:03:19 2000 Owen Taylor <otaylor@redhat.com>
* gtk/testcalendar.c (calendar_font_selection_ok): Use font
descriptions.
* gtk/gtkentry.c (gtk_entry_draw_text): Center text within
the entry.
* gtk/gtkfontsel.c (gtk_font_selection_dialog_init): Start of
redoing (vastly simplifying) for Pango. Still needs quite
a bit of work. (Size selection is currently poor. List of
predefined sizes is not a good idea, since all of these
sizes won't necessarily be distinct.)
Tue May 30 13:50:19 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkfont-x11.c (gdk_font_charset_for_locale): Handle
CODESET results for LANG=C.
Mon May 29 15:49:10 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.[ch]: Add a 'font_name' declaration to RC
which takes a stringized pango font description;
ignore the older 'font' and 'fontset' declarations.
* gtk/gtkstyle.c gtk/gtkrc.c: Fill in the style->font
field with a GdkFont derived via gdk_font_from_description(),
for compatibility. (Should we just remove it entirely?
Probably too much compatibility breakage, but people
should be migrating to the new Pango stuff as quickly
as possible.)
Mon May 29 15:47:41 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c gtk/gtkclist.c: s/pango_font_unref/g_object_unref/.
Mon May 29 15:44:46 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcalender.c: Roughly pango-ized. Really needs
redoing; there are some bugs in size allocation right
now, the semi-existant distinction between header / day
fonts was removed, but, with Pango, could actually
be made functional in a nice way.
* gtk/testcalender: Move calender from examples into this
directory as a test program. (We really need to restrcture
testgtk into a whole directory full of tests for every
widget or functionality group, separated into multiple .c
files.)
Mon May 29 15:19:56 2000 Owen Taylor <otaylor@redhat.com>
* gtk/testgtk.c (file_exists): Fix stupid typo that
was keeping RC file from being loaded.
* gtk/testgtkrc gtk/testgtkrc2: Test new pango-ized
RC file font code.
Mon May 29 14:31:27 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkfont.h gdk/x11/gdkfont-x11.c (gdk_font_from_description):
Add function to load a GdkFont from a PangoFontDescription.
Fri May 26 17:16:40 2000 Owen Taylor <otaylor@redhat.com>
* gtk/frame.[ch] gtkaspectframe.c: Make frame widgets able
to have any widget for the label, use a GtkLabel widget
to display the text. (Based partially on a patch from
Anders Carlson.)
(Quite a bit of code reorganization - strip 90% of the
guts out of gtkaspectframe and add a single virtual
func to GtkFrameClass - compute_child_allocation.)
Fri May 26 12:00:02 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkctree.c gtk/gtkclist.[ch]: Pangoized.
(Removed clist->row_center_offset field because caching
it wasn't saving time or code, added private function
_gtk_clist_create_cell_layout()).
Wed May 24 15:59:37 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkaccellabel.c: Pangoized.
* gtk/[hv]ruler.c: Pangoized
Mon May 22 19:23:59 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c (gtk_file_selection_init):
Use gtk_clist_set_column_auto_resize() to remove need
need for manual column width computations.
Mon May 22 18:50:26 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktooltips.[ch]: Replace custom drawing with a GtkLabel,
ensuring Pango correctness, and considerably simplifying the
code.
* gtk/gtklabel.c gtk[hv]scale.c: 1000 => PANGO_SCALE.
* gtk/gtklabel.c (gtk_label_size_request): Fixed incorrect
getting of numbers of lines.
* gtk/gtklabel.c (gtk_label_size_request): Set the requisition
to the actual requested width of the lable, not to the wrap
width we set.
* gtk/gtktextchild.h: Remove extraneous include of gtk/gtk.h.
* gtk/gtktextbtree.c gtk/gtktextbuffer.c gtk/gtktextlayout.c
gtk/gtktextview.c gtk/gtktextview.[ch]: Fix up includes.
* gtk/gtktextview.c: Fix structure inheritance.
* gtk/gtkprogressbar.c: Pangoize.
Mon May 22 15:47:30 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextview.c (gtk_text_view_get_first_para_iter): Encapsulate
in a function.
* gtk/gtktextlayout.c (find_display_line_above): Fixed
bug with computing line tops.
* gtk/gtktextview.c (changed_handler): Fix < , <= confusion.
Thu May 18 18:53:31 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextdisplay.c (gtk_text_layout_draw): Fix up the x_offset
and y_offset coordinates to do what we need now. (The offset between
buffer and layout coordinates has been reintroduced, but is a
bit different than before.)
* gtk/gtktextview.[ch]: No longer inherit from GtkLayout; instead
handle the adjustments ourselves, and scroll as necessary using
the new gdk_window_scroll().
The advantage of this is that when we are incrementally revalidating,
we are essentially rearranging things around the visible portion
of the screen. With the old setup, the visible portion of the
screen was moved around in the layout, so scrolling and redrawing
to track that caused jumping of the display. Since we now
control the scrolling ourselves, we can suppress this and
only redraw when things actually change.
Thu May 18 18:47:25 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextbtree.c (redisplay_mark): We need to invalidate
the region not just redisplay it after-all, since we store the
cursors in the LineDisplay. (Ugly interactions here between
GtkLayout and GtkTextBTree here.)
* gtk/gtktextbtree.c (redisplay_region): Fixed reversed comparison.
Thu May 18 18:43:21 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.h gdk/x11/gdkgeometry-x11.c (gdk_window_scroll):
Added function to scroll contents of a window while keeping the
window constant. Works by XCopyArea or guffaw-scrolling depending
on the details of how the window is set up. (guffaw-scrolling
still needs to be filled in.)
Wed May 17 22:36:53 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextiter.c gtk/gtkmain.c: Add a debug key for the text widget,
move the debugging that was tied to a global variable
to that.
* gtk/gtkmarshal.list: Add NONE:INT,INT,INT
* gtk/gtktextbtree.[ch] gtk/gtktextlayout.c: Keep a separate
validated flag, in line data instead of setting height/width to
-1. This allows us to perform operations with partially invalid
buffer (using the old size for invalid lines) and thus to do
incremental vaidation. Keep height/width aggregates up to date
when deleting text and rebalancing the tree.
* gtk/gtktextbtree.[ch]: Add functions validate a line
(gtk_text_btree_validate_line), and to validate up
to a number of pixels (gtk_text_btree_validate).
* gtk/gtktextlayout.[ch]: Add an ::invalidated signal
that indicates that something is changed and a revalidation
pass is needed. Change ::need_repaint to ::changed, and
make it take old and new yranges instead of a rectangle.
* gtk/gtktextbtree.[ch] gtk/gtktextlayout.[ch]: Move
the line_data_destroy() function from
gtk_text_btree_add_view() to a virtual function in
GtkTextLayout
* gtk/gtktextbtree.[ch]: Remove gtk_text_btree_get_damage_range(),
since we are handling partial repaints in a different fashion
now.
* gtk/gtktextbtree.[ch]: Only repaint the changed portion
of the selection instead of queueing a repaint on the
entire widget.
* gtk/gtktextbuffer.[ch] gtk/gtktextbtree.[ch]: Move
get_selection_bounds() down to btree, make the function
in buffer a wrapper around the btree function.
* gtk/gtktextlayout.[ch]: Add functions to check if the
layout is valid and to recompute either a range of pixels
aroudn a line or a certain total number of pixels.
* gtk/gtktextlayout.[ch]: Cache a single line display;
now that we only redraw the needed portions, the hit rate
for this cache is quite high.
* gtk/gtktextview.[ch]: Keep track of the first paragraph
on the screen so that when re-laying-out the buffer, we can
keep the same place. This requires connecting to ::value_changed
on the adjustments
* gtk/gtktextview.[ch]: Add idle functions to revalidate
the buffer after we receive an ::invalidated signal.
Wed May 17 22:10:47 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.c (gtk_layout_size_allocate): Set upper
to max of allocation and layout size, not just to the
layout size.
* gtk/gtk[hv]scrollbar.c (gtk_[hv]scrollbar_calc_slider_size):
Invalidate window so it gets redrawn properly.
* gdk/gdkwindow.c (gdk_window_invalidate_rect): Allow rect == NULL
to mean the entire window.
* gdk/gdkevents.h: Move definition for GDK_PRIORITY_REDRAW
into public header.
Mon May 15 14:51:31 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextmark.c (gtk_text_mark_get_name): Add function
to get the name of a mark.
* gtk/gtktextlayout.c (gtk_text_layout_get_line_at_y): Add a function
to find the paragraph from a y position.
Thu May 11 12:57:20 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextbtree.c (gtk_text_btree_node_invalidate_upward): Valid
nodes have width/height >= 0, not > 0.
Tue May 9 21:29:06 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.[ch] gtk/gtktextdisplay.c (gtk_text_layout_get_line_display):
Add a size_only flag, so when we only need the size, we don't create
useless appearance attributes.
* gtk/gtktextview.c (gtk_text_view_ensure_layout): Remove
duplicate setting of font description.
* gtk/gtkscale.c: Use PANGO_SCALE instead of 1000
Wed Apr 26 01:53:23 2000 Owen Taylor <otaylor@redhat.com>
* gtk/Makefile.am (EXTRA_DIST): Add OLD_STAMP into
EXTRA_DIST. It does not work well when the file that
everything depends on is not in the tarball.
Wed Apr 26 00:56:14 2000 Owen Taylor <otaylor@redhat.com>
* gtk/testgtk.c: Some hacks and fixes so that it basically
works when not sitting in the GTK+ build tree.
2000-05-03 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (gtk_text_line_next_could_contain_tag):
Properly determine the ordering of the tag root and the current
line within the tree. Previous algorithm only worked if the tag
root's immediate parent was the common root of both the current
line and the tag root.
Wed Apr 26 00:43:00 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.c (set_para_values): Fix some bugs in
alignment.
* gtk/gtktextview.c (gtk_text_view_ensure_layout): Track
the widget text directional dynamically.
* gtk/gtktextview.[ch]: Added functions to get and set default
wrap mode.
Tue Apr 25 23:47:38 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.c (gtk_text_layout_get_iter_location): Fix bug
in cursor location computation.
Tue Apr 25 23:22:59 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.c (gtk_layout_set_size): Clamp hadjustment/
vadjusment values properly when layout gets smaller.
* gtk/gtktextview.c (need_repaint_handler): Areas being
passed in are far completely inaccurate, and sometimes
too small, so, for now, just queue a redraw on the
whole visible region.
2000-04-25 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (summary_destroy): new function to
destroy tag summary nodes
(gtk_text_line_next_could_contain_tag): this function was
totally broken if the line passed in wasn't below the tag
root. Fix it.
(gtk_text_btree_first_could_contain_tag): In the tag == NULL
"wildcard" case, we have to do a linear scan. Blah.
(gtk_text_btree_last_could_contain_tag): In tag == NULL case,
we have to do the linear scan
(tag_removed_cb): When a tag is removed from the tag table,
remove the GtkTextTagInfo node from the btree.
(gtk_text_btree_spew): Implement the spew function, for
our debugging pleasure.
Tue Apr 25 19:40:18 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.c (gtk_text_layout_set_buffer): Fix
a problem with referring to the wrong buffer.
* gtk/gtkentry.c: Fix focus-in/focus-out confusion.
* gtk/gtkrc.c gtk/gtkstyle.c: Moving setting default
font description to gtk_style_new() - otherwise things
don't work without a .gtkrc file.
* gtk/gtktextbuffer.c (gtk_text_buffer_new): Sink the
tags table if we create it ourself, too.
* gdk/gdktypes.h (enum): Move GDK_RELEASE_MASK, since
it was conflicting with XKB modifiers.
* gtk/gtktextview.[ch]: Add simple support for
GtkIMContext.
Mon Apr 24 19:34:18 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_move_cursor_visually): Fix problem
with deletion from last commit.
Mon Apr 24 19:29:40 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_create_pango_context): Set the language
in the context from the current locale.
* gtk/gtkentry.c (gtk_entry_size_request): Use language from the
context, not hardcoded value.
* gtk/gtkentry.c (gtk_entry_move_cursor): Make character movement visual,
not logical.
Sun Apr 23 23:39:18 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c gtk/gtktextdisplay.c: Don't handle selections as
attributes - that doesn't handle partial-glyph selection
properly. Instead use new pango_layout_line_get_x_ranges()
functionality to draw the selection.
* gtk/gtkentry.c: Simplify code since pango_layout_line_index_to_x()
now properly handles out-of-range coordinates.
* gtk/gtktextbuffer.c: Emit "mark_set" when the cursor is moved.
* gtk/gtktextiter.h gtk/gtktextiterprivate.h: Make gtk_text_iter_get_line_byte()
public.
* gtk/gtktextlayout.[ch]: Properly set the direction in the PangoContext
for paragraphs opposite to the base direction of the widget.
* gtk/gtktextlayout.[ch] gtk/gtktextdisplay.c: Fixes for alignment.
* gtk/gtktextlayout.c: Don't split segments on marks, since that
causes Arabic words to reshape as you cursor through.
* gtk/gtktextlayout.[ch] gtk/gtktextview.[ch]: Implement virtual
cursor position when moving vertically with the arrow keys and
scrolling with page-up/page-down. (Arrow keys save only the X,
scrolling saves both X and Y.)
This means you can line-up / line-down or page-up / page-down
without losing your place, and also that moving vertically
with the cursor keys keeps the same X position, not the same
character count:
* gtk/gtktextlayout.[ch] gtk/gtktextview.[ch]: Make vertical
arrow keys move by display lines, not paragraphs.
Tue Apr 18 14:16:50 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.c: Make sure that the bin window is at least
as big as the allocation. (Should we also make sure that the
bin window is big enough to completely cover widget->window?)
* gtk/gtktextview.c (gtk_text_view_get_visible_rect): Add
function to get the onscreen rectangle.
* gdk/x11/gdkwindow-x11.c (gdk_window_get_pointer): Correctly account
for offsets in window coordinates.
Sun Apr 16 16:13:27 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_get_cursor_locations): Fix index/offset
confusion.
* gtk/gtktextview.c (gtk_text_view_ensure_layout): Set the default direction
from the widget direction.
* gtk/gtktexttag.c gtk/gtktexttagprivate.h (gtk_text_tag_set_arg):
Add a "direction" attribute.
* gtk/gtktextview.c: global s/tkxt/text_view/.
* gtk/testtext.c: Added long block of text in Arabic, to test out
the direction attributes. (Some problems with the shaping system
for arabic become obvious - like the fact the cursor splits words
into unjoined pieces.)
Fri Apr 14 12:54:34 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextdisplay.c (render_layout): Add overstrike handling.
* gtk/gtktextlayout.c: Fix up alignment.
* gtk/testtext.c: Add some tests for centering, wrapping.
Fri Apr 14 09:26:22 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkdrawable.h gdk/gdkdraw.c gdk/gdkwindow.c gdk/x11/gdkdrawable-x11.c:
Add a draw_glyphs() operation to the drawable vtable and gdk_draw_glyphs().
If we wrote GTK+-specific layout-render function this could just replace
the draw_layout() operation in the vtable.
* gtk/gtkentry.c: Move guts of gtk_entry_get_cursor_locations to
pango_layout_get_cursor_pos() and use that function.
* gtk/gtktextchild.[ch]: add gtk_ onto pixmap_segment_new(), since it
is a non-static symbol.
* gtk/gtktextbtree.[ch]: Replace gtk_text_btree_find_line_data_by_y()
with gtk_text_btree_find_line_by_y()
* gtk/gtktextdisplay.c: Rewrote for Pango - uses a custom layout
renderer that handles GtkTextAppearance attributes.
* gtk/gtktexttag.[ch] gtk/gtktexttagprivate.h:
- Move the values in the style that don't affect geometry into a
GtkTextAppearance structure.
- Change underline to take a PangoUnderline and "font" a string
representation of a font description
- Add a "font_desc" attribute which takes a FontDescription structure.
* gtk/gtktextlayout.[ch]:
- Get rid of the display-line list per each line. Instead, we
generate, on demand, a GtkTextLineDisplay structure which]
contains a PangoLayout * and other necesary information
(offsets, cursor locations) for displaying a paragraph.
- Get rid of the code to wrap lines, create display chunks,
etc. Instead, we just go through a paragraph and convert
it into the necessary inputs to a PangoLayout.
- Implement a new attribute type, GtkTextAttrAppearance. This
holds a GtkTextAppearance, and is used to pass colors,
stipple, etc, through from the layout to the display without
having to use lots and lots of individual attributes.
- Reimplement gtk_layout_get_iter_at_pixel() gtk_layout_get_iter_pos()
in terms of PangoLayout functions.
* gtk/gtktextview.c:
- Handle passing the necessary PangoContext to the layout
- Some fixups in painting to deal with the automatic backing store
and offsetting of GTK+-1.4
- Add a style_set handler so that the default style reacts
properly to theme changes.
* gtk/gtktext?*.[ch]: Random code-style fixes.
* gtk/testtext.c: Substitute in languages that Pango handles now for Thai
Mon Apr 10 10:33:45 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktext?*.[ch]: Check in Havoc's port of the Tk text widget,
in original form preparatory to Pango-ization and gdkimcontext-ization.
Thu Apr 6 19:25:39 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimcontext.c: Move default implementations to real_* vfuncs,
so that we can derive from gtkimcontext in language bindings properly.
Thu Apr 6 16:02:52 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimcontextsimple.[ch]: Use gdk_keyval_to_unicode to gdk_unicode_to_keyval.
Add a compose table including (almost) all the compose combinations
from X. This is 6k of static, shared data as opposed to 50k or so of dynamic
data in the XIM implementation.
* gdk/gdk.h gdk/gdkkeyuni.c gdk/win32/gdkevents-win32.c (gdk_keyval_to_unicode, gdk_unicode_to_keyval):
Moved functions to convert keyvalues from and to unicode here from
the win32 port and made them public.
Wed Apr 5 16:37:29 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkeditable.c (gtk_editable_insert_text): Allow new_text_length == -1.
Wed Apr 5 16:27:45 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimcontext.[ch]: Base class for new input context system
* gtk/gtkimmulticontext.[ch]: Proxy input context that allows
the real input context implementation to be loaded from modules
and switched on the fly.
* gtk/gtkcontextsimple.[ch]: Simple implementation of an input
context that just does direct keysymbol => unicode translation.
* gtk/gtkentry.[ch]: Start switching editing over to using
GtkInputContext. (No handling of preedit yet.)
Wed Apr 5 15:48:41 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktypeutils.h (GTK_CHECK_GET_CLASS): Fix problem with one too
many substitutions. (klass should not be subsituted.)
Wed Apr 5 00:18:14 2000 Owen Taylor <otaylor@redhat.com>
* configure.in: Add checks for Pango
* configure.in docs/Makefile.am: Add test for sgml2html
and allow 'make dist' without building html, but print out
warnings in that case. (For making snapshots)
* gdk/Makefile.am gdk/x11/Makefile.am gtk/Makefile.am:
Add Pango libraries and C flags
* gdk/gdkdraw.c gdk/gdkdrawable.h gdkwindow.c gdk/x11/gdkdrawable-x11.c:
Add function (gdk_draw_layout) to draw a pango layout.
* gdk/gdkpango.h gdk/x11/gdkpango-x11.c: New file with functions
for getting Pango contexts for GDK.
* gtk/gtkeditable.c: Get rid of dead code gtk_editable_parent_set()
* gtk/gtkentry.[ch]: Complete rewrite to use Pango, add bidirectional
editing.
* gtk/gtkentry.c: Hack in simple Hebrew input with direct
keysym => unicode translations. More languages can be added
here, but real input-method support is needed.
* docs/Changes-1.4.txt: Added note about entry behavior.
* gtk/gtkenums.h gtk/gtkwidget.[ch] testgtk.c gtkprivate.h: Add functions
to set the reading direction for a widget and the global direction.
Add test which allows toggling the global direction. Two private
flags are used to store the direction. (GTK_DIRECTION_SET + GTK_DIRECTION_LTR)
* gtk/gtkcheckbutton.c gtk/gtkframe.c gtk/gtkhbbox.c gtk/gtkhbox.c
gtk/gtkradiobutton.c gtk/gtkspinbutton.c gtk/gtktable.c
* gtk/gtk[hv]scale.c gtk/gtkscale.[ch]: Draw numbers using Pango
* gtk/gtklabel.[ch]: Moved to Pango and considerably rewritten. Line breaking,
underlining now handled by Pango.
* gtk/gtkstyle.[ch] gtk/gtkrc.[ch]: Add a PangoFontDescription
to RCStyle and Style. (Having both this and the old font name and GdkFont
is temporary.)
* gtk/gtkwidget.[ch] (gtk_widget_create_pango_{context,layout}): Added
convenience functions for creating contexts and layouts for widgets.
* gtk/testgtk.c: Enhance label tests with multilingual labels.
2000-06-02 03:14:07 +00:00
|
|
|
|
|
2010-10-24 05:22:13 +00:00
|
|
|
|
result = week_of_year (&week, &year,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
((priv->day[row][6] < 15 && row > 3 ? 1 : 0)
|
|
|
|
|
+ priv->month) % 12 + 1, priv->day[row][6]);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
g_return_if_fail (result);
|
Remove all references to offscreen flag which was no longer used.
Thu Jun 1 23:05:13 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Remove all references to
offscreen flag which was no longer used.
* gtk/gtkprivate.h (enum): Remove unused flags and compress.
* gtk/gtkframe.c (gtk_frame_set_label_widget): Check
for non-null label_widget->parent.
* gtk/gtkentry.c: Get rid of code to deal with PangoAttribute
which no longer was used.
* gdk/gdkpango.c (gdk_pango_context_get_info): make static.
* gdk/gdkpango.c (gdk_draw_layout[_line]): Add checks
for null arguments.
* gdk/x11/gdkgeometry-x11.c (gdk_window_scroll): add
check for destroyed windows.
Thu Jun 1 13:48:45 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimmulticontext.c: Add a finalize method and unref
the slave context there.
* gtk/gtkinvisible.[ch]: Make reference counting behavior
identical to GtkWindow.
Thu Jun 1 01:54:11 2000 Owen Taylor <otaylor@redhat.com>
* Makefile.am gdk/gdkpango.c: Copy the layout render function from
pangox to here, so we can write them independent of rendering
system, using GDK primitives.
* gdk/gdkdrawable.h gdk/gdkdraw.c gdk/gdkwindow.c
gdk/x11/gdkdrawable-x11.c: Remove draw_layout() from the vtable,
since we have a rendering-system independent implementation in
terms of draw_glyphs().
* gdk/gdkpango.c gdkdrawable.h (gdk_draw_layout_line): New
function to render a single line.
* gdk/x11/gdkpango.c: Move the guts of this file mostly
into ../gdkpango.c, which simplifies things, since we
don't have to deal with raw X gc's.
Fri May 19 04:28:16 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.[ch]: Add get_log_attrs() function to
get the logical attributes for a given GtkTextLine.
Tue May 30 16:05:39 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkfont-x11.c (gdk_font_charset_for_locale): Track
g_locale_get_codeset() to g_get_codeset() change.
Tue May 30 15:03:19 2000 Owen Taylor <otaylor@redhat.com>
* gtk/testcalendar.c (calendar_font_selection_ok): Use font
descriptions.
* gtk/gtkentry.c (gtk_entry_draw_text): Center text within
the entry.
* gtk/gtkfontsel.c (gtk_font_selection_dialog_init): Start of
redoing (vastly simplifying) for Pango. Still needs quite
a bit of work. (Size selection is currently poor. List of
predefined sizes is not a good idea, since all of these
sizes won't necessarily be distinct.)
Tue May 30 13:50:19 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkfont-x11.c (gdk_font_charset_for_locale): Handle
CODESET results for LANG=C.
Mon May 29 15:49:10 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.[ch]: Add a 'font_name' declaration to RC
which takes a stringized pango font description;
ignore the older 'font' and 'fontset' declarations.
* gtk/gtkstyle.c gtk/gtkrc.c: Fill in the style->font
field with a GdkFont derived via gdk_font_from_description(),
for compatibility. (Should we just remove it entirely?
Probably too much compatibility breakage, but people
should be migrating to the new Pango stuff as quickly
as possible.)
Mon May 29 15:47:41 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c gtk/gtkclist.c: s/pango_font_unref/g_object_unref/.
Mon May 29 15:44:46 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcalender.c: Roughly pango-ized. Really needs
redoing; there are some bugs in size allocation right
now, the semi-existant distinction between header / day
fonts was removed, but, with Pango, could actually
be made functional in a nice way.
* gtk/testcalender: Move calender from examples into this
directory as a test program. (We really need to restrcture
testgtk into a whole directory full of tests for every
widget or functionality group, separated into multiple .c
files.)
Mon May 29 15:19:56 2000 Owen Taylor <otaylor@redhat.com>
* gtk/testgtk.c (file_exists): Fix stupid typo that
was keeping RC file from being loaded.
* gtk/testgtkrc gtk/testgtkrc2: Test new pango-ized
RC file font code.
Mon May 29 14:31:27 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkfont.h gdk/x11/gdkfont-x11.c (gdk_font_from_description):
Add function to load a GdkFont from a PangoFontDescription.
Fri May 26 17:16:40 2000 Owen Taylor <otaylor@redhat.com>
* gtk/frame.[ch] gtkaspectframe.c: Make frame widgets able
to have any widget for the label, use a GtkLabel widget
to display the text. (Based partially on a patch from
Anders Carlson.)
(Quite a bit of code reorganization - strip 90% of the
guts out of gtkaspectframe and add a single virtual
func to GtkFrameClass - compute_child_allocation.)
Fri May 26 12:00:02 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkctree.c gtk/gtkclist.[ch]: Pangoized.
(Removed clist->row_center_offset field because caching
it wasn't saving time or code, added private function
_gtk_clist_create_cell_layout()).
Wed May 24 15:59:37 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkaccellabel.c: Pangoized.
* gtk/[hv]ruler.c: Pangoized
Mon May 22 19:23:59 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c (gtk_file_selection_init):
Use gtk_clist_set_column_auto_resize() to remove need
need for manual column width computations.
Mon May 22 18:50:26 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktooltips.[ch]: Replace custom drawing with a GtkLabel,
ensuring Pango correctness, and considerably simplifying the
code.
* gtk/gtklabel.c gtk[hv]scale.c: 1000 => PANGO_SCALE.
* gtk/gtklabel.c (gtk_label_size_request): Fixed incorrect
getting of numbers of lines.
* gtk/gtklabel.c (gtk_label_size_request): Set the requisition
to the actual requested width of the lable, not to the wrap
width we set.
* gtk/gtktextchild.h: Remove extraneous include of gtk/gtk.h.
* gtk/gtktextbtree.c gtk/gtktextbuffer.c gtk/gtktextlayout.c
gtk/gtktextview.c gtk/gtktextview.[ch]: Fix up includes.
* gtk/gtktextview.c: Fix structure inheritance.
* gtk/gtkprogressbar.c: Pangoize.
Mon May 22 15:47:30 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextview.c (gtk_text_view_get_first_para_iter): Encapsulate
in a function.
* gtk/gtktextlayout.c (find_display_line_above): Fixed
bug with computing line tops.
* gtk/gtktextview.c (changed_handler): Fix < , <= confusion.
Thu May 18 18:53:31 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextdisplay.c (gtk_text_layout_draw): Fix up the x_offset
and y_offset coordinates to do what we need now. (The offset between
buffer and layout coordinates has been reintroduced, but is a
bit different than before.)
* gtk/gtktextview.[ch]: No longer inherit from GtkLayout; instead
handle the adjustments ourselves, and scroll as necessary using
the new gdk_window_scroll().
The advantage of this is that when we are incrementally revalidating,
we are essentially rearranging things around the visible portion
of the screen. With the old setup, the visible portion of the
screen was moved around in the layout, so scrolling and redrawing
to track that caused jumping of the display. Since we now
control the scrolling ourselves, we can suppress this and
only redraw when things actually change.
Thu May 18 18:47:25 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextbtree.c (redisplay_mark): We need to invalidate
the region not just redisplay it after-all, since we store the
cursors in the LineDisplay. (Ugly interactions here between
GtkLayout and GtkTextBTree here.)
* gtk/gtktextbtree.c (redisplay_region): Fixed reversed comparison.
Thu May 18 18:43:21 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.h gdk/x11/gdkgeometry-x11.c (gdk_window_scroll):
Added function to scroll contents of a window while keeping the
window constant. Works by XCopyArea or guffaw-scrolling depending
on the details of how the window is set up. (guffaw-scrolling
still needs to be filled in.)
Wed May 17 22:36:53 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextiter.c gtk/gtkmain.c: Add a debug key for the text widget,
move the debugging that was tied to a global variable
to that.
* gtk/gtkmarshal.list: Add NONE:INT,INT,INT
* gtk/gtktextbtree.[ch] gtk/gtktextlayout.c: Keep a separate
validated flag, in line data instead of setting height/width to
-1. This allows us to perform operations with partially invalid
buffer (using the old size for invalid lines) and thus to do
incremental vaidation. Keep height/width aggregates up to date
when deleting text and rebalancing the tree.
* gtk/gtktextbtree.[ch]: Add functions validate a line
(gtk_text_btree_validate_line), and to validate up
to a number of pixels (gtk_text_btree_validate).
* gtk/gtktextlayout.[ch]: Add an ::invalidated signal
that indicates that something is changed and a revalidation
pass is needed. Change ::need_repaint to ::changed, and
make it take old and new yranges instead of a rectangle.
* gtk/gtktextbtree.[ch] gtk/gtktextlayout.[ch]: Move
the line_data_destroy() function from
gtk_text_btree_add_view() to a virtual function in
GtkTextLayout
* gtk/gtktextbtree.[ch]: Remove gtk_text_btree_get_damage_range(),
since we are handling partial repaints in a different fashion
now.
* gtk/gtktextbtree.[ch]: Only repaint the changed portion
of the selection instead of queueing a repaint on the
entire widget.
* gtk/gtktextbuffer.[ch] gtk/gtktextbtree.[ch]: Move
get_selection_bounds() down to btree, make the function
in buffer a wrapper around the btree function.
* gtk/gtktextlayout.[ch]: Add functions to check if the
layout is valid and to recompute either a range of pixels
aroudn a line or a certain total number of pixels.
* gtk/gtktextlayout.[ch]: Cache a single line display;
now that we only redraw the needed portions, the hit rate
for this cache is quite high.
* gtk/gtktextview.[ch]: Keep track of the first paragraph
on the screen so that when re-laying-out the buffer, we can
keep the same place. This requires connecting to ::value_changed
on the adjustments
* gtk/gtktextview.[ch]: Add idle functions to revalidate
the buffer after we receive an ::invalidated signal.
Wed May 17 22:10:47 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.c (gtk_layout_size_allocate): Set upper
to max of allocation and layout size, not just to the
layout size.
* gtk/gtk[hv]scrollbar.c (gtk_[hv]scrollbar_calc_slider_size):
Invalidate window so it gets redrawn properly.
* gdk/gdkwindow.c (gdk_window_invalidate_rect): Allow rect == NULL
to mean the entire window.
* gdk/gdkevents.h: Move definition for GDK_PRIORITY_REDRAW
into public header.
Mon May 15 14:51:31 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextmark.c (gtk_text_mark_get_name): Add function
to get the name of a mark.
* gtk/gtktextlayout.c (gtk_text_layout_get_line_at_y): Add a function
to find the paragraph from a y position.
Thu May 11 12:57:20 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextbtree.c (gtk_text_btree_node_invalidate_upward): Valid
nodes have width/height >= 0, not > 0.
Tue May 9 21:29:06 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.[ch] gtk/gtktextdisplay.c (gtk_text_layout_get_line_display):
Add a size_only flag, so when we only need the size, we don't create
useless appearance attributes.
* gtk/gtktextview.c (gtk_text_view_ensure_layout): Remove
duplicate setting of font description.
* gtk/gtkscale.c: Use PANGO_SCALE instead of 1000
Wed Apr 26 01:53:23 2000 Owen Taylor <otaylor@redhat.com>
* gtk/Makefile.am (EXTRA_DIST): Add OLD_STAMP into
EXTRA_DIST. It does not work well when the file that
everything depends on is not in the tarball.
Wed Apr 26 00:56:14 2000 Owen Taylor <otaylor@redhat.com>
* gtk/testgtk.c: Some hacks and fixes so that it basically
works when not sitting in the GTK+ build tree.
2000-05-03 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (gtk_text_line_next_could_contain_tag):
Properly determine the ordering of the tag root and the current
line within the tree. Previous algorithm only worked if the tag
root's immediate parent was the common root of both the current
line and the tag root.
Wed Apr 26 00:43:00 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.c (set_para_values): Fix some bugs in
alignment.
* gtk/gtktextview.c (gtk_text_view_ensure_layout): Track
the widget text directional dynamically.
* gtk/gtktextview.[ch]: Added functions to get and set default
wrap mode.
Tue Apr 25 23:47:38 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.c (gtk_text_layout_get_iter_location): Fix bug
in cursor location computation.
Tue Apr 25 23:22:59 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.c (gtk_layout_set_size): Clamp hadjustment/
vadjusment values properly when layout gets smaller.
* gtk/gtktextview.c (need_repaint_handler): Areas being
passed in are far completely inaccurate, and sometimes
too small, so, for now, just queue a redraw on the
whole visible region.
2000-04-25 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (summary_destroy): new function to
destroy tag summary nodes
(gtk_text_line_next_could_contain_tag): this function was
totally broken if the line passed in wasn't below the tag
root. Fix it.
(gtk_text_btree_first_could_contain_tag): In the tag == NULL
"wildcard" case, we have to do a linear scan. Blah.
(gtk_text_btree_last_could_contain_tag): In tag == NULL case,
we have to do the linear scan
(tag_removed_cb): When a tag is removed from the tag table,
remove the GtkTextTagInfo node from the btree.
(gtk_text_btree_spew): Implement the spew function, for
our debugging pleasure.
Tue Apr 25 19:40:18 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.c (gtk_text_layout_set_buffer): Fix
a problem with referring to the wrong buffer.
* gtk/gtkentry.c: Fix focus-in/focus-out confusion.
* gtk/gtkrc.c gtk/gtkstyle.c: Moving setting default
font description to gtk_style_new() - otherwise things
don't work without a .gtkrc file.
* gtk/gtktextbuffer.c (gtk_text_buffer_new): Sink the
tags table if we create it ourself, too.
* gdk/gdktypes.h (enum): Move GDK_RELEASE_MASK, since
it was conflicting with XKB modifiers.
* gtk/gtktextview.[ch]: Add simple support for
GtkIMContext.
Mon Apr 24 19:34:18 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_move_cursor_visually): Fix problem
with deletion from last commit.
Mon Apr 24 19:29:40 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_create_pango_context): Set the language
in the context from the current locale.
* gtk/gtkentry.c (gtk_entry_size_request): Use language from the
context, not hardcoded value.
* gtk/gtkentry.c (gtk_entry_move_cursor): Make character movement visual,
not logical.
Sun Apr 23 23:39:18 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c gtk/gtktextdisplay.c: Don't handle selections as
attributes - that doesn't handle partial-glyph selection
properly. Instead use new pango_layout_line_get_x_ranges()
functionality to draw the selection.
* gtk/gtkentry.c: Simplify code since pango_layout_line_index_to_x()
now properly handles out-of-range coordinates.
* gtk/gtktextbuffer.c: Emit "mark_set" when the cursor is moved.
* gtk/gtktextiter.h gtk/gtktextiterprivate.h: Make gtk_text_iter_get_line_byte()
public.
* gtk/gtktextlayout.[ch]: Properly set the direction in the PangoContext
for paragraphs opposite to the base direction of the widget.
* gtk/gtktextlayout.[ch] gtk/gtktextdisplay.c: Fixes for alignment.
* gtk/gtktextlayout.c: Don't split segments on marks, since that
causes Arabic words to reshape as you cursor through.
* gtk/gtktextlayout.[ch] gtk/gtktextview.[ch]: Implement virtual
cursor position when moving vertically with the arrow keys and
scrolling with page-up/page-down. (Arrow keys save only the X,
scrolling saves both X and Y.)
This means you can line-up / line-down or page-up / page-down
without losing your place, and also that moving vertically
with the cursor keys keeps the same X position, not the same
character count:
* gtk/gtktextlayout.[ch] gtk/gtktextview.[ch]: Make vertical
arrow keys move by display lines, not paragraphs.
Tue Apr 18 14:16:50 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.c: Make sure that the bin window is at least
as big as the allocation. (Should we also make sure that the
bin window is big enough to completely cover widget->window?)
* gtk/gtktextview.c (gtk_text_view_get_visible_rect): Add
function to get the onscreen rectangle.
* gdk/x11/gdkwindow-x11.c (gdk_window_get_pointer): Correctly account
for offsets in window coordinates.
Sun Apr 16 16:13:27 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_get_cursor_locations): Fix index/offset
confusion.
* gtk/gtktextview.c (gtk_text_view_ensure_layout): Set the default direction
from the widget direction.
* gtk/gtktexttag.c gtk/gtktexttagprivate.h (gtk_text_tag_set_arg):
Add a "direction" attribute.
* gtk/gtktextview.c: global s/tkxt/text_view/.
* gtk/testtext.c: Added long block of text in Arabic, to test out
the direction attributes. (Some problems with the shaping system
for arabic become obvious - like the fact the cursor splits words
into unjoined pieces.)
Fri Apr 14 12:54:34 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextdisplay.c (render_layout): Add overstrike handling.
* gtk/gtktextlayout.c: Fix up alignment.
* gtk/testtext.c: Add some tests for centering, wrapping.
Fri Apr 14 09:26:22 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkdrawable.h gdk/gdkdraw.c gdk/gdkwindow.c gdk/x11/gdkdrawable-x11.c:
Add a draw_glyphs() operation to the drawable vtable and gdk_draw_glyphs().
If we wrote GTK+-specific layout-render function this could just replace
the draw_layout() operation in the vtable.
* gtk/gtkentry.c: Move guts of gtk_entry_get_cursor_locations to
pango_layout_get_cursor_pos() and use that function.
* gtk/gtktextchild.[ch]: add gtk_ onto pixmap_segment_new(), since it
is a non-static symbol.
* gtk/gtktextbtree.[ch]: Replace gtk_text_btree_find_line_data_by_y()
with gtk_text_btree_find_line_by_y()
* gtk/gtktextdisplay.c: Rewrote for Pango - uses a custom layout
renderer that handles GtkTextAppearance attributes.
* gtk/gtktexttag.[ch] gtk/gtktexttagprivate.h:
- Move the values in the style that don't affect geometry into a
GtkTextAppearance structure.
- Change underline to take a PangoUnderline and "font" a string
representation of a font description
- Add a "font_desc" attribute which takes a FontDescription structure.
* gtk/gtktextlayout.[ch]:
- Get rid of the display-line list per each line. Instead, we
generate, on demand, a GtkTextLineDisplay structure which]
contains a PangoLayout * and other necesary information
(offsets, cursor locations) for displaying a paragraph.
- Get rid of the code to wrap lines, create display chunks,
etc. Instead, we just go through a paragraph and convert
it into the necessary inputs to a PangoLayout.
- Implement a new attribute type, GtkTextAttrAppearance. This
holds a GtkTextAppearance, and is used to pass colors,
stipple, etc, through from the layout to the display without
having to use lots and lots of individual attributes.
- Reimplement gtk_layout_get_iter_at_pixel() gtk_layout_get_iter_pos()
in terms of PangoLayout functions.
* gtk/gtktextview.c:
- Handle passing the necessary PangoContext to the layout
- Some fixups in painting to deal with the automatic backing store
and offsetting of GTK+-1.4
- Add a style_set handler so that the default style reacts
properly to theme changes.
* gtk/gtktext?*.[ch]: Random code-style fixes.
* gtk/testtext.c: Substitute in languages that Pango handles now for Thai
Mon Apr 10 10:33:45 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktext?*.[ch]: Check in Havoc's port of the Tk text widget,
in original form preparatory to Pango-ization and gdkimcontext-ization.
Thu Apr 6 19:25:39 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimcontext.c: Move default implementations to real_* vfuncs,
so that we can derive from gtkimcontext in language bindings properly.
Thu Apr 6 16:02:52 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimcontextsimple.[ch]: Use gdk_keyval_to_unicode to gdk_unicode_to_keyval.
Add a compose table including (almost) all the compose combinations
from X. This is 6k of static, shared data as opposed to 50k or so of dynamic
data in the XIM implementation.
* gdk/gdk.h gdk/gdkkeyuni.c gdk/win32/gdkevents-win32.c (gdk_keyval_to_unicode, gdk_unicode_to_keyval):
Moved functions to convert keyvalues from and to unicode here from
the win32 port and made them public.
Wed Apr 5 16:37:29 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkeditable.c (gtk_editable_insert_text): Allow new_text_length == -1.
Wed Apr 5 16:27:45 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimcontext.[ch]: Base class for new input context system
* gtk/gtkimmulticontext.[ch]: Proxy input context that allows
the real input context implementation to be loaded from modules
and switched on the fly.
* gtk/gtkcontextsimple.[ch]: Simple implementation of an input
context that just does direct keysymbol => unicode translation.
* gtk/gtkentry.[ch]: Start switching editing over to using
GtkInputContext. (No handling of preedit yet.)
Wed Apr 5 15:48:41 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktypeutils.h (GTK_CHECK_GET_CLASS): Fix problem with one too
many substitutions. (klass should not be subsituted.)
Wed Apr 5 00:18:14 2000 Owen Taylor <otaylor@redhat.com>
* configure.in: Add checks for Pango
* configure.in docs/Makefile.am: Add test for sgml2html
and allow 'make dist' without building html, but print out
warnings in that case. (For making snapshots)
* gdk/Makefile.am gdk/x11/Makefile.am gtk/Makefile.am:
Add Pango libraries and C flags
* gdk/gdkdraw.c gdk/gdkdrawable.h gdkwindow.c gdk/x11/gdkdrawable-x11.c:
Add function (gdk_draw_layout) to draw a pango layout.
* gdk/gdkpango.h gdk/x11/gdkpango-x11.c: New file with functions
for getting Pango contexts for GDK.
* gtk/gtkeditable.c: Get rid of dead code gtk_editable_parent_set()
* gtk/gtkentry.[ch]: Complete rewrite to use Pango, add bidirectional
editing.
* gtk/gtkentry.c: Hack in simple Hebrew input with direct
keysym => unicode translations. More languages can be added
here, but real input-method support is needed.
* docs/Changes-1.4.txt: Added note about entry behavior.
* gtk/gtkenums.h gtk/gtkwidget.[ch] testgtk.c gtkprivate.h: Add functions
to set the reading direction for a widget and the global direction.
Add test which allows toggling the global direction. Two private
flags are used to store the direction. (GTK_DIRECTION_SET + GTK_DIRECTION_LTR)
* gtk/gtkcheckbutton.c gtk/gtkframe.c gtk/gtkhbbox.c gtk/gtkhbox.c
gtk/gtkradiobutton.c gtk/gtkspinbutton.c gtk/gtktable.c
* gtk/gtk[hv]scale.c gtk/gtkscale.[ch]: Draw numbers using Pango
* gtk/gtklabel.[ch]: Moved to Pango and considerably rewritten. Line breaking,
underlining now handled by Pango.
* gtk/gtkstyle.[ch] gtk/gtkrc.[ch]: Add a PangoFontDescription
to RCStyle and Style. (Having both this and the old font name and GdkFont
is temporary.)
* gtk/gtkwidget.[ch] (gtk_widget_create_pango_{context,layout}): Added
convenience functions for creating contexts and layouts for widgets.
* gtk/testgtk.c: Enhance label tests with multilingual labels.
2000-06-02 03:14:07 +00:00
|
|
|
|
|
2006-01-25 16:26:41 +00:00
|
|
|
|
/* Translators: this defines whether the week numbers should use
|
2006-01-25 17:08:51 +00:00
|
|
|
|
* localized digits or the ones used in English (0123...).
|
2006-01-25 16:26:41 +00:00
|
|
|
|
*
|
2006-03-30 22:56:09 +00:00
|
|
|
|
* Translate to "%Id" if you want to use localized digits, or
|
2008-10-27 01:42:28 +00:00
|
|
|
|
* translate to "%d" otherwise.
|
2006-01-25 16:26:41 +00:00
|
|
|
|
*
|
|
|
|
|
* Note that translating this doesn't guarantee that you get localized
|
2008-10-27 01:42:28 +00:00
|
|
|
|
* digits. That needs support from your system and locale definition
|
2006-01-25 16:26:41 +00:00
|
|
|
|
* too.
|
|
|
|
|
*/
|
2008-10-27 01:42:28 +00:00
|
|
|
|
g_snprintf (buffer, sizeof (buffer), C_("calendar:week:digits", "%d"), week);
|
Remove all references to offscreen flag which was no longer used.
Thu Jun 1 23:05:13 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Remove all references to
offscreen flag which was no longer used.
* gtk/gtkprivate.h (enum): Remove unused flags and compress.
* gtk/gtkframe.c (gtk_frame_set_label_widget): Check
for non-null label_widget->parent.
* gtk/gtkentry.c: Get rid of code to deal with PangoAttribute
which no longer was used.
* gdk/gdkpango.c (gdk_pango_context_get_info): make static.
* gdk/gdkpango.c (gdk_draw_layout[_line]): Add checks
for null arguments.
* gdk/x11/gdkgeometry-x11.c (gdk_window_scroll): add
check for destroyed windows.
Thu Jun 1 13:48:45 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimmulticontext.c: Add a finalize method and unref
the slave context there.
* gtk/gtkinvisible.[ch]: Make reference counting behavior
identical to GtkWindow.
Thu Jun 1 01:54:11 2000 Owen Taylor <otaylor@redhat.com>
* Makefile.am gdk/gdkpango.c: Copy the layout render function from
pangox to here, so we can write them independent of rendering
system, using GDK primitives.
* gdk/gdkdrawable.h gdk/gdkdraw.c gdk/gdkwindow.c
gdk/x11/gdkdrawable-x11.c: Remove draw_layout() from the vtable,
since we have a rendering-system independent implementation in
terms of draw_glyphs().
* gdk/gdkpango.c gdkdrawable.h (gdk_draw_layout_line): New
function to render a single line.
* gdk/x11/gdkpango.c: Move the guts of this file mostly
into ../gdkpango.c, which simplifies things, since we
don't have to deal with raw X gc's.
Fri May 19 04:28:16 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.[ch]: Add get_log_attrs() function to
get the logical attributes for a given GtkTextLine.
Tue May 30 16:05:39 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkfont-x11.c (gdk_font_charset_for_locale): Track
g_locale_get_codeset() to g_get_codeset() change.
Tue May 30 15:03:19 2000 Owen Taylor <otaylor@redhat.com>
* gtk/testcalendar.c (calendar_font_selection_ok): Use font
descriptions.
* gtk/gtkentry.c (gtk_entry_draw_text): Center text within
the entry.
* gtk/gtkfontsel.c (gtk_font_selection_dialog_init): Start of
redoing (vastly simplifying) for Pango. Still needs quite
a bit of work. (Size selection is currently poor. List of
predefined sizes is not a good idea, since all of these
sizes won't necessarily be distinct.)
Tue May 30 13:50:19 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkfont-x11.c (gdk_font_charset_for_locale): Handle
CODESET results for LANG=C.
Mon May 29 15:49:10 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.[ch]: Add a 'font_name' declaration to RC
which takes a stringized pango font description;
ignore the older 'font' and 'fontset' declarations.
* gtk/gtkstyle.c gtk/gtkrc.c: Fill in the style->font
field with a GdkFont derived via gdk_font_from_description(),
for compatibility. (Should we just remove it entirely?
Probably too much compatibility breakage, but people
should be migrating to the new Pango stuff as quickly
as possible.)
Mon May 29 15:47:41 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c gtk/gtkclist.c: s/pango_font_unref/g_object_unref/.
Mon May 29 15:44:46 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcalender.c: Roughly pango-ized. Really needs
redoing; there are some bugs in size allocation right
now, the semi-existant distinction between header / day
fonts was removed, but, with Pango, could actually
be made functional in a nice way.
* gtk/testcalender: Move calender from examples into this
directory as a test program. (We really need to restrcture
testgtk into a whole directory full of tests for every
widget or functionality group, separated into multiple .c
files.)
Mon May 29 15:19:56 2000 Owen Taylor <otaylor@redhat.com>
* gtk/testgtk.c (file_exists): Fix stupid typo that
was keeping RC file from being loaded.
* gtk/testgtkrc gtk/testgtkrc2: Test new pango-ized
RC file font code.
Mon May 29 14:31:27 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkfont.h gdk/x11/gdkfont-x11.c (gdk_font_from_description):
Add function to load a GdkFont from a PangoFontDescription.
Fri May 26 17:16:40 2000 Owen Taylor <otaylor@redhat.com>
* gtk/frame.[ch] gtkaspectframe.c: Make frame widgets able
to have any widget for the label, use a GtkLabel widget
to display the text. (Based partially on a patch from
Anders Carlson.)
(Quite a bit of code reorganization - strip 90% of the
guts out of gtkaspectframe and add a single virtual
func to GtkFrameClass - compute_child_allocation.)
Fri May 26 12:00:02 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkctree.c gtk/gtkclist.[ch]: Pangoized.
(Removed clist->row_center_offset field because caching
it wasn't saving time or code, added private function
_gtk_clist_create_cell_layout()).
Wed May 24 15:59:37 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkaccellabel.c: Pangoized.
* gtk/[hv]ruler.c: Pangoized
Mon May 22 19:23:59 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c (gtk_file_selection_init):
Use gtk_clist_set_column_auto_resize() to remove need
need for manual column width computations.
Mon May 22 18:50:26 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktooltips.[ch]: Replace custom drawing with a GtkLabel,
ensuring Pango correctness, and considerably simplifying the
code.
* gtk/gtklabel.c gtk[hv]scale.c: 1000 => PANGO_SCALE.
* gtk/gtklabel.c (gtk_label_size_request): Fixed incorrect
getting of numbers of lines.
* gtk/gtklabel.c (gtk_label_size_request): Set the requisition
to the actual requested width of the lable, not to the wrap
width we set.
* gtk/gtktextchild.h: Remove extraneous include of gtk/gtk.h.
* gtk/gtktextbtree.c gtk/gtktextbuffer.c gtk/gtktextlayout.c
gtk/gtktextview.c gtk/gtktextview.[ch]: Fix up includes.
* gtk/gtktextview.c: Fix structure inheritance.
* gtk/gtkprogressbar.c: Pangoize.
Mon May 22 15:47:30 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextview.c (gtk_text_view_get_first_para_iter): Encapsulate
in a function.
* gtk/gtktextlayout.c (find_display_line_above): Fixed
bug with computing line tops.
* gtk/gtktextview.c (changed_handler): Fix < , <= confusion.
Thu May 18 18:53:31 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextdisplay.c (gtk_text_layout_draw): Fix up the x_offset
and y_offset coordinates to do what we need now. (The offset between
buffer and layout coordinates has been reintroduced, but is a
bit different than before.)
* gtk/gtktextview.[ch]: No longer inherit from GtkLayout; instead
handle the adjustments ourselves, and scroll as necessary using
the new gdk_window_scroll().
The advantage of this is that when we are incrementally revalidating,
we are essentially rearranging things around the visible portion
of the screen. With the old setup, the visible portion of the
screen was moved around in the layout, so scrolling and redrawing
to track that caused jumping of the display. Since we now
control the scrolling ourselves, we can suppress this and
only redraw when things actually change.
Thu May 18 18:47:25 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextbtree.c (redisplay_mark): We need to invalidate
the region not just redisplay it after-all, since we store the
cursors in the LineDisplay. (Ugly interactions here between
GtkLayout and GtkTextBTree here.)
* gtk/gtktextbtree.c (redisplay_region): Fixed reversed comparison.
Thu May 18 18:43:21 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.h gdk/x11/gdkgeometry-x11.c (gdk_window_scroll):
Added function to scroll contents of a window while keeping the
window constant. Works by XCopyArea or guffaw-scrolling depending
on the details of how the window is set up. (guffaw-scrolling
still needs to be filled in.)
Wed May 17 22:36:53 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextiter.c gtk/gtkmain.c: Add a debug key for the text widget,
move the debugging that was tied to a global variable
to that.
* gtk/gtkmarshal.list: Add NONE:INT,INT,INT
* gtk/gtktextbtree.[ch] gtk/gtktextlayout.c: Keep a separate
validated flag, in line data instead of setting height/width to
-1. This allows us to perform operations with partially invalid
buffer (using the old size for invalid lines) and thus to do
incremental vaidation. Keep height/width aggregates up to date
when deleting text and rebalancing the tree.
* gtk/gtktextbtree.[ch]: Add functions validate a line
(gtk_text_btree_validate_line), and to validate up
to a number of pixels (gtk_text_btree_validate).
* gtk/gtktextlayout.[ch]: Add an ::invalidated signal
that indicates that something is changed and a revalidation
pass is needed. Change ::need_repaint to ::changed, and
make it take old and new yranges instead of a rectangle.
* gtk/gtktextbtree.[ch] gtk/gtktextlayout.[ch]: Move
the line_data_destroy() function from
gtk_text_btree_add_view() to a virtual function in
GtkTextLayout
* gtk/gtktextbtree.[ch]: Remove gtk_text_btree_get_damage_range(),
since we are handling partial repaints in a different fashion
now.
* gtk/gtktextbtree.[ch]: Only repaint the changed portion
of the selection instead of queueing a repaint on the
entire widget.
* gtk/gtktextbuffer.[ch] gtk/gtktextbtree.[ch]: Move
get_selection_bounds() down to btree, make the function
in buffer a wrapper around the btree function.
* gtk/gtktextlayout.[ch]: Add functions to check if the
layout is valid and to recompute either a range of pixels
aroudn a line or a certain total number of pixels.
* gtk/gtktextlayout.[ch]: Cache a single line display;
now that we only redraw the needed portions, the hit rate
for this cache is quite high.
* gtk/gtktextview.[ch]: Keep track of the first paragraph
on the screen so that when re-laying-out the buffer, we can
keep the same place. This requires connecting to ::value_changed
on the adjustments
* gtk/gtktextview.[ch]: Add idle functions to revalidate
the buffer after we receive an ::invalidated signal.
Wed May 17 22:10:47 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.c (gtk_layout_size_allocate): Set upper
to max of allocation and layout size, not just to the
layout size.
* gtk/gtk[hv]scrollbar.c (gtk_[hv]scrollbar_calc_slider_size):
Invalidate window so it gets redrawn properly.
* gdk/gdkwindow.c (gdk_window_invalidate_rect): Allow rect == NULL
to mean the entire window.
* gdk/gdkevents.h: Move definition for GDK_PRIORITY_REDRAW
into public header.
Mon May 15 14:51:31 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextmark.c (gtk_text_mark_get_name): Add function
to get the name of a mark.
* gtk/gtktextlayout.c (gtk_text_layout_get_line_at_y): Add a function
to find the paragraph from a y position.
Thu May 11 12:57:20 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextbtree.c (gtk_text_btree_node_invalidate_upward): Valid
nodes have width/height >= 0, not > 0.
Tue May 9 21:29:06 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.[ch] gtk/gtktextdisplay.c (gtk_text_layout_get_line_display):
Add a size_only flag, so when we only need the size, we don't create
useless appearance attributes.
* gtk/gtktextview.c (gtk_text_view_ensure_layout): Remove
duplicate setting of font description.
* gtk/gtkscale.c: Use PANGO_SCALE instead of 1000
Wed Apr 26 01:53:23 2000 Owen Taylor <otaylor@redhat.com>
* gtk/Makefile.am (EXTRA_DIST): Add OLD_STAMP into
EXTRA_DIST. It does not work well when the file that
everything depends on is not in the tarball.
Wed Apr 26 00:56:14 2000 Owen Taylor <otaylor@redhat.com>
* gtk/testgtk.c: Some hacks and fixes so that it basically
works when not sitting in the GTK+ build tree.
2000-05-03 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (gtk_text_line_next_could_contain_tag):
Properly determine the ordering of the tag root and the current
line within the tree. Previous algorithm only worked if the tag
root's immediate parent was the common root of both the current
line and the tag root.
Wed Apr 26 00:43:00 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.c (set_para_values): Fix some bugs in
alignment.
* gtk/gtktextview.c (gtk_text_view_ensure_layout): Track
the widget text directional dynamically.
* gtk/gtktextview.[ch]: Added functions to get and set default
wrap mode.
Tue Apr 25 23:47:38 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.c (gtk_text_layout_get_iter_location): Fix bug
in cursor location computation.
Tue Apr 25 23:22:59 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.c (gtk_layout_set_size): Clamp hadjustment/
vadjusment values properly when layout gets smaller.
* gtk/gtktextview.c (need_repaint_handler): Areas being
passed in are far completely inaccurate, and sometimes
too small, so, for now, just queue a redraw on the
whole visible region.
2000-04-25 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (summary_destroy): new function to
destroy tag summary nodes
(gtk_text_line_next_could_contain_tag): this function was
totally broken if the line passed in wasn't below the tag
root. Fix it.
(gtk_text_btree_first_could_contain_tag): In the tag == NULL
"wildcard" case, we have to do a linear scan. Blah.
(gtk_text_btree_last_could_contain_tag): In tag == NULL case,
we have to do the linear scan
(tag_removed_cb): When a tag is removed from the tag table,
remove the GtkTextTagInfo node from the btree.
(gtk_text_btree_spew): Implement the spew function, for
our debugging pleasure.
Tue Apr 25 19:40:18 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.c (gtk_text_layout_set_buffer): Fix
a problem with referring to the wrong buffer.
* gtk/gtkentry.c: Fix focus-in/focus-out confusion.
* gtk/gtkrc.c gtk/gtkstyle.c: Moving setting default
font description to gtk_style_new() - otherwise things
don't work without a .gtkrc file.
* gtk/gtktextbuffer.c (gtk_text_buffer_new): Sink the
tags table if we create it ourself, too.
* gdk/gdktypes.h (enum): Move GDK_RELEASE_MASK, since
it was conflicting with XKB modifiers.
* gtk/gtktextview.[ch]: Add simple support for
GtkIMContext.
Mon Apr 24 19:34:18 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_move_cursor_visually): Fix problem
with deletion from last commit.
Mon Apr 24 19:29:40 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_create_pango_context): Set the language
in the context from the current locale.
* gtk/gtkentry.c (gtk_entry_size_request): Use language from the
context, not hardcoded value.
* gtk/gtkentry.c (gtk_entry_move_cursor): Make character movement visual,
not logical.
Sun Apr 23 23:39:18 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c gtk/gtktextdisplay.c: Don't handle selections as
attributes - that doesn't handle partial-glyph selection
properly. Instead use new pango_layout_line_get_x_ranges()
functionality to draw the selection.
* gtk/gtkentry.c: Simplify code since pango_layout_line_index_to_x()
now properly handles out-of-range coordinates.
* gtk/gtktextbuffer.c: Emit "mark_set" when the cursor is moved.
* gtk/gtktextiter.h gtk/gtktextiterprivate.h: Make gtk_text_iter_get_line_byte()
public.
* gtk/gtktextlayout.[ch]: Properly set the direction in the PangoContext
for paragraphs opposite to the base direction of the widget.
* gtk/gtktextlayout.[ch] gtk/gtktextdisplay.c: Fixes for alignment.
* gtk/gtktextlayout.c: Don't split segments on marks, since that
causes Arabic words to reshape as you cursor through.
* gtk/gtktextlayout.[ch] gtk/gtktextview.[ch]: Implement virtual
cursor position when moving vertically with the arrow keys and
scrolling with page-up/page-down. (Arrow keys save only the X,
scrolling saves both X and Y.)
This means you can line-up / line-down or page-up / page-down
without losing your place, and also that moving vertically
with the cursor keys keeps the same X position, not the same
character count:
* gtk/gtktextlayout.[ch] gtk/gtktextview.[ch]: Make vertical
arrow keys move by display lines, not paragraphs.
Tue Apr 18 14:16:50 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.c: Make sure that the bin window is at least
as big as the allocation. (Should we also make sure that the
bin window is big enough to completely cover widget->window?)
* gtk/gtktextview.c (gtk_text_view_get_visible_rect): Add
function to get the onscreen rectangle.
* gdk/x11/gdkwindow-x11.c (gdk_window_get_pointer): Correctly account
for offsets in window coordinates.
Sun Apr 16 16:13:27 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_get_cursor_locations): Fix index/offset
confusion.
* gtk/gtktextview.c (gtk_text_view_ensure_layout): Set the default direction
from the widget direction.
* gtk/gtktexttag.c gtk/gtktexttagprivate.h (gtk_text_tag_set_arg):
Add a "direction" attribute.
* gtk/gtktextview.c: global s/tkxt/text_view/.
* gtk/testtext.c: Added long block of text in Arabic, to test out
the direction attributes. (Some problems with the shaping system
for arabic become obvious - like the fact the cursor splits words
into unjoined pieces.)
Fri Apr 14 12:54:34 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextdisplay.c (render_layout): Add overstrike handling.
* gtk/gtktextlayout.c: Fix up alignment.
* gtk/testtext.c: Add some tests for centering, wrapping.
Fri Apr 14 09:26:22 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkdrawable.h gdk/gdkdraw.c gdk/gdkwindow.c gdk/x11/gdkdrawable-x11.c:
Add a draw_glyphs() operation to the drawable vtable and gdk_draw_glyphs().
If we wrote GTK+-specific layout-render function this could just replace
the draw_layout() operation in the vtable.
* gtk/gtkentry.c: Move guts of gtk_entry_get_cursor_locations to
pango_layout_get_cursor_pos() and use that function.
* gtk/gtktextchild.[ch]: add gtk_ onto pixmap_segment_new(), since it
is a non-static symbol.
* gtk/gtktextbtree.[ch]: Replace gtk_text_btree_find_line_data_by_y()
with gtk_text_btree_find_line_by_y()
* gtk/gtktextdisplay.c: Rewrote for Pango - uses a custom layout
renderer that handles GtkTextAppearance attributes.
* gtk/gtktexttag.[ch] gtk/gtktexttagprivate.h:
- Move the values in the style that don't affect geometry into a
GtkTextAppearance structure.
- Change underline to take a PangoUnderline and "font" a string
representation of a font description
- Add a "font_desc" attribute which takes a FontDescription structure.
* gtk/gtktextlayout.[ch]:
- Get rid of the display-line list per each line. Instead, we
generate, on demand, a GtkTextLineDisplay structure which]
contains a PangoLayout * and other necesary information
(offsets, cursor locations) for displaying a paragraph.
- Get rid of the code to wrap lines, create display chunks,
etc. Instead, we just go through a paragraph and convert
it into the necessary inputs to a PangoLayout.
- Implement a new attribute type, GtkTextAttrAppearance. This
holds a GtkTextAppearance, and is used to pass colors,
stipple, etc, through from the layout to the display without
having to use lots and lots of individual attributes.
- Reimplement gtk_layout_get_iter_at_pixel() gtk_layout_get_iter_pos()
in terms of PangoLayout functions.
* gtk/gtktextview.c:
- Handle passing the necessary PangoContext to the layout
- Some fixups in painting to deal with the automatic backing store
and offsetting of GTK+-1.4
- Add a style_set handler so that the default style reacts
properly to theme changes.
* gtk/gtktext?*.[ch]: Random code-style fixes.
* gtk/testtext.c: Substitute in languages that Pango handles now for Thai
Mon Apr 10 10:33:45 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktext?*.[ch]: Check in Havoc's port of the Tk text widget,
in original form preparatory to Pango-ization and gdkimcontext-ization.
Thu Apr 6 19:25:39 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimcontext.c: Move default implementations to real_* vfuncs,
so that we can derive from gtkimcontext in language bindings properly.
Thu Apr 6 16:02:52 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimcontextsimple.[ch]: Use gdk_keyval_to_unicode to gdk_unicode_to_keyval.
Add a compose table including (almost) all the compose combinations
from X. This is 6k of static, shared data as opposed to 50k or so of dynamic
data in the XIM implementation.
* gdk/gdk.h gdk/gdkkeyuni.c gdk/win32/gdkevents-win32.c (gdk_keyval_to_unicode, gdk_unicode_to_keyval):
Moved functions to convert keyvalues from and to unicode here from
the win32 port and made them public.
Wed Apr 5 16:37:29 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkeditable.c (gtk_editable_insert_text): Allow new_text_length == -1.
Wed Apr 5 16:27:45 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimcontext.[ch]: Base class for new input context system
* gtk/gtkimmulticontext.[ch]: Proxy input context that allows
the real input context implementation to be loaded from modules
and switched on the fly.
* gtk/gtkcontextsimple.[ch]: Simple implementation of an input
context that just does direct keysymbol => unicode translation.
* gtk/gtkentry.[ch]: Start switching editing over to using
GtkInputContext. (No handling of preedit yet.)
Wed Apr 5 15:48:41 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktypeutils.h (GTK_CHECK_GET_CLASS): Fix problem with one too
many substitutions. (klass should not be subsituted.)
Wed Apr 5 00:18:14 2000 Owen Taylor <otaylor@redhat.com>
* configure.in: Add checks for Pango
* configure.in docs/Makefile.am: Add test for sgml2html
and allow 'make dist' without building html, but print out
warnings in that case. (For making snapshots)
* gdk/Makefile.am gdk/x11/Makefile.am gtk/Makefile.am:
Add Pango libraries and C flags
* gdk/gdkdraw.c gdk/gdkdrawable.h gdkwindow.c gdk/x11/gdkdrawable-x11.c:
Add function (gdk_draw_layout) to draw a pango layout.
* gdk/gdkpango.h gdk/x11/gdkpango-x11.c: New file with functions
for getting Pango contexts for GDK.
* gtk/gtkeditable.c: Get rid of dead code gtk_editable_parent_set()
* gtk/gtkentry.[ch]: Complete rewrite to use Pango, add bidirectional
editing.
* gtk/gtkentry.c: Hack in simple Hebrew input with direct
keysym => unicode translations. More languages can be added
here, but real input-method support is needed.
* docs/Changes-1.4.txt: Added note about entry behavior.
* gtk/gtkenums.h gtk/gtkwidget.[ch] testgtk.c gtkprivate.h: Add functions
to set the reading direction for a widget and the global direction.
Add test which allows toggling the global direction. Two private
flags are used to store the direction. (GTK_DIRECTION_SET + GTK_DIRECTION_LTR)
* gtk/gtkcheckbutton.c gtk/gtkframe.c gtk/gtkhbbox.c gtk/gtkhbox.c
gtk/gtkradiobutton.c gtk/gtkspinbutton.c gtk/gtktable.c
* gtk/gtk[hv]scale.c gtk/gtkscale.[ch]: Draw numbers using Pango
* gtk/gtklabel.[ch]: Moved to Pango and considerably rewritten. Line breaking,
underlining now handled by Pango.
* gtk/gtkstyle.[ch] gtk/gtkrc.[ch]: Add a PangoFontDescription
to RCStyle and Style. (Having both this and the old font name and GdkFont
is temporary.)
* gtk/gtkwidget.[ch] (gtk_widget_create_pango_{context,layout}): Added
convenience functions for creating contexts and layouts for widgets.
* gtk/testgtk.c: Enhance label tests with multilingual labels.
2000-06-02 03:14:07 +00:00
|
|
|
|
pango_layout_set_text (layout, buffer, -1);
|
2000-07-02 21:32:56 +00:00
|
|
|
|
pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
|
Remove all references to offscreen flag which was no longer used.
Thu Jun 1 23:05:13 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Remove all references to
offscreen flag which was no longer used.
* gtk/gtkprivate.h (enum): Remove unused flags and compress.
* gtk/gtkframe.c (gtk_frame_set_label_widget): Check
for non-null label_widget->parent.
* gtk/gtkentry.c: Get rid of code to deal with PangoAttribute
which no longer was used.
* gdk/gdkpango.c (gdk_pango_context_get_info): make static.
* gdk/gdkpango.c (gdk_draw_layout[_line]): Add checks
for null arguments.
* gdk/x11/gdkgeometry-x11.c (gdk_window_scroll): add
check for destroyed windows.
Thu Jun 1 13:48:45 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimmulticontext.c: Add a finalize method and unref
the slave context there.
* gtk/gtkinvisible.[ch]: Make reference counting behavior
identical to GtkWindow.
Thu Jun 1 01:54:11 2000 Owen Taylor <otaylor@redhat.com>
* Makefile.am gdk/gdkpango.c: Copy the layout render function from
pangox to here, so we can write them independent of rendering
system, using GDK primitives.
* gdk/gdkdrawable.h gdk/gdkdraw.c gdk/gdkwindow.c
gdk/x11/gdkdrawable-x11.c: Remove draw_layout() from the vtable,
since we have a rendering-system independent implementation in
terms of draw_glyphs().
* gdk/gdkpango.c gdkdrawable.h (gdk_draw_layout_line): New
function to render a single line.
* gdk/x11/gdkpango.c: Move the guts of this file mostly
into ../gdkpango.c, which simplifies things, since we
don't have to deal with raw X gc's.
Fri May 19 04:28:16 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.[ch]: Add get_log_attrs() function to
get the logical attributes for a given GtkTextLine.
Tue May 30 16:05:39 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkfont-x11.c (gdk_font_charset_for_locale): Track
g_locale_get_codeset() to g_get_codeset() change.
Tue May 30 15:03:19 2000 Owen Taylor <otaylor@redhat.com>
* gtk/testcalendar.c (calendar_font_selection_ok): Use font
descriptions.
* gtk/gtkentry.c (gtk_entry_draw_text): Center text within
the entry.
* gtk/gtkfontsel.c (gtk_font_selection_dialog_init): Start of
redoing (vastly simplifying) for Pango. Still needs quite
a bit of work. (Size selection is currently poor. List of
predefined sizes is not a good idea, since all of these
sizes won't necessarily be distinct.)
Tue May 30 13:50:19 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkfont-x11.c (gdk_font_charset_for_locale): Handle
CODESET results for LANG=C.
Mon May 29 15:49:10 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.[ch]: Add a 'font_name' declaration to RC
which takes a stringized pango font description;
ignore the older 'font' and 'fontset' declarations.
* gtk/gtkstyle.c gtk/gtkrc.c: Fill in the style->font
field with a GdkFont derived via gdk_font_from_description(),
for compatibility. (Should we just remove it entirely?
Probably too much compatibility breakage, but people
should be migrating to the new Pango stuff as quickly
as possible.)
Mon May 29 15:47:41 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c gtk/gtkclist.c: s/pango_font_unref/g_object_unref/.
Mon May 29 15:44:46 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcalender.c: Roughly pango-ized. Really needs
redoing; there are some bugs in size allocation right
now, the semi-existant distinction between header / day
fonts was removed, but, with Pango, could actually
be made functional in a nice way.
* gtk/testcalender: Move calender from examples into this
directory as a test program. (We really need to restrcture
testgtk into a whole directory full of tests for every
widget or functionality group, separated into multiple .c
files.)
Mon May 29 15:19:56 2000 Owen Taylor <otaylor@redhat.com>
* gtk/testgtk.c (file_exists): Fix stupid typo that
was keeping RC file from being loaded.
* gtk/testgtkrc gtk/testgtkrc2: Test new pango-ized
RC file font code.
Mon May 29 14:31:27 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkfont.h gdk/x11/gdkfont-x11.c (gdk_font_from_description):
Add function to load a GdkFont from a PangoFontDescription.
Fri May 26 17:16:40 2000 Owen Taylor <otaylor@redhat.com>
* gtk/frame.[ch] gtkaspectframe.c: Make frame widgets able
to have any widget for the label, use a GtkLabel widget
to display the text. (Based partially on a patch from
Anders Carlson.)
(Quite a bit of code reorganization - strip 90% of the
guts out of gtkaspectframe and add a single virtual
func to GtkFrameClass - compute_child_allocation.)
Fri May 26 12:00:02 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkctree.c gtk/gtkclist.[ch]: Pangoized.
(Removed clist->row_center_offset field because caching
it wasn't saving time or code, added private function
_gtk_clist_create_cell_layout()).
Wed May 24 15:59:37 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkaccellabel.c: Pangoized.
* gtk/[hv]ruler.c: Pangoized
Mon May 22 19:23:59 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c (gtk_file_selection_init):
Use gtk_clist_set_column_auto_resize() to remove need
need for manual column width computations.
Mon May 22 18:50:26 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktooltips.[ch]: Replace custom drawing with a GtkLabel,
ensuring Pango correctness, and considerably simplifying the
code.
* gtk/gtklabel.c gtk[hv]scale.c: 1000 => PANGO_SCALE.
* gtk/gtklabel.c (gtk_label_size_request): Fixed incorrect
getting of numbers of lines.
* gtk/gtklabel.c (gtk_label_size_request): Set the requisition
to the actual requested width of the lable, not to the wrap
width we set.
* gtk/gtktextchild.h: Remove extraneous include of gtk/gtk.h.
* gtk/gtktextbtree.c gtk/gtktextbuffer.c gtk/gtktextlayout.c
gtk/gtktextview.c gtk/gtktextview.[ch]: Fix up includes.
* gtk/gtktextview.c: Fix structure inheritance.
* gtk/gtkprogressbar.c: Pangoize.
Mon May 22 15:47:30 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextview.c (gtk_text_view_get_first_para_iter): Encapsulate
in a function.
* gtk/gtktextlayout.c (find_display_line_above): Fixed
bug with computing line tops.
* gtk/gtktextview.c (changed_handler): Fix < , <= confusion.
Thu May 18 18:53:31 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextdisplay.c (gtk_text_layout_draw): Fix up the x_offset
and y_offset coordinates to do what we need now. (The offset between
buffer and layout coordinates has been reintroduced, but is a
bit different than before.)
* gtk/gtktextview.[ch]: No longer inherit from GtkLayout; instead
handle the adjustments ourselves, and scroll as necessary using
the new gdk_window_scroll().
The advantage of this is that when we are incrementally revalidating,
we are essentially rearranging things around the visible portion
of the screen. With the old setup, the visible portion of the
screen was moved around in the layout, so scrolling and redrawing
to track that caused jumping of the display. Since we now
control the scrolling ourselves, we can suppress this and
only redraw when things actually change.
Thu May 18 18:47:25 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextbtree.c (redisplay_mark): We need to invalidate
the region not just redisplay it after-all, since we store the
cursors in the LineDisplay. (Ugly interactions here between
GtkLayout and GtkTextBTree here.)
* gtk/gtktextbtree.c (redisplay_region): Fixed reversed comparison.
Thu May 18 18:43:21 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.h gdk/x11/gdkgeometry-x11.c (gdk_window_scroll):
Added function to scroll contents of a window while keeping the
window constant. Works by XCopyArea or guffaw-scrolling depending
on the details of how the window is set up. (guffaw-scrolling
still needs to be filled in.)
Wed May 17 22:36:53 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextiter.c gtk/gtkmain.c: Add a debug key for the text widget,
move the debugging that was tied to a global variable
to that.
* gtk/gtkmarshal.list: Add NONE:INT,INT,INT
* gtk/gtktextbtree.[ch] gtk/gtktextlayout.c: Keep a separate
validated flag, in line data instead of setting height/width to
-1. This allows us to perform operations with partially invalid
buffer (using the old size for invalid lines) and thus to do
incremental vaidation. Keep height/width aggregates up to date
when deleting text and rebalancing the tree.
* gtk/gtktextbtree.[ch]: Add functions validate a line
(gtk_text_btree_validate_line), and to validate up
to a number of pixels (gtk_text_btree_validate).
* gtk/gtktextlayout.[ch]: Add an ::invalidated signal
that indicates that something is changed and a revalidation
pass is needed. Change ::need_repaint to ::changed, and
make it take old and new yranges instead of a rectangle.
* gtk/gtktextbtree.[ch] gtk/gtktextlayout.[ch]: Move
the line_data_destroy() function from
gtk_text_btree_add_view() to a virtual function in
GtkTextLayout
* gtk/gtktextbtree.[ch]: Remove gtk_text_btree_get_damage_range(),
since we are handling partial repaints in a different fashion
now.
* gtk/gtktextbtree.[ch]: Only repaint the changed portion
of the selection instead of queueing a repaint on the
entire widget.
* gtk/gtktextbuffer.[ch] gtk/gtktextbtree.[ch]: Move
get_selection_bounds() down to btree, make the function
in buffer a wrapper around the btree function.
* gtk/gtktextlayout.[ch]: Add functions to check if the
layout is valid and to recompute either a range of pixels
aroudn a line or a certain total number of pixels.
* gtk/gtktextlayout.[ch]: Cache a single line display;
now that we only redraw the needed portions, the hit rate
for this cache is quite high.
* gtk/gtktextview.[ch]: Keep track of the first paragraph
on the screen so that when re-laying-out the buffer, we can
keep the same place. This requires connecting to ::value_changed
on the adjustments
* gtk/gtktextview.[ch]: Add idle functions to revalidate
the buffer after we receive an ::invalidated signal.
Wed May 17 22:10:47 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.c (gtk_layout_size_allocate): Set upper
to max of allocation and layout size, not just to the
layout size.
* gtk/gtk[hv]scrollbar.c (gtk_[hv]scrollbar_calc_slider_size):
Invalidate window so it gets redrawn properly.
* gdk/gdkwindow.c (gdk_window_invalidate_rect): Allow rect == NULL
to mean the entire window.
* gdk/gdkevents.h: Move definition for GDK_PRIORITY_REDRAW
into public header.
Mon May 15 14:51:31 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextmark.c (gtk_text_mark_get_name): Add function
to get the name of a mark.
* gtk/gtktextlayout.c (gtk_text_layout_get_line_at_y): Add a function
to find the paragraph from a y position.
Thu May 11 12:57:20 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextbtree.c (gtk_text_btree_node_invalidate_upward): Valid
nodes have width/height >= 0, not > 0.
Tue May 9 21:29:06 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.[ch] gtk/gtktextdisplay.c (gtk_text_layout_get_line_display):
Add a size_only flag, so when we only need the size, we don't create
useless appearance attributes.
* gtk/gtktextview.c (gtk_text_view_ensure_layout): Remove
duplicate setting of font description.
* gtk/gtkscale.c: Use PANGO_SCALE instead of 1000
Wed Apr 26 01:53:23 2000 Owen Taylor <otaylor@redhat.com>
* gtk/Makefile.am (EXTRA_DIST): Add OLD_STAMP into
EXTRA_DIST. It does not work well when the file that
everything depends on is not in the tarball.
Wed Apr 26 00:56:14 2000 Owen Taylor <otaylor@redhat.com>
* gtk/testgtk.c: Some hacks and fixes so that it basically
works when not sitting in the GTK+ build tree.
2000-05-03 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (gtk_text_line_next_could_contain_tag):
Properly determine the ordering of the tag root and the current
line within the tree. Previous algorithm only worked if the tag
root's immediate parent was the common root of both the current
line and the tag root.
Wed Apr 26 00:43:00 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.c (set_para_values): Fix some bugs in
alignment.
* gtk/gtktextview.c (gtk_text_view_ensure_layout): Track
the widget text directional dynamically.
* gtk/gtktextview.[ch]: Added functions to get and set default
wrap mode.
Tue Apr 25 23:47:38 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.c (gtk_text_layout_get_iter_location): Fix bug
in cursor location computation.
Tue Apr 25 23:22:59 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.c (gtk_layout_set_size): Clamp hadjustment/
vadjusment values properly when layout gets smaller.
* gtk/gtktextview.c (need_repaint_handler): Areas being
passed in are far completely inaccurate, and sometimes
too small, so, for now, just queue a redraw on the
whole visible region.
2000-04-25 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (summary_destroy): new function to
destroy tag summary nodes
(gtk_text_line_next_could_contain_tag): this function was
totally broken if the line passed in wasn't below the tag
root. Fix it.
(gtk_text_btree_first_could_contain_tag): In the tag == NULL
"wildcard" case, we have to do a linear scan. Blah.
(gtk_text_btree_last_could_contain_tag): In tag == NULL case,
we have to do the linear scan
(tag_removed_cb): When a tag is removed from the tag table,
remove the GtkTextTagInfo node from the btree.
(gtk_text_btree_spew): Implement the spew function, for
our debugging pleasure.
Tue Apr 25 19:40:18 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.c (gtk_text_layout_set_buffer): Fix
a problem with referring to the wrong buffer.
* gtk/gtkentry.c: Fix focus-in/focus-out confusion.
* gtk/gtkrc.c gtk/gtkstyle.c: Moving setting default
font description to gtk_style_new() - otherwise things
don't work without a .gtkrc file.
* gtk/gtktextbuffer.c (gtk_text_buffer_new): Sink the
tags table if we create it ourself, too.
* gdk/gdktypes.h (enum): Move GDK_RELEASE_MASK, since
it was conflicting with XKB modifiers.
* gtk/gtktextview.[ch]: Add simple support for
GtkIMContext.
Mon Apr 24 19:34:18 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_move_cursor_visually): Fix problem
with deletion from last commit.
Mon Apr 24 19:29:40 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_create_pango_context): Set the language
in the context from the current locale.
* gtk/gtkentry.c (gtk_entry_size_request): Use language from the
context, not hardcoded value.
* gtk/gtkentry.c (gtk_entry_move_cursor): Make character movement visual,
not logical.
Sun Apr 23 23:39:18 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c gtk/gtktextdisplay.c: Don't handle selections as
attributes - that doesn't handle partial-glyph selection
properly. Instead use new pango_layout_line_get_x_ranges()
functionality to draw the selection.
* gtk/gtkentry.c: Simplify code since pango_layout_line_index_to_x()
now properly handles out-of-range coordinates.
* gtk/gtktextbuffer.c: Emit "mark_set" when the cursor is moved.
* gtk/gtktextiter.h gtk/gtktextiterprivate.h: Make gtk_text_iter_get_line_byte()
public.
* gtk/gtktextlayout.[ch]: Properly set the direction in the PangoContext
for paragraphs opposite to the base direction of the widget.
* gtk/gtktextlayout.[ch] gtk/gtktextdisplay.c: Fixes for alignment.
* gtk/gtktextlayout.c: Don't split segments on marks, since that
causes Arabic words to reshape as you cursor through.
* gtk/gtktextlayout.[ch] gtk/gtktextview.[ch]: Implement virtual
cursor position when moving vertically with the arrow keys and
scrolling with page-up/page-down. (Arrow keys save only the X,
scrolling saves both X and Y.)
This means you can line-up / line-down or page-up / page-down
without losing your place, and also that moving vertically
with the cursor keys keeps the same X position, not the same
character count:
* gtk/gtktextlayout.[ch] gtk/gtktextview.[ch]: Make vertical
arrow keys move by display lines, not paragraphs.
Tue Apr 18 14:16:50 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.c: Make sure that the bin window is at least
as big as the allocation. (Should we also make sure that the
bin window is big enough to completely cover widget->window?)
* gtk/gtktextview.c (gtk_text_view_get_visible_rect): Add
function to get the onscreen rectangle.
* gdk/x11/gdkwindow-x11.c (gdk_window_get_pointer): Correctly account
for offsets in window coordinates.
Sun Apr 16 16:13:27 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_get_cursor_locations): Fix index/offset
confusion.
* gtk/gtktextview.c (gtk_text_view_ensure_layout): Set the default direction
from the widget direction.
* gtk/gtktexttag.c gtk/gtktexttagprivate.h (gtk_text_tag_set_arg):
Add a "direction" attribute.
* gtk/gtktextview.c: global s/tkxt/text_view/.
* gtk/testtext.c: Added long block of text in Arabic, to test out
the direction attributes. (Some problems with the shaping system
for arabic become obvious - like the fact the cursor splits words
into unjoined pieces.)
Fri Apr 14 12:54:34 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextdisplay.c (render_layout): Add overstrike handling.
* gtk/gtktextlayout.c: Fix up alignment.
* gtk/testtext.c: Add some tests for centering, wrapping.
Fri Apr 14 09:26:22 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkdrawable.h gdk/gdkdraw.c gdk/gdkwindow.c gdk/x11/gdkdrawable-x11.c:
Add a draw_glyphs() operation to the drawable vtable and gdk_draw_glyphs().
If we wrote GTK+-specific layout-render function this could just replace
the draw_layout() operation in the vtable.
* gtk/gtkentry.c: Move guts of gtk_entry_get_cursor_locations to
pango_layout_get_cursor_pos() and use that function.
* gtk/gtktextchild.[ch]: add gtk_ onto pixmap_segment_new(), since it
is a non-static symbol.
* gtk/gtktextbtree.[ch]: Replace gtk_text_btree_find_line_data_by_y()
with gtk_text_btree_find_line_by_y()
* gtk/gtktextdisplay.c: Rewrote for Pango - uses a custom layout
renderer that handles GtkTextAppearance attributes.
* gtk/gtktexttag.[ch] gtk/gtktexttagprivate.h:
- Move the values in the style that don't affect geometry into a
GtkTextAppearance structure.
- Change underline to take a PangoUnderline and "font" a string
representation of a font description
- Add a "font_desc" attribute which takes a FontDescription structure.
* gtk/gtktextlayout.[ch]:
- Get rid of the display-line list per each line. Instead, we
generate, on demand, a GtkTextLineDisplay structure which]
contains a PangoLayout * and other necesary information
(offsets, cursor locations) for displaying a paragraph.
- Get rid of the code to wrap lines, create display chunks,
etc. Instead, we just go through a paragraph and convert
it into the necessary inputs to a PangoLayout.
- Implement a new attribute type, GtkTextAttrAppearance. This
holds a GtkTextAppearance, and is used to pass colors,
stipple, etc, through from the layout to the display without
having to use lots and lots of individual attributes.
- Reimplement gtk_layout_get_iter_at_pixel() gtk_layout_get_iter_pos()
in terms of PangoLayout functions.
* gtk/gtktextview.c:
- Handle passing the necessary PangoContext to the layout
- Some fixups in painting to deal with the automatic backing store
and offsetting of GTK+-1.4
- Add a style_set handler so that the default style reacts
properly to theme changes.
* gtk/gtktext?*.[ch]: Random code-style fixes.
* gtk/testtext.c: Substitute in languages that Pango handles now for Thai
Mon Apr 10 10:33:45 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktext?*.[ch]: Check in Havoc's port of the Tk text widget,
in original form preparatory to Pango-ization and gdkimcontext-ization.
Thu Apr 6 19:25:39 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimcontext.c: Move default implementations to real_* vfuncs,
so that we can derive from gtkimcontext in language bindings properly.
Thu Apr 6 16:02:52 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimcontextsimple.[ch]: Use gdk_keyval_to_unicode to gdk_unicode_to_keyval.
Add a compose table including (almost) all the compose combinations
from X. This is 6k of static, shared data as opposed to 50k or so of dynamic
data in the XIM implementation.
* gdk/gdk.h gdk/gdkkeyuni.c gdk/win32/gdkevents-win32.c (gdk_keyval_to_unicode, gdk_unicode_to_keyval):
Moved functions to convert keyvalues from and to unicode here from
the win32 port and made them public.
Wed Apr 5 16:37:29 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkeditable.c (gtk_editable_insert_text): Allow new_text_length == -1.
Wed Apr 5 16:27:45 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimcontext.[ch]: Base class for new input context system
* gtk/gtkimmulticontext.[ch]: Proxy input context that allows
the real input context implementation to be loaded from modules
and switched on the fly.
* gtk/gtkcontextsimple.[ch]: Simple implementation of an input
context that just does direct keysymbol => unicode translation.
* gtk/gtkentry.[ch]: Start switching editing over to using
GtkInputContext. (No handling of preedit yet.)
Wed Apr 5 15:48:41 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktypeutils.h (GTK_CHECK_GET_CLASS): Fix problem with one too
many substitutions. (klass should not be subsituted.)
Wed Apr 5 00:18:14 2000 Owen Taylor <otaylor@redhat.com>
* configure.in: Add checks for Pango
* configure.in docs/Makefile.am: Add test for sgml2html
and allow 'make dist' without building html, but print out
warnings in that case. (For making snapshots)
* gdk/Makefile.am gdk/x11/Makefile.am gtk/Makefile.am:
Add Pango libraries and C flags
* gdk/gdkdraw.c gdk/gdkdrawable.h gdkwindow.c gdk/x11/gdkdrawable-x11.c:
Add function (gdk_draw_layout) to draw a pango layout.
* gdk/gdkpango.h gdk/x11/gdkpango-x11.c: New file with functions
for getting Pango contexts for GDK.
* gtk/gtkeditable.c: Get rid of dead code gtk_editable_parent_set()
* gtk/gtkentry.[ch]: Complete rewrite to use Pango, add bidirectional
editing.
* gtk/gtkentry.c: Hack in simple Hebrew input with direct
keysym => unicode translations. More languages can be added
here, but real input-method support is needed.
* docs/Changes-1.4.txt: Added note about entry behavior.
* gtk/gtkenums.h gtk/gtkwidget.[ch] testgtk.c gtkprivate.h: Add functions
to set the reading direction for a widget and the global direction.
Add test which allows toggling the global direction. Two private
flags are used to store the direction. (GTK_DIRECTION_SET + GTK_DIRECTION_LTR)
* gtk/gtkcheckbutton.c gtk/gtkframe.c gtk/gtkhbbox.c gtk/gtkhbox.c
gtk/gtkradiobutton.c gtk/gtkspinbutton.c gtk/gtktable.c
* gtk/gtk[hv]scale.c gtk/gtkscale.[ch]: Draw numbers using Pango
* gtk/gtklabel.[ch]: Moved to Pango and considerably rewritten. Line breaking,
underlining now handled by Pango.
* gtk/gtkstyle.[ch] gtk/gtkrc.[ch]: Add a PangoFontDescription
to RCStyle and Style. (Having both this and the old font name and GdkFont
is temporary.)
* gtk/gtkwidget.[ch] (gtk_widget_create_pango_{context,layout}): Added
convenience functions for creating contexts and layouts for widgets.
* gtk/testgtk.c: Enhance label tests with multilingual labels.
2000-06-02 03:14:07 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
y_loc = calendar_top_y_for_row (calendar, row) + (day_height - logical_rect.height) / 2;
|
Remove all references to offscreen flag which was no longer used.
Thu Jun 1 23:05:13 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Remove all references to
offscreen flag which was no longer used.
* gtk/gtkprivate.h (enum): Remove unused flags and compress.
* gtk/gtkframe.c (gtk_frame_set_label_widget): Check
for non-null label_widget->parent.
* gtk/gtkentry.c: Get rid of code to deal with PangoAttribute
which no longer was used.
* gdk/gdkpango.c (gdk_pango_context_get_info): make static.
* gdk/gdkpango.c (gdk_draw_layout[_line]): Add checks
for null arguments.
* gdk/x11/gdkgeometry-x11.c (gdk_window_scroll): add
check for destroyed windows.
Thu Jun 1 13:48:45 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimmulticontext.c: Add a finalize method and unref
the slave context there.
* gtk/gtkinvisible.[ch]: Make reference counting behavior
identical to GtkWindow.
Thu Jun 1 01:54:11 2000 Owen Taylor <otaylor@redhat.com>
* Makefile.am gdk/gdkpango.c: Copy the layout render function from
pangox to here, so we can write them independent of rendering
system, using GDK primitives.
* gdk/gdkdrawable.h gdk/gdkdraw.c gdk/gdkwindow.c
gdk/x11/gdkdrawable-x11.c: Remove draw_layout() from the vtable,
since we have a rendering-system independent implementation in
terms of draw_glyphs().
* gdk/gdkpango.c gdkdrawable.h (gdk_draw_layout_line): New
function to render a single line.
* gdk/x11/gdkpango.c: Move the guts of this file mostly
into ../gdkpango.c, which simplifies things, since we
don't have to deal with raw X gc's.
Fri May 19 04:28:16 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.[ch]: Add get_log_attrs() function to
get the logical attributes for a given GtkTextLine.
Tue May 30 16:05:39 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkfont-x11.c (gdk_font_charset_for_locale): Track
g_locale_get_codeset() to g_get_codeset() change.
Tue May 30 15:03:19 2000 Owen Taylor <otaylor@redhat.com>
* gtk/testcalendar.c (calendar_font_selection_ok): Use font
descriptions.
* gtk/gtkentry.c (gtk_entry_draw_text): Center text within
the entry.
* gtk/gtkfontsel.c (gtk_font_selection_dialog_init): Start of
redoing (vastly simplifying) for Pango. Still needs quite
a bit of work. (Size selection is currently poor. List of
predefined sizes is not a good idea, since all of these
sizes won't necessarily be distinct.)
Tue May 30 13:50:19 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkfont-x11.c (gdk_font_charset_for_locale): Handle
CODESET results for LANG=C.
Mon May 29 15:49:10 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.[ch]: Add a 'font_name' declaration to RC
which takes a stringized pango font description;
ignore the older 'font' and 'fontset' declarations.
* gtk/gtkstyle.c gtk/gtkrc.c: Fill in the style->font
field with a GdkFont derived via gdk_font_from_description(),
for compatibility. (Should we just remove it entirely?
Probably too much compatibility breakage, but people
should be migrating to the new Pango stuff as quickly
as possible.)
Mon May 29 15:47:41 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c gtk/gtkclist.c: s/pango_font_unref/g_object_unref/.
Mon May 29 15:44:46 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcalender.c: Roughly pango-ized. Really needs
redoing; there are some bugs in size allocation right
now, the semi-existant distinction between header / day
fonts was removed, but, with Pango, could actually
be made functional in a nice way.
* gtk/testcalender: Move calender from examples into this
directory as a test program. (We really need to restrcture
testgtk into a whole directory full of tests for every
widget or functionality group, separated into multiple .c
files.)
Mon May 29 15:19:56 2000 Owen Taylor <otaylor@redhat.com>
* gtk/testgtk.c (file_exists): Fix stupid typo that
was keeping RC file from being loaded.
* gtk/testgtkrc gtk/testgtkrc2: Test new pango-ized
RC file font code.
Mon May 29 14:31:27 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkfont.h gdk/x11/gdkfont-x11.c (gdk_font_from_description):
Add function to load a GdkFont from a PangoFontDescription.
Fri May 26 17:16:40 2000 Owen Taylor <otaylor@redhat.com>
* gtk/frame.[ch] gtkaspectframe.c: Make frame widgets able
to have any widget for the label, use a GtkLabel widget
to display the text. (Based partially on a patch from
Anders Carlson.)
(Quite a bit of code reorganization - strip 90% of the
guts out of gtkaspectframe and add a single virtual
func to GtkFrameClass - compute_child_allocation.)
Fri May 26 12:00:02 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkctree.c gtk/gtkclist.[ch]: Pangoized.
(Removed clist->row_center_offset field because caching
it wasn't saving time or code, added private function
_gtk_clist_create_cell_layout()).
Wed May 24 15:59:37 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkaccellabel.c: Pangoized.
* gtk/[hv]ruler.c: Pangoized
Mon May 22 19:23:59 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c (gtk_file_selection_init):
Use gtk_clist_set_column_auto_resize() to remove need
need for manual column width computations.
Mon May 22 18:50:26 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktooltips.[ch]: Replace custom drawing with a GtkLabel,
ensuring Pango correctness, and considerably simplifying the
code.
* gtk/gtklabel.c gtk[hv]scale.c: 1000 => PANGO_SCALE.
* gtk/gtklabel.c (gtk_label_size_request): Fixed incorrect
getting of numbers of lines.
* gtk/gtklabel.c (gtk_label_size_request): Set the requisition
to the actual requested width of the lable, not to the wrap
width we set.
* gtk/gtktextchild.h: Remove extraneous include of gtk/gtk.h.
* gtk/gtktextbtree.c gtk/gtktextbuffer.c gtk/gtktextlayout.c
gtk/gtktextview.c gtk/gtktextview.[ch]: Fix up includes.
* gtk/gtktextview.c: Fix structure inheritance.
* gtk/gtkprogressbar.c: Pangoize.
Mon May 22 15:47:30 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextview.c (gtk_text_view_get_first_para_iter): Encapsulate
in a function.
* gtk/gtktextlayout.c (find_display_line_above): Fixed
bug with computing line tops.
* gtk/gtktextview.c (changed_handler): Fix < , <= confusion.
Thu May 18 18:53:31 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextdisplay.c (gtk_text_layout_draw): Fix up the x_offset
and y_offset coordinates to do what we need now. (The offset between
buffer and layout coordinates has been reintroduced, but is a
bit different than before.)
* gtk/gtktextview.[ch]: No longer inherit from GtkLayout; instead
handle the adjustments ourselves, and scroll as necessary using
the new gdk_window_scroll().
The advantage of this is that when we are incrementally revalidating,
we are essentially rearranging things around the visible portion
of the screen. With the old setup, the visible portion of the
screen was moved around in the layout, so scrolling and redrawing
to track that caused jumping of the display. Since we now
control the scrolling ourselves, we can suppress this and
only redraw when things actually change.
Thu May 18 18:47:25 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextbtree.c (redisplay_mark): We need to invalidate
the region not just redisplay it after-all, since we store the
cursors in the LineDisplay. (Ugly interactions here between
GtkLayout and GtkTextBTree here.)
* gtk/gtktextbtree.c (redisplay_region): Fixed reversed comparison.
Thu May 18 18:43:21 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.h gdk/x11/gdkgeometry-x11.c (gdk_window_scroll):
Added function to scroll contents of a window while keeping the
window constant. Works by XCopyArea or guffaw-scrolling depending
on the details of how the window is set up. (guffaw-scrolling
still needs to be filled in.)
Wed May 17 22:36:53 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextiter.c gtk/gtkmain.c: Add a debug key for the text widget,
move the debugging that was tied to a global variable
to that.
* gtk/gtkmarshal.list: Add NONE:INT,INT,INT
* gtk/gtktextbtree.[ch] gtk/gtktextlayout.c: Keep a separate
validated flag, in line data instead of setting height/width to
-1. This allows us to perform operations with partially invalid
buffer (using the old size for invalid lines) and thus to do
incremental vaidation. Keep height/width aggregates up to date
when deleting text and rebalancing the tree.
* gtk/gtktextbtree.[ch]: Add functions validate a line
(gtk_text_btree_validate_line), and to validate up
to a number of pixels (gtk_text_btree_validate).
* gtk/gtktextlayout.[ch]: Add an ::invalidated signal
that indicates that something is changed and a revalidation
pass is needed. Change ::need_repaint to ::changed, and
make it take old and new yranges instead of a rectangle.
* gtk/gtktextbtree.[ch] gtk/gtktextlayout.[ch]: Move
the line_data_destroy() function from
gtk_text_btree_add_view() to a virtual function in
GtkTextLayout
* gtk/gtktextbtree.[ch]: Remove gtk_text_btree_get_damage_range(),
since we are handling partial repaints in a different fashion
now.
* gtk/gtktextbtree.[ch]: Only repaint the changed portion
of the selection instead of queueing a repaint on the
entire widget.
* gtk/gtktextbuffer.[ch] gtk/gtktextbtree.[ch]: Move
get_selection_bounds() down to btree, make the function
in buffer a wrapper around the btree function.
* gtk/gtktextlayout.[ch]: Add functions to check if the
layout is valid and to recompute either a range of pixels
aroudn a line or a certain total number of pixels.
* gtk/gtktextlayout.[ch]: Cache a single line display;
now that we only redraw the needed portions, the hit rate
for this cache is quite high.
* gtk/gtktextview.[ch]: Keep track of the first paragraph
on the screen so that when re-laying-out the buffer, we can
keep the same place. This requires connecting to ::value_changed
on the adjustments
* gtk/gtktextview.[ch]: Add idle functions to revalidate
the buffer after we receive an ::invalidated signal.
Wed May 17 22:10:47 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.c (gtk_layout_size_allocate): Set upper
to max of allocation and layout size, not just to the
layout size.
* gtk/gtk[hv]scrollbar.c (gtk_[hv]scrollbar_calc_slider_size):
Invalidate window so it gets redrawn properly.
* gdk/gdkwindow.c (gdk_window_invalidate_rect): Allow rect == NULL
to mean the entire window.
* gdk/gdkevents.h: Move definition for GDK_PRIORITY_REDRAW
into public header.
Mon May 15 14:51:31 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextmark.c (gtk_text_mark_get_name): Add function
to get the name of a mark.
* gtk/gtktextlayout.c (gtk_text_layout_get_line_at_y): Add a function
to find the paragraph from a y position.
Thu May 11 12:57:20 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextbtree.c (gtk_text_btree_node_invalidate_upward): Valid
nodes have width/height >= 0, not > 0.
Tue May 9 21:29:06 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.[ch] gtk/gtktextdisplay.c (gtk_text_layout_get_line_display):
Add a size_only flag, so when we only need the size, we don't create
useless appearance attributes.
* gtk/gtktextview.c (gtk_text_view_ensure_layout): Remove
duplicate setting of font description.
* gtk/gtkscale.c: Use PANGO_SCALE instead of 1000
Wed Apr 26 01:53:23 2000 Owen Taylor <otaylor@redhat.com>
* gtk/Makefile.am (EXTRA_DIST): Add OLD_STAMP into
EXTRA_DIST. It does not work well when the file that
everything depends on is not in the tarball.
Wed Apr 26 00:56:14 2000 Owen Taylor <otaylor@redhat.com>
* gtk/testgtk.c: Some hacks and fixes so that it basically
works when not sitting in the GTK+ build tree.
2000-05-03 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (gtk_text_line_next_could_contain_tag):
Properly determine the ordering of the tag root and the current
line within the tree. Previous algorithm only worked if the tag
root's immediate parent was the common root of both the current
line and the tag root.
Wed Apr 26 00:43:00 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.c (set_para_values): Fix some bugs in
alignment.
* gtk/gtktextview.c (gtk_text_view_ensure_layout): Track
the widget text directional dynamically.
* gtk/gtktextview.[ch]: Added functions to get and set default
wrap mode.
Tue Apr 25 23:47:38 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.c (gtk_text_layout_get_iter_location): Fix bug
in cursor location computation.
Tue Apr 25 23:22:59 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.c (gtk_layout_set_size): Clamp hadjustment/
vadjusment values properly when layout gets smaller.
* gtk/gtktextview.c (need_repaint_handler): Areas being
passed in are far completely inaccurate, and sometimes
too small, so, for now, just queue a redraw on the
whole visible region.
2000-04-25 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (summary_destroy): new function to
destroy tag summary nodes
(gtk_text_line_next_could_contain_tag): this function was
totally broken if the line passed in wasn't below the tag
root. Fix it.
(gtk_text_btree_first_could_contain_tag): In the tag == NULL
"wildcard" case, we have to do a linear scan. Blah.
(gtk_text_btree_last_could_contain_tag): In tag == NULL case,
we have to do the linear scan
(tag_removed_cb): When a tag is removed from the tag table,
remove the GtkTextTagInfo node from the btree.
(gtk_text_btree_spew): Implement the spew function, for
our debugging pleasure.
Tue Apr 25 19:40:18 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.c (gtk_text_layout_set_buffer): Fix
a problem with referring to the wrong buffer.
* gtk/gtkentry.c: Fix focus-in/focus-out confusion.
* gtk/gtkrc.c gtk/gtkstyle.c: Moving setting default
font description to gtk_style_new() - otherwise things
don't work without a .gtkrc file.
* gtk/gtktextbuffer.c (gtk_text_buffer_new): Sink the
tags table if we create it ourself, too.
* gdk/gdktypes.h (enum): Move GDK_RELEASE_MASK, since
it was conflicting with XKB modifiers.
* gtk/gtktextview.[ch]: Add simple support for
GtkIMContext.
Mon Apr 24 19:34:18 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_move_cursor_visually): Fix problem
with deletion from last commit.
Mon Apr 24 19:29:40 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_create_pango_context): Set the language
in the context from the current locale.
* gtk/gtkentry.c (gtk_entry_size_request): Use language from the
context, not hardcoded value.
* gtk/gtkentry.c (gtk_entry_move_cursor): Make character movement visual,
not logical.
Sun Apr 23 23:39:18 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c gtk/gtktextdisplay.c: Don't handle selections as
attributes - that doesn't handle partial-glyph selection
properly. Instead use new pango_layout_line_get_x_ranges()
functionality to draw the selection.
* gtk/gtkentry.c: Simplify code since pango_layout_line_index_to_x()
now properly handles out-of-range coordinates.
* gtk/gtktextbuffer.c: Emit "mark_set" when the cursor is moved.
* gtk/gtktextiter.h gtk/gtktextiterprivate.h: Make gtk_text_iter_get_line_byte()
public.
* gtk/gtktextlayout.[ch]: Properly set the direction in the PangoContext
for paragraphs opposite to the base direction of the widget.
* gtk/gtktextlayout.[ch] gtk/gtktextdisplay.c: Fixes for alignment.
* gtk/gtktextlayout.c: Don't split segments on marks, since that
causes Arabic words to reshape as you cursor through.
* gtk/gtktextlayout.[ch] gtk/gtktextview.[ch]: Implement virtual
cursor position when moving vertically with the arrow keys and
scrolling with page-up/page-down. (Arrow keys save only the X,
scrolling saves both X and Y.)
This means you can line-up / line-down or page-up / page-down
without losing your place, and also that moving vertically
with the cursor keys keeps the same X position, not the same
character count:
* gtk/gtktextlayout.[ch] gtk/gtktextview.[ch]: Make vertical
arrow keys move by display lines, not paragraphs.
Tue Apr 18 14:16:50 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.c: Make sure that the bin window is at least
as big as the allocation. (Should we also make sure that the
bin window is big enough to completely cover widget->window?)
* gtk/gtktextview.c (gtk_text_view_get_visible_rect): Add
function to get the onscreen rectangle.
* gdk/x11/gdkwindow-x11.c (gdk_window_get_pointer): Correctly account
for offsets in window coordinates.
Sun Apr 16 16:13:27 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_get_cursor_locations): Fix index/offset
confusion.
* gtk/gtktextview.c (gtk_text_view_ensure_layout): Set the default direction
from the widget direction.
* gtk/gtktexttag.c gtk/gtktexttagprivate.h (gtk_text_tag_set_arg):
Add a "direction" attribute.
* gtk/gtktextview.c: global s/tkxt/text_view/.
* gtk/testtext.c: Added long block of text in Arabic, to test out
the direction attributes. (Some problems with the shaping system
for arabic become obvious - like the fact the cursor splits words
into unjoined pieces.)
Fri Apr 14 12:54:34 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextdisplay.c (render_layout): Add overstrike handling.
* gtk/gtktextlayout.c: Fix up alignment.
* gtk/testtext.c: Add some tests for centering, wrapping.
Fri Apr 14 09:26:22 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkdrawable.h gdk/gdkdraw.c gdk/gdkwindow.c gdk/x11/gdkdrawable-x11.c:
Add a draw_glyphs() operation to the drawable vtable and gdk_draw_glyphs().
If we wrote GTK+-specific layout-render function this could just replace
the draw_layout() operation in the vtable.
* gtk/gtkentry.c: Move guts of gtk_entry_get_cursor_locations to
pango_layout_get_cursor_pos() and use that function.
* gtk/gtktextchild.[ch]: add gtk_ onto pixmap_segment_new(), since it
is a non-static symbol.
* gtk/gtktextbtree.[ch]: Replace gtk_text_btree_find_line_data_by_y()
with gtk_text_btree_find_line_by_y()
* gtk/gtktextdisplay.c: Rewrote for Pango - uses a custom layout
renderer that handles GtkTextAppearance attributes.
* gtk/gtktexttag.[ch] gtk/gtktexttagprivate.h:
- Move the values in the style that don't affect geometry into a
GtkTextAppearance structure.
- Change underline to take a PangoUnderline and "font" a string
representation of a font description
- Add a "font_desc" attribute which takes a FontDescription structure.
* gtk/gtktextlayout.[ch]:
- Get rid of the display-line list per each line. Instead, we
generate, on demand, a GtkTextLineDisplay structure which]
contains a PangoLayout * and other necesary information
(offsets, cursor locations) for displaying a paragraph.
- Get rid of the code to wrap lines, create display chunks,
etc. Instead, we just go through a paragraph and convert
it into the necessary inputs to a PangoLayout.
- Implement a new attribute type, GtkTextAttrAppearance. This
holds a GtkTextAppearance, and is used to pass colors,
stipple, etc, through from the layout to the display without
having to use lots and lots of individual attributes.
- Reimplement gtk_layout_get_iter_at_pixel() gtk_layout_get_iter_pos()
in terms of PangoLayout functions.
* gtk/gtktextview.c:
- Handle passing the necessary PangoContext to the layout
- Some fixups in painting to deal with the automatic backing store
and offsetting of GTK+-1.4
- Add a style_set handler so that the default style reacts
properly to theme changes.
* gtk/gtktext?*.[ch]: Random code-style fixes.
* gtk/testtext.c: Substitute in languages that Pango handles now for Thai
Mon Apr 10 10:33:45 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktext?*.[ch]: Check in Havoc's port of the Tk text widget,
in original form preparatory to Pango-ization and gdkimcontext-ization.
Thu Apr 6 19:25:39 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimcontext.c: Move default implementations to real_* vfuncs,
so that we can derive from gtkimcontext in language bindings properly.
Thu Apr 6 16:02:52 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimcontextsimple.[ch]: Use gdk_keyval_to_unicode to gdk_unicode_to_keyval.
Add a compose table including (almost) all the compose combinations
from X. This is 6k of static, shared data as opposed to 50k or so of dynamic
data in the XIM implementation.
* gdk/gdk.h gdk/gdkkeyuni.c gdk/win32/gdkevents-win32.c (gdk_keyval_to_unicode, gdk_unicode_to_keyval):
Moved functions to convert keyvalues from and to unicode here from
the win32 port and made them public.
Wed Apr 5 16:37:29 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkeditable.c (gtk_editable_insert_text): Allow new_text_length == -1.
Wed Apr 5 16:27:45 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimcontext.[ch]: Base class for new input context system
* gtk/gtkimmulticontext.[ch]: Proxy input context that allows
the real input context implementation to be loaded from modules
and switched on the fly.
* gtk/gtkcontextsimple.[ch]: Simple implementation of an input
context that just does direct keysymbol => unicode translation.
* gtk/gtkentry.[ch]: Start switching editing over to using
GtkInputContext. (No handling of preedit yet.)
Wed Apr 5 15:48:41 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktypeutils.h (GTK_CHECK_GET_CLASS): Fix problem with one too
many substitutions. (klass should not be subsituted.)
Wed Apr 5 00:18:14 2000 Owen Taylor <otaylor@redhat.com>
* configure.in: Add checks for Pango
* configure.in docs/Makefile.am: Add test for sgml2html
and allow 'make dist' without building html, but print out
warnings in that case. (For making snapshots)
* gdk/Makefile.am gdk/x11/Makefile.am gtk/Makefile.am:
Add Pango libraries and C flags
* gdk/gdkdraw.c gdk/gdkdrawable.h gdkwindow.c gdk/x11/gdkdrawable-x11.c:
Add function (gdk_draw_layout) to draw a pango layout.
* gdk/gdkpango.h gdk/x11/gdkpango-x11.c: New file with functions
for getting Pango contexts for GDK.
* gtk/gtkeditable.c: Get rid of dead code gtk_editable_parent_set()
* gtk/gtkentry.[ch]: Complete rewrite to use Pango, add bidirectional
editing.
* gtk/gtkentry.c: Hack in simple Hebrew input with direct
keysym => unicode translations. More languages can be added
here, but real input-method support is needed.
* docs/Changes-1.4.txt: Added note about entry behavior.
* gtk/gtkenums.h gtk/gtkwidget.[ch] testgtk.c gtkprivate.h: Add functions
to set the reading direction for a widget and the global direction.
Add test which allows toggling the global direction. Two private
flags are used to store the direction. (GTK_DIRECTION_SET + GTK_DIRECTION_LTR)
* gtk/gtkcheckbutton.c gtk/gtkframe.c gtk/gtkhbbox.c gtk/gtkhbox.c
gtk/gtkradiobutton.c gtk/gtkspinbutton.c gtk/gtktable.c
* gtk/gtk[hv]scale.c gtk/gtkscale.[ch]: Draw numbers using Pango
* gtk/gtklabel.[ch]: Moved to Pango and considerably rewritten. Line breaking,
underlining now handled by Pango.
* gtk/gtkstyle.[ch] gtk/gtkrc.[ch]: Add a PangoFontDescription
to RCStyle and Style. (Having both this and the old font name and GdkFont
is temporary.)
* gtk/gtkwidget.[ch] (gtk_widget_create_pango_{context,layout}): Added
convenience functions for creating contexts and layouts for widgets.
* gtk/testgtk.c: Enhance label tests with multilingual labels.
2000-06-02 03:14:07 +00:00
|
|
|
|
|
2010-10-24 05:22:13 +00:00
|
|
|
|
x_loc = x + (priv->week_width
|
2011-01-24 02:50:39 +00:00
|
|
|
|
- logical_rect.width
|
|
|
|
|
- calendar_xsep - focus_padding - focus_width);
|
Remove all references to offscreen flag which was no longer used.
Thu Jun 1 23:05:13 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Remove all references to
offscreen flag which was no longer used.
* gtk/gtkprivate.h (enum): Remove unused flags and compress.
* gtk/gtkframe.c (gtk_frame_set_label_widget): Check
for non-null label_widget->parent.
* gtk/gtkentry.c: Get rid of code to deal with PangoAttribute
which no longer was used.
* gdk/gdkpango.c (gdk_pango_context_get_info): make static.
* gdk/gdkpango.c (gdk_draw_layout[_line]): Add checks
for null arguments.
* gdk/x11/gdkgeometry-x11.c (gdk_window_scroll): add
check for destroyed windows.
Thu Jun 1 13:48:45 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimmulticontext.c: Add a finalize method and unref
the slave context there.
* gtk/gtkinvisible.[ch]: Make reference counting behavior
identical to GtkWindow.
Thu Jun 1 01:54:11 2000 Owen Taylor <otaylor@redhat.com>
* Makefile.am gdk/gdkpango.c: Copy the layout render function from
pangox to here, so we can write them independent of rendering
system, using GDK primitives.
* gdk/gdkdrawable.h gdk/gdkdraw.c gdk/gdkwindow.c
gdk/x11/gdkdrawable-x11.c: Remove draw_layout() from the vtable,
since we have a rendering-system independent implementation in
terms of draw_glyphs().
* gdk/gdkpango.c gdkdrawable.h (gdk_draw_layout_line): New
function to render a single line.
* gdk/x11/gdkpango.c: Move the guts of this file mostly
into ../gdkpango.c, which simplifies things, since we
don't have to deal with raw X gc's.
Fri May 19 04:28:16 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.[ch]: Add get_log_attrs() function to
get the logical attributes for a given GtkTextLine.
Tue May 30 16:05:39 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkfont-x11.c (gdk_font_charset_for_locale): Track
g_locale_get_codeset() to g_get_codeset() change.
Tue May 30 15:03:19 2000 Owen Taylor <otaylor@redhat.com>
* gtk/testcalendar.c (calendar_font_selection_ok): Use font
descriptions.
* gtk/gtkentry.c (gtk_entry_draw_text): Center text within
the entry.
* gtk/gtkfontsel.c (gtk_font_selection_dialog_init): Start of
redoing (vastly simplifying) for Pango. Still needs quite
a bit of work. (Size selection is currently poor. List of
predefined sizes is not a good idea, since all of these
sizes won't necessarily be distinct.)
Tue May 30 13:50:19 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkfont-x11.c (gdk_font_charset_for_locale): Handle
CODESET results for LANG=C.
Mon May 29 15:49:10 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.[ch]: Add a 'font_name' declaration to RC
which takes a stringized pango font description;
ignore the older 'font' and 'fontset' declarations.
* gtk/gtkstyle.c gtk/gtkrc.c: Fill in the style->font
field with a GdkFont derived via gdk_font_from_description(),
for compatibility. (Should we just remove it entirely?
Probably too much compatibility breakage, but people
should be migrating to the new Pango stuff as quickly
as possible.)
Mon May 29 15:47:41 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c gtk/gtkclist.c: s/pango_font_unref/g_object_unref/.
Mon May 29 15:44:46 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcalender.c: Roughly pango-ized. Really needs
redoing; there are some bugs in size allocation right
now, the semi-existant distinction between header / day
fonts was removed, but, with Pango, could actually
be made functional in a nice way.
* gtk/testcalender: Move calender from examples into this
directory as a test program. (We really need to restrcture
testgtk into a whole directory full of tests for every
widget or functionality group, separated into multiple .c
files.)
Mon May 29 15:19:56 2000 Owen Taylor <otaylor@redhat.com>
* gtk/testgtk.c (file_exists): Fix stupid typo that
was keeping RC file from being loaded.
* gtk/testgtkrc gtk/testgtkrc2: Test new pango-ized
RC file font code.
Mon May 29 14:31:27 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkfont.h gdk/x11/gdkfont-x11.c (gdk_font_from_description):
Add function to load a GdkFont from a PangoFontDescription.
Fri May 26 17:16:40 2000 Owen Taylor <otaylor@redhat.com>
* gtk/frame.[ch] gtkaspectframe.c: Make frame widgets able
to have any widget for the label, use a GtkLabel widget
to display the text. (Based partially on a patch from
Anders Carlson.)
(Quite a bit of code reorganization - strip 90% of the
guts out of gtkaspectframe and add a single virtual
func to GtkFrameClass - compute_child_allocation.)
Fri May 26 12:00:02 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkctree.c gtk/gtkclist.[ch]: Pangoized.
(Removed clist->row_center_offset field because caching
it wasn't saving time or code, added private function
_gtk_clist_create_cell_layout()).
Wed May 24 15:59:37 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkaccellabel.c: Pangoized.
* gtk/[hv]ruler.c: Pangoized
Mon May 22 19:23:59 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c (gtk_file_selection_init):
Use gtk_clist_set_column_auto_resize() to remove need
need for manual column width computations.
Mon May 22 18:50:26 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktooltips.[ch]: Replace custom drawing with a GtkLabel,
ensuring Pango correctness, and considerably simplifying the
code.
* gtk/gtklabel.c gtk[hv]scale.c: 1000 => PANGO_SCALE.
* gtk/gtklabel.c (gtk_label_size_request): Fixed incorrect
getting of numbers of lines.
* gtk/gtklabel.c (gtk_label_size_request): Set the requisition
to the actual requested width of the lable, not to the wrap
width we set.
* gtk/gtktextchild.h: Remove extraneous include of gtk/gtk.h.
* gtk/gtktextbtree.c gtk/gtktextbuffer.c gtk/gtktextlayout.c
gtk/gtktextview.c gtk/gtktextview.[ch]: Fix up includes.
* gtk/gtktextview.c: Fix structure inheritance.
* gtk/gtkprogressbar.c: Pangoize.
Mon May 22 15:47:30 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextview.c (gtk_text_view_get_first_para_iter): Encapsulate
in a function.
* gtk/gtktextlayout.c (find_display_line_above): Fixed
bug with computing line tops.
* gtk/gtktextview.c (changed_handler): Fix < , <= confusion.
Thu May 18 18:53:31 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextdisplay.c (gtk_text_layout_draw): Fix up the x_offset
and y_offset coordinates to do what we need now. (The offset between
buffer and layout coordinates has been reintroduced, but is a
bit different than before.)
* gtk/gtktextview.[ch]: No longer inherit from GtkLayout; instead
handle the adjustments ourselves, and scroll as necessary using
the new gdk_window_scroll().
The advantage of this is that when we are incrementally revalidating,
we are essentially rearranging things around the visible portion
of the screen. With the old setup, the visible portion of the
screen was moved around in the layout, so scrolling and redrawing
to track that caused jumping of the display. Since we now
control the scrolling ourselves, we can suppress this and
only redraw when things actually change.
Thu May 18 18:47:25 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextbtree.c (redisplay_mark): We need to invalidate
the region not just redisplay it after-all, since we store the
cursors in the LineDisplay. (Ugly interactions here between
GtkLayout and GtkTextBTree here.)
* gtk/gtktextbtree.c (redisplay_region): Fixed reversed comparison.
Thu May 18 18:43:21 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.h gdk/x11/gdkgeometry-x11.c (gdk_window_scroll):
Added function to scroll contents of a window while keeping the
window constant. Works by XCopyArea or guffaw-scrolling depending
on the details of how the window is set up. (guffaw-scrolling
still needs to be filled in.)
Wed May 17 22:36:53 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextiter.c gtk/gtkmain.c: Add a debug key for the text widget,
move the debugging that was tied to a global variable
to that.
* gtk/gtkmarshal.list: Add NONE:INT,INT,INT
* gtk/gtktextbtree.[ch] gtk/gtktextlayout.c: Keep a separate
validated flag, in line data instead of setting height/width to
-1. This allows us to perform operations with partially invalid
buffer (using the old size for invalid lines) and thus to do
incremental vaidation. Keep height/width aggregates up to date
when deleting text and rebalancing the tree.
* gtk/gtktextbtree.[ch]: Add functions validate a line
(gtk_text_btree_validate_line), and to validate up
to a number of pixels (gtk_text_btree_validate).
* gtk/gtktextlayout.[ch]: Add an ::invalidated signal
that indicates that something is changed and a revalidation
pass is needed. Change ::need_repaint to ::changed, and
make it take old and new yranges instead of a rectangle.
* gtk/gtktextbtree.[ch] gtk/gtktextlayout.[ch]: Move
the line_data_destroy() function from
gtk_text_btree_add_view() to a virtual function in
GtkTextLayout
* gtk/gtktextbtree.[ch]: Remove gtk_text_btree_get_damage_range(),
since we are handling partial repaints in a different fashion
now.
* gtk/gtktextbtree.[ch]: Only repaint the changed portion
of the selection instead of queueing a repaint on the
entire widget.
* gtk/gtktextbuffer.[ch] gtk/gtktextbtree.[ch]: Move
get_selection_bounds() down to btree, make the function
in buffer a wrapper around the btree function.
* gtk/gtktextlayout.[ch]: Add functions to check if the
layout is valid and to recompute either a range of pixels
aroudn a line or a certain total number of pixels.
* gtk/gtktextlayout.[ch]: Cache a single line display;
now that we only redraw the needed portions, the hit rate
for this cache is quite high.
* gtk/gtktextview.[ch]: Keep track of the first paragraph
on the screen so that when re-laying-out the buffer, we can
keep the same place. This requires connecting to ::value_changed
on the adjustments
* gtk/gtktextview.[ch]: Add idle functions to revalidate
the buffer after we receive an ::invalidated signal.
Wed May 17 22:10:47 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.c (gtk_layout_size_allocate): Set upper
to max of allocation and layout size, not just to the
layout size.
* gtk/gtk[hv]scrollbar.c (gtk_[hv]scrollbar_calc_slider_size):
Invalidate window so it gets redrawn properly.
* gdk/gdkwindow.c (gdk_window_invalidate_rect): Allow rect == NULL
to mean the entire window.
* gdk/gdkevents.h: Move definition for GDK_PRIORITY_REDRAW
into public header.
Mon May 15 14:51:31 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextmark.c (gtk_text_mark_get_name): Add function
to get the name of a mark.
* gtk/gtktextlayout.c (gtk_text_layout_get_line_at_y): Add a function
to find the paragraph from a y position.
Thu May 11 12:57:20 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextbtree.c (gtk_text_btree_node_invalidate_upward): Valid
nodes have width/height >= 0, not > 0.
Tue May 9 21:29:06 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.[ch] gtk/gtktextdisplay.c (gtk_text_layout_get_line_display):
Add a size_only flag, so when we only need the size, we don't create
useless appearance attributes.
* gtk/gtktextview.c (gtk_text_view_ensure_layout): Remove
duplicate setting of font description.
* gtk/gtkscale.c: Use PANGO_SCALE instead of 1000
Wed Apr 26 01:53:23 2000 Owen Taylor <otaylor@redhat.com>
* gtk/Makefile.am (EXTRA_DIST): Add OLD_STAMP into
EXTRA_DIST. It does not work well when the file that
everything depends on is not in the tarball.
Wed Apr 26 00:56:14 2000 Owen Taylor <otaylor@redhat.com>
* gtk/testgtk.c: Some hacks and fixes so that it basically
works when not sitting in the GTK+ build tree.
2000-05-03 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (gtk_text_line_next_could_contain_tag):
Properly determine the ordering of the tag root and the current
line within the tree. Previous algorithm only worked if the tag
root's immediate parent was the common root of both the current
line and the tag root.
Wed Apr 26 00:43:00 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.c (set_para_values): Fix some bugs in
alignment.
* gtk/gtktextview.c (gtk_text_view_ensure_layout): Track
the widget text directional dynamically.
* gtk/gtktextview.[ch]: Added functions to get and set default
wrap mode.
Tue Apr 25 23:47:38 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.c (gtk_text_layout_get_iter_location): Fix bug
in cursor location computation.
Tue Apr 25 23:22:59 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.c (gtk_layout_set_size): Clamp hadjustment/
vadjusment values properly when layout gets smaller.
* gtk/gtktextview.c (need_repaint_handler): Areas being
passed in are far completely inaccurate, and sometimes
too small, so, for now, just queue a redraw on the
whole visible region.
2000-04-25 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (summary_destroy): new function to
destroy tag summary nodes
(gtk_text_line_next_could_contain_tag): this function was
totally broken if the line passed in wasn't below the tag
root. Fix it.
(gtk_text_btree_first_could_contain_tag): In the tag == NULL
"wildcard" case, we have to do a linear scan. Blah.
(gtk_text_btree_last_could_contain_tag): In tag == NULL case,
we have to do the linear scan
(tag_removed_cb): When a tag is removed from the tag table,
remove the GtkTextTagInfo node from the btree.
(gtk_text_btree_spew): Implement the spew function, for
our debugging pleasure.
Tue Apr 25 19:40:18 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.c (gtk_text_layout_set_buffer): Fix
a problem with referring to the wrong buffer.
* gtk/gtkentry.c: Fix focus-in/focus-out confusion.
* gtk/gtkrc.c gtk/gtkstyle.c: Moving setting default
font description to gtk_style_new() - otherwise things
don't work without a .gtkrc file.
* gtk/gtktextbuffer.c (gtk_text_buffer_new): Sink the
tags table if we create it ourself, too.
* gdk/gdktypes.h (enum): Move GDK_RELEASE_MASK, since
it was conflicting with XKB modifiers.
* gtk/gtktextview.[ch]: Add simple support for
GtkIMContext.
Mon Apr 24 19:34:18 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_move_cursor_visually): Fix problem
with deletion from last commit.
Mon Apr 24 19:29:40 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_create_pango_context): Set the language
in the context from the current locale.
* gtk/gtkentry.c (gtk_entry_size_request): Use language from the
context, not hardcoded value.
* gtk/gtkentry.c (gtk_entry_move_cursor): Make character movement visual,
not logical.
Sun Apr 23 23:39:18 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c gtk/gtktextdisplay.c: Don't handle selections as
attributes - that doesn't handle partial-glyph selection
properly. Instead use new pango_layout_line_get_x_ranges()
functionality to draw the selection.
* gtk/gtkentry.c: Simplify code since pango_layout_line_index_to_x()
now properly handles out-of-range coordinates.
* gtk/gtktextbuffer.c: Emit "mark_set" when the cursor is moved.
* gtk/gtktextiter.h gtk/gtktextiterprivate.h: Make gtk_text_iter_get_line_byte()
public.
* gtk/gtktextlayout.[ch]: Properly set the direction in the PangoContext
for paragraphs opposite to the base direction of the widget.
* gtk/gtktextlayout.[ch] gtk/gtktextdisplay.c: Fixes for alignment.
* gtk/gtktextlayout.c: Don't split segments on marks, since that
causes Arabic words to reshape as you cursor through.
* gtk/gtktextlayout.[ch] gtk/gtktextview.[ch]: Implement virtual
cursor position when moving vertically with the arrow keys and
scrolling with page-up/page-down. (Arrow keys save only the X,
scrolling saves both X and Y.)
This means you can line-up / line-down or page-up / page-down
without losing your place, and also that moving vertically
with the cursor keys keeps the same X position, not the same
character count:
* gtk/gtktextlayout.[ch] gtk/gtktextview.[ch]: Make vertical
arrow keys move by display lines, not paragraphs.
Tue Apr 18 14:16:50 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.c: Make sure that the bin window is at least
as big as the allocation. (Should we also make sure that the
bin window is big enough to completely cover widget->window?)
* gtk/gtktextview.c (gtk_text_view_get_visible_rect): Add
function to get the onscreen rectangle.
* gdk/x11/gdkwindow-x11.c (gdk_window_get_pointer): Correctly account
for offsets in window coordinates.
Sun Apr 16 16:13:27 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_get_cursor_locations): Fix index/offset
confusion.
* gtk/gtktextview.c (gtk_text_view_ensure_layout): Set the default direction
from the widget direction.
* gtk/gtktexttag.c gtk/gtktexttagprivate.h (gtk_text_tag_set_arg):
Add a "direction" attribute.
* gtk/gtktextview.c: global s/tkxt/text_view/.
* gtk/testtext.c: Added long block of text in Arabic, to test out
the direction attributes. (Some problems with the shaping system
for arabic become obvious - like the fact the cursor splits words
into unjoined pieces.)
Fri Apr 14 12:54:34 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextdisplay.c (render_layout): Add overstrike handling.
* gtk/gtktextlayout.c: Fix up alignment.
* gtk/testtext.c: Add some tests for centering, wrapping.
Fri Apr 14 09:26:22 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkdrawable.h gdk/gdkdraw.c gdk/gdkwindow.c gdk/x11/gdkdrawable-x11.c:
Add a draw_glyphs() operation to the drawable vtable and gdk_draw_glyphs().
If we wrote GTK+-specific layout-render function this could just replace
the draw_layout() operation in the vtable.
* gtk/gtkentry.c: Move guts of gtk_entry_get_cursor_locations to
pango_layout_get_cursor_pos() and use that function.
* gtk/gtktextchild.[ch]: add gtk_ onto pixmap_segment_new(), since it
is a non-static symbol.
* gtk/gtktextbtree.[ch]: Replace gtk_text_btree_find_line_data_by_y()
with gtk_text_btree_find_line_by_y()
* gtk/gtktextdisplay.c: Rewrote for Pango - uses a custom layout
renderer that handles GtkTextAppearance attributes.
* gtk/gtktexttag.[ch] gtk/gtktexttagprivate.h:
- Move the values in the style that don't affect geometry into a
GtkTextAppearance structure.
- Change underline to take a PangoUnderline and "font" a string
representation of a font description
- Add a "font_desc" attribute which takes a FontDescription structure.
* gtk/gtktextlayout.[ch]:
- Get rid of the display-line list per each line. Instead, we
generate, on demand, a GtkTextLineDisplay structure which]
contains a PangoLayout * and other necesary information
(offsets, cursor locations) for displaying a paragraph.
- Get rid of the code to wrap lines, create display chunks,
etc. Instead, we just go through a paragraph and convert
it into the necessary inputs to a PangoLayout.
- Implement a new attribute type, GtkTextAttrAppearance. This
holds a GtkTextAppearance, and is used to pass colors,
stipple, etc, through from the layout to the display without
having to use lots and lots of individual attributes.
- Reimplement gtk_layout_get_iter_at_pixel() gtk_layout_get_iter_pos()
in terms of PangoLayout functions.
* gtk/gtktextview.c:
- Handle passing the necessary PangoContext to the layout
- Some fixups in painting to deal with the automatic backing store
and offsetting of GTK+-1.4
- Add a style_set handler so that the default style reacts
properly to theme changes.
* gtk/gtktext?*.[ch]: Random code-style fixes.
* gtk/testtext.c: Substitute in languages that Pango handles now for Thai
Mon Apr 10 10:33:45 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktext?*.[ch]: Check in Havoc's port of the Tk text widget,
in original form preparatory to Pango-ization and gdkimcontext-ization.
Thu Apr 6 19:25:39 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimcontext.c: Move default implementations to real_* vfuncs,
so that we can derive from gtkimcontext in language bindings properly.
Thu Apr 6 16:02:52 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimcontextsimple.[ch]: Use gdk_keyval_to_unicode to gdk_unicode_to_keyval.
Add a compose table including (almost) all the compose combinations
from X. This is 6k of static, shared data as opposed to 50k or so of dynamic
data in the XIM implementation.
* gdk/gdk.h gdk/gdkkeyuni.c gdk/win32/gdkevents-win32.c (gdk_keyval_to_unicode, gdk_unicode_to_keyval):
Moved functions to convert keyvalues from and to unicode here from
the win32 port and made them public.
Wed Apr 5 16:37:29 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkeditable.c (gtk_editable_insert_text): Allow new_text_length == -1.
Wed Apr 5 16:27:45 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimcontext.[ch]: Base class for new input context system
* gtk/gtkimmulticontext.[ch]: Proxy input context that allows
the real input context implementation to be loaded from modules
and switched on the fly.
* gtk/gtkcontextsimple.[ch]: Simple implementation of an input
context that just does direct keysymbol => unicode translation.
* gtk/gtkentry.[ch]: Start switching editing over to using
GtkInputContext. (No handling of preedit yet.)
Wed Apr 5 15:48:41 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktypeutils.h (GTK_CHECK_GET_CLASS): Fix problem with one too
many substitutions. (klass should not be subsituted.)
Wed Apr 5 00:18:14 2000 Owen Taylor <otaylor@redhat.com>
* configure.in: Add checks for Pango
* configure.in docs/Makefile.am: Add test for sgml2html
and allow 'make dist' without building html, but print out
warnings in that case. (For making snapshots)
* gdk/Makefile.am gdk/x11/Makefile.am gtk/Makefile.am:
Add Pango libraries and C flags
* gdk/gdkdraw.c gdk/gdkdrawable.h gdkwindow.c gdk/x11/gdkdrawable-x11.c:
Add function (gdk_draw_layout) to draw a pango layout.
* gdk/gdkpango.h gdk/x11/gdkpango-x11.c: New file with functions
for getting Pango contexts for GDK.
* gtk/gtkeditable.c: Get rid of dead code gtk_editable_parent_set()
* gtk/gtkentry.[ch]: Complete rewrite to use Pango, add bidirectional
editing.
* gtk/gtkentry.c: Hack in simple Hebrew input with direct
keysym => unicode translations. More languages can be added
here, but real input-method support is needed.
* docs/Changes-1.4.txt: Added note about entry behavior.
* gtk/gtkenums.h gtk/gtkwidget.[ch] testgtk.c gtkprivate.h: Add functions
to set the reading direction for a widget and the global direction.
Add test which allows toggling the global direction. Two private
flags are used to store the direction. (GTK_DIRECTION_SET + GTK_DIRECTION_LTR)
* gtk/gtkcheckbutton.c gtk/gtkframe.c gtk/gtkhbbox.c gtk/gtkhbox.c
gtk/gtkradiobutton.c gtk/gtkspinbutton.c gtk/gtktable.c
* gtk/gtk[hv]scale.c gtk/gtkscale.[ch]: Draw numbers using Pango
* gtk/gtklabel.[ch]: Moved to Pango and considerably rewritten. Line breaking,
underlining now handled by Pango.
* gtk/gtkstyle.[ch] gtk/gtkrc.[ch]: Add a PangoFontDescription
to RCStyle and Style. (Having both this and the old font name and GdkFont
is temporary.)
* gtk/gtkwidget.[ch] (gtk_widget_create_pango_{context,layout}): Added
convenience functions for creating contexts and layouts for widgets.
* gtk/testgtk.c: Enhance label tests with multilingual labels.
2000-06-02 03:14:07 +00:00
|
|
|
|
|
2011-01-10 19:40:37 +00:00
|
|
|
|
gtk_render_layout (context, cr, x_loc, y_loc, layout);
|
1998-09-27 18:32:00 +00:00
|
|
|
|
}
|
2011-01-10 19:40:37 +00:00
|
|
|
|
|
2002-10-09 22:11:08 +00:00
|
|
|
|
g_object_unref (layout);
|
2010-09-04 17:16:26 +00:00
|
|
|
|
|
2011-01-10 19:40:37 +00:00
|
|
|
|
gtk_style_context_restore (context);
|
2010-09-04 17:16:26 +00:00
|
|
|
|
cairo_restore (cr);
|
1998-09-27 18:32:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2005-05-11 19:16:19 +00:00
|
|
|
|
calendar_invalidate_day_num (GtkCalendar *calendar,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
gint day)
|
1998-09-27 18:32:00 +00:00
|
|
|
|
{
|
2010-08-12 15:14:51 +00:00
|
|
|
|
GtkCalendarPrivate *priv = calendar->priv;
|
1998-09-27 18:32:00 +00:00
|
|
|
|
gint r, c, row, col;
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
1998-09-27 18:32:00 +00:00
|
|
|
|
row = -1;
|
|
|
|
|
col = -1;
|
|
|
|
|
for (r = 0; r < 6; r++)
|
|
|
|
|
for (c = 0; c < 7; c++)
|
2010-08-12 15:14:51 +00:00
|
|
|
|
if (priv->day_month[r][c] == MONTH_CURRENT &&
|
2011-01-24 02:50:39 +00:00
|
|
|
|
priv->day[r][c] == day)
|
|
|
|
|
{
|
|
|
|
|
row = r;
|
|
|
|
|
col = c;
|
|
|
|
|
}
|
|
|
|
|
|
1998-09-27 18:32:00 +00:00
|
|
|
|
g_return_if_fail (row != -1);
|
|
|
|
|
g_return_if_fail (col != -1);
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
calendar_invalidate_day (calendar, row, col);
|
1998-09-27 18:32:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2005-05-11 19:16:19 +00:00
|
|
|
|
calendar_invalidate_day (GtkCalendar *calendar,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
gint row,
|
|
|
|
|
gint col)
|
1998-09-27 18:32:00 +00:00
|
|
|
|
{
|
2010-10-24 05:22:13 +00:00
|
|
|
|
GdkRectangle day_rect;
|
|
|
|
|
GtkAllocation allocation;
|
2005-05-11 19:16:19 +00:00
|
|
|
|
|
2010-10-24 05:22:13 +00:00
|
|
|
|
gtk_widget_get_allocation (GTK_WIDGET (calendar), &allocation);
|
|
|
|
|
calendar_day_rectangle (calendar, row, col, &day_rect);
|
|
|
|
|
gtk_widget_queue_draw_area (GTK_WIDGET (calendar),
|
|
|
|
|
allocation.x + day_rect.x,
|
|
|
|
|
allocation.y + day_rect.y,
|
|
|
|
|
day_rect.width, day_rect.height);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
2007-12-28 09:26:20 +00:00
|
|
|
|
static gboolean
|
|
|
|
|
is_color_attribute (PangoAttribute *attribute,
|
|
|
|
|
gpointer data)
|
|
|
|
|
{
|
|
|
|
|
return (attribute->klass->type == PANGO_ATTR_FOREGROUND ||
|
|
|
|
|
attribute->klass->type == PANGO_ATTR_BACKGROUND);
|
|
|
|
|
}
|
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
static void
|
|
|
|
|
calendar_paint_day (GtkCalendar *calendar,
|
2010-09-04 17:07:39 +00:00
|
|
|
|
cairo_t *cr,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
gint row,
|
|
|
|
|
gint col)
|
2005-05-11 19:16:19 +00:00
|
|
|
|
{
|
|
|
|
|
GtkWidget *widget = GTK_WIDGET (calendar);
|
|
|
|
|
GtkCalendarPrivate *priv = GTK_CALENDAR_GET_PRIVATE (calendar);
|
2011-01-10 19:40:37 +00:00
|
|
|
|
GtkStyleContext *context;
|
|
|
|
|
GtkStateFlags state = 0;
|
2008-01-17 16:42:04 +00:00
|
|
|
|
gchar *detail;
|
2006-01-26 20:40:18 +00:00
|
|
|
|
gchar buffer[32];
|
1998-09-27 18:32:00 +00:00
|
|
|
|
gint day;
|
2005-05-11 19:16:19 +00:00
|
|
|
|
gint x_loc, y_loc;
|
|
|
|
|
GdkRectangle day_rect;
|
2002-02-14 04:05:13 +00:00
|
|
|
|
|
Remove all references to offscreen flag which was no longer used.
Thu Jun 1 23:05:13 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Remove all references to
offscreen flag which was no longer used.
* gtk/gtkprivate.h (enum): Remove unused flags and compress.
* gtk/gtkframe.c (gtk_frame_set_label_widget): Check
for non-null label_widget->parent.
* gtk/gtkentry.c: Get rid of code to deal with PangoAttribute
which no longer was used.
* gdk/gdkpango.c (gdk_pango_context_get_info): make static.
* gdk/gdkpango.c (gdk_draw_layout[_line]): Add checks
for null arguments.
* gdk/x11/gdkgeometry-x11.c (gdk_window_scroll): add
check for destroyed windows.
Thu Jun 1 13:48:45 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimmulticontext.c: Add a finalize method and unref
the slave context there.
* gtk/gtkinvisible.[ch]: Make reference counting behavior
identical to GtkWindow.
Thu Jun 1 01:54:11 2000 Owen Taylor <otaylor@redhat.com>
* Makefile.am gdk/gdkpango.c: Copy the layout render function from
pangox to here, so we can write them independent of rendering
system, using GDK primitives.
* gdk/gdkdrawable.h gdk/gdkdraw.c gdk/gdkwindow.c
gdk/x11/gdkdrawable-x11.c: Remove draw_layout() from the vtable,
since we have a rendering-system independent implementation in
terms of draw_glyphs().
* gdk/gdkpango.c gdkdrawable.h (gdk_draw_layout_line): New
function to render a single line.
* gdk/x11/gdkpango.c: Move the guts of this file mostly
into ../gdkpango.c, which simplifies things, since we
don't have to deal with raw X gc's.
Fri May 19 04:28:16 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.[ch]: Add get_log_attrs() function to
get the logical attributes for a given GtkTextLine.
Tue May 30 16:05:39 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkfont-x11.c (gdk_font_charset_for_locale): Track
g_locale_get_codeset() to g_get_codeset() change.
Tue May 30 15:03:19 2000 Owen Taylor <otaylor@redhat.com>
* gtk/testcalendar.c (calendar_font_selection_ok): Use font
descriptions.
* gtk/gtkentry.c (gtk_entry_draw_text): Center text within
the entry.
* gtk/gtkfontsel.c (gtk_font_selection_dialog_init): Start of
redoing (vastly simplifying) for Pango. Still needs quite
a bit of work. (Size selection is currently poor. List of
predefined sizes is not a good idea, since all of these
sizes won't necessarily be distinct.)
Tue May 30 13:50:19 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkfont-x11.c (gdk_font_charset_for_locale): Handle
CODESET results for LANG=C.
Mon May 29 15:49:10 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.[ch]: Add a 'font_name' declaration to RC
which takes a stringized pango font description;
ignore the older 'font' and 'fontset' declarations.
* gtk/gtkstyle.c gtk/gtkrc.c: Fill in the style->font
field with a GdkFont derived via gdk_font_from_description(),
for compatibility. (Should we just remove it entirely?
Probably too much compatibility breakage, but people
should be migrating to the new Pango stuff as quickly
as possible.)
Mon May 29 15:47:41 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c gtk/gtkclist.c: s/pango_font_unref/g_object_unref/.
Mon May 29 15:44:46 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcalender.c: Roughly pango-ized. Really needs
redoing; there are some bugs in size allocation right
now, the semi-existant distinction between header / day
fonts was removed, but, with Pango, could actually
be made functional in a nice way.
* gtk/testcalender: Move calender from examples into this
directory as a test program. (We really need to restrcture
testgtk into a whole directory full of tests for every
widget or functionality group, separated into multiple .c
files.)
Mon May 29 15:19:56 2000 Owen Taylor <otaylor@redhat.com>
* gtk/testgtk.c (file_exists): Fix stupid typo that
was keeping RC file from being loaded.
* gtk/testgtkrc gtk/testgtkrc2: Test new pango-ized
RC file font code.
Mon May 29 14:31:27 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkfont.h gdk/x11/gdkfont-x11.c (gdk_font_from_description):
Add function to load a GdkFont from a PangoFontDescription.
Fri May 26 17:16:40 2000 Owen Taylor <otaylor@redhat.com>
* gtk/frame.[ch] gtkaspectframe.c: Make frame widgets able
to have any widget for the label, use a GtkLabel widget
to display the text. (Based partially on a patch from
Anders Carlson.)
(Quite a bit of code reorganization - strip 90% of the
guts out of gtkaspectframe and add a single virtual
func to GtkFrameClass - compute_child_allocation.)
Fri May 26 12:00:02 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkctree.c gtk/gtkclist.[ch]: Pangoized.
(Removed clist->row_center_offset field because caching
it wasn't saving time or code, added private function
_gtk_clist_create_cell_layout()).
Wed May 24 15:59:37 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkaccellabel.c: Pangoized.
* gtk/[hv]ruler.c: Pangoized
Mon May 22 19:23:59 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c (gtk_file_selection_init):
Use gtk_clist_set_column_auto_resize() to remove need
need for manual column width computations.
Mon May 22 18:50:26 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktooltips.[ch]: Replace custom drawing with a GtkLabel,
ensuring Pango correctness, and considerably simplifying the
code.
* gtk/gtklabel.c gtk[hv]scale.c: 1000 => PANGO_SCALE.
* gtk/gtklabel.c (gtk_label_size_request): Fixed incorrect
getting of numbers of lines.
* gtk/gtklabel.c (gtk_label_size_request): Set the requisition
to the actual requested width of the lable, not to the wrap
width we set.
* gtk/gtktextchild.h: Remove extraneous include of gtk/gtk.h.
* gtk/gtktextbtree.c gtk/gtktextbuffer.c gtk/gtktextlayout.c
gtk/gtktextview.c gtk/gtktextview.[ch]: Fix up includes.
* gtk/gtktextview.c: Fix structure inheritance.
* gtk/gtkprogressbar.c: Pangoize.
Mon May 22 15:47:30 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextview.c (gtk_text_view_get_first_para_iter): Encapsulate
in a function.
* gtk/gtktextlayout.c (find_display_line_above): Fixed
bug with computing line tops.
* gtk/gtktextview.c (changed_handler): Fix < , <= confusion.
Thu May 18 18:53:31 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextdisplay.c (gtk_text_layout_draw): Fix up the x_offset
and y_offset coordinates to do what we need now. (The offset between
buffer and layout coordinates has been reintroduced, but is a
bit different than before.)
* gtk/gtktextview.[ch]: No longer inherit from GtkLayout; instead
handle the adjustments ourselves, and scroll as necessary using
the new gdk_window_scroll().
The advantage of this is that when we are incrementally revalidating,
we are essentially rearranging things around the visible portion
of the screen. With the old setup, the visible portion of the
screen was moved around in the layout, so scrolling and redrawing
to track that caused jumping of the display. Since we now
control the scrolling ourselves, we can suppress this and
only redraw when things actually change.
Thu May 18 18:47:25 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextbtree.c (redisplay_mark): We need to invalidate
the region not just redisplay it after-all, since we store the
cursors in the LineDisplay. (Ugly interactions here between
GtkLayout and GtkTextBTree here.)
* gtk/gtktextbtree.c (redisplay_region): Fixed reversed comparison.
Thu May 18 18:43:21 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.h gdk/x11/gdkgeometry-x11.c (gdk_window_scroll):
Added function to scroll contents of a window while keeping the
window constant. Works by XCopyArea or guffaw-scrolling depending
on the details of how the window is set up. (guffaw-scrolling
still needs to be filled in.)
Wed May 17 22:36:53 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextiter.c gtk/gtkmain.c: Add a debug key for the text widget,
move the debugging that was tied to a global variable
to that.
* gtk/gtkmarshal.list: Add NONE:INT,INT,INT
* gtk/gtktextbtree.[ch] gtk/gtktextlayout.c: Keep a separate
validated flag, in line data instead of setting height/width to
-1. This allows us to perform operations with partially invalid
buffer (using the old size for invalid lines) and thus to do
incremental vaidation. Keep height/width aggregates up to date
when deleting text and rebalancing the tree.
* gtk/gtktextbtree.[ch]: Add functions validate a line
(gtk_text_btree_validate_line), and to validate up
to a number of pixels (gtk_text_btree_validate).
* gtk/gtktextlayout.[ch]: Add an ::invalidated signal
that indicates that something is changed and a revalidation
pass is needed. Change ::need_repaint to ::changed, and
make it take old and new yranges instead of a rectangle.
* gtk/gtktextbtree.[ch] gtk/gtktextlayout.[ch]: Move
the line_data_destroy() function from
gtk_text_btree_add_view() to a virtual function in
GtkTextLayout
* gtk/gtktextbtree.[ch]: Remove gtk_text_btree_get_damage_range(),
since we are handling partial repaints in a different fashion
now.
* gtk/gtktextbtree.[ch]: Only repaint the changed portion
of the selection instead of queueing a repaint on the
entire widget.
* gtk/gtktextbuffer.[ch] gtk/gtktextbtree.[ch]: Move
get_selection_bounds() down to btree, make the function
in buffer a wrapper around the btree function.
* gtk/gtktextlayout.[ch]: Add functions to check if the
layout is valid and to recompute either a range of pixels
aroudn a line or a certain total number of pixels.
* gtk/gtktextlayout.[ch]: Cache a single line display;
now that we only redraw the needed portions, the hit rate
for this cache is quite high.
* gtk/gtktextview.[ch]: Keep track of the first paragraph
on the screen so that when re-laying-out the buffer, we can
keep the same place. This requires connecting to ::value_changed
on the adjustments
* gtk/gtktextview.[ch]: Add idle functions to revalidate
the buffer after we receive an ::invalidated signal.
Wed May 17 22:10:47 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.c (gtk_layout_size_allocate): Set upper
to max of allocation and layout size, not just to the
layout size.
* gtk/gtk[hv]scrollbar.c (gtk_[hv]scrollbar_calc_slider_size):
Invalidate window so it gets redrawn properly.
* gdk/gdkwindow.c (gdk_window_invalidate_rect): Allow rect == NULL
to mean the entire window.
* gdk/gdkevents.h: Move definition for GDK_PRIORITY_REDRAW
into public header.
Mon May 15 14:51:31 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextmark.c (gtk_text_mark_get_name): Add function
to get the name of a mark.
* gtk/gtktextlayout.c (gtk_text_layout_get_line_at_y): Add a function
to find the paragraph from a y position.
Thu May 11 12:57:20 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextbtree.c (gtk_text_btree_node_invalidate_upward): Valid
nodes have width/height >= 0, not > 0.
Tue May 9 21:29:06 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.[ch] gtk/gtktextdisplay.c (gtk_text_layout_get_line_display):
Add a size_only flag, so when we only need the size, we don't create
useless appearance attributes.
* gtk/gtktextview.c (gtk_text_view_ensure_layout): Remove
duplicate setting of font description.
* gtk/gtkscale.c: Use PANGO_SCALE instead of 1000
Wed Apr 26 01:53:23 2000 Owen Taylor <otaylor@redhat.com>
* gtk/Makefile.am (EXTRA_DIST): Add OLD_STAMP into
EXTRA_DIST. It does not work well when the file that
everything depends on is not in the tarball.
Wed Apr 26 00:56:14 2000 Owen Taylor <otaylor@redhat.com>
* gtk/testgtk.c: Some hacks and fixes so that it basically
works when not sitting in the GTK+ build tree.
2000-05-03 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (gtk_text_line_next_could_contain_tag):
Properly determine the ordering of the tag root and the current
line within the tree. Previous algorithm only worked if the tag
root's immediate parent was the common root of both the current
line and the tag root.
Wed Apr 26 00:43:00 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.c (set_para_values): Fix some bugs in
alignment.
* gtk/gtktextview.c (gtk_text_view_ensure_layout): Track
the widget text directional dynamically.
* gtk/gtktextview.[ch]: Added functions to get and set default
wrap mode.
Tue Apr 25 23:47:38 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.c (gtk_text_layout_get_iter_location): Fix bug
in cursor location computation.
Tue Apr 25 23:22:59 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.c (gtk_layout_set_size): Clamp hadjustment/
vadjusment values properly when layout gets smaller.
* gtk/gtktextview.c (need_repaint_handler): Areas being
passed in are far completely inaccurate, and sometimes
too small, so, for now, just queue a redraw on the
whole visible region.
2000-04-25 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (summary_destroy): new function to
destroy tag summary nodes
(gtk_text_line_next_could_contain_tag): this function was
totally broken if the line passed in wasn't below the tag
root. Fix it.
(gtk_text_btree_first_could_contain_tag): In the tag == NULL
"wildcard" case, we have to do a linear scan. Blah.
(gtk_text_btree_last_could_contain_tag): In tag == NULL case,
we have to do the linear scan
(tag_removed_cb): When a tag is removed from the tag table,
remove the GtkTextTagInfo node from the btree.
(gtk_text_btree_spew): Implement the spew function, for
our debugging pleasure.
Tue Apr 25 19:40:18 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.c (gtk_text_layout_set_buffer): Fix
a problem with referring to the wrong buffer.
* gtk/gtkentry.c: Fix focus-in/focus-out confusion.
* gtk/gtkrc.c gtk/gtkstyle.c: Moving setting default
font description to gtk_style_new() - otherwise things
don't work without a .gtkrc file.
* gtk/gtktextbuffer.c (gtk_text_buffer_new): Sink the
tags table if we create it ourself, too.
* gdk/gdktypes.h (enum): Move GDK_RELEASE_MASK, since
it was conflicting with XKB modifiers.
* gtk/gtktextview.[ch]: Add simple support for
GtkIMContext.
Mon Apr 24 19:34:18 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_move_cursor_visually): Fix problem
with deletion from last commit.
Mon Apr 24 19:29:40 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_create_pango_context): Set the language
in the context from the current locale.
* gtk/gtkentry.c (gtk_entry_size_request): Use language from the
context, not hardcoded value.
* gtk/gtkentry.c (gtk_entry_move_cursor): Make character movement visual,
not logical.
Sun Apr 23 23:39:18 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c gtk/gtktextdisplay.c: Don't handle selections as
attributes - that doesn't handle partial-glyph selection
properly. Instead use new pango_layout_line_get_x_ranges()
functionality to draw the selection.
* gtk/gtkentry.c: Simplify code since pango_layout_line_index_to_x()
now properly handles out-of-range coordinates.
* gtk/gtktextbuffer.c: Emit "mark_set" when the cursor is moved.
* gtk/gtktextiter.h gtk/gtktextiterprivate.h: Make gtk_text_iter_get_line_byte()
public.
* gtk/gtktextlayout.[ch]: Properly set the direction in the PangoContext
for paragraphs opposite to the base direction of the widget.
* gtk/gtktextlayout.[ch] gtk/gtktextdisplay.c: Fixes for alignment.
* gtk/gtktextlayout.c: Don't split segments on marks, since that
causes Arabic words to reshape as you cursor through.
* gtk/gtktextlayout.[ch] gtk/gtktextview.[ch]: Implement virtual
cursor position when moving vertically with the arrow keys and
scrolling with page-up/page-down. (Arrow keys save only the X,
scrolling saves both X and Y.)
This means you can line-up / line-down or page-up / page-down
without losing your place, and also that moving vertically
with the cursor keys keeps the same X position, not the same
character count:
* gtk/gtktextlayout.[ch] gtk/gtktextview.[ch]: Make vertical
arrow keys move by display lines, not paragraphs.
Tue Apr 18 14:16:50 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.c: Make sure that the bin window is at least
as big as the allocation. (Should we also make sure that the
bin window is big enough to completely cover widget->window?)
* gtk/gtktextview.c (gtk_text_view_get_visible_rect): Add
function to get the onscreen rectangle.
* gdk/x11/gdkwindow-x11.c (gdk_window_get_pointer): Correctly account
for offsets in window coordinates.
Sun Apr 16 16:13:27 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_get_cursor_locations): Fix index/offset
confusion.
* gtk/gtktextview.c (gtk_text_view_ensure_layout): Set the default direction
from the widget direction.
* gtk/gtktexttag.c gtk/gtktexttagprivate.h (gtk_text_tag_set_arg):
Add a "direction" attribute.
* gtk/gtktextview.c: global s/tkxt/text_view/.
* gtk/testtext.c: Added long block of text in Arabic, to test out
the direction attributes. (Some problems with the shaping system
for arabic become obvious - like the fact the cursor splits words
into unjoined pieces.)
Fri Apr 14 12:54:34 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextdisplay.c (render_layout): Add overstrike handling.
* gtk/gtktextlayout.c: Fix up alignment.
* gtk/testtext.c: Add some tests for centering, wrapping.
Fri Apr 14 09:26:22 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkdrawable.h gdk/gdkdraw.c gdk/gdkwindow.c gdk/x11/gdkdrawable-x11.c:
Add a draw_glyphs() operation to the drawable vtable and gdk_draw_glyphs().
If we wrote GTK+-specific layout-render function this could just replace
the draw_layout() operation in the vtable.
* gtk/gtkentry.c: Move guts of gtk_entry_get_cursor_locations to
pango_layout_get_cursor_pos() and use that function.
* gtk/gtktextchild.[ch]: add gtk_ onto pixmap_segment_new(), since it
is a non-static symbol.
* gtk/gtktextbtree.[ch]: Replace gtk_text_btree_find_line_data_by_y()
with gtk_text_btree_find_line_by_y()
* gtk/gtktextdisplay.c: Rewrote for Pango - uses a custom layout
renderer that handles GtkTextAppearance attributes.
* gtk/gtktexttag.[ch] gtk/gtktexttagprivate.h:
- Move the values in the style that don't affect geometry into a
GtkTextAppearance structure.
- Change underline to take a PangoUnderline and "font" a string
representation of a font description
- Add a "font_desc" attribute which takes a FontDescription structure.
* gtk/gtktextlayout.[ch]:
- Get rid of the display-line list per each line. Instead, we
generate, on demand, a GtkTextLineDisplay structure which]
contains a PangoLayout * and other necesary information
(offsets, cursor locations) for displaying a paragraph.
- Get rid of the code to wrap lines, create display chunks,
etc. Instead, we just go through a paragraph and convert
it into the necessary inputs to a PangoLayout.
- Implement a new attribute type, GtkTextAttrAppearance. This
holds a GtkTextAppearance, and is used to pass colors,
stipple, etc, through from the layout to the display without
having to use lots and lots of individual attributes.
- Reimplement gtk_layout_get_iter_at_pixel() gtk_layout_get_iter_pos()
in terms of PangoLayout functions.
* gtk/gtktextview.c:
- Handle passing the necessary PangoContext to the layout
- Some fixups in painting to deal with the automatic backing store
and offsetting of GTK+-1.4
- Add a style_set handler so that the default style reacts
properly to theme changes.
* gtk/gtktext?*.[ch]: Random code-style fixes.
* gtk/testtext.c: Substitute in languages that Pango handles now for Thai
Mon Apr 10 10:33:45 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktext?*.[ch]: Check in Havoc's port of the Tk text widget,
in original form preparatory to Pango-ization and gdkimcontext-ization.
Thu Apr 6 19:25:39 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimcontext.c: Move default implementations to real_* vfuncs,
so that we can derive from gtkimcontext in language bindings properly.
Thu Apr 6 16:02:52 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimcontextsimple.[ch]: Use gdk_keyval_to_unicode to gdk_unicode_to_keyval.
Add a compose table including (almost) all the compose combinations
from X. This is 6k of static, shared data as opposed to 50k or so of dynamic
data in the XIM implementation.
* gdk/gdk.h gdk/gdkkeyuni.c gdk/win32/gdkevents-win32.c (gdk_keyval_to_unicode, gdk_unicode_to_keyval):
Moved functions to convert keyvalues from and to unicode here from
the win32 port and made them public.
Wed Apr 5 16:37:29 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkeditable.c (gtk_editable_insert_text): Allow new_text_length == -1.
Wed Apr 5 16:27:45 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimcontext.[ch]: Base class for new input context system
* gtk/gtkimmulticontext.[ch]: Proxy input context that allows
the real input context implementation to be loaded from modules
and switched on the fly.
* gtk/gtkcontextsimple.[ch]: Simple implementation of an input
context that just does direct keysymbol => unicode translation.
* gtk/gtkentry.[ch]: Start switching editing over to using
GtkInputContext. (No handling of preedit yet.)
Wed Apr 5 15:48:41 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktypeutils.h (GTK_CHECK_GET_CLASS): Fix problem with one too
many substitutions. (klass should not be subsituted.)
Wed Apr 5 00:18:14 2000 Owen Taylor <otaylor@redhat.com>
* configure.in: Add checks for Pango
* configure.in docs/Makefile.am: Add test for sgml2html
and allow 'make dist' without building html, but print out
warnings in that case. (For making snapshots)
* gdk/Makefile.am gdk/x11/Makefile.am gtk/Makefile.am:
Add Pango libraries and C flags
* gdk/gdkdraw.c gdk/gdkdrawable.h gdkwindow.c gdk/x11/gdkdrawable-x11.c:
Add function (gdk_draw_layout) to draw a pango layout.
* gdk/gdkpango.h gdk/x11/gdkpango-x11.c: New file with functions
for getting Pango contexts for GDK.
* gtk/gtkeditable.c: Get rid of dead code gtk_editable_parent_set()
* gtk/gtkentry.[ch]: Complete rewrite to use Pango, add bidirectional
editing.
* gtk/gtkentry.c: Hack in simple Hebrew input with direct
keysym => unicode translations. More languages can be added
here, but real input-method support is needed.
* docs/Changes-1.4.txt: Added note about entry behavior.
* gtk/gtkenums.h gtk/gtkwidget.[ch] testgtk.c gtkprivate.h: Add functions
to set the reading direction for a widget and the global direction.
Add test which allows toggling the global direction. Two private
flags are used to store the direction. (GTK_DIRECTION_SET + GTK_DIRECTION_LTR)
* gtk/gtkcheckbutton.c gtk/gtkframe.c gtk/gtkhbbox.c gtk/gtkhbox.c
gtk/gtkradiobutton.c gtk/gtkspinbutton.c gtk/gtktable.c
* gtk/gtk[hv]scale.c gtk/gtkscale.[ch]: Draw numbers using Pango
* gtk/gtklabel.[ch]: Moved to Pango and considerably rewritten. Line breaking,
underlining now handled by Pango.
* gtk/gtkstyle.[ch] gtk/gtkrc.[ch]: Add a PangoFontDescription
to RCStyle and Style. (Having both this and the old font name and GdkFont
is temporary.)
* gtk/gtkwidget.[ch] (gtk_widget_create_pango_{context,layout}): Added
convenience functions for creating contexts and layouts for widgets.
* gtk/testgtk.c: Enhance label tests with multilingual labels.
2000-06-02 03:14:07 +00:00
|
|
|
|
PangoLayout *layout;
|
|
|
|
|
PangoRectangle logical_rect;
|
2007-12-28 09:36:06 +00:00
|
|
|
|
gboolean overflow = FALSE;
|
2007-12-28 09:39:34 +00:00
|
|
|
|
gboolean show_details;
|
|
|
|
|
|
1998-09-27 18:32:00 +00:00
|
|
|
|
g_return_if_fail (row < 6);
|
|
|
|
|
g_return_if_fail (col < 7);
|
1998-10-04 23:07:04 +00:00
|
|
|
|
|
2011-01-10 19:40:37 +00:00
|
|
|
|
context = gtk_widget_get_style_context (widget);
|
2011-12-15 01:39:00 +00:00
|
|
|
|
state = gtk_widget_get_state_flags (widget);
|
2010-08-11 21:17:18 +00:00
|
|
|
|
|
2010-08-12 15:14:51 +00:00
|
|
|
|
day = priv->day[row][col];
|
|
|
|
|
show_details = (priv->display_flags & GTK_CALENDAR_SHOW_DETAILS);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
|
|
|
|
|
calendar_day_rectangle (calendar, row, col, &day_rect);
|
2011-01-10 19:40:37 +00:00
|
|
|
|
|
|
|
|
|
gtk_style_context_save (context);
|
|
|
|
|
|
2011-12-15 01:39:00 +00:00
|
|
|
|
state &= ~(GTK_STATE_FLAG_INCONSISTENT | GTK_STATE_FLAG_ACTIVE | GTK_STATE_FLAG_SELECTED);
|
|
|
|
|
|
|
|
|
|
if (priv->day_month[row][col] == MONTH_PREV ||
|
|
|
|
|
priv->day_month[row][col] == MONTH_NEXT)
|
|
|
|
|
state |= GTK_STATE_FLAG_INCONSISTENT;
|
2011-01-10 19:40:37 +00:00
|
|
|
|
else
|
1998-09-27 18:32:00 +00:00
|
|
|
|
{
|
2011-12-15 01:39:00 +00:00
|
|
|
|
if (priv->marked_date[day-1])
|
|
|
|
|
state |= GTK_STATE_FLAG_ACTIVE;
|
2011-01-10 19:40:37 +00:00
|
|
|
|
|
2011-12-15 01:39:00 +00:00
|
|
|
|
if (priv->selected_day == day)
|
2011-01-10 19:40:37 +00:00
|
|
|
|
{
|
2011-12-15 01:39:00 +00:00
|
|
|
|
state |= GTK_STATE_FLAG_SELECTED;
|
2011-01-10 19:40:37 +00:00
|
|
|
|
|
2011-12-15 01:39:00 +00:00
|
|
|
|
gtk_style_context_set_state (context, state);
|
|
|
|
|
gtk_render_background (context, cr,
|
|
|
|
|
day_rect.x, day_rect.y,
|
|
|
|
|
day_rect.width, day_rect.height);
|
2011-01-10 19:40:37 +00:00
|
|
|
|
}
|
1998-10-05 03:52:48 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-01-10 19:40:37 +00:00
|
|
|
|
gtk_style_context_set_state (context, state);
|
|
|
|
|
|
2006-01-25 16:26:41 +00:00
|
|
|
|
/* Translators: this defines whether the day numbers should use
|
2006-01-25 17:08:51 +00:00
|
|
|
|
* localized digits or the ones used in English (0123...).
|
2006-01-25 16:26:41 +00:00
|
|
|
|
*
|
2006-03-30 22:56:09 +00:00
|
|
|
|
* Translate to "%Id" if you want to use localized digits, or
|
2008-10-27 01:42:28 +00:00
|
|
|
|
* translate to "%d" otherwise.
|
2006-01-25 16:26:41 +00:00
|
|
|
|
*
|
|
|
|
|
* Note that translating this doesn't guarantee that you get localized
|
2008-10-27 01:42:28 +00:00
|
|
|
|
* digits. That needs support from your system and locale definition
|
2006-01-25 16:26:41 +00:00
|
|
|
|
* too.
|
|
|
|
|
*/
|
2008-10-27 01:42:28 +00:00
|
|
|
|
g_snprintf (buffer, sizeof (buffer), C_("calendar:day:digits", "%d"), day);
|
2007-12-28 09:26:20 +00:00
|
|
|
|
|
|
|
|
|
/* Get extra information to show, if any: */
|
|
|
|
|
|
2010-02-09 02:18:13 +00:00
|
|
|
|
detail = gtk_calendar_get_detail (calendar, row, col);
|
2007-12-28 09:26:20 +00:00
|
|
|
|
|
2000-07-02 22:30:54 +00:00
|
|
|
|
layout = gtk_widget_create_pango_layout (widget, buffer);
|
2007-12-28 09:26:20 +00:00
|
|
|
|
pango_layout_set_alignment (layout, PANGO_ALIGN_CENTER);
|
2000-07-02 21:32:56 +00:00
|
|
|
|
pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
2007-12-28 09:26:20 +00:00
|
|
|
|
x_loc = day_rect.x + (day_rect.width - logical_rect.width) / 2;
|
|
|
|
|
y_loc = day_rect.y;
|
2007-12-28 09:39:34 +00:00
|
|
|
|
|
2011-01-10 19:40:37 +00:00
|
|
|
|
gtk_render_layout (context, cr, x_loc, y_loc, layout);
|
2007-12-28 09:39:34 +00:00
|
|
|
|
|
2010-08-12 15:14:51 +00:00
|
|
|
|
if (priv->day_month[row][col] == MONTH_CURRENT &&
|
|
|
|
|
(priv->marked_date[day-1] || (detail && !show_details)))
|
2011-01-10 19:40:37 +00:00
|
|
|
|
gtk_render_layout (context, cr, x_loc - 1, y_loc, layout);
|
1998-10-05 03:52:48 +00:00
|
|
|
|
|
2007-12-28 09:26:20 +00:00
|
|
|
|
y_loc += priv->max_day_char_descent;
|
|
|
|
|
|
2007-12-28 09:39:34 +00:00
|
|
|
|
if (priv->detail_func && show_details)
|
2007-12-28 09:26:20 +00:00
|
|
|
|
{
|
2011-01-10 19:40:37 +00:00
|
|
|
|
GdkRGBA color;
|
|
|
|
|
|
2007-12-28 09:36:57 +00:00
|
|
|
|
cairo_save (cr);
|
|
|
|
|
|
2011-01-10 19:40:37 +00:00
|
|
|
|
gtk_style_context_get_color (context, state, &color);
|
|
|
|
|
gdk_cairo_set_source_rgba (cr, &color);
|
2007-12-28 09:36:57 +00:00
|
|
|
|
|
2007-12-28 09:26:20 +00:00
|
|
|
|
cairo_set_line_width (cr, 1);
|
2007-12-28 09:36:57 +00:00
|
|
|
|
cairo_move_to (cr, day_rect.x + 2, y_loc + 0.5);
|
|
|
|
|
cairo_line_to (cr, day_rect.x + day_rect.width - 2, y_loc + 0.5);
|
2007-12-28 09:26:20 +00:00
|
|
|
|
cairo_stroke (cr);
|
|
|
|
|
|
2007-12-28 09:36:57 +00:00
|
|
|
|
cairo_restore (cr);
|
|
|
|
|
|
2007-12-28 09:26:20 +00:00
|
|
|
|
y_loc += 2;
|
|
|
|
|
}
|
|
|
|
|
|
2007-12-28 09:39:34 +00:00
|
|
|
|
if (detail && show_details)
|
2007-12-28 09:26:20 +00:00
|
|
|
|
{
|
|
|
|
|
gchar *markup = g_strconcat ("<small>", detail, "</small>", NULL);
|
|
|
|
|
pango_layout_set_markup (layout, markup, -1);
|
|
|
|
|
g_free (markup);
|
|
|
|
|
|
2010-08-12 15:14:51 +00:00
|
|
|
|
if (day == priv->selected_day)
|
2007-12-28 09:26:20 +00:00
|
|
|
|
{
|
|
|
|
|
/* Stripping colors as they conflict with selection marking. */
|
|
|
|
|
|
|
|
|
|
PangoAttrList *attrs = pango_layout_get_attributes (layout);
|
|
|
|
|
PangoAttrList *colors = NULL;
|
|
|
|
|
|
|
|
|
|
if (attrs)
|
|
|
|
|
colors = pango_attr_list_filter (attrs, is_color_attribute, NULL);
|
|
|
|
|
if (colors)
|
|
|
|
|
pango_attr_list_unref (colors);
|
|
|
|
|
}
|
|
|
|
|
|
2008-01-22 15:03:03 +00:00
|
|
|
|
pango_layout_set_wrap (layout, PANGO_WRAP_WORD_CHAR);
|
|
|
|
|
pango_layout_set_width (layout, PANGO_SCALE * day_rect.width);
|
2007-12-28 09:26:20 +00:00
|
|
|
|
|
2008-01-22 15:03:03 +00:00
|
|
|
|
if (priv->detail_height_rows)
|
2007-12-28 09:36:06 +00:00
|
|
|
|
{
|
2008-01-22 15:03:03 +00:00
|
|
|
|
gint dy = day_rect.height - (y_loc - day_rect.y);
|
|
|
|
|
pango_layout_set_height (layout, PANGO_SCALE * dy);
|
|
|
|
|
pango_layout_set_ellipsize (layout, PANGO_ELLIPSIZE_END);
|
2007-12-28 09:36:06 +00:00
|
|
|
|
}
|
2007-12-28 09:26:20 +00:00
|
|
|
|
|
2008-01-22 15:03:03 +00:00
|
|
|
|
cairo_move_to (cr, day_rect.x, y_loc);
|
|
|
|
|
pango_cairo_show_layout (cr, layout);
|
2007-12-28 09:26:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-08-10 14:00:38 +00:00
|
|
|
|
if (gtk_widget_has_visible_focus (widget) &&
|
|
|
|
|
priv->focus_row == row && priv->focus_col == col)
|
2011-01-10 19:40:37 +00:00
|
|
|
|
gtk_render_focus (context, cr,
|
|
|
|
|
day_rect.x, day_rect.y,
|
|
|
|
|
day_rect.width, day_rect.height);
|
1998-10-05 03:52:48 +00:00
|
|
|
|
|
2007-12-28 09:36:06 +00:00
|
|
|
|
if (overflow)
|
|
|
|
|
priv->detail_overflow[row] |= (1 << col);
|
|
|
|
|
else
|
|
|
|
|
priv->detail_overflow[row] &= ~(1 << col);
|
|
|
|
|
|
2011-01-10 19:40:37 +00:00
|
|
|
|
gtk_style_context_restore (context);
|
2002-10-09 22:11:08 +00:00
|
|
|
|
g_object_unref (layout);
|
2008-01-17 16:42:04 +00:00
|
|
|
|
g_free (detail);
|
1998-09-27 18:32:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
1998-10-01 13:24:42 +00:00
|
|
|
|
static void
|
2010-09-04 17:07:39 +00:00
|
|
|
|
calendar_paint_main (GtkCalendar *calendar,
|
|
|
|
|
cairo_t *cr)
|
1998-09-27 18:32:00 +00:00
|
|
|
|
{
|
2010-09-23 09:53:54 +00:00
|
|
|
|
gint row, col;
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
2010-09-04 17:16:26 +00:00
|
|
|
|
cairo_save (cr);
|
|
|
|
|
|
1998-09-27 18:32:00 +00:00
|
|
|
|
for (col = 0; col < 7; col++)
|
|
|
|
|
for (row = 0; row < 6; row++)
|
2010-09-04 17:07:39 +00:00
|
|
|
|
calendar_paint_day (calendar, cr, row, col);
|
2010-09-04 17:16:26 +00:00
|
|
|
|
|
|
|
|
|
cairo_restore (cr);
|
1998-09-27 18:32:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2005-05-11 19:16:19 +00:00
|
|
|
|
calendar_invalidate_arrow (GtkCalendar *calendar,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
guint arrow)
|
1998-09-27 18:32:00 +00:00
|
|
|
|
{
|
2005-05-11 19:16:19 +00:00
|
|
|
|
GtkCalendarPrivate *priv = GTK_CALENDAR_GET_PRIVATE (calendar);
|
2010-10-24 05:22:13 +00:00
|
|
|
|
|
|
|
|
|
if (priv->display_flags & GTK_CALENDAR_SHOW_HEADING &&
|
|
|
|
|
priv->arrow_win[arrow])
|
|
|
|
|
{
|
|
|
|
|
GdkRectangle rect;
|
|
|
|
|
GtkAllocation allocation;
|
|
|
|
|
|
|
|
|
|
calendar_arrow_rectangle (calendar, arrow, &rect);
|
|
|
|
|
gtk_widget_get_allocation (GTK_WIDGET (calendar), &allocation);
|
|
|
|
|
gtk_widget_queue_draw_area (GTK_WIDGET (calendar),
|
|
|
|
|
allocation.x + rect.x,
|
|
|
|
|
allocation.y + rect.y,
|
|
|
|
|
rect.width, rect.height);
|
|
|
|
|
}
|
2005-05-11 19:16:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
calendar_paint_arrow (GtkCalendar *calendar,
|
2010-09-04 17:07:39 +00:00
|
|
|
|
cairo_t *cr,
|
2010-10-24 05:22:13 +00:00
|
|
|
|
guint arrow)
|
2005-05-11 19:16:19 +00:00
|
|
|
|
{
|
|
|
|
|
GtkWidget *widget = GTK_WIDGET (calendar);
|
|
|
|
|
GtkCalendarPrivate *priv = GTK_CALENDAR_GET_PRIVATE (widget);
|
2011-01-10 19:40:37 +00:00
|
|
|
|
GtkStyleContext *context;
|
|
|
|
|
GtkStateFlags state;
|
2010-10-24 05:22:13 +00:00
|
|
|
|
GdkRectangle rect;
|
2011-01-10 19:40:37 +00:00
|
|
|
|
gdouble angle;
|
2010-10-24 05:22:13 +00:00
|
|
|
|
|
|
|
|
|
if (!priv->arrow_win[arrow])
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
calendar_arrow_rectangle (calendar, arrow, &rect);
|
|
|
|
|
|
2010-09-04 17:16:26 +00:00
|
|
|
|
cairo_save (cr);
|
|
|
|
|
|
2011-01-10 19:40:37 +00:00
|
|
|
|
context = gtk_widget_get_style_context (widget);
|
2011-12-15 01:44:46 +00:00
|
|
|
|
state = gtk_widget_get_state_flags (widget);
|
|
|
|
|
|
|
|
|
|
if (priv->arrow_prelight & (1 << arrow))
|
|
|
|
|
state |= GTK_STATE_FLAG_PRELIGHT;
|
|
|
|
|
else
|
|
|
|
|
state &= ~(GTK_STATE_FLAG_PRELIGHT);
|
2010-08-11 21:17:18 +00:00
|
|
|
|
|
2011-01-10 19:40:37 +00:00
|
|
|
|
gtk_style_context_save (context);
|
|
|
|
|
gtk_style_context_set_state (context, state);
|
|
|
|
|
gtk_style_context_add_class (context, GTK_STYLE_CLASS_BUTTON);
|
|
|
|
|
|
|
|
|
|
gtk_render_background (context, cr,
|
|
|
|
|
rect.x, rect.y,
|
|
|
|
|
rect.width, rect.height);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
|
2010-10-24 05:22:13 +00:00
|
|
|
|
if (arrow == ARROW_MONTH_LEFT || arrow == ARROW_YEAR_LEFT)
|
2011-01-10 19:40:37 +00:00
|
|
|
|
angle = 3 * (G_PI / 2);
|
2010-10-24 05:22:13 +00:00
|
|
|
|
else
|
2011-01-10 19:40:37 +00:00
|
|
|
|
angle = G_PI / 2;
|
|
|
|
|
|
|
|
|
|
gtk_render_arrow (context, cr, angle,
|
|
|
|
|
rect.x + (rect.width - 8) / 2,
|
|
|
|
|
rect.y + (rect.height - 8) / 2,
|
|
|
|
|
8);
|
2010-09-04 17:16:26 +00:00
|
|
|
|
|
2011-01-10 19:40:37 +00:00
|
|
|
|
gtk_style_context_restore (context);
|
2010-09-04 17:16:26 +00:00
|
|
|
|
cairo_restore (cr);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
2010-09-04 17:16:26 +00:00
|
|
|
|
gtk_calendar_draw (GtkWidget *widget,
|
|
|
|
|
cairo_t *cr)
|
2005-05-11 19:16:19 +00:00
|
|
|
|
{
|
|
|
|
|
GtkCalendar *calendar = GTK_CALENDAR (widget);
|
|
|
|
|
GtkCalendarPrivate *priv = GTK_CALENDAR_GET_PRIVATE (widget);
|
|
|
|
|
int i;
|
|
|
|
|
|
2010-09-04 17:16:26 +00:00
|
|
|
|
if (gtk_cairo_should_draw_window (cr, gtk_widget_get_window (widget)))
|
1998-09-27 18:32:00 +00:00
|
|
|
|
{
|
2011-01-10 19:40:37 +00:00
|
|
|
|
GtkStyleContext *context;
|
|
|
|
|
|
|
|
|
|
context = gtk_widget_get_style_context (widget);
|
|
|
|
|
|
|
|
|
|
gtk_style_context_save (context);
|
|
|
|
|
gtk_style_context_add_class (context, GTK_STYLE_CLASS_VIEW);
|
|
|
|
|
|
|
|
|
|
gtk_render_background (context, cr, 0, 0,
|
|
|
|
|
gtk_widget_get_allocated_width (widget),
|
|
|
|
|
gtk_widget_get_allocated_height (widget));
|
|
|
|
|
gtk_render_frame (context, cr, 0, 0,
|
2010-09-04 17:16:26 +00:00
|
|
|
|
gtk_widget_get_allocated_width (widget),
|
|
|
|
|
gtk_widget_get_allocated_height (widget));
|
2011-04-07 19:21:32 +00:00
|
|
|
|
|
|
|
|
|
gtk_style_context_restore (context);
|
2010-09-04 17:16:26 +00:00
|
|
|
|
}
|
2005-05-11 19:16:19 +00:00
|
|
|
|
|
2010-10-24 05:22:13 +00:00
|
|
|
|
calendar_paint_main (calendar, cr);
|
2010-08-11 21:17:18 +00:00
|
|
|
|
|
2010-10-24 05:22:13 +00:00
|
|
|
|
if (priv->display_flags & GTK_CALENDAR_SHOW_HEADING)
|
|
|
|
|
{
|
|
|
|
|
calendar_paint_header (calendar, cr);
|
|
|
|
|
for (i = 0; i < 4; i++)
|
|
|
|
|
calendar_paint_arrow (calendar, cr, i);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (priv->display_flags & GTK_CALENDAR_SHOW_DAY_NAMES)
|
2010-09-04 17:16:26 +00:00
|
|
|
|
calendar_paint_day_names (calendar, cr);
|
2010-10-24 05:22:13 +00:00
|
|
|
|
|
|
|
|
|
if (priv->display_flags & GTK_CALENDAR_SHOW_WEEK_NUMBERS)
|
2010-09-04 17:16:26 +00:00
|
|
|
|
calendar_paint_week_numbers (calendar, cr);
|
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
return FALSE;
|
1998-09-27 18:32:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-08-11 21:17:18 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
/****************************************
|
|
|
|
|
* Mouse handling *
|
|
|
|
|
****************************************/
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
calendar_arrow_action (GtkCalendar *calendar,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
guint arrow)
|
2003-05-08 00:25:51 +00:00
|
|
|
|
{
|
2005-05-11 19:16:19 +00:00
|
|
|
|
switch (arrow)
|
|
|
|
|
{
|
|
|
|
|
case ARROW_YEAR_LEFT:
|
|
|
|
|
calendar_set_year_prev (calendar);
|
|
|
|
|
break;
|
|
|
|
|
case ARROW_YEAR_RIGHT:
|
|
|
|
|
calendar_set_year_next (calendar);
|
|
|
|
|
break;
|
|
|
|
|
case ARROW_MONTH_LEFT:
|
|
|
|
|
calendar_set_month_prev (calendar);
|
|
|
|
|
break;
|
|
|
|
|
case ARROW_MONTH_RIGHT:
|
|
|
|
|
calendar_set_month_next (calendar);
|
|
|
|
|
break;
|
|
|
|
|
default:;
|
|
|
|
|
/* do nothing */
|
|
|
|
|
}
|
2003-05-08 00:25:51 +00:00
|
|
|
|
}
|
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
static gboolean
|
|
|
|
|
calendar_timer (gpointer data)
|
2003-05-08 00:25:51 +00:00
|
|
|
|
{
|
2005-05-11 19:16:19 +00:00
|
|
|
|
GtkCalendar *calendar = data;
|
|
|
|
|
GtkCalendarPrivate *priv = GTK_CALENDAR_GET_PRIVATE (calendar);
|
|
|
|
|
gboolean retval = FALSE;
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
if (priv->timer)
|
1998-09-27 18:32:00 +00:00
|
|
|
|
{
|
2005-05-11 19:16:19 +00:00
|
|
|
|
calendar_arrow_action (calendar, priv->click_child);
|
|
|
|
|
|
|
|
|
|
if (priv->need_timer)
|
2011-01-24 02:50:39 +00:00
|
|
|
|
{
|
2005-11-22 12:40:15 +00:00
|
|
|
|
GtkSettings *settings;
|
|
|
|
|
guint timeout;
|
|
|
|
|
|
|
|
|
|
settings = gtk_widget_get_settings (GTK_WIDGET (calendar));
|
|
|
|
|
g_object_get (settings, "gtk-timeout-repeat", &timeout, NULL);
|
|
|
|
|
|
2011-01-24 02:50:39 +00:00
|
|
|
|
priv->need_timer = FALSE;
|
|
|
|
|
priv->timer = gdk_threads_add_timeout_full (G_PRIORITY_DEFAULT_IDLE,
|
|
|
|
|
timeout * SCROLL_DELAY_FACTOR,
|
|
|
|
|
(GSourceFunc) calendar_timer,
|
|
|
|
|
(gpointer) calendar, NULL);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
retval = TRUE;
|
2005-05-11 19:16:19 +00:00
|
|
|
|
}
|
2003-08-08 22:44:14 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
return retval;
|
1998-09-27 18:32:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
static void
|
|
|
|
|
calendar_start_spinning (GtkCalendar *calendar,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
gint click_child)
|
1998-09-27 18:32:00 +00:00
|
|
|
|
{
|
2005-05-11 19:16:19 +00:00
|
|
|
|
GtkCalendarPrivate *priv = GTK_CALENDAR_GET_PRIVATE (calendar);
|
|
|
|
|
|
|
|
|
|
priv->click_child = click_child;
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
if (!priv->timer)
|
1998-09-27 18:32:00 +00:00
|
|
|
|
{
|
2005-11-22 12:40:15 +00:00
|
|
|
|
GtkSettings *settings;
|
|
|
|
|
guint timeout;
|
|
|
|
|
|
|
|
|
|
settings = gtk_widget_get_settings (GTK_WIDGET (calendar));
|
|
|
|
|
g_object_get (settings, "gtk-timeout-initial", &timeout, NULL);
|
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
priv->need_timer = TRUE;
|
2006-12-22 19:10:43 +00:00
|
|
|
|
priv->timer = gdk_threads_add_timeout_full (G_PRIORITY_DEFAULT_IDLE,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
timeout,
|
|
|
|
|
(GSourceFunc) calendar_timer,
|
|
|
|
|
(gpointer) calendar, NULL);
|
1998-09-27 18:32:00 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2002-03-21 00:50:15 +00:00
|
|
|
|
static void
|
2005-05-11 19:16:19 +00:00
|
|
|
|
calendar_stop_spinning (GtkCalendar *calendar)
|
2002-03-21 00:50:15 +00:00
|
|
|
|
{
|
2005-05-11 19:16:19 +00:00
|
|
|
|
GtkCalendarPrivate *priv = GTK_CALENDAR_GET_PRIVATE (calendar);
|
2002-03-21 00:50:15 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
if (priv->timer)
|
|
|
|
|
{
|
|
|
|
|
g_source_remove (priv->timer);
|
|
|
|
|
priv->timer = 0;
|
|
|
|
|
priv->need_timer = FALSE;
|
|
|
|
|
}
|
2002-03-21 00:50:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
static void
|
2010-10-24 05:22:13 +00:00
|
|
|
|
calendar_main_button_press (GtkCalendar *calendar,
|
|
|
|
|
GdkEventButton *event)
|
1998-09-27 18:32:00 +00:00
|
|
|
|
{
|
2005-05-11 19:16:19 +00:00
|
|
|
|
GtkWidget *widget = GTK_WIDGET (calendar);
|
|
|
|
|
GtkCalendarPrivate *priv = GTK_CALENDAR_GET_PRIVATE (calendar);
|
|
|
|
|
gint x, y;
|
2010-10-24 05:22:13 +00:00
|
|
|
|
gint win_x, win_y;
|
2005-05-11 19:16:19 +00:00
|
|
|
|
gint row, col;
|
|
|
|
|
gint day_month;
|
|
|
|
|
gint day;
|
2010-10-24 05:22:13 +00:00
|
|
|
|
GtkAllocation allocation;
|
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
x = (gint) (event->x);
|
|
|
|
|
y = (gint) (event->y);
|
2010-10-24 05:22:13 +00:00
|
|
|
|
|
|
|
|
|
gdk_window_get_position (priv->main_win, &win_x, &win_y);
|
|
|
|
|
gtk_widget_get_allocation (widget, &allocation);
|
|
|
|
|
|
|
|
|
|
row = calendar_row_from_y (calendar, y + win_y - allocation.y);
|
|
|
|
|
col = calendar_column_from_x (calendar, x + win_x - allocation.x);
|
1998-09-27 18:32:00 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
/* If row or column isn't found, just return. */
|
|
|
|
|
if (row == -1 || col == -1)
|
|
|
|
|
return;
|
2010-10-24 05:22:13 +00:00
|
|
|
|
|
2010-08-12 15:14:51 +00:00
|
|
|
|
day_month = priv->day_month[row][col];
|
2005-05-11 19:16:19 +00:00
|
|
|
|
|
|
|
|
|
if (event->type == GDK_BUTTON_PRESS)
|
2000-02-26 11:39:07 +00:00
|
|
|
|
{
|
2010-08-12 15:14:51 +00:00
|
|
|
|
day = priv->day[row][col];
|
2010-10-24 05:22:13 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
if (day_month == MONTH_PREV)
|
2010-10-24 05:22:13 +00:00
|
|
|
|
calendar_set_month_prev (calendar);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
else if (day_month == MONTH_NEXT)
|
2010-10-24 05:22:13 +00:00
|
|
|
|
calendar_set_month_next (calendar);
|
|
|
|
|
|
2010-03-01 03:21:41 +00:00
|
|
|
|
if (!gtk_widget_has_focus (widget))
|
2010-10-24 05:22:13 +00:00
|
|
|
|
gtk_widget_grab_focus (widget);
|
|
|
|
|
|
|
|
|
|
if (event->button == 1)
|
|
|
|
|
{
|
|
|
|
|
priv->in_drag = 1;
|
|
|
|
|
priv->drag_start_x = x;
|
|
|
|
|
priv->drag_start_y = y;
|
|
|
|
|
}
|
2005-05-11 19:16:19 +00:00
|
|
|
|
|
|
|
|
|
calendar_select_and_focus_day (calendar, day);
|
2000-02-26 11:39:07 +00:00
|
|
|
|
}
|
2005-05-11 19:16:19 +00:00
|
|
|
|
else if (event->type == GDK_2BUTTON_PRESS)
|
1998-09-27 18:32:00 +00:00
|
|
|
|
{
|
2005-05-11 19:16:19 +00:00
|
|
|
|
priv->in_drag = 0;
|
|
|
|
|
if (day_month == MONTH_CURRENT)
|
2010-10-24 05:22:13 +00:00
|
|
|
|
g_signal_emit (calendar,
|
|
|
|
|
gtk_calendar_signals[DAY_SELECTED_DOUBLE_CLICK_SIGNAL],
|
|
|
|
|
0);
|
1998-09-27 18:32:00 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
static gboolean
|
2010-10-24 05:22:13 +00:00
|
|
|
|
gtk_calendar_button_press (GtkWidget *widget,
|
|
|
|
|
GdkEventButton *event)
|
1998-09-27 18:32:00 +00:00
|
|
|
|
{
|
2005-05-11 19:16:19 +00:00
|
|
|
|
GtkCalendar *calendar = GTK_CALENDAR (widget);
|
|
|
|
|
GtkCalendarPrivate *priv = GTK_CALENDAR_GET_PRIVATE (widget);
|
|
|
|
|
gint arrow = -1;
|
2010-10-24 05:22:13 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
if (event->window == priv->main_win)
|
|
|
|
|
calendar_main_button_press (calendar, event);
|
2001-03-24 06:10:40 +00:00
|
|
|
|
|
2010-03-01 03:21:41 +00:00
|
|
|
|
if (!gtk_widget_has_focus (widget))
|
2003-05-20 22:37:57 +00:00
|
|
|
|
gtk_widget_grab_focus (widget);
|
1999-02-20 19:09:21 +00:00
|
|
|
|
|
2003-05-20 22:37:57 +00:00
|
|
|
|
for (arrow = ARROW_YEAR_LEFT; arrow <= ARROW_MONTH_RIGHT; arrow++)
|
|
|
|
|
{
|
2005-05-11 19:16:19 +00:00
|
|
|
|
if (event->window == priv->arrow_win[arrow])
|
2011-01-24 02:50:39 +00:00
|
|
|
|
{
|
2010-10-24 05:22:13 +00:00
|
|
|
|
|
2011-01-24 02:50:39 +00:00
|
|
|
|
/* only call the action on single click, not double */
|
|
|
|
|
if (event->type == GDK_BUTTON_PRESS)
|
|
|
|
|
{
|
|
|
|
|
if (event->button == 1)
|
|
|
|
|
calendar_start_spinning (calendar, arrow);
|
2004-06-10 04:09:33 +00:00
|
|
|
|
|
2011-01-24 02:50:39 +00:00
|
|
|
|
calendar_arrow_action (calendar, arrow);
|
|
|
|
|
}
|
2001-03-24 06:10:40 +00:00
|
|
|
|
|
2011-01-24 02:50:39 +00:00
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
2003-05-20 22:37:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
2011-01-24 02:50:39 +00:00
|
|
|
|
gtk_calendar_button_release (GtkWidget *widget,
|
|
|
|
|
GdkEventButton *event)
|
2003-05-20 22:37:57 +00:00
|
|
|
|
{
|
2005-05-11 19:16:19 +00:00
|
|
|
|
GtkCalendar *calendar = GTK_CALENDAR (widget);
|
|
|
|
|
GtkCalendarPrivate *priv = GTK_CALENDAR_GET_PRIVATE (widget);
|
2003-08-08 23:01:17 +00:00
|
|
|
|
|
2010-10-24 05:22:13 +00:00
|
|
|
|
if (event->button == 1)
|
2003-08-08 23:01:17 +00:00
|
|
|
|
{
|
2005-05-11 19:16:19 +00:00
|
|
|
|
calendar_stop_spinning (calendar);
|
2003-08-08 23:01:17 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
if (priv->in_drag)
|
2011-01-24 02:50:39 +00:00
|
|
|
|
priv->in_drag = 0;
|
2003-08-08 23:01:17 +00:00
|
|
|
|
}
|
2003-05-20 22:37:57 +00:00
|
|
|
|
|
|
|
|
|
return TRUE;
|
1998-09-27 18:32:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-03-16 20:12:40 +00:00
|
|
|
|
static gboolean
|
2011-01-24 02:50:39 +00:00
|
|
|
|
gtk_calendar_motion_notify (GtkWidget *widget,
|
|
|
|
|
GdkEventMotion *event)
|
1998-09-27 18:32:00 +00:00
|
|
|
|
{
|
2005-05-11 19:16:19 +00:00
|
|
|
|
GtkCalendarPrivate *priv = GTK_CALENDAR_GET_PRIVATE (widget);
|
2003-08-08 23:01:17 +00:00
|
|
|
|
|
2010-10-24 05:22:13 +00:00
|
|
|
|
if (priv->in_drag)
|
|
|
|
|
{
|
|
|
|
|
if (gtk_drag_check_threshold (widget,
|
|
|
|
|
priv->drag_start_x, priv->drag_start_y,
|
|
|
|
|
event->x, event->y))
|
|
|
|
|
{
|
|
|
|
|
GdkDragContext *context;
|
|
|
|
|
GtkTargetList *target_list = gtk_target_list_new (NULL, 0);
|
|
|
|
|
gtk_target_list_add_text_targets (target_list, 0);
|
|
|
|
|
context = gtk_drag_begin (widget, target_list, GDK_ACTION_COPY,
|
|
|
|
|
1, (GdkEvent *)event);
|
|
|
|
|
|
|
|
|
|
priv->in_drag = 0;
|
|
|
|
|
gtk_target_list_unref (target_list);
|
|
|
|
|
gtk_drag_set_icon_default (context);
|
|
|
|
|
}
|
1998-09-27 18:32:00 +00:00
|
|
|
|
}
|
2010-10-24 05:22:13 +00:00
|
|
|
|
|
1998-09-27 18:32:00 +00:00
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
2001-03-16 20:12:40 +00:00
|
|
|
|
static gboolean
|
2011-01-24 02:50:39 +00:00
|
|
|
|
gtk_calendar_enter_notify (GtkWidget *widget,
|
|
|
|
|
GdkEventCrossing *event)
|
1998-09-27 18:32:00 +00:00
|
|
|
|
{
|
2005-05-11 19:16:19 +00:00
|
|
|
|
GtkCalendar *calendar = GTK_CALENDAR (widget);
|
|
|
|
|
GtkCalendarPrivate *priv = GTK_CALENDAR_GET_PRIVATE (widget);
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
if (event->window == priv->arrow_win[ARROW_MONTH_LEFT])
|
1998-09-27 18:32:00 +00:00
|
|
|
|
{
|
2011-12-15 01:44:46 +00:00
|
|
|
|
priv->arrow_prelight |= (1 << ARROW_MONTH_LEFT);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
calendar_invalidate_arrow (calendar, ARROW_MONTH_LEFT);
|
1998-09-27 18:32:00 +00:00
|
|
|
|
}
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
if (event->window == priv->arrow_win[ARROW_MONTH_RIGHT])
|
1998-09-27 18:32:00 +00:00
|
|
|
|
{
|
2011-12-15 01:44:46 +00:00
|
|
|
|
priv->arrow_prelight |= (1 << ARROW_MONTH_RIGHT);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
calendar_invalidate_arrow (calendar, ARROW_MONTH_RIGHT);
|
1998-09-27 18:32:00 +00:00
|
|
|
|
}
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
if (event->window == priv->arrow_win[ARROW_YEAR_LEFT])
|
1998-09-27 18:32:00 +00:00
|
|
|
|
{
|
2011-12-15 01:44:46 +00:00
|
|
|
|
priv->arrow_prelight |= (1 << ARROW_YEAR_LEFT);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
calendar_invalidate_arrow (calendar, ARROW_YEAR_LEFT);
|
1998-09-27 18:32:00 +00:00
|
|
|
|
}
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
if (event->window == priv->arrow_win[ARROW_YEAR_RIGHT])
|
1998-09-27 18:32:00 +00:00
|
|
|
|
{
|
2011-12-15 01:44:46 +00:00
|
|
|
|
priv->arrow_prelight |= (1 << ARROW_YEAR_RIGHT);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
calendar_invalidate_arrow (calendar, ARROW_YEAR_RIGHT);
|
1998-09-27 18:32:00 +00:00
|
|
|
|
}
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
1998-09-27 18:32:00 +00:00
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
2001-03-16 20:12:40 +00:00
|
|
|
|
static gboolean
|
2010-10-24 05:22:13 +00:00
|
|
|
|
gtk_calendar_leave_notify (GtkWidget *widget,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
GdkEventCrossing *event)
|
1998-09-27 18:32:00 +00:00
|
|
|
|
{
|
2005-05-11 19:16:19 +00:00
|
|
|
|
GtkCalendar *calendar = GTK_CALENDAR (widget);
|
|
|
|
|
GtkCalendarPrivate *priv = GTK_CALENDAR_GET_PRIVATE (widget);
|
2010-10-24 05:22:13 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
if (event->window == priv->arrow_win[ARROW_MONTH_LEFT])
|
1998-09-27 18:32:00 +00:00
|
|
|
|
{
|
2011-12-15 01:44:46 +00:00
|
|
|
|
priv->arrow_prelight &= ~(1 << ARROW_MONTH_LEFT);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
calendar_invalidate_arrow (calendar, ARROW_MONTH_LEFT);
|
1998-09-27 18:32:00 +00:00
|
|
|
|
}
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
if (event->window == priv->arrow_win[ARROW_MONTH_RIGHT])
|
1998-09-27 18:32:00 +00:00
|
|
|
|
{
|
2011-12-15 01:44:46 +00:00
|
|
|
|
priv->arrow_prelight &= ~(1 << ARROW_MONTH_RIGHT);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
calendar_invalidate_arrow (calendar, ARROW_MONTH_RIGHT);
|
1998-09-27 18:32:00 +00:00
|
|
|
|
}
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
if (event->window == priv->arrow_win[ARROW_YEAR_LEFT])
|
1998-09-27 18:32:00 +00:00
|
|
|
|
{
|
2011-12-15 01:44:46 +00:00
|
|
|
|
priv->arrow_prelight &= ~(1 << ARROW_YEAR_LEFT);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
calendar_invalidate_arrow (calendar, ARROW_YEAR_LEFT);
|
1998-09-27 18:32:00 +00:00
|
|
|
|
}
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
if (event->window == priv->arrow_win[ARROW_YEAR_RIGHT])
|
1998-09-27 18:32:00 +00:00
|
|
|
|
{
|
2011-12-15 01:44:46 +00:00
|
|
|
|
priv->arrow_prelight &= ~(1 << ARROW_YEAR_RIGHT);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
calendar_invalidate_arrow (calendar, ARROW_YEAR_RIGHT);
|
1998-09-27 18:32:00 +00:00
|
|
|
|
}
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
1998-09-27 18:32:00 +00:00
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
2003-08-08 22:03:25 +00:00
|
|
|
|
static gboolean
|
|
|
|
|
gtk_calendar_scroll (GtkWidget *widget,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
GdkEventScroll *event)
|
2003-08-08 22:03:25 +00:00
|
|
|
|
{
|
|
|
|
|
GtkCalendar *calendar = GTK_CALENDAR (widget);
|
|
|
|
|
|
2011-01-24 02:50:39 +00:00
|
|
|
|
if (event->direction == GDK_SCROLL_UP)
|
2003-08-08 22:03:25 +00:00
|
|
|
|
{
|
2010-03-01 03:21:41 +00:00
|
|
|
|
if (!gtk_widget_has_focus (widget))
|
2011-01-24 02:50:39 +00:00
|
|
|
|
gtk_widget_grab_focus (widget);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
calendar_set_month_prev (calendar);
|
2003-08-08 22:03:25 +00:00
|
|
|
|
}
|
2011-01-24 02:50:39 +00:00
|
|
|
|
else if (event->direction == GDK_SCROLL_DOWN)
|
2003-08-08 22:03:25 +00:00
|
|
|
|
{
|
2010-03-01 03:21:41 +00:00
|
|
|
|
if (!gtk_widget_has_focus (widget))
|
2011-01-24 02:50:39 +00:00
|
|
|
|
gtk_widget_grab_focus (widget);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
calendar_set_month_next (calendar);
|
2003-08-08 22:03:25 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
|
|
|
|
|
/****************************************
|
|
|
|
|
* Key handling *
|
|
|
|
|
****************************************/
|
|
|
|
|
|
2011-01-24 02:50:39 +00:00
|
|
|
|
static void
|
|
|
|
|
move_focus (GtkCalendar *calendar,
|
|
|
|
|
gint direction)
|
2003-08-08 22:17:34 +00:00
|
|
|
|
{
|
2010-08-12 15:14:51 +00:00
|
|
|
|
GtkCalendarPrivate *priv = calendar->priv;
|
2003-08-08 22:17:34 +00:00
|
|
|
|
GtkTextDirection text_dir = gtk_widget_get_direction (GTK_WIDGET (calendar));
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
2003-08-08 22:17:34 +00:00
|
|
|
|
if ((text_dir == GTK_TEXT_DIR_LTR && direction == -1) ||
|
2011-01-24 02:50:39 +00:00
|
|
|
|
(text_dir == GTK_TEXT_DIR_RTL && direction == 1))
|
2003-08-08 22:17:34 +00:00
|
|
|
|
{
|
2010-08-12 15:14:51 +00:00
|
|
|
|
if (priv->focus_col > 0)
|
2011-01-24 02:50:39 +00:00
|
|
|
|
priv->focus_col--;
|
2010-08-12 15:14:51 +00:00
|
|
|
|
else if (priv->focus_row > 0)
|
2011-01-24 02:50:39 +00:00
|
|
|
|
{
|
|
|
|
|
priv->focus_col = 6;
|
|
|
|
|
priv->focus_row--;
|
|
|
|
|
}
|
2007-01-19 03:52:03 +00:00
|
|
|
|
|
2010-08-12 15:14:51 +00:00
|
|
|
|
if (priv->focus_col < 0)
|
|
|
|
|
priv->focus_col = 6;
|
|
|
|
|
if (priv->focus_row < 0)
|
|
|
|
|
priv->focus_row = 5;
|
2003-08-08 22:17:34 +00:00
|
|
|
|
}
|
2011-01-24 02:50:39 +00:00
|
|
|
|
else
|
2003-08-08 22:17:34 +00:00
|
|
|
|
{
|
2010-08-12 15:14:51 +00:00
|
|
|
|
if (priv->focus_col < 6)
|
2011-01-24 02:50:39 +00:00
|
|
|
|
priv->focus_col++;
|
2010-08-12 15:14:51 +00:00
|
|
|
|
else if (priv->focus_row < 5)
|
2011-01-24 02:50:39 +00:00
|
|
|
|
{
|
|
|
|
|
priv->focus_col = 0;
|
|
|
|
|
priv->focus_row++;
|
|
|
|
|
}
|
2007-01-19 03:52:03 +00:00
|
|
|
|
|
2010-08-12 15:14:51 +00:00
|
|
|
|
if (priv->focus_col < 0)
|
|
|
|
|
priv->focus_col = 0;
|
|
|
|
|
if (priv->focus_row < 0)
|
|
|
|
|
priv->focus_row = 0;
|
2003-08-08 22:17:34 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2001-03-16 20:12:40 +00:00
|
|
|
|
static gboolean
|
1998-09-27 18:32:00 +00:00
|
|
|
|
gtk_calendar_key_press (GtkWidget *widget,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
GdkEventKey *event)
|
1998-09-27 18:32:00 +00:00
|
|
|
|
{
|
2010-08-12 15:14:51 +00:00
|
|
|
|
GtkCalendar *calendar = GTK_CALENDAR (widget);
|
|
|
|
|
GtkCalendarPrivate *priv = calendar->priv;
|
1998-09-27 18:32:00 +00:00
|
|
|
|
gint return_val;
|
1998-10-05 03:52:48 +00:00
|
|
|
|
gint old_focus_row;
|
|
|
|
|
gint old_focus_col;
|
|
|
|
|
gint row, col, day;
|
2010-08-12 15:14:51 +00:00
|
|
|
|
|
1998-09-27 18:32:00 +00:00
|
|
|
|
return_val = FALSE;
|
2010-08-12 15:14:51 +00:00
|
|
|
|
|
|
|
|
|
old_focus_row = priv->focus_row;
|
|
|
|
|
old_focus_col = priv->focus_col;
|
1998-10-05 03:52:48 +00:00
|
|
|
|
|
1998-09-27 18:32:00 +00:00
|
|
|
|
switch (event->keyval)
|
|
|
|
|
{
|
2010-09-08 17:35:51 +00:00
|
|
|
|
case GDK_KEY_KP_Left:
|
|
|
|
|
case GDK_KEY_Left:
|
1998-09-27 18:32:00 +00:00
|
|
|
|
return_val = TRUE;
|
|
|
|
|
if (event->state & GDK_CONTROL_MASK)
|
2011-01-24 02:50:39 +00:00
|
|
|
|
calendar_set_month_prev (calendar);
|
1998-09-27 18:32:00 +00:00
|
|
|
|
else
|
2011-01-24 02:50:39 +00:00
|
|
|
|
{
|
|
|
|
|
move_focus (calendar, -1);
|
|
|
|
|
calendar_invalidate_day (calendar, old_focus_row, old_focus_col);
|
|
|
|
|
calendar_invalidate_day (calendar, priv->focus_row,
|
|
|
|
|
priv->focus_col);
|
|
|
|
|
}
|
1998-09-27 18:32:00 +00:00
|
|
|
|
break;
|
2010-09-08 17:35:51 +00:00
|
|
|
|
case GDK_KEY_KP_Right:
|
|
|
|
|
case GDK_KEY_Right:
|
1998-09-27 18:32:00 +00:00
|
|
|
|
return_val = TRUE;
|
|
|
|
|
if (event->state & GDK_CONTROL_MASK)
|
2011-01-24 02:50:39 +00:00
|
|
|
|
calendar_set_month_next (calendar);
|
1998-09-27 18:32:00 +00:00
|
|
|
|
else
|
2011-01-24 02:50:39 +00:00
|
|
|
|
{
|
|
|
|
|
move_focus (calendar, 1);
|
|
|
|
|
calendar_invalidate_day (calendar, old_focus_row, old_focus_col);
|
|
|
|
|
calendar_invalidate_day (calendar, priv->focus_row,
|
|
|
|
|
priv->focus_col);
|
|
|
|
|
}
|
1998-09-27 18:32:00 +00:00
|
|
|
|
break;
|
2010-09-08 17:35:51 +00:00
|
|
|
|
case GDK_KEY_KP_Up:
|
|
|
|
|
case GDK_KEY_Up:
|
1998-09-27 18:32:00 +00:00
|
|
|
|
return_val = TRUE;
|
|
|
|
|
if (event->state & GDK_CONTROL_MASK)
|
2011-01-24 02:50:39 +00:00
|
|
|
|
calendar_set_year_prev (calendar);
|
1998-09-27 18:32:00 +00:00
|
|
|
|
else
|
2011-01-24 02:50:39 +00:00
|
|
|
|
{
|
|
|
|
|
if (priv->focus_row > 0)
|
|
|
|
|
priv->focus_row--;
|
2010-08-12 15:14:51 +00:00
|
|
|
|
if (priv->focus_row < 0)
|
|
|
|
|
priv->focus_row = 5;
|
|
|
|
|
if (priv->focus_col < 0)
|
|
|
|
|
priv->focus_col = 6;
|
2011-01-24 02:50:39 +00:00
|
|
|
|
calendar_invalidate_day (calendar, old_focus_row, old_focus_col);
|
|
|
|
|
calendar_invalidate_day (calendar, priv->focus_row,
|
|
|
|
|
priv->focus_col);
|
|
|
|
|
}
|
1998-09-27 18:32:00 +00:00
|
|
|
|
break;
|
2010-09-08 17:35:51 +00:00
|
|
|
|
case GDK_KEY_KP_Down:
|
|
|
|
|
case GDK_KEY_Down:
|
1998-09-27 18:32:00 +00:00
|
|
|
|
return_val = TRUE;
|
|
|
|
|
if (event->state & GDK_CONTROL_MASK)
|
2011-01-24 02:50:39 +00:00
|
|
|
|
calendar_set_year_next (calendar);
|
1998-09-27 18:32:00 +00:00
|
|
|
|
else
|
2011-01-24 02:50:39 +00:00
|
|
|
|
{
|
|
|
|
|
if (priv->focus_row < 5)
|
|
|
|
|
priv->focus_row++;
|
2010-08-12 15:14:51 +00:00
|
|
|
|
if (priv->focus_col < 0)
|
|
|
|
|
priv->focus_col = 0;
|
2011-01-24 02:50:39 +00:00
|
|
|
|
calendar_invalidate_day (calendar, old_focus_row, old_focus_col);
|
|
|
|
|
calendar_invalidate_day (calendar, priv->focus_row,
|
|
|
|
|
priv->focus_col);
|
|
|
|
|
}
|
1998-09-27 18:32:00 +00:00
|
|
|
|
break;
|
2010-09-08 17:35:51 +00:00
|
|
|
|
case GDK_KEY_KP_Space:
|
|
|
|
|
case GDK_KEY_space:
|
2010-08-12 15:14:51 +00:00
|
|
|
|
row = priv->focus_row;
|
|
|
|
|
col = priv->focus_col;
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
1998-10-05 03:52:48 +00:00
|
|
|
|
if (row > -1 && col > -1)
|
2011-01-24 02:50:39 +00:00
|
|
|
|
{
|
|
|
|
|
return_val = TRUE;
|
1998-10-05 03:52:48 +00:00
|
|
|
|
|
2010-08-12 15:14:51 +00:00
|
|
|
|
day = priv->day[row][col];
|
2011-01-24 02:50:39 +00:00
|
|
|
|
if (priv->day_month[row][col] == MONTH_PREV)
|
|
|
|
|
calendar_set_month_prev (calendar);
|
|
|
|
|
else if (priv->day_month[row][col] == MONTH_NEXT)
|
|
|
|
|
calendar_set_month_next (calendar);
|
|
|
|
|
|
|
|
|
|
calendar_select_and_focus_day (calendar, day);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1998-09-27 18:32:00 +00:00
|
|
|
|
return return_val;
|
|
|
|
|
}
|
2003-05-08 00:25:51 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
|
|
|
|
|
/****************************************
|
|
|
|
|
* Misc widget methods *
|
|
|
|
|
****************************************/
|
2003-05-08 00:25:51 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
static void
|
2011-01-10 19:40:37 +00:00
|
|
|
|
gtk_calendar_state_flags_changed (GtkWidget *widget,
|
|
|
|
|
GtkStateFlags previous_state)
|
2005-05-11 19:16:19 +00:00
|
|
|
|
{
|
|
|
|
|
GtkCalendar *calendar = GTK_CALENDAR (widget);
|
|
|
|
|
GtkCalendarPrivate *priv = GTK_CALENDAR_GET_PRIVATE (widget);
|
2010-10-24 05:22:13 +00:00
|
|
|
|
|
2010-02-27 04:24:24 +00:00
|
|
|
|
if (!gtk_widget_is_sensitive (widget))
|
2003-05-08 00:25:51 +00:00
|
|
|
|
{
|
2005-05-11 19:16:19 +00:00
|
|
|
|
priv->in_drag = 0;
|
2010-10-24 05:22:13 +00:00
|
|
|
|
calendar_stop_spinning (calendar);
|
2003-05-08 00:25:51 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_calendar_grab_notify (GtkWidget *widget,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
gboolean was_grabbed)
|
2003-05-08 00:25:51 +00:00
|
|
|
|
{
|
2005-05-11 19:16:19 +00:00
|
|
|
|
if (!was_grabbed)
|
|
|
|
|
calendar_stop_spinning (GTK_CALENDAR (widget));
|
|
|
|
|
}
|
2003-05-08 00:25:51 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
static gboolean
|
|
|
|
|
gtk_calendar_focus_out (GtkWidget *widget,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
GdkEventFocus *event)
|
2005-05-11 19:16:19 +00:00
|
|
|
|
{
|
|
|
|
|
GtkCalendarPrivate *priv = GTK_CALENDAR_GET_PRIVATE (widget);
|
2007-12-28 09:26:38 +00:00
|
|
|
|
GtkCalendar *calendar = GTK_CALENDAR (widget);
|
2003-05-08 00:25:51 +00:00
|
|
|
|
|
2007-12-28 09:26:38 +00:00
|
|
|
|
calendar_queue_refresh (calendar);
|
|
|
|
|
calendar_stop_spinning (calendar);
|
2010-10-24 05:22:13 +00:00
|
|
|
|
|
|
|
|
|
priv->in_drag = 0;
|
2003-05-08 00:25:51 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
return FALSE;
|
2003-05-08 00:25:51 +00:00
|
|
|
|
}
|
2003-08-08 23:01:17 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
|
|
|
|
|
/****************************************
|
|
|
|
|
* Drag and Drop *
|
|
|
|
|
****************************************/
|
|
|
|
|
|
2003-08-08 23:01:17 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_calendar_drag_data_get (GtkWidget *widget,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
GdkDragContext *context,
|
|
|
|
|
GtkSelectionData *selection_data,
|
|
|
|
|
guint info,
|
|
|
|
|
guint time)
|
2003-08-08 23:01:17 +00:00
|
|
|
|
{
|
|
|
|
|
GtkCalendar *calendar = GTK_CALENDAR (widget);
|
2010-08-12 15:14:51 +00:00
|
|
|
|
GtkCalendarPrivate *priv = calendar->priv;
|
2003-08-08 23:01:17 +00:00
|
|
|
|
GDate *date;
|
|
|
|
|
gchar str[128];
|
|
|
|
|
gsize len;
|
|
|
|
|
|
2010-08-12 15:14:51 +00:00
|
|
|
|
date = g_date_new_dmy (priv->selected_day, priv->month + 1, priv->year);
|
2003-08-08 23:01:17 +00:00
|
|
|
|
len = g_date_strftime (str, 127, "%x", date);
|
|
|
|
|
gtk_selection_data_set_text (selection_data, str, len);
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
2003-08-08 23:01:17 +00:00
|
|
|
|
g_free (date);
|
|
|
|
|
}
|
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
/* Get/set whether drag_motion requested the drag data and
|
|
|
|
|
* drag_data_received should thus not actually insert the data,
|
|
|
|
|
* since the data doesn't result from a drop.
|
|
|
|
|
*/
|
|
|
|
|
static void
|
|
|
|
|
set_status_pending (GdkDragContext *context,
|
|
|
|
|
GdkDragAction suggested_action)
|
|
|
|
|
{
|
|
|
|
|
g_object_set_data (G_OBJECT (context),
|
2005-09-01 05:11:46 +00:00
|
|
|
|
I_("gtk-calendar-status-pending"),
|
2005-05-11 19:16:19 +00:00
|
|
|
|
GINT_TO_POINTER (suggested_action));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static GdkDragAction
|
|
|
|
|
get_status_pending (GdkDragContext *context)
|
|
|
|
|
{
|
|
|
|
|
return GPOINTER_TO_INT (g_object_get_data (G_OBJECT (context),
|
|
|
|
|
"gtk-calendar-status-pending"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gtk_calendar_drag_leave (GtkWidget *widget,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
GdkDragContext *context,
|
|
|
|
|
guint time)
|
2005-05-11 19:16:19 +00:00
|
|
|
|
{
|
|
|
|
|
GtkCalendarPrivate *priv = GTK_CALENDAR_GET_PRIVATE (widget);
|
|
|
|
|
|
|
|
|
|
priv->drag_highlight = 0;
|
|
|
|
|
gtk_drag_unhighlight (widget);
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
|
gtk_calendar_drag_motion (GtkWidget *widget,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
GdkDragContext *context,
|
|
|
|
|
gint x,
|
|
|
|
|
gint y,
|
|
|
|
|
guint time)
|
2005-05-11 19:16:19 +00:00
|
|
|
|
{
|
|
|
|
|
GtkCalendarPrivate *priv = GTK_CALENDAR_GET_PRIVATE (widget);
|
|
|
|
|
GdkAtom target;
|
2010-12-10 05:59:07 +00:00
|
|
|
|
|
|
|
|
|
if (!priv->drag_highlight)
|
2005-05-11 19:16:19 +00:00
|
|
|
|
{
|
|
|
|
|
priv->drag_highlight = 1;
|
|
|
|
|
gtk_drag_highlight (widget);
|
|
|
|
|
}
|
2010-12-10 05:59:07 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
target = gtk_drag_dest_find_target (widget, context, NULL);
|
2010-12-10 05:59:07 +00:00
|
|
|
|
if (target == GDK_NONE || gdk_drag_context_get_suggested_action (context) == 0)
|
2005-05-11 19:16:19 +00:00
|
|
|
|
gdk_drag_status (context, 0, time);
|
|
|
|
|
else
|
|
|
|
|
{
|
2010-12-10 05:59:07 +00:00
|
|
|
|
set_status_pending (context, gdk_drag_context_get_suggested_action (context));
|
2005-05-11 19:16:19 +00:00
|
|
|
|
gtk_drag_get_data (widget, context, target, time);
|
|
|
|
|
}
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
|
gtk_calendar_drag_drop (GtkWidget *widget,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
GdkDragContext *context,
|
|
|
|
|
gint x,
|
|
|
|
|
gint y,
|
|
|
|
|
guint time)
|
2005-05-11 19:16:19 +00:00
|
|
|
|
{
|
|
|
|
|
GdkAtom target;
|
|
|
|
|
|
2011-01-24 02:50:39 +00:00
|
|
|
|
target = gtk_drag_dest_find_target (widget, context, NULL);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
if (target != GDK_NONE)
|
|
|
|
|
{
|
2011-01-24 02:50:39 +00:00
|
|
|
|
gtk_drag_get_data (widget, context,
|
|
|
|
|
target,
|
|
|
|
|
time);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gtk_calendar_drag_data_received (GtkWidget *widget,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
GdkDragContext *context,
|
|
|
|
|
gint x,
|
|
|
|
|
gint y,
|
|
|
|
|
GtkSelectionData *selection_data,
|
|
|
|
|
guint info,
|
|
|
|
|
guint time)
|
2005-05-11 19:16:19 +00:00
|
|
|
|
{
|
|
|
|
|
GtkCalendar *calendar = GTK_CALENDAR (widget);
|
2010-08-12 15:14:51 +00:00
|
|
|
|
GtkCalendarPrivate *priv = calendar->priv;
|
2005-05-11 19:16:19 +00:00
|
|
|
|
guint day, month, year;
|
|
|
|
|
gchar *str;
|
|
|
|
|
GDate *date;
|
|
|
|
|
GdkDragAction suggested_action;
|
|
|
|
|
|
|
|
|
|
suggested_action = get_status_pending (context);
|
|
|
|
|
|
2011-01-24 02:50:39 +00:00
|
|
|
|
if (suggested_action)
|
2005-05-11 19:16:19 +00:00
|
|
|
|
{
|
|
|
|
|
set_status_pending (context, 0);
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
/* We are getting this data due to a request in drag_motion,
|
|
|
|
|
* rather than due to a request in drag_drop, so we are just
|
|
|
|
|
* supposed to call drag_status, not actually paste in the
|
|
|
|
|
* data.
|
|
|
|
|
*/
|
2007-12-19 22:57:01 +00:00
|
|
|
|
str = (gchar*) gtk_selection_data_get_text (selection_data);
|
|
|
|
|
|
2011-01-24 02:50:39 +00:00
|
|
|
|
if (str)
|
|
|
|
|
{
|
|
|
|
|
date = g_date_new ();
|
|
|
|
|
g_date_set_parse (date, str);
|
|
|
|
|
if (!g_date_valid (date))
|
|
|
|
|
suggested_action = 0;
|
|
|
|
|
g_date_free (date);
|
|
|
|
|
g_free (str);
|
|
|
|
|
}
|
2005-05-11 19:16:19 +00:00
|
|
|
|
else
|
2011-01-24 02:50:39 +00:00
|
|
|
|
suggested_action = 0;
|
2005-05-11 19:16:19 +00:00
|
|
|
|
|
|
|
|
|
gdk_drag_status (context, suggested_action, time);
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
date = g_date_new ();
|
2007-12-19 22:57:01 +00:00
|
|
|
|
str = (gchar*) gtk_selection_data_get_text (selection_data);
|
2011-01-24 02:50:39 +00:00
|
|
|
|
if (str)
|
2005-05-11 19:16:19 +00:00
|
|
|
|
{
|
|
|
|
|
g_date_set_parse (date, str);
|
|
|
|
|
g_free (str);
|
|
|
|
|
}
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
|
|
|
|
if (!g_date_valid (date))
|
2005-05-11 19:16:19 +00:00
|
|
|
|
{
|
|
|
|
|
g_warning ("Received invalid date data\n");
|
2011-01-24 02:50:39 +00:00
|
|
|
|
g_date_free (date);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
gtk_drag_finish (context, FALSE, FALSE, time);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
day = g_date_get_day (date);
|
|
|
|
|
month = g_date_get_month (date);
|
|
|
|
|
year = g_date_get_year (date);
|
2011-01-24 02:50:39 +00:00
|
|
|
|
g_date_free (date);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
|
|
|
|
|
gtk_drag_finish (context, TRUE, FALSE, time);
|
|
|
|
|
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
g_object_freeze_notify (G_OBJECT (calendar));
|
2010-08-12 15:14:51 +00:00
|
|
|
|
if (!(priv->display_flags & GTK_CALENDAR_NO_MONTH_CHANGE)
|
|
|
|
|
&& (priv->display_flags & GTK_CALENDAR_SHOW_HEADING))
|
2005-05-11 19:16:19 +00:00
|
|
|
|
gtk_calendar_select_month (calendar, month - 1, year);
|
|
|
|
|
gtk_calendar_select_day (calendar, day);
|
2011-01-24 02:50:39 +00:00
|
|
|
|
g_object_thaw_notify (G_OBJECT (calendar));
|
2005-05-11 19:16:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/****************************************
|
|
|
|
|
* Public API *
|
|
|
|
|
****************************************/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gtk_calendar_new:
|
2011-01-24 02:50:39 +00:00
|
|
|
|
*
|
|
|
|
|
* Creates a new calendar, with the current date being selected.
|
|
|
|
|
*
|
2005-05-11 19:16:19 +00:00
|
|
|
|
* Return value: a newly #GtkCalendar widget
|
|
|
|
|
**/
|
|
|
|
|
GtkWidget*
|
|
|
|
|
gtk_calendar_new (void)
|
|
|
|
|
{
|
|
|
|
|
return g_object_new (GTK_TYPE_CALENDAR, NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gtk_calendar_get_display_options:
|
|
|
|
|
* @calendar: a #GtkCalendar
|
2011-01-24 02:50:39 +00:00
|
|
|
|
*
|
|
|
|
|
* Returns the current display options of @calendar.
|
|
|
|
|
*
|
2005-05-11 19:16:19 +00:00
|
|
|
|
* Return value: the display options.
|
|
|
|
|
*
|
|
|
|
|
* Since: 2.4
|
|
|
|
|
**/
|
2011-01-24 02:50:39 +00:00
|
|
|
|
GtkCalendarDisplayOptions
|
2005-05-11 19:16:19 +00:00
|
|
|
|
gtk_calendar_get_display_options (GtkCalendar *calendar)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (GTK_IS_CALENDAR (calendar), 0);
|
|
|
|
|
|
2010-08-12 15:14:51 +00:00
|
|
|
|
return calendar->priv->display_flags;
|
2005-05-11 19:16:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gtk_calendar_set_display_options:
|
|
|
|
|
* @calendar: a #GtkCalendar
|
|
|
|
|
* @flags: the display options to set
|
2011-01-24 02:50:39 +00:00
|
|
|
|
*
|
|
|
|
|
* Sets display options (whether to display the heading and the month
|
2005-05-11 19:16:19 +00:00
|
|
|
|
* headings).
|
|
|
|
|
*
|
|
|
|
|
* Since: 2.4
|
|
|
|
|
**/
|
|
|
|
|
void
|
2011-01-24 02:50:39 +00:00
|
|
|
|
gtk_calendar_set_display_options (GtkCalendar *calendar,
|
|
|
|
|
GtkCalendarDisplayOptions flags)
|
2005-05-11 19:16:19 +00:00
|
|
|
|
{
|
|
|
|
|
GtkWidget *widget = GTK_WIDGET (calendar);
|
|
|
|
|
GtkCalendarPrivate *priv = GTK_CALENDAR_GET_PRIVATE (calendar);
|
|
|
|
|
gint resize = 0;
|
|
|
|
|
GtkCalendarDisplayOptions old_flags;
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_CALENDAR (calendar));
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
2010-08-12 15:14:51 +00:00
|
|
|
|
old_flags = priv->display_flags;
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
2010-03-02 06:16:02 +00:00
|
|
|
|
if (gtk_widget_get_realized (widget))
|
2005-05-11 19:16:19 +00:00
|
|
|
|
{
|
2010-08-12 15:14:51 +00:00
|
|
|
|
if ((flags ^ priv->display_flags) & GTK_CALENDAR_NO_MONTH_CHANGE)
|
2011-01-24 02:50:39 +00:00
|
|
|
|
{
|
|
|
|
|
resize ++;
|
|
|
|
|
if (! (flags & GTK_CALENDAR_NO_MONTH_CHANGE)
|
2010-10-24 05:22:13 +00:00
|
|
|
|
&& (priv->display_flags & GTK_CALENDAR_SHOW_HEADING))
|
2011-01-24 02:50:39 +00:00
|
|
|
|
{
|
|
|
|
|
priv->display_flags &= ~GTK_CALENDAR_NO_MONTH_CHANGE;
|
|
|
|
|
calendar_realize_arrows (calendar);
|
2010-12-20 22:07:20 +00:00
|
|
|
|
if (gtk_widget_get_mapped (widget))
|
|
|
|
|
calendar_map_arrows (calendar);
|
2011-01-24 02:50:39 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
calendar_unrealize_arrows (calendar);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-08-12 15:14:51 +00:00
|
|
|
|
if ((flags ^ priv->display_flags) & GTK_CALENDAR_SHOW_HEADING)
|
2011-01-24 02:50:39 +00:00
|
|
|
|
{
|
|
|
|
|
resize++;
|
|
|
|
|
|
|
|
|
|
if (flags & GTK_CALENDAR_SHOW_HEADING)
|
2010-10-24 05:22:13 +00:00
|
|
|
|
{
|
2011-01-24 02:50:39 +00:00
|
|
|
|
priv->display_flags |= GTK_CALENDAR_SHOW_HEADING;
|
|
|
|
|
calendar_realize_arrows (calendar);
|
2010-12-20 22:07:20 +00:00
|
|
|
|
if (gtk_widget_get_mapped (widget))
|
|
|
|
|
calendar_map_arrows (calendar);
|
2010-10-24 05:22:13 +00:00
|
|
|
|
}
|
2011-01-24 02:50:39 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
calendar_unrealize_arrows (calendar);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-08-12 15:14:51 +00:00
|
|
|
|
if ((flags ^ priv->display_flags) & GTK_CALENDAR_SHOW_DAY_NAMES)
|
2011-01-24 02:50:39 +00:00
|
|
|
|
{
|
|
|
|
|
resize++;
|
|
|
|
|
|
|
|
|
|
if (flags & GTK_CALENDAR_SHOW_DAY_NAMES)
|
|
|
|
|
priv->display_flags |= GTK_CALENDAR_SHOW_DAY_NAMES;
|
|
|
|
|
}
|
|
|
|
|
|
2010-08-12 15:14:51 +00:00
|
|
|
|
if ((flags ^ priv->display_flags) & GTK_CALENDAR_SHOW_WEEK_NUMBERS)
|
2010-10-24 05:22:13 +00:00
|
|
|
|
{
|
|
|
|
|
resize++;
|
|
|
|
|
|
|
|
|
|
if (flags & GTK_CALENDAR_SHOW_WEEK_NUMBERS)
|
|
|
|
|
priv->display_flags |= GTK_CALENDAR_SHOW_WEEK_NUMBERS;
|
|
|
|
|
}
|
2005-05-11 19:16:19 +00:00
|
|
|
|
|
2010-08-12 15:14:51 +00:00
|
|
|
|
if ((flags ^ priv->display_flags) & GTK_CALENDAR_SHOW_DETAILS)
|
2007-12-28 09:39:34 +00:00
|
|
|
|
resize++;
|
|
|
|
|
|
2010-08-12 15:14:51 +00:00
|
|
|
|
priv->display_flags = flags;
|
2005-05-11 19:16:19 +00:00
|
|
|
|
if (resize)
|
2011-01-24 02:50:39 +00:00
|
|
|
|
gtk_widget_queue_resize (GTK_WIDGET (calendar));
|
2010-08-28 23:09:21 +00:00
|
|
|
|
}
|
2005-05-11 19:16:19 +00:00
|
|
|
|
else
|
2010-08-12 15:14:51 +00:00
|
|
|
|
priv->display_flags = flags;
|
2010-08-28 23:09:21 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
g_object_freeze_notify (G_OBJECT (calendar));
|
2010-08-12 15:14:51 +00:00
|
|
|
|
if ((old_flags ^ priv->display_flags) & GTK_CALENDAR_SHOW_HEADING)
|
2005-05-11 19:16:19 +00:00
|
|
|
|
g_object_notify (G_OBJECT (calendar), "show-heading");
|
2010-08-12 15:14:51 +00:00
|
|
|
|
if ((old_flags ^ priv->display_flags) & GTK_CALENDAR_SHOW_DAY_NAMES)
|
2005-05-11 19:16:19 +00:00
|
|
|
|
g_object_notify (G_OBJECT (calendar), "show-day-names");
|
2010-08-12 15:14:51 +00:00
|
|
|
|
if ((old_flags ^ priv->display_flags) & GTK_CALENDAR_NO_MONTH_CHANGE)
|
2005-05-11 19:16:19 +00:00
|
|
|
|
g_object_notify (G_OBJECT (calendar), "no-month-change");
|
2010-08-12 15:14:51 +00:00
|
|
|
|
if ((old_flags ^ priv->display_flags) & GTK_CALENDAR_SHOW_WEEK_NUMBERS)
|
2005-05-11 19:16:19 +00:00
|
|
|
|
g_object_notify (G_OBJECT (calendar), "show-week-numbers");
|
|
|
|
|
g_object_thaw_notify (G_OBJECT (calendar));
|
2003-08-08 23:01:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_calendar_select_month:
|
|
|
|
|
* @calendar: a #GtkCalendar
|
|
|
|
|
* @month: a month number between 0 and 11.
|
|
|
|
|
* @year: the year the month is in.
|
2010-06-15 04:00:40 +00:00
|
|
|
|
*
|
2005-05-11 19:16:19 +00:00
|
|
|
|
* Shifts the calendar to a different month.
|
|
|
|
|
**/
|
2010-06-15 04:00:40 +00:00
|
|
|
|
void
|
2005-05-11 19:16:19 +00:00
|
|
|
|
gtk_calendar_select_month (GtkCalendar *calendar,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
guint month,
|
|
|
|
|
guint year)
|
2003-08-08 23:01:17 +00:00
|
|
|
|
{
|
2010-08-12 15:14:51 +00:00
|
|
|
|
GtkCalendarPrivate *priv;
|
|
|
|
|
|
2010-06-15 04:00:40 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_CALENDAR (calendar));
|
|
|
|
|
g_return_if_fail (month <= 11);
|
|
|
|
|
|
2010-08-12 15:14:51 +00:00
|
|
|
|
priv = calendar->priv;
|
|
|
|
|
|
|
|
|
|
priv->month = month;
|
|
|
|
|
priv->year = year;
|
2010-06-15 04:00:40 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
calendar_compute_days (calendar);
|
2007-12-28 09:26:38 +00:00
|
|
|
|
calendar_queue_refresh (calendar);
|
2003-08-08 23:01:17 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
g_object_freeze_notify (G_OBJECT (calendar));
|
|
|
|
|
g_object_notify (G_OBJECT (calendar), "month");
|
|
|
|
|
g_object_notify (G_OBJECT (calendar), "year");
|
|
|
|
|
g_object_thaw_notify (G_OBJECT (calendar));
|
2003-08-08 23:01:17 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
g_signal_emit (calendar,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
gtk_calendar_signals[MONTH_CHANGED_SIGNAL],
|
|
|
|
|
0);
|
2003-08-08 23:01:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_calendar_select_day:
|
|
|
|
|
* @calendar: a #GtkCalendar.
|
2011-01-24 02:50:39 +00:00
|
|
|
|
* @day: the day number between 1 and 31, or 0 to unselect
|
2005-05-11 19:16:19 +00:00
|
|
|
|
* the currently selected day.
|
2011-01-24 02:50:39 +00:00
|
|
|
|
*
|
2005-05-11 19:16:19 +00:00
|
|
|
|
* Selects a day from the current month.
|
|
|
|
|
**/
|
|
|
|
|
void
|
|
|
|
|
gtk_calendar_select_day (GtkCalendar *calendar,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
guint day)
|
2003-08-08 23:01:17 +00:00
|
|
|
|
{
|
2010-08-12 15:14:51 +00:00
|
|
|
|
GtkCalendarPrivate *priv;
|
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_CALENDAR (calendar));
|
|
|
|
|
g_return_if_fail (day <= 31);
|
2010-08-12 15:14:51 +00:00
|
|
|
|
|
|
|
|
|
priv = calendar->priv;
|
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
/* Deselect the old day */
|
2010-08-12 15:14:51 +00:00
|
|
|
|
if (priv->selected_day > 0)
|
2003-08-08 23:01:17 +00:00
|
|
|
|
{
|
2005-05-11 19:16:19 +00:00
|
|
|
|
gint selected_day;
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
2010-08-12 15:14:51 +00:00
|
|
|
|
selected_day = priv->selected_day;
|
|
|
|
|
priv->selected_day = 0;
|
2010-01-07 15:47:35 +00:00
|
|
|
|
if (gtk_widget_is_drawable (GTK_WIDGET (calendar)))
|
2011-01-24 02:50:39 +00:00
|
|
|
|
calendar_invalidate_day_num (calendar, selected_day);
|
2003-08-08 23:01:17 +00:00
|
|
|
|
}
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
2010-08-12 15:14:51 +00:00
|
|
|
|
priv->selected_day = day;
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
/* Select the new day */
|
|
|
|
|
if (day != 0)
|
|
|
|
|
{
|
2010-01-07 15:47:35 +00:00
|
|
|
|
if (gtk_widget_is_drawable (GTK_WIDGET (calendar)))
|
2011-01-24 02:50:39 +00:00
|
|
|
|
calendar_invalidate_day_num (calendar, day);
|
2005-05-11 19:16:19 +00:00
|
|
|
|
}
|
2011-01-24 02:50:39 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
g_object_notify (G_OBJECT (calendar), "day");
|
|
|
|
|
|
|
|
|
|
g_signal_emit (calendar,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
gtk_calendar_signals[DAY_SELECTED_SIGNAL],
|
|
|
|
|
0);
|
2003-08-08 23:01:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_calendar_clear_marks:
|
|
|
|
|
* @calendar: a #GtkCalendar
|
2011-01-24 02:50:39 +00:00
|
|
|
|
*
|
2005-05-11 19:16:19 +00:00
|
|
|
|
* Remove all visual markers.
|
|
|
|
|
**/
|
|
|
|
|
void
|
|
|
|
|
gtk_calendar_clear_marks (GtkCalendar *calendar)
|
2003-08-08 23:01:17 +00:00
|
|
|
|
{
|
2010-08-12 15:14:51 +00:00
|
|
|
|
GtkCalendarPrivate *priv;
|
2005-05-11 19:16:19 +00:00
|
|
|
|
guint day;
|
2010-08-12 15:14:51 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_CALENDAR (calendar));
|
2010-08-12 15:14:51 +00:00
|
|
|
|
|
|
|
|
|
priv = calendar->priv;
|
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
for (day = 0; day < 31; day++)
|
2003-08-08 23:01:17 +00:00
|
|
|
|
{
|
2010-08-12 15:14:51 +00:00
|
|
|
|
priv->marked_date[day] = FALSE;
|
2003-08-08 23:01:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-08-12 15:14:51 +00:00
|
|
|
|
priv->num_marked_dates = 0;
|
2007-12-28 09:26:38 +00:00
|
|
|
|
calendar_queue_refresh (calendar);
|
2003-08-08 23:01:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_calendar_mark_day:
|
2010-06-15 04:00:40 +00:00
|
|
|
|
* @calendar: a #GtkCalendar
|
2005-05-11 19:16:19 +00:00
|
|
|
|
* @day: the day number to mark between 1 and 31.
|
2010-06-15 04:00:40 +00:00
|
|
|
|
*
|
2005-05-11 19:16:19 +00:00
|
|
|
|
* Places a visual marker on a particular day.
|
2010-06-15 04:00:40 +00:00
|
|
|
|
*/
|
|
|
|
|
void
|
2005-05-11 19:16:19 +00:00
|
|
|
|
gtk_calendar_mark_day (GtkCalendar *calendar,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
guint day)
|
2003-08-08 23:01:17 +00:00
|
|
|
|
{
|
2010-08-12 15:14:51 +00:00
|
|
|
|
GtkCalendarPrivate *priv;
|
|
|
|
|
|
2010-06-15 04:00:40 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_CALENDAR (calendar));
|
|
|
|
|
|
2010-08-12 15:14:51 +00:00
|
|
|
|
priv = calendar->priv;
|
|
|
|
|
|
|
|
|
|
if (day >= 1 && day <= 31 && !priv->marked_date[day-1])
|
2003-08-08 23:01:17 +00:00
|
|
|
|
{
|
2010-08-12 15:14:51 +00:00
|
|
|
|
priv->marked_date[day - 1] = TRUE;
|
|
|
|
|
priv->num_marked_dates++;
|
2005-05-11 19:16:19 +00:00
|
|
|
|
calendar_invalidate_day_num (calendar, day);
|
2003-08-08 23:01:17 +00:00
|
|
|
|
}
|
2005-05-11 19:16:19 +00:00
|
|
|
|
}
|
2003-08-08 23:01:17 +00:00
|
|
|
|
|
2010-08-29 17:14:24 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_calendar_get_day_is_marked:
|
|
|
|
|
* @calendar: a #GtkCalendar
|
|
|
|
|
* @day: the day number between 1 and 31.
|
|
|
|
|
*
|
|
|
|
|
* Returns if the @day of the @calendar is already marked.
|
|
|
|
|
*
|
|
|
|
|
* Returns: whether the day is marked.
|
|
|
|
|
*
|
|
|
|
|
* Since: 3.0
|
|
|
|
|
*/
|
|
|
|
|
gboolean
|
|
|
|
|
gtk_calendar_get_day_is_marked (GtkCalendar *calendar,
|
|
|
|
|
guint day)
|
|
|
|
|
{
|
|
|
|
|
GtkCalendarPrivate *priv;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (GTK_IS_CALENDAR (calendar), FALSE);
|
|
|
|
|
|
|
|
|
|
priv = calendar->priv;
|
|
|
|
|
|
|
|
|
|
if (day >= 1 && day <= 31)
|
|
|
|
|
return priv->marked_date[day - 1];
|
|
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_calendar_unmark_day:
|
|
|
|
|
* @calendar: a #GtkCalendar.
|
|
|
|
|
* @day: the day number to unmark between 1 and 31.
|
2010-06-15 04:00:40 +00:00
|
|
|
|
*
|
2005-05-11 19:16:19 +00:00
|
|
|
|
* Removes the visual marker from a particular day.
|
2010-06-15 04:00:40 +00:00
|
|
|
|
*/
|
|
|
|
|
void
|
2005-05-11 19:16:19 +00:00
|
|
|
|
gtk_calendar_unmark_day (GtkCalendar *calendar,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
guint day)
|
2005-05-11 19:16:19 +00:00
|
|
|
|
{
|
2010-08-12 15:14:51 +00:00
|
|
|
|
GtkCalendarPrivate *priv;
|
|
|
|
|
|
2010-06-15 04:00:40 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_CALENDAR (calendar));
|
|
|
|
|
|
2010-08-12 15:14:51 +00:00
|
|
|
|
priv = calendar->priv;
|
|
|
|
|
|
|
|
|
|
if (day >= 1 && day <= 31 && priv->marked_date[day-1])
|
2003-08-08 23:01:17 +00:00
|
|
|
|
{
|
2010-08-12 15:14:51 +00:00
|
|
|
|
priv->marked_date[day - 1] = FALSE;
|
|
|
|
|
priv->num_marked_dates--;
|
2005-05-11 19:16:19 +00:00
|
|
|
|
calendar_invalidate_day_num (calendar, day);
|
2003-08-08 23:01:17 +00:00
|
|
|
|
}
|
2005-05-11 19:16:19 +00:00
|
|
|
|
}
|
2003-08-08 23:01:17 +00:00
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_calendar_get_date:
|
|
|
|
|
* @calendar: a #GtkCalendar
|
2011-01-18 09:10:30 +00:00
|
|
|
|
* @year: (out) (allow-none): location to store the year as a decimal
|
|
|
|
|
* number (e.g. 2011), or %NULL
|
|
|
|
|
* @month: (out) (allow-none): location to store the month number
|
|
|
|
|
* (between 0 and 11), or %NULL
|
|
|
|
|
* @day: (out) (allow-none): location to store the day number (between
|
|
|
|
|
* 1 and 31), or %NULL
|
2011-01-04 16:44:09 +00:00
|
|
|
|
*
|
2005-05-11 19:16:19 +00:00
|
|
|
|
* Obtains the selected date from a #GtkCalendar.
|
2011-01-04 16:44:09 +00:00
|
|
|
|
*/
|
2005-05-11 19:16:19 +00:00
|
|
|
|
void
|
|
|
|
|
gtk_calendar_get_date (GtkCalendar *calendar,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
guint *year,
|
|
|
|
|
guint *month,
|
|
|
|
|
guint *day)
|
2005-05-11 19:16:19 +00:00
|
|
|
|
{
|
2010-08-12 15:14:51 +00:00
|
|
|
|
GtkCalendarPrivate *priv;
|
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_CALENDAR (calendar));
|
2010-08-12 15:14:51 +00:00
|
|
|
|
|
|
|
|
|
priv = calendar->priv;
|
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
if (year)
|
2010-08-12 15:14:51 +00:00
|
|
|
|
*year = priv->year;
|
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
if (month)
|
2010-08-12 15:14:51 +00:00
|
|
|
|
*month = priv->month;
|
|
|
|
|
|
2005-05-11 19:16:19 +00:00
|
|
|
|
if (day)
|
2010-08-12 15:14:51 +00:00
|
|
|
|
*day = priv->selected_day;
|
2005-05-11 19:16:19 +00:00
|
|
|
|
}
|
2003-08-08 23:01:17 +00:00
|
|
|
|
|
2007-12-27 20:41:08 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_calendar_set_detail_func:
|
|
|
|
|
* @calendar: a #GtkCalendar.
|
|
|
|
|
* @func: a function providing details for each day.
|
|
|
|
|
* @data: data to pass to @func invokations.
|
|
|
|
|
* @destroy: a function for releasing @data.
|
|
|
|
|
*
|
|
|
|
|
* Installs a function which provides Pango markup with detail information
|
|
|
|
|
* for each day. Examples for such details are holidays or appointments. That
|
|
|
|
|
* information is shown below each day when #GtkCalendar:show-details is set.
|
|
|
|
|
* A tooltip containing with full detail information is provided, if the entire
|
|
|
|
|
* text should not fit into the details area, or if #GtkCalendar:show-details
|
|
|
|
|
* is not set.
|
|
|
|
|
*
|
|
|
|
|
* The size of the details area can be restricted by setting the
|
|
|
|
|
* #GtkCalendar:detail-width-chars and #GtkCalendar:detail-height-rows
|
|
|
|
|
* properties.
|
|
|
|
|
*
|
2008-02-15 23:42:42 +00:00
|
|
|
|
* Since: 2.14
|
2007-12-27 20:41:08 +00:00
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
gtk_calendar_set_detail_func (GtkCalendar *calendar,
|
|
|
|
|
GtkCalendarDetailFunc func,
|
|
|
|
|
gpointer data,
|
|
|
|
|
GDestroyNotify destroy)
|
|
|
|
|
{
|
|
|
|
|
GtkCalendarPrivate *priv;
|
|
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_CALENDAR (calendar));
|
|
|
|
|
|
|
|
|
|
priv = GTK_CALENDAR_GET_PRIVATE (calendar);
|
|
|
|
|
|
|
|
|
|
if (priv->detail_func_destroy)
|
|
|
|
|
priv->detail_func_destroy (priv->detail_func_user_data);
|
|
|
|
|
|
|
|
|
|
priv->detail_func = func;
|
|
|
|
|
priv->detail_func_user_data = data;
|
|
|
|
|
priv->detail_func_destroy = destroy;
|
|
|
|
|
|
|
|
|
|
gtk_widget_set_has_tooltip (GTK_WIDGET (calendar),
|
|
|
|
|
NULL != priv->detail_func);
|
|
|
|
|
gtk_widget_queue_resize (GTK_WIDGET (calendar));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gtk_calendar_set_detail_width_chars:
|
|
|
|
|
* @calendar: a #GtkCalendar.
|
|
|
|
|
* @chars: detail width in characters.
|
|
|
|
|
*
|
|
|
|
|
* Updates the width of detail cells.
|
|
|
|
|
* See #GtkCalendar:detail-width-chars.
|
|
|
|
|
*
|
2008-02-15 23:42:42 +00:00
|
|
|
|
* Since: 2.14
|
2007-12-27 20:41:08 +00:00
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
gtk_calendar_set_detail_width_chars (GtkCalendar *calendar,
|
|
|
|
|
gint chars)
|
|
|
|
|
{
|
|
|
|
|
GtkCalendarPrivate *priv;
|
|
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_CALENDAR (calendar));
|
|
|
|
|
|
|
|
|
|
priv = GTK_CALENDAR_GET_PRIVATE (calendar);
|
|
|
|
|
|
|
|
|
|
if (chars != priv->detail_width_chars)
|
|
|
|
|
{
|
|
|
|
|
priv->detail_width_chars = chars;
|
|
|
|
|
g_object_notify (G_OBJECT (calendar), "detail-width-chars");
|
|
|
|
|
gtk_widget_queue_resize_no_redraw (GTK_WIDGET (calendar));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gtk_calendar_set_detail_height_rows:
|
|
|
|
|
* @calendar: a #GtkCalendar.
|
|
|
|
|
* @rows: detail height in rows.
|
|
|
|
|
*
|
|
|
|
|
* Updates the height of detail cells.
|
|
|
|
|
* See #GtkCalendar:detail-height-rows.
|
|
|
|
|
*
|
2008-02-15 23:42:42 +00:00
|
|
|
|
* Since: 2.14
|
2007-12-27 20:41:08 +00:00
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
gtk_calendar_set_detail_height_rows (GtkCalendar *calendar,
|
|
|
|
|
gint rows)
|
|
|
|
|
{
|
|
|
|
|
GtkCalendarPrivate *priv;
|
|
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_CALENDAR (calendar));
|
|
|
|
|
|
|
|
|
|
priv = GTK_CALENDAR_GET_PRIVATE (calendar);
|
|
|
|
|
|
|
|
|
|
if (rows != priv->detail_height_rows)
|
|
|
|
|
{
|
|
|
|
|
priv->detail_height_rows = rows;
|
|
|
|
|
g_object_notify (G_OBJECT (calendar), "detail-height-rows");
|
|
|
|
|
gtk_widget_queue_resize_no_redraw (GTK_WIDGET (calendar));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gtk_calendar_get_detail_width_chars:
|
|
|
|
|
* @calendar: a #GtkCalendar.
|
|
|
|
|
*
|
|
|
|
|
* Queries the width of detail cells, in characters.
|
|
|
|
|
* See #GtkCalendar:detail-width-chars.
|
|
|
|
|
*
|
2008-02-15 23:42:42 +00:00
|
|
|
|
* Since: 2.14
|
2007-12-27 20:41:08 +00:00
|
|
|
|
*
|
|
|
|
|
* Return value: The width of detail cells, in characters.
|
|
|
|
|
*/
|
|
|
|
|
gint
|
|
|
|
|
gtk_calendar_get_detail_width_chars (GtkCalendar *calendar)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (GTK_IS_CALENDAR (calendar), 0);
|
|
|
|
|
return GTK_CALENDAR_GET_PRIVATE (calendar)->detail_width_chars;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gtk_calendar_get_detail_height_rows:
|
|
|
|
|
* @calendar: a #GtkCalendar.
|
|
|
|
|
*
|
|
|
|
|
* Queries the height of detail cells, in rows.
|
|
|
|
|
* See #GtkCalendar:detail-width-chars.
|
|
|
|
|
*
|
2008-02-15 23:42:42 +00:00
|
|
|
|
* Since: 2.14
|
2007-12-27 20:41:08 +00:00
|
|
|
|
*
|
|
|
|
|
* Return value: The height of detail cells, in rows.
|
|
|
|
|
*/
|
|
|
|
|
gint
|
|
|
|
|
gtk_calendar_get_detail_height_rows (GtkCalendar *calendar)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (GTK_IS_CALENDAR (calendar), 0);
|
|
|
|
|
return GTK_CALENDAR_GET_PRIVATE (calendar)->detail_height_rows;
|
|
|
|
|
}
|