diff options
author | Guillaume Seguin <guillaume@segu.in> | 2007-12-04 23:08:33 +0100 |
---|---|---|
committer | Guillaume Seguin <guillaume@segu.in> | 2007-12-04 23:08:33 +0100 |
commit | c967d8ecf9df4717d12f9b9f8f22602b4f1b1cd7 (patch) | |
tree | 83e4018654b893af539ddfb9cc51a1bec4e7ae13 | |
parent | 110975205175b312a952a061f0627a7fa755ad92 (diff) | |
download | gmathlib-c967d8ecf9df4717d12f9b9f8f22602b4f1b1cd7.tar.gz gmathlib-c967d8ecf9df4717d12f9b9f8f22602b4f1b1cd7.tar.bz2 |
* Add empty symbol rendering to cross_symbol util for editor mode
-rw-r--r-- | cairo/gmathcairo_renderers.c | 5 | ||||
-rw-r--r-- | cairo/gmathcairo_utils.c | 34 | ||||
-rw-r--r-- | include/gmathcairo.h | 2 |
3 files changed, 32 insertions, 9 deletions
diff --git a/cairo/gmathcairo_renderers.c b/cairo/gmathcairo_renderers.c index 5cfe461..a4da1ae 100644 --- a/cairo/gmathcairo_renderers.c +++ b/cairo/gmathcairo_renderers.c @@ -512,6 +512,7 @@ render_boundary (GMathCairoContext *ccontext, GMathSymbol *symbol, return gmathcairo_render_cross_symbol (ccontext, value, NULL, symbol->children[1], NULL, symbol->children[0], + false, true, false, true, size, symbol); } @@ -560,7 +561,9 @@ render_appr (GMathCairoContext *ccontext, GMathSymbol *symbol, float size) return gmathcairo_render_cross_symbol (ccontext, "→", symbol->children[0], symbol->children[1], - NULL, NULL, size, symbol); + NULL, NULL, + true, true, false, false, + size, symbol); } /* Render a subscript symbol */ diff --git a/cairo/gmathcairo_utils.c b/cairo/gmathcairo_utils.c index d23116f..a4fedac 100644 --- a/cairo/gmathcairo_utils.c +++ b/cairo/gmathcairo_utils.c @@ -154,6 +154,8 @@ GMathBoxed* gmathcairo_render_cross_symbol (GMathCairoContext *ccontext, gchar *value, GMathSymbol *lsymbol, GMathSymbol *rsymbol, GMathSymbol *tsymbol, GMathSymbol *bsymbol, + bool has_left, bool has_right, + bool has_top, bool has_bottom, float size, GMathSymbol *symbol) { GMathBoxed *boxed; @@ -183,9 +185,12 @@ gmathcairo_render_cross_symbol (GMathCairoContext *ccontext, gchar *value, width = width1 = width0; height = height0; - if (lsymbol) + if (has_left) { - children[0] = gmathcairo_render_symbol (ccontext, lsymbol, size); + if (lsymbol) + children[0] = gmathcairo_render_symbol (ccontext, lsymbol, size); + if (ccontext->editor_mode && !children[0]) + children[0] = gmathcairo_render_empty (ccontext, lsymbol, size); if (children[0]) { dwl = children[0]->box.width; @@ -194,9 +199,12 @@ gmathcairo_render_cross_symbol (GMathCairoContext *ccontext, gchar *value, height = MAX (height, dhl); } } - if (rsymbol) + if (has_right) { - children[1] = gmathcairo_render_symbol (ccontext, rsymbol, size); + if (rsymbol) + children[1] = gmathcairo_render_symbol (ccontext, rsymbol, size); + if (ccontext->editor_mode && !children[1]) + children[1] = gmathcairo_render_empty (ccontext, rsymbol, size); if (children[1]) { dwr = children[1]->box.width; @@ -207,9 +215,14 @@ gmathcairo_render_cross_symbol (GMathCairoContext *ccontext, gchar *value, } height1 = height; empty_height = (height - height0) / 2; - if (tsymbol) + if (has_top) { - children[2] = gmathcairo_render_symbol (ccontext, tsymbol, size_small); + if (tsymbol) + children[2] = gmathcairo_render_symbol (ccontext, tsymbol, + size_small); + if (ccontext->editor_mode && !children[2]) + children[2] = gmathcairo_render_empty (ccontext, tsymbol, + size_small); if (children[2]) { dwt = children[2]->box.width; @@ -223,9 +236,14 @@ gmathcairo_render_cross_symbol (GMathCairoContext *ccontext, gchar *value, height += dht - empty_height; } } - if (bsymbol) + if (has_bottom) { - children[3] = gmathcairo_render_symbol (ccontext, bsymbol, size_small); + if (bsymbol) + children[3] = gmathcairo_render_symbol (ccontext, bsymbol, + size_small); + if (ccontext->editor_mode && !children[3]) + children[3] = gmathcairo_render_empty (ccontext, bsymbol, + size_small); if (children[3]) { dwb = children[3]->box.width; diff --git a/include/gmathcairo.h b/include/gmathcairo.h index e1d206b..34556af 100644 --- a/include/gmathcairo.h +++ b/include/gmathcairo.h @@ -133,6 +133,8 @@ GMathBoxed* gmathcairo_render_cross_symbol (GMathCairoContext *ccontext, gchar *value, GMathSymbol *lsymbol, GMathSymbol *rsymbol, GMathSymbol *tsymbol, GMathSymbol *bsymbol, + bool has_left, bool has_right, + bool has_top, bool has_bottom, float size, GMathSymbol *symbol); GMathBoxed* |