Mercurial > pidgin.yaz
changeset 20330:4ab7551d9626
applied changes from 4a3126ce09aff7f83c70b32f2048f5b7f302b79e
through c62d29ba9f12404999d6ff94564dd951ea8f9c44
applied changes from c62d29ba9f12404999d6ff94564dd951ea8f9c44
through 83245b7ca93e546927c19472b74cf4dff6d1a96b
applied changes from 83245b7ca93e546927c19472b74cf4dff6d1a96b
through e7a18c70a00a0534e1e6f7956970e10d6d0b69ec
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Fri, 19 Oct 2007 18:23:28 +0000 |
parents | 24ce4fcce5b0 |
children | 233c423d40d3 |
files | pidgin/gtkconv.c |
diffstat | 1 files changed, 37 insertions(+), 28 deletions(-) [+] |
line wrap: on
line diff
--- a/pidgin/gtkconv.c Fri Oct 19 18:14:53 2007 +0000 +++ b/pidgin/gtkconv.c Fri Oct 19 18:23:28 2007 +0000 @@ -4300,45 +4300,54 @@ gtk_menu_shell_insert(GTK_MENU_SHELL(menu), menuitem, 1); } - static void resize_imhtml_cb(PidginConversation *gtkconv) { GtkTextBuffer *buffer; GtkTextIter iter; - int wrapped_lines; - int lines; - GdkRectangle oneline; + int wrapped_lines; + int lines; + GdkRectangle oneline; GtkRequisition sr; - int height; - int pad_top, pad_inside, pad_bottom; + int height, diff; + int pad_top, pad_inside, pad_bottom; buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); - wrapped_lines = 1; - gtk_text_buffer_get_start_iter(buffer, &iter); - gtk_text_view_get_iter_location(GTK_TEXT_VIEW(gtkconv->entry), &iter, &oneline); - while (gtk_text_view_forward_display_line(GTK_TEXT_VIEW(gtkconv->entry), &iter)) - wrapped_lines++; - - lines = gtk_text_buffer_get_line_count(buffer); - - /* Show a maximum of 4 lines */ - lines = MIN(lines, 4); - wrapped_lines = MIN(wrapped_lines, 4); - - pad_top = gtk_text_view_get_pixels_above_lines(GTK_TEXT_VIEW(gtkconv->entry)); - pad_bottom = gtk_text_view_get_pixels_below_lines(GTK_TEXT_VIEW(gtkconv->entry)); - pad_inside = gtk_text_view_get_pixels_inside_wrap(GTK_TEXT_VIEW(gtkconv->entry)); - - height = (oneline.height + pad_top + pad_bottom) * lines; - height += (oneline.height + pad_inside) * (wrapped_lines - lines); + wrapped_lines = 1; + gtk_text_buffer_get_start_iter(buffer, &iter); + gtk_text_view_get_iter_location(GTK_TEXT_VIEW(gtkconv->entry), &iter, &oneline); + while (gtk_text_view_forward_display_line(GTK_TEXT_VIEW(gtkconv->entry), &iter)) + wrapped_lines++; + + lines = gtk_text_buffer_get_line_count(buffer); + + /* Show a maximum of 4 lines */ + lines = MIN(lines, 4); + wrapped_lines = MIN(wrapped_lines, 4); + + pad_top = gtk_text_view_get_pixels_above_lines(GTK_TEXT_VIEW(gtkconv->entry)); + pad_bottom = gtk_text_view_get_pixels_below_lines(GTK_TEXT_VIEW(gtkconv->entry)); + pad_inside = gtk_text_view_get_pixels_inside_wrap(GTK_TEXT_VIEW(gtkconv->entry)); + + height = (oneline.height + pad_top + pad_bottom) * lines; + height += (oneline.height + pad_inside) * (wrapped_lines - lines); gtkconv->auto_resize = TRUE; - g_idle_add(reset_auto_resize_cb, gtkconv); - gtk_widget_size_request(gtkconv->lower_hbox, &sr); - if (sr.height < height + PIDGIN_HIG_BOX_SPACE) { + g_idle_add(reset_auto_resize_cb, gtkconv); + + diff = height - gtkconv->entry->allocation.height; + + if (diff > 0) { + gtk_widget_size_request(gtkconv->lower_hbox, &sr); gtkconv->entry_growing = TRUE; - gtk_widget_set_size_request(gtkconv->lower_hbox, -1, height + PIDGIN_HIG_BOX_SPACE); + + /* uncomment this to auto resize even after the user manually + resizes + gtk_paned_set_position(GTK_PANED(gtkconv->lower_hbox->parent->parent), + -1); + */ + gtk_widget_set_size_request(gtkconv->lower_hbox, -1, + diff + gtkconv->lower_hbox->allocation.height); } }