void CL_SpanLayout_Impl::layout_lines(CL_GraphicContext & gc, int max_width) { lines.clear(); if (objects.empty()) return; layout_cache.metrics = -1; layout_cache.object_index = -1; CurrentLine current_line; std::vector<TextBlock> blocks = find_text_blocks(); for (std::vector<TextBlock>::size_type block_index = 0; block_index < blocks.size(); block_index++) { if (objects[current_line.object_index].type == object_text) layout_text(gc, blocks, block_index, current_line, max_width); else layout_block(current_line, max_width, blocks, block_index); } next_line(current_line); }
string SymbolTable::text(string prefix) { stringstream ss; ss << prefix << "symbol_table_ {" << endl; for(size_t sbl_idx=1; sbl_idx<=nsymbols_; ++sbl_idx) { ss << prefix << " [" << sbl_idx << "]{"; ss << " layout(" << layout_text(table_[sbl_idx].layout) << "),"; ss << " nelem(" << table_[sbl_idx].nelem << "),"; ss << " data(" << *(table_[sbl_idx].data) << "),"; ss << " const_data("<< table_[sbl_idx].const_data << "),"; ss << " etype(" << etype_text(table_[sbl_idx].etype) << "),"; ss << endl << prefix << " "; ss << " ndim(" << table_[sbl_idx].ndim << "),"; ss << " start(" << table_[sbl_idx].start << "),"; ss << " shape("; for(int64_t dim_idx=0; dim_idx < table_[sbl_idx].ndim; ++dim_idx) { ss << table_[sbl_idx].shape[dim_idx]; if (dim_idx != (table_[sbl_idx].ndim-1)) { ss << prefix << ", "; } } ss << "),"; ss << " stride("; for(int64_t dim_idx=0; dim_idx < table_[sbl_idx].ndim; ++dim_idx) { ss << table_[sbl_idx].stride[dim_idx]; if (dim_idx != (table_[sbl_idx].ndim-1)) { ss << prefix << ", "; } } ss << "),"; ss << endl << prefix << " "; ss << "}" << endl; } ss << prefix << "}" << endl; return ss.str(); }
string Operand::layout(void) { return layout_text(meta().layout); }
static void histogram_draw (ggvisd *ggv, ggobid *gg) { gint i; gchar *str; colorschemed *scheme = gg->activeColorScheme; dissimd *D = ggv->dissim; GtkWidget *da = D->da; gint ymax = da->allocation.height - 2*HISTOGRAM_VMARGIN - HISTOGRAM_GRIP_SPACE; PangoLayout *layout = gtk_widget_create_pango_layout(da, NULL); PangoRectangle rect; if (D->pix == NULL) return; if (ggv->trans_dist.nels == 0) return; if (gg->plot_GC == NULL) init_plot_GC (D->pix, gg); histogram_pixmap_clear (ggv, gg); gdk_gc_set_foreground (gg->plot_GC, &scheme->rgb_accent); for (i=0; i<D->nbins; i++) { if (D->bars_included.els[i]) { gdk_draw_rectangle (D->pix, gg->plot_GC, true, D->bars[i].x, D->bars[i].y, D->bars[i].width, D->bars[i].height); } else { if (i>0) /* leading vertical edge */ gdk_draw_line (D->pix, gg->plot_GC, D->bars[i].x, D->bars[i-1].y, D->bars[i].x, D->bars[i].y); /* horizontal line */ gdk_draw_line (D->pix, gg->plot_GC, D->bars[i].x, D->bars[i].y, D->bars[i].x+D->bars[i].width, D->bars[i].y); if (i<D->nbins-1) /* trailing vertical edge */ gdk_draw_line (D->pix, gg->plot_GC, D->bars[i].x+D->bars[i].width, D->bars[i].y, D->bars[i].x+D->bars[i].width, D->bars[i+1].y); } } gdk_draw_line (D->pix, gg->plot_GC, D->bars[D->nbins-1].x+D->bars[D->nbins-1].width, D->bars[D->nbins-1].y, D->bars[D->nbins-1].x+D->bars[D->nbins-1].width, ymax); if (trans_dist_max == -G_MAXDOUBLE) /*-- not initialized -- why? --*/ str = g_strdup_printf ("%s", "??"); else str = g_strdup_printf ("%2.2f", trans_dist_max); layout_text(layout, str, &rect); gdk_draw_layout(D->pix, gg->plot_GC, da->allocation.width - STR_HMARGIN - rect.width, STR_VMARGIN, layout); g_free (str); if (trans_dist_min == G_MAXDOUBLE) /*-- not initialized -- why? --*/ str = g_strdup_printf ("%s", "??"); else str = g_strdup_printf ("%2.2f", trans_dist_min); layout_text(layout, str, &rect); gdk_draw_layout(D->pix, gg->plot_GC, (gint) STR_HMARGIN/2, STR_VMARGIN, layout); g_free (str); g_object_unref(layout); draw_grip_control (ggv, gg); histogram_pixmap_copy (ggv, gg); }