Re: align layout patch
- From: Dennis Cranston <dennis_cranston yahoo com>
- To: Reginald Melchisedek Poyau <melchisedek earthlink net>, Dave Bordoley <bordoley msu edu>
- Cc: Alexander Larsson <alexl redhat com>, nautilus-list gnome org
- Subject: Re: align layout patch
- Date: Wed, 11 Sep 2002 08:34:12 -0700 (PDT)
Reginald-
I have tried your patch, and overall it works well. But, everytime I navigate
in a nautilus window I see the following.
** (nautilus:7998): CRITICAL **: file nautilus-icon-container.c: line 1200
(lay_down_icons_in_auto_layout): assertion `icon_list != NULL' failed
Good work!
Dennis
--- Reginald Melchisedek Poyau <melchisedek earthlink net> wrote:
> On Tue, 2002-09-10 at 22:17, Dave Bordoley wrote:
> > Uhh this patch does some funky things like cleaup by name on the desktop
> > causes the icons to be spaced way far apart, does this in the icon view
> > too for directories with few icons. I can email you a screenshot if
> > needed.
> I see. This behavior is not a bug it is a design feature that removes
> excess leftover space on the opposite side of primary layout direction.
> I've disable this behavior for the case where there is only one line
> icons.
>
>
> > dave
> > --
> > nautilus-list mailing list
> > nautilus-list gnome org
> > http://mail.gnome.org/mailman/listinfo/nautilus-list
> --
> "There has grown in the minds of certain groups in this country the
> idea that just because
> a man or corporation has made a profit out of the public for a number of
> years, the
> government and the courts are charged with guaranteeing such profit in
> the future, even in
> the face of changing circumstances and contrary to public interest. This
> strange doctrine
> is supported by neither statue or common law. Neither corporations or
> individuals have the
> right to come into court and ask that the clock of history be stopped,
> or turned back."
>
> -Robert Heinlein, Life Line, 1939
> > ? nautilus/autom4te-2.53.cache
> ? nautilus/components/adapter/Nautilus_ComponentAdapterFactory_std.server.in
> ? nautilus/components/history/Nautilus_View_history.server.in
> ? nautilus/components/loser/content/Nautilus_View_content-loser.server.in
> ? nautilus/components/loser/sidebar/Nautilus_View_sidebar-loser.server.in
> ? nautilus/components/music/Nautilus_View_music.server.in
> ? nautilus/components/notes/Nautilus_View_notes.server.in
> ? nautilus/components/sample/Nautilus_View_sample.server.in
> ? nautilus/components/text/Nautilus_View_text.server.in
> ? nautilus/components/throbber/Nautilus_Control_throbber.server.in
> ? nautilus/components/tree/Nautilus_View_tree.server.in
> Index: nautilus/libnautilus-private/nautilus-icon-container.c
> ===================================================================
> RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-icon-container.c,v
> retrieving revision 1.295
> diff -u -b -B -p -u -r1.295 nautilus-icon-container.c
> --- nautilus/libnautilus-private/nautilus-icon-container.c 9 Sep 2002
> 17:21:36 -0000 1.295
> +++ nautilus/libnautilus-private/nautilus-icon-container.c 11 Sep 2002
> 10:07:29 -0000
> @@ -28,6 +28,7 @@
> #include "nautilus-icon-container.h"
>
> #include "nautilus-global-preferences.h"
> +#include "nautilus-file-utilities.h"
> #include "nautilus-icon-private.h"
> #include "nautilus-lib-self-check-functions.h"
> #include "nautilus-marshal.h"
> @@ -159,7 +160,7 @@ static void setup_label_gcs
>
> static int click_policy_auto_value;
>
> -static gpointer accessible_parent_class;
> +gpointer accessible_parent_class;
>
> static GQuark accessible_private_data_quark = 0;
>
> @@ -677,11 +678,18 @@ nautilus_icon_container_update_scroll_re
> if (nautilus_icon_container_get_is_fixed_size (container)) {
> pixels_per_unit = GNOME_CANVAS (container)->pixels_per_unit;
>
> + /* Changes panel avoidance behavior for T_B_R_L
> + layout mode.*/
> + if (container->details->layout_mode == NAUTILUS_ICON_LAYOUT_T_B_R_L) {
> + x1 = (double) container->details->right_margin;
> + } else {
> + x1 = (double) - container->details->left_margin;
> + }
> +
> /* Set the scroll region to the size of the container allocation */
> allocation = >K_WIDGET (container)->allocation;
> eel_gnome_canvas_set_scroll_region_left_justify
> - (GNOME_CANVAS (container),
> - (double) - container->details->left_margin,
> + (GNOME_CANVAS (container), x1,
> (double) - container->details->top_margin,
> (double) (allocation->width - 1) / pixels_per_unit
> - container->details->left_margin
> @@ -708,6 +716,19 @@ nautilus_icon_container_update_scroll_re
> }
>
> if (reset_scroll_region) {
> + /* Workaround that prevents left justifications
> + of icons in T_B_R_L layout mode in regular
> + directories */
> + if (container->details->layout_mode == NAUTILUS_ICON_LAYOUT_T_B_R_L) {
> + pixels_per_unit = GNOME_CANVAS (container)->pixels_per_unit;
> + hadj = gtk_layout_get_hadjustment (GTK_LAYOUT (container));
> + allocation = >K_WIDGET (container)->allocation;
> +
> + x1 = MIN (CONTAINER_PAD_LEFT + CONTAINER_PAD_RIGHT
> + + (allocation->width - hadj->page_size) / pixels_per_unit, x1);
> + x2 = (allocation->width - 1) / pixels_per_unit - CONTAINER_PAD_RIGHT;
> + }
> +
> eel_gnome_canvas_set_scroll_region_left_justify
> (GNOME_CANVAS (container),
> x1 - CONTAINER_PAD_LEFT,
> @@ -779,7 +800,7 @@ resort (NautilusIconContainer *container
> /* Given an icon's bounds, compute the width of the space it should be
> * placed in.
> */
> -static int
> +static inline int
> get_icon_space_width (NautilusIconContainer *container, const ArtDRect
> *bounds)
> {
> double world_width;
> @@ -796,147 +817,425 @@ get_icon_space_width (NautilusIconContai
> }
>
> typedef struct {
> - double width;
> + /* {x,y} Cartesian basis */
> + double *x;
> + double *y;
> +
> + /* {u, m} IconLayout basis */
> + double u;
> + double m;
> +
> + /* 0 or 180 degrees depending on
> + layout mode. Initial value
> + also depends on layout mode */
> + double m_direction;
> +} IconLayoutBases;
> +
> +typedef struct {
> + double origin;
> + double end;
> +} IconLayoutBasisComponent;
> +
> +typedef struct {
> + IconLayoutBasisComponent *icon_u_component;
> + IconLayoutBasisComponent *icon_m_component;
> double x_offset;
> double y_offset;
> -} IconPositions;
> +} IconLayoutIconInfo;
>
> -static void
> -lay_down_one_line (NautilusIconContainer *container,
> - GList *line_start,
> - GList *line_end,
> - double y,
> - GArray *positions)
> -{
> - GList *p;
> - NautilusIcon *icon;
> - double x;
> - IconPositions *position;
> - int i;
> +typedef struct {
> + /* u is the primary vector (L_R or T_B) in which
> + icons are going to layed down depending on
> + layout mode. m vector is orthogonal to u. */
> + GArray *u_components;
> + GHashTable *m_components;
> + unsigned int u_index;
> + unsigned int m_index;
> +} IconLayoutGridCells;
>
> - /* FIXME: Should layout differently when in RTL base mode */
> +typedef struct {
> + NautilusIconContainer *container;
> + IconLayoutGridCells *cells;
> + IconLayoutBases bases;
> + IconLayoutBasisComponent max_m_component;
> + double line_u_length;
> + double canvas_u_length;
> + double u_adjustment;
> +} IconLayoutGrid;
>
> - /* Lay out the icons along the baseline. */
> - x = 0;
> - i = 0;
> - for (p = line_start; p != line_end; p = p->next) {
> - icon = p->data;
> +static inline IconLayoutIconInfo*
> +icon_layout_get_icon_info (NautilusIconContainer *container,
> + NautilusIcon *icon,
> + GHashTable *icons_informations)
> +{
> + ArtDRect bounds;
> + ArtDRect icon_bounds;
> + IconLayoutIconInfo *info;
>
> - position = &g_array_index (positions, IconPositions, i++);
> + info = g_hash_table_lookup (icons_informations, icon);
>
> - icon_set_position
> - (icon,
> - x + position->x_offset,
> - y + position->y_offset);
> + if (info == NULL) {
> + /* Assume it's only one level hierarchy to avoid costly affine
> calculations */
> + gnome_canvas_item_get_bounds (GNOME_CANVAS_ITEM (icon->item),
> + &bounds.x0, &bounds.y0,
> + &bounds.x1, &bounds.y1);
> + icon_bounds = nautilus_icon_canvas_item_get_icon_rectangle (icon->item);
> +
> + info = g_new0 (IconLayoutIconInfo, 1);
> + info->icon_u_component = g_new0 (IconLayoutBasisComponent, 1);
> + info->icon_m_component = g_new0 (IconLayoutBasisComponent, 1);
> + info->y_offset = icon_bounds.y0 - icon_bounds.y1;
> + info->x_offset = (icon_bounds.x0 - icon_bounds.x1) / 2;
>
> - x += position->width;
> + switch (container->details->layout_mode)
> + {
> + case NAUTILUS_ICON_LAYOUT_L_R_T_B:
> + info->icon_u_component->origin = get_icon_space_width (container,
> &bounds) / 2;
> + info->icon_u_component->end = info->icon_u_component->origin;
> + info->icon_m_component->origin = ICON_PAD_TOP + icon_bounds.y1 -
> bounds.y0;
> + info->icon_m_component->end = bounds.y1 - icon_bounds.y1 +
> ICON_PAD_BOTTOM;
> + break;
> + case NAUTILUS_ICON_LAYOUT_T_B_L_R:
>
=== message truncated ===
__________________________________________________
Yahoo! - We Remember
9-11: A tribute to the more than 3,000 lives lost
http://dir.remember.yahoo.com/tribute
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]