aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui
diff options
context:
space:
mode:
authorArturo Espinosa <unammx@src.gnome.org>1998-04-11 09:18:21 +0800
committerArturo Espinosa <unammx@src.gnome.org>1998-04-11 09:18:21 +0800
commit6caeba284969e0a0ea6b901b559c3078e2444c62 (patch)
tree4ec3105374a39a5fd74f1190a9f256009d43f1db /calendar/gui
parent6cffb55b8d4a036c5f006cb8df0a2dea9bd191a2 (diff)
downloadgsoc2013-evolution-6caeba284969e0a0ea6b901b559c3078e2444c62.tar.gz
gsoc2013-evolution-6caeba284969e0a0ea6b901b559c3078e2444c62.tar.zst
gsoc2013-evolution-6caeba284969e0a0ea6b901b559c3078e2444c62.zip
Oops, compilation fixes plus more work - Federico
svn path=/trunk/; revision=123
Diffstat (limited to 'calendar/gui')
-rw-r--r--calendar/gui/gncal-full-day.c85
1 files changed, 45 insertions, 40 deletions
diff --git a/calendar/gui/gncal-full-day.c b/calendar/gui/gncal-full-day.c
index 485e3ef881..a03d0a0811 100644
--- a/calendar/gui/gncal-full-day.c
+++ b/calendar/gui/gncal-full-day.c
@@ -37,14 +37,15 @@ struct layout_row {
struct drag_info {
enum {
- DRAG_SELECT,
- DRAG_MOVE,
- DRAG_SIZE
+ DRAG_NONE,
+ DRAG_SELECT, /* selecting a range in the main window */
+ DRAG_MOVE, /* moving a child */
+ DRAG_SIZE /* resizing a child */
} drag_mode;
Child *child;
- int new_row;
- int new_rows_used;
+ int start_row;
+ int rows_used;
};
@@ -589,7 +590,7 @@ gncal_full_day_init (GncalFullDay *fullday)
fullday->interval = 30; /* 30 minutes by default */
fullday->children = NULL;
- fullday->drag_info = g_new (struct drag_info, 1);
+ fullday->drag_info = g_new0 (struct drag_info, 1);
fullday->up_down_cursor = NULL;
fullday->beam_cursor = NULL;
@@ -987,9 +988,9 @@ draw_xor_rect (GncalFullDay *fullday)
widget->style->white_gc,
FALSE,
di->child->x + i,
- di->new_row * row_height + i,
+ di->start_row * row_height + i,
di->child->width - 2 * i - 1,
- di->new_rows_used * row_height - 2 * i - 2);
+ di->rows_used * row_height - 2 * i - 2);
gdk_gc_set_function (widget->style->white_gc, GDK_COPY);
gdk_gc_set_subwindow (widget->style->white_gc, GDK_CLIP_BY_CHILDREN);
@@ -1039,6 +1040,7 @@ gncal_full_day_button_press (GtkWidget *widget, GdkEventButton *event)
int xthickness, ythickness;
int width, height;
int xpos, ypos;
+ int row_height;
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (GNCAL_IS_FULL_DAY (widget), FALSE);
@@ -1089,10 +1091,12 @@ gncal_full_day_button_press (GtkWidget *widget, GdkEventButton *event)
else
di->drag_mode = DRAG_SIZE;
+ row_height = calc_row_height (fullday);
+
di->child = child;
- di->new_y = child->y;
- di->new_height = child->height;
+ di->start_row = get_row_from_y (fullday, child->y, FALSE);
+ di->rows_used = child->height / row_height;
gdk_pointer_grab (child->window, FALSE,
(GDK_BUTTON_MOTION_MASK
@@ -1111,43 +1115,48 @@ gncal_full_day_button_press (GtkWidget *widget, GdkEventButton *event)
static void
recompute_motion (GncalFullDay *fullday, int y)
{
- GtkWidget *widget;
struct drag_info *di;
- int rows, row_height;
- int ythickness;
+ int f_rows;
+ int row;
- widget = GTK_WIDGET (fullday);
+ di = fullday->drag_info;
- get_tm_range (fullday, fullday->lower, fullday->upper, NULL, NULL, NULL, &rows);
+ get_tm_range (fullday, fullday->lower, fullday->upper, NULL, NULL, NULL, &f_rows);
- ythickness = widget->style->klass->ythickness;
+ switch (di->drag_mode) {
+ case DRAG_SELECT:
+ row = get_row_from_y (fullday, y, FALSE);
- row_height = calc_row_height (fullday);
+ if (row >= f_rows)
+ row = f_rows - 1;
- y -= ythickness;
- y = (y + row_height / 2) / row_height; /* round to nearest bound */
- y = y * row_height + ythickness;
+ if (row < di->start_row) {
+ di->rows_used = di->start_row - row + 1;
+ di->start_row = row;
+ } else
+ di->rows_used = row - di->start_row + 1;
- di = fullday->drag_info;
+ break;
- switch (di->drag_mode) {
case DRAG_MOVE:
- if (y < ythickness)
- y = ythickness;
- else if (y >= (ythickness + rows * row_height - di->new_height))
- y = ythickness + rows * row_height - di->new_height;
+ row = get_row_from_y (fullday, y, FALSE);
- di->new_y = y;
+ if (row > (f_rows - di->rows_used))
+ row = f_rows - di->rows_used;
+
+ di->start_row = row;
break;
-
+
case DRAG_SIZE:
- if (y <= di->child->y)
- y = di->child->y + row_height;
- else if (y >= (ythickness + rows * row_height))
- y = ythickness + rows * row_height;
+ row = get_row_from_y (fullday, y, TRUE);
- di->new_height = y - di->new_y;
+ if (row <= di->start_row)
+ row = di->start_row + 1;
+ else if (row > f_rows)
+ row = f_rows;
+
+ di->rows_used = row - di->start_row;
break;
@@ -1163,23 +1172,19 @@ update_from_drag_info (GncalFullDay *fullday)
GtkWidget *widget;
struct tm tm;
int row_height;
- int start_row, used_rows;
di = fullday->drag_info;
widget = GTK_WIDGET (fullday);
- get_tm_range (fullday, fullday->lower, fullday->upper, &tm, NULL, NULL, &f_rows);
+ get_tm_range (fullday, fullday->lower, fullday->upper, &tm, NULL, NULL, NULL);
row_height = calc_row_height (fullday);
- start_row = (di->new_y - widget->style->klass->ythickness) / row_height;
- used_rows = di->new_height / row_height;
-
- tm.tm_min += fullday->interval * start_row;
+ tm.tm_min += fullday->interval * di->start_row;
di->child->ico->dtstart = mktime (&tm);
- tm.tm_min += fullday->interval * used_rows;
+ tm.tm_min += fullday->interval * di->rows_used;
di->child->ico->dtend = mktime (&tm);
child_range_changed (fullday, di->child);
n>3-16/+22 * Honor WITHOUT_NLS and grab maintainership.jkim2011-08-272-5/+12 * Honor WITHOUT_NLS.jkim2011-08-273-3/+33 * Update to 2.0.0 and grab maintainership.jkim2011-08-264-7/+31 * Fix locale directories using gnomehack.jkim2011-08-232-3/+3 * Rename distinfo.core to distinfo.core-ttf to avoid confusion with core(5) file.jkim2011-08-233-1/+1 * Fix build dependencies.jkim2011-08-111-3/+3 * Use PLIST_DIRS properly.jkim2011-08-112-2/+2 * Remove pkg-plist and generate it from Makefile.jkim2011-08-112-10/+15 * Sort file names.jkim2011-08-111-1/+1 * - Update to 12 and grab maintainership.jkim2011-08-113-14/+32 * Rename ko-KR.* to ko_KR.* for consistency with other dictionaries.jkim2011-08-101-4/+4 * Korean hunspell dictionariesjkim2011-08-105-0/+52 * IBus-Hangul is an input method (IM) for Korean language, based on IBus.jkim2011-08-097-0/+109 * Add the font category in COMMENT.jkim2011-08-091-1/+1 * - Split korean/unfonts-ttf into korean/unfonts-core and korean/unfonts-extra.jkim2011-08-098-0/+461 * Install the correct license file and fix English font names.jkim2011-08-063-6/+6 * Nanum Gothic Coding font family is free Hangul fonts developed byjkim2011-08-066-0/+161 * Replace PREFIX with LOCALBASE in few places.jkim2011-08-061-3/+3 * Nanum font family is free Hangul fonts developed by NHN Corporationjkim2011-08-067-0/+187 * Reset maintainership and deprecate some korean ports with no more publicjkim2011-08-052-2/+8 * - Update to 0.8.1 and unbreak build on HEAD.jkim2011-08-049-45/+58 * - Fix a security vulnerability (CVE-2008-2383).jkim2011-08-045-2/+505 * - Update to 2.2 and undeprecate.jkim2011-08-049-869/+40 * Remove WWW entries from unmaintained ports that return 404 or where the domainehaupt2011-08-032-4/+0 * Deprecate some ports where I can't find distfiles and upstreambapt2011-08-037-0/+21 * Mark BROKEN: Does not fetchbapt2011-08-021-0/+2 * Bye bye abandonwares (part 4)bapt2011-08-0154-2473/+0 * Remove dead site (ftp.kaist.ac.kr)ehaupt2011-07-297-10/+2 * Update scim-tables ports to 0.5.10. Appease portlint.lx2011-07-216-28/+38 * Reset maintainership de jure. In fact KDE 3 has not been maintained by our teammakc2011-07-081-1/+1 * Update KDE Software Compilation ports to 4.6.5makc2011-07-082-2/+21 * Another bunch of deprecation: no more public distfiles and/or abandonwarebapt2011-06-176-0/+18 * Mark broken some ports with unfetchable distfilesbapt2011-06-172-0/+4 * Unfetchable, no new home found: deprecatebapt2011-06-161-0/+3 * The FreeBSD KDE Team is pleased to announce KDE SC 4.6.4. Read fullavilla2011-06-141-2/+2 * - Update to 0.99.9wen2011-06-102-4/+4 * Update KDE Software Compilation ports to 4.6.3makc2011-05-172-2/+39 * - Set CONFLICTS with unzip-iconv upcoming as a new porttota2011-05-051-1/+1 * Bump PORTREVISION after open-mofit updatemakc2011-05-022-2/+2 * Remove unmaintained expired nvi related portsbapt2011-05-023-40/+0 * Removed ports that depends on iiimf expired ports + they are abandonwarebapt2011-05-028-178/+0 * - Update to 0.99.8culot2011-04-113-5/+18 * - Update to 0.0.12culot2011-04-116-16/+33 * The FreeBSD KDE Team is pleased to announce April updates for KDEavilla2011-04-072-2/+5 * The FreeBSD KDE Team is pleased to announce KDE SC 4.6.1 and KDE PIMavilla2011-03-252-11/+39 * - Get Rid MD5 supportmiwi2011-03-1949-87/+0 * - Unbreakpav2011-03-172-22/+20 * - Remove unnecessary PKGNAMEPREFIX declarationsunpoet2011-01-09