Make the any-key-creates-new-appointment-at-selection thing actually work - Federico
svn path=/trunk/; revision=173
This commit is contained in:
@ -1,5 +1,9 @@
|
|||||||
1998-04-20 Federico Mena Quintero <federico@nuclecu.unam.mx>
|
1998-04-20 Federico Mena Quintero <federico@nuclecu.unam.mx>
|
||||||
|
|
||||||
|
* gncal-full-day.c (gncal_full_day_get_day_start_yoffset): New
|
||||||
|
public function that returns the y offset for the row
|
||||||
|
corresponding to the "day begin" time.
|
||||||
|
|
||||||
* gncal-full-day.c (gncal_full_day_key_press): Now any printable
|
* gncal-full-day.c (gncal_full_day_key_press): Now any printable
|
||||||
keystroke (not just Return) will activate the selected range.
|
keystroke (not just Return) will activate the selected range.
|
||||||
|
|
||||||
|
@ -1812,6 +1812,7 @@ gncal_full_day_key_press (GtkWidget *widget, GdkEventKey *event)
|
|||||||
struct drag_info *di;
|
struct drag_info *di;
|
||||||
GList *children;
|
GList *children;
|
||||||
Child *child;
|
Child *child;
|
||||||
|
gint pos;
|
||||||
|
|
||||||
g_return_val_if_fail (widget != NULL, FALSE);
|
g_return_val_if_fail (widget != NULL, FALSE);
|
||||||
g_return_val_if_fail (GNCAL_IS_FULL_DAY (widget), FALSE);
|
g_return_val_if_fail (GNCAL_IS_FULL_DAY (widget), FALSE);
|
||||||
@ -1834,20 +1835,22 @@ gncal_full_day_key_press (GtkWidget *widget, GdkEventKey *event)
|
|||||||
|
|
||||||
gtk_signal_emit (GTK_OBJECT (fullday), fullday_signals[RANGE_ACTIVATED]);
|
gtk_signal_emit (GTK_OBJECT (fullday), fullday_signals[RANGE_ACTIVATED]);
|
||||||
|
|
||||||
/* This is sort of a hack. We find the focused child, if it exists, and
|
/* Find the new child, which should hopefully be focused, and insert the keypress */
|
||||||
* we re-send the keystroke to it.
|
|
||||||
*/
|
|
||||||
|
|
||||||
for (children = fullday->children; children; children = children->next) {
|
for (children = fullday->children; children; children = children->next) {
|
||||||
child = children->data;
|
child = children->data;
|
||||||
|
|
||||||
if (GTK_WIDGET_HAS_FOCUS (child->widget)) {
|
if (GTK_WIDGET_HAS_FOCUS (child->widget)) {
|
||||||
event->window = GTK_TEXT (child->widget)->text_area;
|
pos = gtk_text_get_length (GTK_TEXT (child->widget));
|
||||||
gtk_widget_event (widget, (GdkEvent *) event);
|
|
||||||
|
gtk_editable_insert_text (GTK_EDITABLE (child->widget),
|
||||||
|
event->string,
|
||||||
|
event->length,
|
||||||
|
&pos);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -2072,6 +2075,22 @@ gncal_full_day_focus_child (GncalFullDay *fullday, iCalObject *ico)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
gncal_full_day_get_day_start_yoffset (GncalFullDay *fullday)
|
||||||
|
{
|
||||||
|
GtkWidget *widget;
|
||||||
|
int begin_row;
|
||||||
|
|
||||||
|
g_return_val_if_fail (fullday != NULL, 0);
|
||||||
|
g_return_val_if_fail (GNCAL_IS_FULL_DAY (fullday), 0);
|
||||||
|
|
||||||
|
widget = GTK_WIDGET (fullday);
|
||||||
|
|
||||||
|
begin_row = (day_begin * 60) / fullday->interval;
|
||||||
|
|
||||||
|
return widget->style->klass->ythickness + begin_row * calc_row_height (fullday);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
range_activated (GncalFullDay *fullday)
|
range_activated (GncalFullDay *fullday)
|
||||||
{
|
{
|
||||||
|
@ -49,20 +49,22 @@ struct _GncalFullDayClass {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
guint gncal_full_day_get_type (void);
|
guint gncal_full_day_get_type (void);
|
||||||
GtkWidget *gncal_full_day_new (GnomeCalendar *calendar, time_t lower, time_t upper);
|
GtkWidget *gncal_full_day_new (GnomeCalendar *calendar, time_t lower, time_t upper);
|
||||||
|
|
||||||
void gncal_full_day_update (GncalFullDay *fullday, iCalObject *ico, int flags);
|
void gncal_full_day_update (GncalFullDay *fullday, iCalObject *ico, int flags);
|
||||||
void gncal_full_day_set_bounds (GncalFullDay *fullday, time_t lower, time_t upper);
|
void gncal_full_day_set_bounds (GncalFullDay *fullday, time_t lower, time_t upper);
|
||||||
|
|
||||||
/* Returns the selected range in lower and upper. If nothing is
|
/* Returns the selected range in lower and upper. If nothing is
|
||||||
* selected, return value is FALSE, otherwise it is TRUE.
|
* selected, return value is FALSE, otherwise it is TRUE.
|
||||||
* The lower and upper values are always set to proper values, regardless of
|
* The lower and upper values are always set to proper values, regardless of
|
||||||
* the selection value
|
* the selection value
|
||||||
*/
|
*/
|
||||||
int gncal_full_day_selection_range (GncalFullDay *fullday, time_t *lower, time_t *upper);
|
int gncal_full_day_selection_range (GncalFullDay *fullday, time_t *lower, time_t *upper);
|
||||||
|
|
||||||
void gncal_full_day_focus_child (GncalFullDay *fullday, iCalObject *ico);
|
void gncal_full_day_focus_child (GncalFullDay *fullday, iCalObject *ico);
|
||||||
|
|
||||||
|
int gncal_full_day_get_day_start_yoffset (GncalFullDay *fullday);
|
||||||
|
|
||||||
END_GNOME_DECLS
|
END_GNOME_DECLS
|
||||||
|
|
||||||
|
@ -102,6 +102,7 @@ setup_day_view (GnomeCalendar *gcal, time_t now)
|
|||||||
GTK_FILL | GTK_EXPAND | GTK_SHRINK,
|
GTK_FILL | GTK_EXPAND | GTK_SHRINK,
|
||||||
0, 0);
|
0, 0);
|
||||||
gtk_container_add (GTK_CONTAINER (sw), gcal->day_view);
|
gtk_container_add (GTK_CONTAINER (sw), gcal->day_view);
|
||||||
|
|
||||||
gtk_widget_show_all (GTK_WIDGET (t));
|
gtk_widget_show_all (GTK_WIDGET (t));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1812,6 +1812,7 @@ gncal_full_day_key_press (GtkWidget *widget, GdkEventKey *event)
|
|||||||
struct drag_info *di;
|
struct drag_info *di;
|
||||||
GList *children;
|
GList *children;
|
||||||
Child *child;
|
Child *child;
|
||||||
|
gint pos;
|
||||||
|
|
||||||
g_return_val_if_fail (widget != NULL, FALSE);
|
g_return_val_if_fail (widget != NULL, FALSE);
|
||||||
g_return_val_if_fail (GNCAL_IS_FULL_DAY (widget), FALSE);
|
g_return_val_if_fail (GNCAL_IS_FULL_DAY (widget), FALSE);
|
||||||
@ -1834,20 +1835,22 @@ gncal_full_day_key_press (GtkWidget *widget, GdkEventKey *event)
|
|||||||
|
|
||||||
gtk_signal_emit (GTK_OBJECT (fullday), fullday_signals[RANGE_ACTIVATED]);
|
gtk_signal_emit (GTK_OBJECT (fullday), fullday_signals[RANGE_ACTIVATED]);
|
||||||
|
|
||||||
/* This is sort of a hack. We find the focused child, if it exists, and
|
/* Find the new child, which should hopefully be focused, and insert the keypress */
|
||||||
* we re-send the keystroke to it.
|
|
||||||
*/
|
|
||||||
|
|
||||||
for (children = fullday->children; children; children = children->next) {
|
for (children = fullday->children; children; children = children->next) {
|
||||||
child = children->data;
|
child = children->data;
|
||||||
|
|
||||||
if (GTK_WIDGET_HAS_FOCUS (child->widget)) {
|
if (GTK_WIDGET_HAS_FOCUS (child->widget)) {
|
||||||
event->window = GTK_TEXT (child->widget)->text_area;
|
pos = gtk_text_get_length (GTK_TEXT (child->widget));
|
||||||
gtk_widget_event (widget, (GdkEvent *) event);
|
|
||||||
|
gtk_editable_insert_text (GTK_EDITABLE (child->widget),
|
||||||
|
event->string,
|
||||||
|
event->length,
|
||||||
|
&pos);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -2072,6 +2075,22 @@ gncal_full_day_focus_child (GncalFullDay *fullday, iCalObject *ico)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
gncal_full_day_get_day_start_yoffset (GncalFullDay *fullday)
|
||||||
|
{
|
||||||
|
GtkWidget *widget;
|
||||||
|
int begin_row;
|
||||||
|
|
||||||
|
g_return_val_if_fail (fullday != NULL, 0);
|
||||||
|
g_return_val_if_fail (GNCAL_IS_FULL_DAY (fullday), 0);
|
||||||
|
|
||||||
|
widget = GTK_WIDGET (fullday);
|
||||||
|
|
||||||
|
begin_row = (day_begin * 60) / fullday->interval;
|
||||||
|
|
||||||
|
return widget->style->klass->ythickness + begin_row * calc_row_height (fullday);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
range_activated (GncalFullDay *fullday)
|
range_activated (GncalFullDay *fullday)
|
||||||
{
|
{
|
||||||
|
@ -49,20 +49,22 @@ struct _GncalFullDayClass {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
guint gncal_full_day_get_type (void);
|
guint gncal_full_day_get_type (void);
|
||||||
GtkWidget *gncal_full_day_new (GnomeCalendar *calendar, time_t lower, time_t upper);
|
GtkWidget *gncal_full_day_new (GnomeCalendar *calendar, time_t lower, time_t upper);
|
||||||
|
|
||||||
void gncal_full_day_update (GncalFullDay *fullday, iCalObject *ico, int flags);
|
void gncal_full_day_update (GncalFullDay *fullday, iCalObject *ico, int flags);
|
||||||
void gncal_full_day_set_bounds (GncalFullDay *fullday, time_t lower, time_t upper);
|
void gncal_full_day_set_bounds (GncalFullDay *fullday, time_t lower, time_t upper);
|
||||||
|
|
||||||
/* Returns the selected range in lower and upper. If nothing is
|
/* Returns the selected range in lower and upper. If nothing is
|
||||||
* selected, return value is FALSE, otherwise it is TRUE.
|
* selected, return value is FALSE, otherwise it is TRUE.
|
||||||
* The lower and upper values are always set to proper values, regardless of
|
* The lower and upper values are always set to proper values, regardless of
|
||||||
* the selection value
|
* the selection value
|
||||||
*/
|
*/
|
||||||
int gncal_full_day_selection_range (GncalFullDay *fullday, time_t *lower, time_t *upper);
|
int gncal_full_day_selection_range (GncalFullDay *fullday, time_t *lower, time_t *upper);
|
||||||
|
|
||||||
void gncal_full_day_focus_child (GncalFullDay *fullday, iCalObject *ico);
|
void gncal_full_day_focus_child (GncalFullDay *fullday, iCalObject *ico);
|
||||||
|
|
||||||
|
int gncal_full_day_get_day_start_yoffset (GncalFullDay *fullday);
|
||||||
|
|
||||||
END_GNOME_DECLS
|
END_GNOME_DECLS
|
||||||
|
|
||||||
|
@ -102,6 +102,7 @@ setup_day_view (GnomeCalendar *gcal, time_t now)
|
|||||||
GTK_FILL | GTK_EXPAND | GTK_SHRINK,
|
GTK_FILL | GTK_EXPAND | GTK_SHRINK,
|
||||||
0, 0);
|
0, 0);
|
||||||
gtk_container_add (GTK_CONTAINER (sw), gcal->day_view);
|
gtk_container_add (GTK_CONTAINER (sw), gcal->day_view);
|
||||||
|
|
||||||
gtk_widget_show_all (GTK_WIDGET (t));
|
gtk_widget_show_all (GTK_WIDGET (t));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user