summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Seguin <guillaume@segu.in>2007-12-04 22:48:40 +0100
committerGuillaume Seguin <guillaume@segu.in>2007-12-04 22:48:40 +0100
commit90f0dbf8d4abe1c72372bc0a8778f05b741014b6 (patch)
tree0b5857b785c2652418c36c2d0e29339f14d3a22d
parentf6298e09bcef0de54b0f621168e1f36354ae7956 (diff)
downloadgmathlib-90f0dbf8d4abe1c72372bc0a8778f05b741014b6.tar.gz
gmathlib-90f0dbf8d4abe1c72372bc0a8778f05b741014b6.tar.bz2
* Add empty children rendering support to most Cairo symbol renderers
-rw-r--r--cairo/gmathcairo_renderers.c47
1 files changed, 44 insertions, 3 deletions
diff --git a/cairo/gmathcairo_renderers.c b/cairo/gmathcairo_renderers.c
index 55df1f4..5cfe461 100644
--- a/cairo/gmathcairo_renderers.c
+++ b/cairo/gmathcairo_renderers.c
@@ -146,9 +146,11 @@ render_2op (GMathCairoContext *ccontext, GMathSymbol *symbol, float size)
children = gmathcairo_render_children_at_size (ccontext, symbol, size);
/* Get the size of each children surface and set the total size */
if (ccontext->editor_mode && !children[0])
- children[0] = gmathcairo_render_empty (ccontext, symbol, size);
+ children[0] = gmathcairo_render_empty (ccontext, symbol->children[0],
+ size);
if (ccontext->editor_mode && !children[1])
- children[1] = gmathcairo_render_empty (ccontext, symbol, size);
+ children[1] = gmathcairo_render_empty (ccontext, symbol->children[1],
+ size);
if (children[0])
{
dw0 = children[0]->box.width;
@@ -239,6 +241,12 @@ render_frac (GMathCairoContext *ccontext, GMathSymbol *symbol, float size)
height = height0 = 2;
children = gmathcairo_render_children_at_size (ccontext, symbol, size);
+ if (ccontext->editor_mode && !children[0])
+ children[0] = gmathcairo_render_empty (ccontext, symbol->children[0],
+ size);
+ if (ccontext->editor_mode && !children[1])
+ children[1] = gmathcairo_render_empty (ccontext, symbol->children[1],
+ size);
if (children[0])
{
dw0 = children[0]->box.width;
@@ -328,6 +336,9 @@ render_fun (GMathCairoContext *ccontext, GMathSymbol *symbol, float size)
/* Render the children at the current size */
children = gmathcairo_render_children_at_size (ccontext, symbol, size);
+ if (ccontext->editor_mode && !children[0])
+ children[0] = gmathcairo_render_empty (ccontext, symbol->children[0],
+ size);
/* Get the size of each children surface and set the total size */
if (children[0])
{
@@ -395,6 +406,15 @@ render_paren (GMathCairoContext *ccontext, GMathSymbol *symbol, float size)
width = height = 0;
children = gmathcairo_render_children_at_size (ccontext, symbol, size);
+ if (ccontext->editor_mode && !children[0])
+ children[0] = gmathcairo_render_empty (ccontext, symbol->children[0],
+ size);
+ if (ccontext->editor_mode && !children[1])
+ children[1] = gmathcairo_render_empty (ccontext, symbol->children[1],
+ size);
+ if (ccontext->editor_mode && !children[2])
+ children[2] = gmathcairo_render_empty (ccontext, symbol->children[2],
+ size);
if (children[0])
{
dw0 = children[0]->box.width;
@@ -570,10 +590,12 @@ render_sub (GMathCairoContext *ccontext, GMathSymbol *symbol, float size)
}
children[1] = gmathcairo_render_symbol (ccontext, symbol->children[1],
size_small);
-
width = dw0 = children[0]->box.width;
height = dh0 = children[0]->box.height;
+ if (ccontext->editor_mode && !children[1])
+ children[1] = gmathcairo_render_empty (ccontext, symbol->children[1],
+ size_small);
if (children[1])
{
dw1 = children[1]->box.width;
@@ -650,6 +672,9 @@ render_super (GMathCairoContext *ccontext, GMathSymbol *symbol, float size)
width = dw0 = children[0]->box.width;
height = dh0 = children[0]->box.height;
+ if (ccontext->editor_mode && !children[1])
+ children[1] = gmathcairo_render_empty (ccontext, symbol->children[1],
+ size_small);
if (children[1])
{
dw1 = children[1]->box.width;
@@ -738,6 +763,10 @@ render_sum (GMathCairoContext *ccontext, GMathSymbol *symbol, float size)
{
children[0] = gmathcairo_render_symbol (ccontext, symbol->children[0],
size_small);
+ if (ccontext->editor_mode && !children[0])
+ children[0] = gmathcairo_render_empty (ccontext,
+ symbol->children[0],
+ size_small);
if (children[0])
{
dwb = children[0]->box.width;
@@ -754,6 +783,10 @@ render_sum (GMathCairoContext *ccontext, GMathSymbol *symbol, float size)
{
children[1] = gmathcairo_render_symbol (ccontext, symbol->children[1],
size_small);
+ if (ccontext->editor_mode && !children[1])
+ children[1] = gmathcairo_render_empty (ccontext,
+ symbol->children[1],
+ size_small);
if (children[1])
{
dwt = children[1]->box.width;
@@ -870,6 +903,10 @@ render_product (GMathCairoContext *ccontext, GMathSymbol *symbol, float size)
{
children[0] = gmathcairo_render_symbol (ccontext, symbol->children[0],
size_small);
+ if (ccontext->editor_mode && !children[0])
+ children[0] = gmathcairo_render_empty (ccontext,
+ symbol->children[0],
+ size_small);
if (children[0])
{
dwb = children[0]->box.width;
@@ -886,6 +923,10 @@ render_product (GMathCairoContext *ccontext, GMathSymbol *symbol, float size)
{
children[1] = gmathcairo_render_symbol (ccontext, symbol->children[1],
size_small);
+ if (ccontext->editor_mode && !children[1])
+ children[1] = gmathcairo_render_empty (ccontext,
+ symbol->children[1],
+ size_small);
if (children[1])
{
dwt = children[1]->box.width;