aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--ChangeLog.ja6
-rw-r--r--src/gtkutils.c25
-rw-r--r--src/gtkutils.h3
-rw-r--r--src/summaryview.c13
-rw-r--r--src/summaryview.h2
6 files changed, 44 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index a1086b8a..80954c2b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2005-09-22
+ * src/gtkutils.[ch]
+ src/summaryview.[ch]: align selected row to center when reached to
+ the edge on key operation.
+
+2005-09-22
+
* src/summaryview.c: keep selecting row after changing thread display.
2005-09-21
diff --git a/ChangeLog.ja b/ChangeLog.ja
index f0bb4433..2424227a 100644
--- a/ChangeLog.ja
+++ b/ChangeLog.ja
@@ -1,5 +1,11 @@
2005-09-22
+ * src/gtkutils.[ch]
+ src/summaryview.[ch]: キー操作で端に達したときに選択行を中央に
+ 配置するようにした。
+
+2005-09-22
+
* src/summaryview.c: スレッド表示を変更した後も行を選択し続ける
ようにした。
diff --git a/src/gtkutils.c b/src/gtkutils.c
index 71674a33..54091314 100644
--- a/src/gtkutils.c
+++ b/src/gtkutils.c
@@ -555,7 +555,8 @@ void gtkut_tree_view_vertical_autoscroll(GtkTreeView *treeview)
}
/* modified version of gtk_tree_view_scroll_to_cell */
-void gtkut_tree_view_scroll_to_cell(GtkTreeView *treeview, GtkTreePath *path)
+void gtkut_tree_view_scroll_to_cell(GtkTreeView *treeview, GtkTreePath *path,
+ gboolean align_center)
{
GdkRectangle cell_rect;
GdkRectangle vis_rect;
@@ -575,14 +576,24 @@ void gtkut_tree_view_scroll_to_cell(GtkTreeView *treeview, GtkTreePath *path)
/* add margin */
if (cell_rect.height * 2 < vis_rect.height)
- margin = cell_rect.height + 2;
+ margin = cell_rect.height + (align_center ? 0 : 2);
- if (cell_rect.y < vis_rect.y + margin)
- dest_y = cell_rect.y - margin;
+ if (cell_rect.y < vis_rect.y + margin) {
+ if (align_center)
+ dest_y = cell_rect.y -
+ (vis_rect.height - cell_rect.height) / 2;
+ else
+ dest_y = cell_rect.y - margin;
+ }
if (cell_rect.y + cell_rect.height >
- vis_rect.y + vis_rect.height - margin)
- dest_y = cell_rect.y + cell_rect.height - vis_rect.height +
- margin;
+ vis_rect.y + vis_rect.height - margin) {
+ if (align_center)
+ dest_y = cell_rect.y -
+ (vis_rect.height - cell_rect.height) / 2;
+ else
+ dest_y = cell_rect.y + cell_rect.height -
+ vis_rect.height + margin;
+ }
gtk_tree_view_scroll_to_point(treeview, dest_x, dest_y);
}
diff --git a/src/gtkutils.h b/src/gtkutils.h
index 2a867660..efd6802f 100644
--- a/src/gtkutils.h
+++ b/src/gtkutils.h
@@ -155,7 +155,8 @@ void gtkut_tree_view_expand_parent_all (GtkTreeView *treeview,
void gtkut_tree_view_vertical_autoscroll(GtkTreeView *treeview);
void gtkut_tree_view_scroll_to_cell (GtkTreeView *treeview,
- GtkTreePath *path);
+ GtkTreePath *path,
+ gboolean align_center);
void gtkut_combo_set_items (GtkCombo *combo,
const gchar *str1, ...);
diff --git a/src/summaryview.c b/src/summaryview.c
index 01e2b409..d2372398 100644
--- a/src/summaryview.c
+++ b/src/summaryview.c
@@ -789,6 +789,7 @@ void summary_clear_list(SummaryView *summaryview)
}
summaryview->filtered = 0;
+ summaryview->on_button_press = FALSE;
summaryview->can_toggle_selection = TRUE;
summaryview->on_drag = FALSE;
if (summaryview->pressed_path) {
@@ -1288,7 +1289,8 @@ void summary_select_row(SummaryView *summaryview, GtkTreeIter *iter,
path, NULL, TRUE, 0.5, 0.0);
} else {
gtkut_tree_view_scroll_to_cell
- (GTK_TREE_VIEW(summaryview->treeview), path);
+ (GTK_TREE_VIEW(summaryview->treeview), path,
+ !summaryview->on_button_press);
}
gtk_tree_path_free(path);
@@ -1310,7 +1312,8 @@ static void summary_scroll_to_selected(SummaryView *summaryview,
path, NULL, TRUE, 0.5, 0.0);
else
gtkut_tree_view_scroll_to_cell
- (GTK_TREE_VIEW(summaryview->treeview), path);
+ (GTK_TREE_VIEW(summaryview->treeview), path,
+ FALSE);
gtk_tree_path_free(path);
}
}
@@ -2230,7 +2233,8 @@ static void summary_display_msg_full(SummaryView *summaryview,
(GTK_NOTEBOOK(msgview->notebook)) == 0)))
gtk_widget_grab_focus(summaryview->treeview);
gtkut_tree_view_scroll_to_cell
- (GTK_TREE_VIEW(summaryview->treeview), path);
+ (GTK_TREE_VIEW(summaryview->treeview), path,
+ !summaryview->on_button_press);
gtk_tree_path_free(path);
}
@@ -4540,6 +4544,8 @@ static gboolean summary_button_pressed(GtkWidget *treeview,
}
if (event->button == 1) {
+ summaryview->on_button_press = TRUE;
+
if (summary_get_selection_type(summaryview) ==
SUMMARY_SELECTED_MULTIPLE && is_selected &&
!mod_pressed) {
@@ -4588,6 +4594,7 @@ static gboolean summary_button_released(GtkWidget *treeview,
NULL, FALSE);
}
+ summaryview->on_button_press = FALSE;
summaryview->can_toggle_selection = TRUE;
summaryview->on_drag = FALSE;
if (summaryview->pressed_path) {
diff --git a/src/summaryview.h b/src/summaryview.h
index d2ba350c..1711c704 100644
--- a/src/summaryview.h
+++ b/src/summaryview.h
@@ -122,6 +122,8 @@ private:
/* counter for filtering */
gint filtered;
+ gboolean on_button_press;
+
/* for DnD */
gboolean can_toggle_selection;
gboolean on_drag;