aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/e-day-view.c
diff options
context:
space:
mode:
authorDamon Chaplin <damon@helixcode.com>2000-12-11 10:22:06 +0800
committerDamon Chaplin <damon@src.gnome.org>2000-12-11 10:22:06 +0800
commitba28f6622636fc3932aab4a0551e2d86b69fd6e4 (patch)
tree4fa39103cd28af9eff5a79778eb22fe2c9b8a9bf /calendar/gui/e-day-view.c
parent50fcc2ad7d4c717aafa62195988a8362fc7a3f19 (diff)
downloadgsoc2013-evolution-ba28f6622636fc3932aab4a0551e2d86b69fd6e4.tar
gsoc2013-evolution-ba28f6622636fc3932aab4a0551e2d86b69fd6e4.tar.gz
gsoc2013-evolution-ba28f6622636fc3932aab4a0551e2d86b69fd6e4.tar.bz2
gsoc2013-evolution-ba28f6622636fc3932aab4a0551e2d86b69fd6e4.tar.lz
gsoc2013-evolution-ba28f6622636fc3932aab4a0551e2d86b69fd6e4.tar.xz
gsoc2013-evolution-ba28f6622636fc3932aab4a0551e2d86b69fd6e4.tar.zst
gsoc2013-evolution-ba28f6622636fc3932aab4a0551e2d86b69fd6e4.zip
added changed flags and added calls to a new function
2000-12-11 Damon Chaplin <damon@helixcode.com> * gui/event-editor.c: added changed flags and added calls to a new function event_editor_set_changed() to set & reset this flag. Added prompt_to_save_changed() which is called when the user selects File/Close or the window's close button. Fixed the 'All day event' toggle button. Made the 'Alarm' page sensitive as appropriate when filling widgets. (Though note that the alarm widgets are not being set yet.) * gui/dialogs/task-editor.c: added changed flag as above. * gui/event-editor-dialog.glade: used good names for all the classification radio buttons so we can access them in the code. * gui/event-editor.c (init_widgets): use the "show week numbers" config option in the recurrence preview calendar. * gui/e-day-view.c (e_day_view_update_event_label): use 9:00 instead of 09:00 in the main view, as we do everywhere else now. It means the times won't line up, but they are easier to read which I think is better. Added support for Page Up/Down, though I think it should move the selection rather than just scroll the canvas. * cal-util/cal-recur.c (generate_instances_for_chunk): removed the end parameter since we should be using the chunk end time now. Added single_rule parameter for when we are generating the occurrences of a single RRULE, in which case the event's start date is not included in the occurrences output (unless it results from the RRULE expansion). Both of these fix problems when using COUNT. * gui/gnome-cal.c (gnome_calendar_on_date_navigator_selection_changed): fixed bug when checking if the new start day starts on the week start day. If you select a complete week it should now show the Week view. svn path=/trunk/; revision=6896
Diffstat (limited to 'calendar/gui/e-day-view.c')
-rw-r--r--calendar/gui/e-day-view.c60
1 files changed, 46 insertions, 14 deletions
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c
index 0f22f59a30..9078fcef73 100644
--- a/calendar/gui/e-day-view.c
+++ b/calendar/gui/e-day-view.c
@@ -69,6 +69,15 @@
we start a drag. */
#define E_DAY_VIEW_DRAG_START_OFFSET 4
+/* The amount we scroll the main canvas when the Page Up/Down keys are pressed,
+ as a fraction of the page size. */
+#define E_DAY_VIEW_PAGE_STEP 0.5
+
+/* The amount we scroll the main canvas when the mouse wheel buttons are
+ pressed, as a fraction of the page size. */
+#define E_DAY_VIEW_WHEEL_MOUSE_STEP_SIZE 0.25
+
+
/* Drag and Drop stuff. */
enum {
TARGET_CALENDAR_EVENT
@@ -113,6 +122,8 @@ static void e_day_view_cursor_key_right (EDayView *day_view,
static void e_day_view_ensure_rows_visible (EDayView *day_view,
gint start_row,
gint end_row);
+static void e_day_view_scroll (EDayView *day_view,
+ gfloat pages_to_scroll);
static gboolean e_day_view_check_if_new_event_fits (EDayView *day_view);
@@ -1665,14 +1676,14 @@ e_day_view_update_event_label (EDayView *day_view,
if (day_view->show_event_end_times) {
/* 24 hour format with end time. */
text = g_strdup_printf
- ("%02i:%02i-%02i:%02i %s",
+ ("%2i:%02i-%2i:%02i %s",
start_display_hour, start_minute,
end_display_hour, end_minute,
text);
} else {
/* 24 hour format without end time. */
text = g_strdup_printf
- ("%02i:%02i %s",
+ ("%2i:%02i %s",
start_display_hour, start_minute,
text);
}
@@ -1680,7 +1691,7 @@ e_day_view_update_event_label (EDayView *day_view,
if (day_view->show_event_end_times) {
/* 12 hour format with end time. */
text = g_strdup_printf
- ("%02i:%02i%s-%02i:%02i%s %s",
+ ("%2i:%02i%s-%2i:%02i%s %s",
start_display_hour, start_minute,
start_suffix,
end_display_hour, end_minute,
@@ -1689,7 +1700,7 @@ e_day_view_update_event_label (EDayView *day_view,
} else {
/* 12 hour format without end time. */
text = g_strdup_printf
- ("%02i:%02i%s %s",
+ ("%2i:%02i%s %s",
start_display_hour, start_minute,
start_suffix,
text);
@@ -2531,16 +2542,14 @@ e_day_view_on_main_canvas_button_press (GtkWidget *widget,
EDayViewPosition pos;
/* Handle scroll wheel events */
- if (event->button == 4 || event->button == 5) {
- GtkAdjustment *adj = GTK_LAYOUT (day_view->main_canvas)->vadjustment;
- gfloat new_value;
-
- new_value = adj->value + ((event->button == 4) ?
- -adj->page_increment / 2:
- adj->page_increment / 2);
- new_value = CLAMP (new_value, adj->lower, adj->upper - adj->page_size);
- gtk_adjustment_set_value (adj, new_value);
-
+ if (event->button == 4) {
+ /* The wheel has been moved up, so scroll the canvas down. */
+ e_day_view_scroll (day_view, E_DAY_VIEW_WHEEL_MOUSE_STEP_SIZE);
+ return TRUE;
+ }
+ if (event->button == 5) {
+ /* The wheel has been moved down, so scroll the canvas up. */
+ e_day_view_scroll (day_view, -E_DAY_VIEW_WHEEL_MOUSE_STEP_SIZE);
return TRUE;
}
@@ -4724,6 +4733,12 @@ e_day_view_key_press (GtkWidget *widget, GdkEventKey *event)
case GDK_Right:
e_day_view_cursor_key_right (day_view, event);
break;
+ case GDK_Page_Up:
+ e_day_view_scroll (day_view, E_DAY_VIEW_PAGE_STEP);
+ break;
+ case GDK_Page_Down:
+ e_day_view_scroll (day_view, -E_DAY_VIEW_PAGE_STEP);
+ break;
default:
stop_emission = FALSE;
break;
@@ -5006,6 +5021,23 @@ e_day_view_cursor_key_right (EDayView *day_view, GdkEventKey *event)
}
+/* Scrolls the main canvas up or down. The pages_to_scroll argument
+ is multiplied with the adjustment's page size and added to the adjustment's
+ value, while ensuring we stay within the bounds. A positive value will
+ scroll the canvas down and a negative value will scroll it up. */
+static void
+e_day_view_scroll (EDayView *day_view,
+ gfloat pages_to_scroll)
+{
+ GtkAdjustment *adj = GTK_LAYOUT (day_view->main_canvas)->vadjustment;
+ gfloat new_value;
+
+ new_value = adj->value - adj->page_size * pages_to_scroll;
+ new_value = CLAMP (new_value, adj->lower, adj->upper - adj->page_size);
+ gtk_adjustment_set_value (adj, new_value);
+}
+
+
static gboolean
e_day_view_check_if_new_event_fits (EDayView *day_view)
{