Re: horizontal space problem with paragraphs (due to listitem plugin?)

"Nickolay V. Shmyrev" <[email protected]>
Newsgroups gmane.editors.conglomerate.devel
Message-ID <[email protected]>
В Вск, 17/10/2004 в 10:34 -0400, Douglas Burke пишет:
> 
> On Sun, 17 Oct 2004, Nickolay V. Shmyrev wrote:
> 
> > The attached patch fixes some issues with children allocation in cong-
> > editor-area-border, cong-editor-area-flow-holder and cong-editor-area-
> > composer. By applying this patch the problem described in previous mail
> > should be fixed.
> 
> Nikolay,
> 
> The bounding box is fixed. Thanks. Unfortunately there are problems when
> you select the "hide" (ie expand/unexpand) button of the listitem; the
> contents disappear but the vertical space they took up remains.
> 
> Doug
> 

Sorry, I've send this only to myself yesterday, not to mailing list.

I've also noticed that during out expander changes, structural
expand/collapse are broken, since the requsion=0 in hidden case returned
only in cong_editor_area_calc_requisition, not in
cong_editor_area_get_requistion. The updated patch fixes this problem
too.
patch.diff (text/x-patch, 7.7 KB)
? patch.diff
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/conglomerate/src/ChangeLog,v
retrieving revision 1.736
diff -u -r1.736 ChangeLog
--- ChangeLog	15 Oct 2004 16:01:40 -0000	1.736
+++ ChangeLog	17 Oct 2004 14:43:46 -0000
@@ -1,3 +1,13 @@
+2004-10-17 Nickolay V. Shmyrev <[email protected]>
+ 
+	* cong-editor-area-composer.c, cong-editor-area-flow-holder.c, cong-editor-area-border.c:
+ 	
+ 	Fix issues with allocation of children.
+ 	
+	* cong-editor-area.c:
+ 	
+ 	Fix hidden area requisition handle.
+
 2004-10-15  Douglas Burke  <[email protected]>
 
 	* cong-attribute-editor-cdata.c, cong-attribute-editor-cdata.h, cong-attribute-editor-enumeration.c, cong-attribute-editor-lang.c, cong-attribute-editor-lang.h, cong-attribute-editor-nmtoken.c, cong-attribute-editor-nmtoken.h, cong-attribute-editor.c, cong-attribute-editor.h, cong-attribute-wrapper-check-button.c, cong-attribute-wrapper-check-button.h, cong-attribute-wrapper-radio-button.c, cong-attribute-wrapper-radio-button.h, cong-attribute-wrapper.c, cong-attribute-wrapper.h, cong-glade.c:
Index: cong-editor-area-border.c
===================================================================
RCS file: /cvs/gnome/conglomerate/src/cong-editor-area-border.c,v
retrieving revision 1.7
diff -u -r1.7 cong-editor-area-border.c
--- cong-editor-area-border.c	25 Jun 2004 00:33:02 -0000	1.7
+++ cong-editor-area-border.c	17 Oct 2004 14:43:46 -0000
@@ -145,7 +145,7 @@
 	if (child) {
 		child_req = cong_editor_area_get_requisition (child,
 							      orientation,
-							      width_hint);
+							      width_hint - PRIVATE(border)->left_pixels - PRIVATE(border)->right_pixels);
 	} else {
 		child_req = 0;
 	}
Index: cong-editor-area-composer.c
===================================================================
RCS file: /cvs/gnome/conglomerate/src/cong-editor-area-composer.c,v
retrieving revision 1.14
diff -u -r1.14 cong-editor-area-composer.c
--- cong-editor-area-composer.c	25 Jun 2004 00:33:02 -0000	1.14
+++ cong-editor-area-composer.c	17 Oct 2004 14:43:46 -0000
@@ -434,17 +434,14 @@
 	gint x;
 	gint y;
 	const GdkRectangle *rect = cong_editor_area_get_window_coords(area);
-#if 0
-	guint this_width = rect->width;
-	guint this_height = rect->height;
-#else
+
 	guint this_width = cong_editor_area_get_requisition (area, 
 							     GTK_ORIENTATION_HORIZONTAL,
 							     rect->width);
 	guint this_height = cong_editor_area_get_requisition (area, 
 							      GTK_ORIENTATION_VERTICAL,
 							      rect->width);
-#endif
+
 	gint total_surplus_space = 0;
 	gint surplus_space_per_expandable_child = 0;
 	guint num_expandable_children = 0;
@@ -548,6 +545,7 @@
 		
 		if (PRIVATE(area_composer)->orientation == GTK_ORIENTATION_HORIZONTAL) {
 			x += child_req_width + PRIVATE(area_composer)->spacing + extra_offset;
+			this_width -= child_req_width + PRIVATE(area_composer)->spacing + extra_offset;
 		} else {
 			y += child_req_height + PRIVATE(area_composer)->spacing + extra_offset;
 		}
Index: cong-editor-area-flow-holder-inlines.c
===================================================================
RCS file: /cvs/gnome/conglomerate/src/cong-editor-area-flow-holder-inlines.c,v
retrieving revision 1.16
diff -u -r1.16 cong-editor-area-flow-holder-inlines.c
--- cong-editor-area-flow-holder-inlines.c	24 Aug 2004 01:58:27 -0000	1.16
+++ cong-editor-area-flow-holder-inlines.c	17 Oct 2004 14:43:46 -0000
@@ -352,18 +352,6 @@
 {
 	CongEditorAreaFlowHolderInlines *area_flow_holder_inlines = CONG_EDITOR_AREA_FLOW_HOLDER_INLINES(area);
 
-#if 1
-	if (GTK_ORIENTATION_HORIZONTAL==orientation) {
-		return width_hint;
-	} else {
-		g_assert(PRIVATE(area_flow_holder_inlines)->line_composer);
-
-		/* FIXME: do we have a sane way of calculating the height of the inlines yet? */
-		return  cong_editor_area_get_requisition (CONG_EDITOR_AREA(PRIVATE(area_flow_holder_inlines)->line_composer),
-							  orientation,
-							  width_hint);
-	}
-#else
 	if (PRIVATE(area_flow_holder_inlines)->line_composer) {
 
 		return  cong_editor_area_get_requisition (CONG_EDITOR_AREA(PRIVATE(area_flow_holder_inlines)->line_composer),
@@ -372,7 +360,6 @@
 	} else {
 		return 0;
 	}
-#endif
 }
 
 static void
Index: cong-editor-area-structural-tag.c
===================================================================
RCS file: /cvs/gnome/conglomerate/src/cong-editor-area-structural-tag.c,v
retrieving revision 1.14
diff -u -r1.14 cong-editor-area-structural-tag.c
--- cong-editor-area-structural-tag.c	24 Aug 2004 02:59:06 -0000	1.14
+++ cong-editor-area-structural-tag.c	17 Oct 2004 14:43:46 -0000
@@ -280,22 +280,22 @@
 		  GtkOrientation orientation,
 		  int width_hint)
 {
-	if (orientation==GTK_ORIENTATION_HORIZONTAL) {
-		return width_hint;
-	} else {
-		gint title_req;
-		gint inner_req;
-		
-		CongEditorAreaStructuralTag *structural_tag = CONG_EDITOR_AREA_STRUCTURAL_TAG(area);
-
-		title_req = cong_editor_area_get_requisition (PRIVATE(structural_tag)->title_vcompose,
-							      orientation,
-							      width_hint-1);
+	CongEditorAreaStructuralTag *structural_tag = CONG_EDITOR_AREA_STRUCTURAL_TAG(area);
+	gint title_req;
+	gint inner_req;
+	
+	title_req = cong_editor_area_get_requisition (PRIVATE(structural_tag)->title_vcompose,
+						      orientation,
+						      width_hint-1);
 
 
-     	        inner_req = cong_editor_area_get_requisition (PRIVATE(structural_tag)->inner_bin,
-							      orientation,
-							      width_hint-1);
+        inner_req = cong_editor_area_get_requisition (PRIVATE(structural_tag)->inner_bin,
+						      orientation,
+						      width_hint-1);
+	
+	if (orientation==GTK_ORIENTATION_HORIZONTAL) {
+		return MAX(title_req, inner_req);
+	} else {
 		return title_req + inner_req + 2;	
 	}
 }
Index: cong-editor-area-structural.c
===================================================================
RCS file: /cvs/gnome/conglomerate/src/cong-editor-area-structural.c,v
retrieving revision 1.10
diff -u -r1.10 cong-editor-area-structural.c
--- cong-editor-area-structural.c	24 Aug 2004 02:59:06 -0000	1.10
+++ cong-editor-area-structural.c	17 Oct 2004 14:43:46 -0000
@@ -395,21 +395,22 @@
 		  GtkOrientation orientation,
 		  int width_hint)
 {
+	CongEditorAreaStructural *structural = CONG_EDITOR_AREA_STRUCTURAL(area);
+	gint title_req;
+	gint inner_req;
+	
+	title_req = cong_editor_area_get_requisition (PRIVATE(structural)->title_vcompose,
+						      orientation,
+						      width_hint-1);
+
+
+        inner_req = cong_editor_area_get_requisition (PRIVATE(structural)->inner_bin,
+						      orientation,
+						      width_hint-1);
+	
 	if (orientation==GTK_ORIENTATION_HORIZONTAL) {
-		return width_hint;
+		return MAX(title_req, inner_req);
 	} else {
-		gint title_req;
-		gint inner_req;
-		
-		CongEditorAreaStructural *structural = CONG_EDITOR_AREA_STRUCTURAL(area);
-
-		title_req = cong_editor_area_get_requisition (PRIVATE(structural)->title_vcompose,
-							      orientation,
-							      width_hint-1);
-
-		inner_req = cong_editor_area_get_requisition (PRIVATE(structural)->inner_bin,
-							      orientation,
-							      width_hint-1);
 		return title_req + inner_req + 2;	
 	}
 }
Index: cong-editor-area.c
===================================================================
RCS file: /cvs/gnome/conglomerate/src/cong-editor-area.c,v
retrieving revision 1.26
diff -u -r1.26 cong-editor-area.c
--- cong-editor-area.c	24 Aug 2004 02:46:40 -0000	1.26
+++ cong-editor-area.c	17 Oct 2004 14:43:46 -0000
@@ -421,6 +421,10 @@
 	g_return_val_if_fail (IS_CONG_EDITOR_AREA(area), 0);
 
 	cache = &PRIVATE(area)->requisition_cache[orientation];
+	
+	if (PRIVATE(area)->is_hidden) {
+	        return 0;
+	}
 
 	/* If not up-to-date, call fn to regenerate cache: */
 	if ( (width_hint!=cache->cached_width_hint)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.