public StatsWidget(Stat stat, Stat category, SubCategoryStat subcat, int textSize) { /* For subcategories, parent is the parent Category */ this.stat = stat; this.category = category; HomeColor = CairoUtils.ColorFromRGB(0xFF, 0x33, 0); AwayColor = CairoUtils.ColorFromRGB(0, 0x99, 0xFF); layout = new Pango.Layout(PangoContext); layout.Wrap = Pango.WrapMode.Char; layout.Alignment = Pango.Alignment.Center; ModifyText(StateType.Normal, LongoMatch.Gui.Helpers.Misc.ToGdkColor(Config.Style.PaletteText)); this.textSize = textSize; name_tpl = "{0}"; count_tpl = "{0} ({1}%)"; if (category == null) { name_tpl = "<b>" + name_tpl + "</b>"; count_tpl = "<b>" + count_tpl + "</b>"; HeightRequest = 25; } else { if (subcat != null) { name_tpl = GLib.Markup.EscapeText(subcat.Name); name_tpl += name_tpl == "" ? "{0}" : ": {0}"; } HeightRequest = 18; } }
/// <summary> /// The measure text. /// </summary> /// <param name="text">The text.</param> /// <param name="fontFamily">The font family.</param> /// <param name="fontSize">The font size.</param> /// <param name="fontWeight">The font weight.</param> /// <returns>The size of the text.</returns> public override OxySize MeasureText(string text, string fontFamily, double fontSize, double fontWeight) { if (text == null) { return(OxySize.Empty); } this.g.Save(); #if GTKSHARP3 Pango.Layout layout = new Layout(this.c); #else Pango.Layout layout = Pango.CairoHelper.CreateLayout(this.g); #endif Pango.FontDescription font = new Pango.FontDescription(); font.Family = fontFamily; font.Weight = (fontWeight >= 700) ? Pango.Weight.Bold : Pango.Weight.Normal; font.AbsoluteSize = (int)(fontSize * Pango.Scale.PangoScale); layout.FontDescription = font; layout.SetText(text); Pango.Rectangle inkRect; Pango.Rectangle logicalRect; layout.GetExtents(out inkRect, out logicalRect); this.g.Restore(); layout.Dispose(); return(new OxySize(logicalRect.Width / Pango.Scale.PangoScale, logicalRect.Height / Pango.Scale.PangoScale)); }
public TimelineLabelsWidget() { layout = new Pango.Layout(PangoContext); layout.Wrap = Pango.WrapMode.Char; layout.Alignment = Pango.Alignment.Left; labelsDict = new Dictionary <string, Gdk.Color> (); }
void imprime_titulo(Cairo.Context cr, Pango.Layout layout, string descrp_admin, string fech) { fontSize = 7.0; layout = null; layout = context.CreatePangoLayout(); desc.Size = (int)(fontSize * pangoScale); layout.FontDescription = desc; comienzo_linea += separacion_linea; layout.FontDescription.Weight = Weight.Bold; // Letra Negrita cr.MoveTo(200 * escala_en_linux_windows, comienzo_linea * escala_en_linux_windows); layout.SetText(descrp_admin.ToString() + " " + fech.ToString()); Pango.CairoHelper.ShowLayout(cr, layout); comienzo_linea += separacion_linea; comienzo_linea += separacion_linea; cr.MoveTo(025 * escala_en_linux_windows, comienzo_linea * escala_en_linux_windows); layout.SetText("CODIGO"); Pango.CairoHelper.ShowLayout(cr, layout); cr.MoveTo(080 * escala_en_linux_windows, comienzo_linea * escala_en_linux_windows); layout.SetText("CANT."); Pango.CairoHelper.ShowLayout(cr, layout); cr.MoveTo(108 * escala_en_linux_windows, comienzo_linea * escala_en_linux_windows); layout.SetText("DESCRIPCION PRODUCTO"); Pango.CairoHelper.ShowLayout(cr, layout); if ((bool)rptconprecio == true) { cr.MoveTo(385 * escala_en_linux_windows, comienzo_linea * escala_en_linux_windows); layout.SetText("PRECIO"); Pango.CairoHelper.ShowLayout(cr, layout); } else { cr.MoveTo(420 * escala_en_linux_windows, comienzo_linea * escala_en_linux_windows); layout.SetText("USADO"); Pango.CairoHelper.ShowLayout(cr, layout); cr.MoveTo(490 * escala_en_linux_windows, comienzo_linea * escala_en_linux_windows); layout.SetText("DEVUELTO"); Pango.CairoHelper.ShowLayout(cr, layout); } layout.FontDescription.Weight = Weight.Normal; fontSize = 7.0; layout = null; layout = context.CreatePangoLayout(); desc.Size = (int)(fontSize * pangoScale); layout.FontDescription = desc; comienzo_linea2 = comienzo_linea + separacion_linea; }
void imprime_encabezado(Cairo.Context cr, Pango.Layout layout) { //cr.Rotate(90); //Imprimir Orizontalmente rota la hoja cambian las posiciones de las lineas y columna fontSize = 8.0; desc.Size = (int)(fontSize * pangoScale); layout.FontDescription = desc; layout.FontDescription.Weight = Weight.Bold; // Letra negrita cr.MoveTo(05 * escala_en_linux_windows, 05 * escala_en_linux_windows); layout.SetText(classpublic.nombre_empresa); Pango.CairoHelper.ShowLayout(cr, layout); cr.MoveTo(05 * escala_en_linux_windows, 15 * escala_en_linux_windows); layout.SetText(classpublic.direccion_empresa); Pango.CairoHelper.ShowLayout(cr, layout); cr.MoveTo(05 * escala_en_linux_windows, 25 * escala_en_linux_windows); layout.SetText(classpublic.telefonofax_empresa); Pango.CairoHelper.ShowLayout(cr, layout); fontSize = 6.0; desc.Size = (int)(fontSize * pangoScale); layout.FontDescription = desc; cr.MoveTo(650 * escala_en_linux_windows, 05 * escala_en_linux_windows); layout.SetText("Fech.Rpt:" + (string)DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); Pango.CairoHelper.ShowLayout(cr, layout); cr.MoveTo(650 * escala_en_linux_windows, 15 * escala_en_linux_windows); layout.SetText("N° Page :" + numpage.ToString().Trim()); Pango.CairoHelper.ShowLayout(cr, layout); cr.MoveTo(05 * escala_en_linux_windows, 35 * escala_en_linux_windows); layout.SetText("Sistema Hospitalario OSIRIS"); Pango.CairoHelper.ShowLayout(cr, layout); fontSize = 11.0; desc.Size = (int)(fontSize * pangoScale); layout.FontDescription = desc; layout.FontDescription.Weight = Weight.Bold; // Letra negrita layout.Alignment = Pango.Alignment.Center; double width = context.Width; layout.Width = (int)width; layout.Alignment = Pango.Alignment.Center; //layout.Wrap = Pango.WrapMode.Word; //layout.SingleParagraphMode = true; layout.Justify = false; cr.MoveTo(width / 2, 45 * escala_en_linux_windows); layout.SetText("PACIENTES_NO_INGRESADOS_A_CAJA"); Pango.CairoHelper.ShowLayout(cr, layout); //cr.MoveTo(225*escala_en_linux_windows, 35*escala_en_linux_windows); layout.SetText(titulo_rpt); Pango.CairoHelper.ShowLayout (cr, layout); fontSize = 8.0; layout = null; layout = context.CreatePangoLayout(); desc.Size = (int)(fontSize * pangoScale); layout.FontDescription = desc; layout.FontDescription.Weight = Weight.Normal; // Letra negrita }
void Paint(Context cr, double w, double h) { layout = Pango.CairoHelper.CreateLayout(cr); cr.LineWidth = 0.5d; cr.SetSourceColor(blackColor); for (int idx = 0; idx < inputDocument.PageCount; idx++) { var page = inputDocument.Pages [idx]; var res = page.Resources; lineHeight = 10d; pageHeight = page.MediaBox.Height; pageWidth = page.MediaBox.Width; cursor = new Tuple <double, double>(0d, pageHeight + margin); DrawMediaBox(cr, page); CObject content = ContentReader.ReadContent(page); DrawContent(cr, content); } }
public static int GetHeight(this Pango.Layout layout) { int raw_ret = pango_layout_get_height(layout.Handle); int ret = raw_ret; return(ret); }
void imprime_encabezado(Cairo.Context cr, Pango.Layout layout) { Gtk.Image image5 = new Gtk.Image(); image5.Name = "image5"; //image5.Pixbuf = new Gdk.Pixbuf(System.IO.Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "osiris.jpg")); image5.Pixbuf = new Gdk.Pixbuf("/opt/osiris/bin/OSIRISLogo.jpg"); // en Linux //image5.Pixbuf.ScaleSimple(128, 128, Gdk.InterpType.Bilinear); //Gdk.CairoHelper.SetSourcePixbuf(cr,image5.Pixbuf,1,-30); //Gdk.CairoHelper.SetSourcePixbuf(cr,image5.Pixbuf.ScaleSimple(145, 50, Gdk.InterpType.Bilinear),1,1); Gdk.CairoHelper.SetSourcePixbuf(cr, image5.Pixbuf, 1, 1); cr.Fill(); //cr.Restore(); cr.Paint(); cr.Restore(); Pango.FontDescription desc = Pango.FontDescription.FromString("Sans"); // cr.Rotate(90) Imprimir Orizontalmente rota la hoja cambian las posiciones de las lineas y columna fontSize = 6.0; desc.Size = (int)(fontSize * pangoScale); layout.FontDescription = desc; layout.FontDescription.Weight = Weight.Bold; //cr.MoveTo(20*escala_en_linux_windows,10*escala_en_linux_windows); layout.SetText(classpublic.nombre_empresa); Pango.CairoHelper.ShowLayout (cr, layout); //cr.MoveTo(20*escala_en_linux_windows,20*escala_en_linux_windows); layout.SetText(classpublic.direccion_empresa); Pango.CairoHelper.ShowLayout (cr, layout); //cr.MoveTo(20*escala_en_linux_windows,30*escala_en_linux_windows); layout.SetText(classpublic.telefonofax_empresa); Pango.CairoHelper.ShowLayout (cr, layout); //cr.MoveTo(20*escala_en_linux_windows,70*escala_en_linux_windows); layout.SetText("Sistema Hospitalario OSIRIS"); Pango.CairoHelper.ShowLayout (cr, layout); // Cambiando el tamaño de la fuente fontSize = 12.0; desc.Size = (int)(fontSize * pangoScale); layout.FontDescription = desc; cr.MoveTo(230 * escala_en_linux_windows, 55 * escala_en_linux_windows); layout.SetText("PROTOCOLO DE ADMISION"); Pango.CairoHelper.ShowLayout(cr, layout); cr.MoveTo(280 * escala_en_linux_windows, 65 * escala_en_linux_windows); layout.SetText("REGISTRO"); Pango.CairoHelper.ShowLayout(cr, layout); layout.FontDescription.Weight = Weight.Normal; // Letra Normal fontSize = 8.0; desc.Size = (int)(fontSize * pangoScale); layout.FontDescription = desc; }
void imprime_encabezado(Cairo.Context cr, Pango.Layout layout) { //Gtk.Image image5 = new Gtk.Image(); //image5.Name = "image5"; //image5.Pixbuf = new Gdk.Pixbuf(System.IO.Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "osiris.jpg")); //image5.Pixbuf = new Gdk.Pixbuf("/opt/osiris/bin/OSIRISLogo.jpg"); // en Linux //---image5.Pixbuf.ScaleSimple(128, 128, Gdk.InterpType.Bilinear); //---Gdk.CairoHelper.SetSourcePixbuf(cr,image5.Pixbuf,1,-30); //---Gdk.CairoHelper.SetSourcePixbuf(cr,image5.Pixbuf.ScaleSimple(145, 50, Gdk.InterpType.Bilinear),1,1); //Gdk.CairoHelper.SetSourcePixbuf(cr,image5.Pixbuf.ScaleSimple(180, 64, Gdk.InterpType.Hyper),1,1); //cr.Fill(); //cr.Paint(); //cr.Restore(); Pango.FontDescription desc = Pango.FontDescription.FromString("Sans"); //cr.Rotate(90); //Imprimir Orizontalmente rota la hoja cambian las posiciones de las lineas y columna fontSize = 8.0; desc.Size = (int)(fontSize * pangoScale); layout.FontDescription = desc; layout.FontDescription.Weight = Weight.Bold; // Letra negrita cr.MoveTo(05 * escala_en_linux_windows, comienzo_linea * escala_en_linux_windows); layout.SetText(classpublic.nombre_empresa); Pango.CairoHelper.ShowLayout(cr, layout); fontSize = 6.0; desc.Size = (int)(fontSize * pangoScale); layout.FontDescription = desc; layout.FontDescription.Weight = Weight.Normal; // Letra normal cr.MoveTo(479 * escala_en_linux_windows, comienzo_linea * escala_en_linux_windows); layout.SetText("Fech.Rpt:" + (string)DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); Pango.CairoHelper.ShowLayout(cr, layout); comienzo_linea += separacion_linea; fontSize = 8.0; desc.Size = (int)(fontSize * pangoScale); layout.FontDescription = desc; layout.FontDescription.Weight = Weight.Bold; // Letra negrita cr.MoveTo(05 * escala_en_linux_windows, comienzo_linea * escala_en_linux_windows); layout.SetText(classpublic.direccion_empresa); Pango.CairoHelper.ShowLayout(cr, layout); fontSize = 6.0; desc.Size = (int)(fontSize * pangoScale); layout.FontDescription = desc; layout.FontDescription.Weight = Weight.Normal; // Letra normal cr.MoveTo(479 * escala_en_linux_windows, comienzo_linea * escala_en_linux_windows); layout.SetText("N° Page :" + numpage.ToString().Trim()); Pango.CairoHelper.ShowLayout(cr, layout); comienzo_linea += separacion_linea; fontSize = 8.0; desc.Size = (int)(fontSize * pangoScale); layout.FontDescription = desc; layout.FontDescription.Weight = Weight.Bold; // Letra negrita cr.MoveTo(05 * escala_en_linux_windows, comienzo_linea * escala_en_linux_windows); layout.SetText(classpublic.telefonofax_empresa); Pango.CairoHelper.ShowLayout(cr, layout); comienzo_linea += separacion_linea; fontSize = 10.0; desc.Size = (int)(fontSize * pangoScale); layout.FontDescription = desc; layout.FontDescription.Weight = Weight.Bold; // Letra negrita cr.MoveTo(200 * escala_en_linux_windows, comienzo_linea * escala_en_linux_windows); layout.SetText(departament); Pango.CairoHelper.ShowLayout(cr, layout); layout.FontDescription.Weight = Weight.Normal; // Letra normal fontSize = 6.0; desc.Size = (int)(fontSize * pangoScale); layout.FontDescription = desc; cr.MoveTo(05 * escala_en_linux_windows, comienzo_linea * escala_en_linux_windows); layout.SetText("Sistema Hospitalario OSIRIS"); Pango.CairoHelper.ShowLayout(cr, layout); // Cambiando el tamaño de la fuente cr.MoveTo(565 * escala_en_linux_windows, 383 * escala_en_linux_windows); cr.LineTo(05, 383); // Linea Horizontal 4 cr.FillExtents(); //. FillPreserve(); cr.SetSourceRGB(0, 0, 0); cr.LineWidth = 0.1; cr.Stroke(); }
void ejecutar_consulta_reporte(PrintContext context) { Cairo.Context cr = context.CairoContext; Pango.Layout layout = context.CreatePangoLayout(); TreeIter iter; string toma_descrip_prod; string toma_descrip_alm; if (this.treeViewEngineFarmacia.GetIterFirst(out iter)) { imprime_encabezado(cr, layout); while (this.treeViewEngineFarmacia.IterNext(ref iter)) { toma_descrip_alm = (string)this.treeViewEngineFarmacia.GetValue(iter, 11); if (toma_descrip_alm.Length > 22) { toma_descrip_alm = toma_descrip_alm.Substring(0, 21); } toma_descrip_alm = (string)this.treeViewEngineFarmacia.GetValue(iter, 11); if (toma_descrip_alm.Length > 22) { toma_descrip_alm = toma_descrip_alm.Substring(0, 21); } } } }
///<summary>Constructor</summary> public Drawer(Gtk.Widget wid, Information inf) { widget = wid; info = inf; pixmapIds = new StringCollection(); // make sure highlight colors are set info.SetupHighlight(wid); fontDescription = Pango.FontDescription.FromString(info.FontName); Pango.Language lang = Pango.Language.FromString(info.FontLanguage); Pango.Context pangoCtx = widget.PangoContext; pangoCtx.FontDescription = fontDescription; pangoCtx.Language = lang; // set the font height and width pangoLayout = new Pango.Layout(pangoCtx); // we use a monospaced font, the actual character doesn't matter pangoLayout.SetText("X"); pangoLayout.GetPixelSize(out width, out height); pangoLayout.SetText(""); // create the font pixmaps InitializePixmaps(); InitializeBackgroundGCs(); }
public StatsWidget(Stat stat, Stat category, SubCategoryStat subcat, int textSize) { /* For subcategories, parent is the parent Category */ this.stat = stat; this.category = category; HomeColor = CairoUtils.ColorFromRGB(0xFF, 0x33, 0); AwayColor = CairoUtils.ColorFromRGB(0, 0x99, 0xFF); layout = new Pango.Layout(PangoContext); layout.Wrap = Pango.WrapMode.Char; layout.Alignment = Pango.Alignment.Center; this.textSize = textSize; name_tpl = "{0}"; count_tpl = "{0} ({1}%)"; if (category == null) { name_tpl = "<b>" + name_tpl + "</b>"; count_tpl = "<b>" + count_tpl + "</b>"; HeightRequest = 25; } else { if (subcat != null) { name_tpl = GLib.Markup.EscapeText(subcat.Name) + ": {0}"; } HeightRequest = 18; } }
/// <summary>Crea una nueva instancia de la clase.</summary> public PanelDibujo() { rdd = new RepresentacionRDD(this); ExposeEvent += new ExposeEventHandler(OnExposeEvent); ConfigureEvent += new ConfigureEventHandler(OnConfigureEvent); this.layout = new Pango.Layout(this.PangoContext); }
protected override void OnStyleSet(Gtk.Style previous_style) { if (this.layout != null) { this.layout.Dispose(); this.layout = null; } if (this.headerLayout != null) { this.headerLayout.Dispose(); this.headerLayout = null; } base.OnStyleSet(previous_style); layout = new Pango.Layout(this.PangoContext); headerLayout = new Pango.Layout(this.PangoContext); if (desc != null) { layout.FontDescription = desc; headerLayout.FontDescription = desc; } layout.Ellipsize = EllipsizeMode.End; headerLayout.Attributes = new AttrList(); // headerLayout.Attributes.Insert (new Pango.AttrWeight (Pango.Weight.Bold)); }
void crea_encbezado(Cairo.Context cr, Pango.Layout layout) { Pango.FontDescription desc = Pango.FontDescription.FromString("Sans"); //cr.Rotate(90); //Imprimir Orizontalmente rota la hoja cambian las posiciones de las lineas y columna fontSize = 8.0; desc.Size = (int)(fontSize * pangoScale); layout.FontDescription = desc; layout.FontDescription.Weight = Weight.Bold; // Letra negrita cr.MoveTo(05 * escala_en_linux_windows, 05 * escala_en_linux_windows); layout.SetText(classpublic.nombre_empresa); Pango.CairoHelper.ShowLayout(cr, layout); cr.MoveTo(05 * escala_en_linux_windows, 15 * escala_en_linux_windows); layout.SetText(classpublic.direccion_empresa); Pango.CairoHelper.ShowLayout(cr, layout); cr.MoveTo(05 * escala_en_linux_windows, 25 * escala_en_linux_windows); layout.SetText(classpublic.telefonofax_empresa); Pango.CairoHelper.ShowLayout(cr, layout); fontSize = 6.0; desc.Size = (int)(fontSize * pangoScale); layout.FontDescription = desc; cr.MoveTo(479 * escala_en_linux_windows, 05 * escala_en_linux_windows); layout.SetText("Fech.Rpt:" + (string)DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); Pango.CairoHelper.ShowLayout(cr, layout); cr.MoveTo(479 * escala_en_linux_windows, 15 * escala_en_linux_windows); layout.SetText("N° Page :" + numpage.ToString().Trim()); Pango.CairoHelper.ShowLayout(cr, layout); cr.MoveTo(05 * escala_en_linux_windows, 35 * escala_en_linux_windows); layout.SetText("Sistema Hospitalario OSIRIS"); Pango.CairoHelper.ShowLayout(cr, layout); // Cambiando el tamaño de la fuente fontSize = 11.0; desc.Size = (int)(fontSize * pangoScale); layout.FontDescription = desc; layout.FontDescription.Weight = Weight.Bold; // Letra negrita cr.MoveTo(155 * escala_en_linux_windows, 85 * escala_en_linux_windows); layout.SetText("AUTORIZACION PARA TRATAMIENTOS MEDICOS,"); Pango.CairoHelper.ShowLayout(cr, layout); cr.MoveTo(145 * escala_en_linux_windows, 95 * escala_en_linux_windows); layout.SetText("PROCEDIMIENTOS DE DIAGNOSTICO TERAPEUTICOS"); Pango.CairoHelper.ShowLayout(cr, layout); cr.MoveTo(220 * escala_en_linux_windows, 105 * escala_en_linux_windows); layout.SetText("Y/O INTERVENCIONES"); Pango.CairoHelper.ShowLayout(cr, layout); layout.FontDescription.Weight = Pango.Weight.Normal; // Letra Normal }
void imprime_linea_producto(Cairo.Context cr, Pango.Layout layout, string idproducto_, string cantidadaplicada_, string datos_, string preciounitario_, decimal subtotal_, decimal ivaprod_, decimal total_) { fontSize = 7.0; layout = null; layout = context.CreatePangoLayout(); desc.Size = (int)(fontSize * pangoScale); layout.FontDescription = desc; comienzo_linea += separacion_linea; cr.MoveTo(006 * escala_en_linux_windows, comienzo_linea * escala_en_linux_windows); layout.SetText(idproducto_); Pango.CairoHelper.ShowLayout(cr, layout); cr.MoveTo(075 * escala_en_linux_windows, comienzo_linea * escala_en_linux_windows); layout.SetText(cantidadaplicada_); Pango.CairoHelper.ShowLayout(cr, layout); if (datos_.Length > 61) { cr.MoveTo(110 * escala_en_linux_windows, comienzo_linea * escala_en_linux_windows); layout.SetText((string)datos_.Substring(0, 60)); Pango.CairoHelper.ShowLayout(cr, layout); } else { cr.MoveTo(110 * escala_en_linux_windows, comienzo_linea * escala_en_linux_windows); layout.SetText((string)datos_); Pango.CairoHelper.ShowLayout(cr, layout); } if ((bool)rptconprecio == true) { cr.MoveTo(380 * escala_en_linux_windows, comienzo_linea * escala_en_linux_windows); layout.SetText(preciounitario_); Pango.CairoHelper.ShowLayout(cr, layout); cr.MoveTo(430 * escala_en_linux_windows, comienzo_linea * escala_en_linux_windows); layout.SetText(subtotal_.ToString("N").PadLeft(10)); Pango.CairoHelper.ShowLayout(cr, layout); cr.MoveTo(480 * escala_en_linux_windows, comienzo_linea * escala_en_linux_windows); layout.SetText(ivaprod_.ToString("N").PadLeft(10)); Pango.CairoHelper.ShowLayout(cr, layout); cr.MoveTo(530 * escala_en_linux_windows, comienzo_linea * escala_en_linux_windows); layout.SetText(total_.ToString("N").PadLeft(10)); Pango.CairoHelper.ShowLayout(cr, layout); } cr.MoveTo(565 * escala_en_linux_windows, (comienzo_linea - 2) * escala_en_linux_windows); cr.LineTo(05, (comienzo_linea - 2) * escala_en_linux_windows); cr.FillExtents(); //. FillPreserve(); cr.SetSourceRGB(0, 0, 0); cr.LineWidth = 0.1; cr.Stroke(); }
protected void OnRealized(object o, EventArgs args) { int x, y; int w, h; GdkWindow.GetOrigin(out x, out y); GdkWindow.GetSize(out w, out h); textTop = y + image.Height - 30; scrollStart = -(image.Height - textTop); scroll = scrollStart; layout = new Pango.Layout(this.PangoContext); // FIXME: this seems wrong but works layout.Width = w * (int)Pango.Scale.PangoScale; layout.Wrap = Pango.WrapMode.Word; layout.Alignment = Pango.Alignment.Center; FontDescription fd = FontDescription.FromString("Tahoma 10"); layout.FontDescription = fd; layout.SetMarkup(CreditText); backGc = new Gdk.GC(GdkWindow); backGc.RgbBgColor = bgColor; }
void OnRealized(object o, EventArgs args) { layout = new Pango.Layout(this.PangoContext); layout.Wrap = Pango.WrapMode.Word; layout.FontDescription = FontDescription.FromString("Monospace Regular"); layout.SetMarkup("Hello Pango.Layout"); }
public TimelineLabelsWidget() { layout = new Pango.Layout(PangoContext); layout.Wrap = Pango.WrapMode.Char; layout.Alignment = Pango.Alignment.Left; labelsDict = new Dictionary <Label, Category> (); }
public RenderCairo(Cairo.Context g, float scale) { this.g = g; this.layout = Pango.CairoHelper.CreateLayout(g); this.scale = scale; g.Scale(scale, scale); }
public Preview(Drawable drawable, CoordinateList<int> coordinates) : base(drawable) { _coordinates = coordinates; PreviewArea area = Area; area.Events = EventMask.ButtonPressMask | EventMask.ButtonReleaseMask | EventMask.PointerMotionHintMask | EventMask.PointerMotionMask | EventMask.LeaveNotifyMask; ButtonPressEvent += (sender, args) => { // Fix me: calculate real-world coordinates _coordinates.Add(new Coordinate<int>((int) args.Event.X, (int) args.Event.Y)); }; ExposeEvent += delegate { var layout = new Pango.Layout(area.PangoContext); layout.FontDescription = FontDescription.FromString("Tahoma 16"); int i = 0; foreach (var coordinate in _coordinates) { layout.SetMarkup(String.Format("{0}", i)); // Fix me: transfer from real-world coordinates area.GdkWindow.DrawLayout(Style.TextGC(StateType.Normal), coordinate.X, coordinate.Y, layout); i++; } }; }
public Preview(Drawable drawable, CoordinateList <int> coordinates) : base(drawable) { _coordinates = coordinates; PreviewArea area = Area; area.Events = EventMask.ButtonPressMask | EventMask.ButtonReleaseMask | EventMask.PointerMotionHintMask | EventMask.PointerMotionMask | EventMask.LeaveNotifyMask; ButtonPressEvent += (sender, args) => { // Fix me: calculate real-world coordinates _coordinates.Add(new Coordinate <int>((int)args.Event.X, (int)args.Event.Y)); }; ExposeEvent += delegate { var layout = new Pango.Layout(area.PangoContext); layout.FontDescription = FontDescription.FromString("Tahoma 16"); int i = 0; foreach (var coordinate in _coordinates) { layout.SetMarkup(String.Format("{0}", i)); // Fix me: transfer from real-world coordinates area.GdkWindow.DrawLayout(Style.TextGC(StateType.Normal), coordinate.X, coordinate.Y, layout); i++; } }; }
public TimelineLabelsWidget() { layout = new Pango.Layout(PangoContext); layout.Wrap = Pango.WrapMode.Char; layout.Alignment = Pango.Alignment.Left; labelsDict = new Dictionary<string, Gdk.Color> (); }
void imprime_encabezado(Cairo.Context cr, Pango.Layout layout) { desc = Pango.FontDescription.FromString("Sans"); //cr.Rotate(90); //Imprimir Orizontalmente rota la hoja cambian las posiciones de las lineas y columna fontSize = 8.0; desc.Size = (int)(fontSize * pangoScale); layout.FontDescription = desc; layout.FontDescription.Weight = Weight.Bold; // Letra negrita cr.MoveTo(05 * escala_en_linux_windows, 05 * escala_en_linux_windows); layout.SetText(classpublic.nombre_empresa); Pango.CairoHelper.ShowLayout(cr, layout); cr.MoveTo(05 * escala_en_linux_windows, 15 * escala_en_linux_windows); layout.SetText(classpublic.direccion_empresa); Pango.CairoHelper.ShowLayout(cr, layout); cr.MoveTo(05 * escala_en_linux_windows, 25 * escala_en_linux_windows); layout.SetText(classpublic.telefonofax_empresa); Pango.CairoHelper.ShowLayout(cr, layout); fontSize = 6.0; desc.Size = (int)(fontSize * pangoScale); layout.FontDescription = desc; cr.MoveTo(479 * escala_en_linux_windows, 05 * escala_en_linux_windows); layout.SetText("Fech.Rpt:" + (string)DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); Pango.CairoHelper.ShowLayout(cr, layout); cr.MoveTo(479 * escala_en_linux_windows, 15 * escala_en_linux_windows); layout.SetText("N° Page :"); Pango.CairoHelper.ShowLayout(cr, layout); cr.MoveTo(05 * escala_en_linux_windows, 35 * escala_en_linux_windows); layout.SetText("Sistema Hospitalario OSIRIS"); Pango.CairoHelper.ShowLayout(cr, layout); // Cambiando el tamaño de la fuente fontSize = 10.0; desc.Size = (int)(fontSize * pangoScale); layout.FontDescription = desc; layout.FontDescription.Weight = Weight.Bold; // Letra negrita cr.MoveTo(225 * escala_en_linux_windows, 35 * escala_en_linux_windows); layout.SetText("REPORTE DE PAGO/ABONOS"); Pango.CairoHelper.ShowLayout(cr, layout); fontSize = 8.0; desc.Size = (int)(fontSize * pangoScale); layout.FontDescription = desc; layout.FontDescription.Weight = Weight.Bold; if (rango1 == "" || rango2 == "") { cr.MoveTo(235 * escala_en_linux_windows, 45 * escala_en_linux_windows); layout.SetText("Todas Las Fechas"); Pango.CairoHelper.ShowLayout(cr, layout); } else { if (rango1 == rango2) { cr.MoveTo(235 * escala_en_linux_windows, 45 * escala_en_linux_windows); layout.SetText("FECHA: " + rango1); Pango.CairoHelper.ShowLayout(cr, layout); } else { cr.MoveTo(235 * escala_en_linux_windows, 45 * escala_en_linux_windows); layout.SetText("Rango del " + rango1 + " al " + rango2); Pango.CairoHelper.ShowLayout(cr, layout); } } fontSize = 7.0; desc.Size = (int)(fontSize * pangoScale); layout.FontDescription = desc; layout.FontDescription.Weight = Weight.Normal; // Letra normal // Creando el Cuadro de Titulos para colocar el nombre del usuario cr.Rectangle(05 * escala_en_linux_windows, 55 * escala_en_linux_windows, 565 * escala_en_linux_windows, 15 * escala_en_linux_windows); cr.FillExtents(); //. FillPreserve(); cr.SetSourceRGB(0, 0, 0); cr.LineWidth = 0.5; cr.Stroke(); /* * ContextoImp.MoveTo(26,720); ContextoImp.Show("FOLIO"); * ContextoImp.MoveTo(56,720); ContextoImp.Show("MONTO"); * ContextoImp.MoveTo(93,720); ContextoImp.Show("F. ABONO"); * ContextoImp.MoveTo(134,720); ContextoImp.Show("Nº. REC."); * ContextoImp.MoveTo(171,720); ContextoImp.Show("PID Y NOMBRE DEL PACIENTE"); * ContextoImp.MoveTo(351,720); ContextoImp.Show("CONCEPTO"); * ContextoImp.MoveTo(501,720); ContextoImp.Show("FORMA DE PAGO"); */ }
public CustomScrollableWidget(string custom_label) : base() { label = custom_label; layout = null; HasWindow = false; }
void imprime_encabezado(Cairo.Context cr, Pango.Layout layout) { //Gtk.Image image5 = new Gtk.Image(); //image5.Name = "image5"; //image5.Pixbuf = new Gdk.Pixbuf(System.IO.Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "osiris.jpg")); //image5.Pixbuf = new Gdk.Pixbuf("/opt/osiris/bin/OSIRISLogo.jpg"); // en Linux //image5.Pixbuf.ScaleSimple(128, 128, Gdk.InterpType.Bilinear); //Gdk.CairoHelper.SetSourcePixbuf(cr,image5.Pixbuf,1,-30); //Gdk.CairoHelper.SetSourcePixbuf(cr,image5.Pixbuf.ScaleSimple(145, 50, Gdk.InterpType.Bilinear),1,1); //Gdk.CairoHelper.SetSourcePixbuf(cr,image5.Pixbuf.ScaleSimple(180, 64, Gdk.InterpType.Hyper),1,1); //cr.Fill(); //cr.Paint(); //cr.Restore(); Pango.FontDescription desc = Pango.FontDescription.FromString("Sans"); //cr.Rotate(90); //Imprimir Orizontalmente rota la hoja cambian las posiciones de las lineas y columna fontSize = 8.0; desc.Size = (int)(fontSize * pangoScale); layout.FontDescription = desc; layout.FontDescription.Weight = Weight.Bold; // Letra negrita cr.MoveTo(05 * escala_en_linux_windows, 05 * escala_en_linux_windows); layout.SetText(classpublic.nombre_empresa); Pango.CairoHelper.ShowLayout(cr, layout); cr.MoveTo(05 * escala_en_linux_windows, 15 * escala_en_linux_windows); layout.SetText(classpublic.direccion_empresa); Pango.CairoHelper.ShowLayout(cr, layout); cr.MoveTo(05 * escala_en_linux_windows, 25 * escala_en_linux_windows); layout.SetText(classpublic.telefonofax_empresa); Pango.CairoHelper.ShowLayout(cr, layout); fontSize = 6.0; desc.Size = (int)(fontSize * pangoScale); layout.FontDescription = desc; cr.MoveTo(650 * escala_en_linux_windows, 05 * escala_en_linux_windows); layout.SetText("Fech.Rpt:" + (string)DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); Pango.CairoHelper.ShowLayout(cr, layout); cr.MoveTo(650 * escala_en_linux_windows, 15 * escala_en_linux_windows); layout.SetText("N° Page :" + numpage.ToString().Trim()); Pango.CairoHelper.ShowLayout(cr, layout); cr.MoveTo(05 * escala_en_linux_windows, 35 * escala_en_linux_windows); layout.SetText("Sistema Hospitalario OSIRIS"); Pango.CairoHelper.ShowLayout(cr, layout); // Cambiando el tamaño de la fuente fontSize = 10.0; desc.Size = (int)(fontSize * pangoScale); layout.FontDescription = desc; cr.MoveTo(240 * escala_en_linux_windows, 25 * escala_en_linux_windows); layout.SetText("REPORTE OCUPACION HOSPITALARIA"); Pango.CairoHelper.ShowLayout(cr, layout); // Creando el Cuadro de Titulos cr.Rectangle(05 * escala_en_linux_windows, 50 * escala_en_linux_windows, 750 * escala_en_linux_windows, 15 * escala_en_linux_windows); cr.FillExtents(); //. FillPreserve(); cr.SetSourceRGB(0, 0, 0); cr.LineWidth = 0.5; cr.Stroke(); fontSize = 7.0; desc.Size = (int)(fontSize * pangoScale); layout.FontDescription = desc; layout.FontDescription.Weight = Weight.Bold; // Letra negrita cr.MoveTo(09 * escala_en_linux_windows, 53 * escala_en_linux_windows); layout.SetText("Folio."); Pango.CairoHelper.ShowLayout(cr, layout); cr.MoveTo(74 * escala_en_linux_windows, 53 * escala_en_linux_windows); layout.SetText("Orden"); Pango.CairoHelper.ShowLayout(cr, layout); cr.MoveTo(114 * escala_en_linux_windows, 53 * escala_en_linux_windows); layout.SetText("Codigo"); Pango.CairoHelper.ShowLayout(cr, layout); cr.MoveTo(300 * escala_en_linux_windows, 53 * escala_en_linux_windows); layout.SetText("Descripcion"); Pango.CairoHelper.ShowLayout(cr, layout); cr.MoveTo(400 * escala_en_linux_windows, 53 * escala_en_linux_windows); layout.SetText("CostoUni"); Pango.CairoHelper.ShowLayout(cr, layout); cr.MoveTo(480 * escala_en_linux_windows, 53 * escala_en_linux_windows); layout.SetText("Fecha"); Pango.CairoHelper.ShowLayout(cr, layout); cr.MoveTo(570 * escala_en_linux_windows, 53 * escala_en_linux_windows); layout.SetText("Surtir"); Pango.CairoHelper.ShowLayout(cr, layout); //cr.MoveTo(570*escala_en_linux_windows,53*escala_en_linux_windows); layout.SetText("Autoz"); Pango.CairoHelper.ShowLayout (cr, layout); //cr.MoveTo(570*escala_en_linux_windows,53*escala_en_linux_windows); layout.SetText("%Gana"); Pango.CairoHelper.ShowLayout (cr, layout); //cr.MoveTo(570*escala_en_linux_windows,53*escala_en_linux_windows); layout.SetText("SubAlmacen"); Pango.CairoHelper.ShowLayout (cr, layout); //cr.MoveTo(570*escala_en_linux_windows,53*escala_en_linux_windows); layout.SetText("Compro"); Pango.CairoHelper.ShowLayout (cr, layout); //cr.MoveTo(570*escala_en_linux_windows,53*escala_en_linux_windows); layout.SetText("Medico"); Pango.CairoHelper.ShowLayout (cr, layout); layout.FontDescription.Weight = Weight.Normal; // Letra Normal }
void RotatedTextExposeEvent (object sender, ExposeEventArgs a) { DrawingArea drawingArea = sender as DrawingArea; int width = drawingArea.Allocation.Width; int height = drawingArea.Allocation.Height; double deviceRadius; // Get the default renderer for the screen, and set it up for drawing Gdk.PangoRenderer renderer = Gdk.PangoRenderer.GetDefault (drawingArea.Screen); renderer.Drawable = drawingArea.GdkWindow; renderer.Gc = drawingArea.Style.BlackGC; // Set up a transformation matrix so that the user space coordinates for // the centered square where we draw are [-RADIUS, RADIUS], [-RADIUS, RADIUS] // We first center, then change the scale deviceRadius = Math.Min (width, height) / 2; Matrix matrix = Pango.Matrix.Identity; matrix.Translate (deviceRadius + (width - 2 * deviceRadius) / 2, deviceRadius + (height - 2 * deviceRadius) / 2); matrix.Scale (deviceRadius / RADIUS, deviceRadius / RADIUS); // Create a PangoLayout, set the font and text Context context = drawingArea.CreatePangoContext (); Pango.Layout layout = new Pango.Layout (context); layout.SetText ("Text"); FontDescription desc = FontDescription.FromString ("Sans Bold 27"); layout.FontDescription = desc; // Draw the layout N_WORDS times in a circle for (int i = 0; i < N_WORDS; i++) { Gdk.Color color = new Gdk.Color (); Matrix rotatedMatrix = matrix; int w, h; double angle = (360 * i) / N_WORDS; // Gradient from red at angle == 60 to blue at angle == 300 color.Red = (ushort) (65535 * (1 + Math.Cos ((angle - 60) * Math.PI / 180)) / 2); color.Green = 0; color.Blue = (ushort) (65535 - color.Red); renderer.SetOverrideColor (RenderPart.Foreground, color); rotatedMatrix.Rotate (angle); context.Matrix = rotatedMatrix; // Inform Pango to re-layout the text with the new transformation matrix layout.ContextChanged (); layout.GetSize (out w, out h); renderer.DrawLayout (layout, - w / 2, (int) (- RADIUS * Pango.Scale.PangoScale)); } // Clean up default renderer, since it is shared renderer.SetOverrideColor (RenderPart.Foreground, Gdk.Color.Zero); renderer.Drawable = null; renderer.Gc = null; }
void imprime_encabezado(Cairo.Context cr, Pango.Layout layout) { //image5.Pixbuf = new Gdk.Pixbuf(System.IO.Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "osiris.jpg")); //image5.Pixbuf = new Gdk.Pixbuf("/opt/osiris/bin/OSIRISLogo.jpg"); // en Linux //image5.Pixbuf.ScaleSimple(128, 128, Gdk.InterpType.Bilinear); //Gdk.CairoHelper.SetSourcePixbuf(cr,image5.Pixbuf,1,-30); //Gdk.CairoHelper.SetSourcePixbuf(cr,image5.Pixbuf.ScaleSimple(145, 50, Gdk.InterpType.Bilinear),1,1); //Gdk.CairoHelper.SetSourcePixbuf(cr,image5.Pixbuf.ScaleSimple(180, 64, Gdk.InterpType.Hyper),1,1); //cr.Fill(); //cr.Paint(); //cr.Restore(); Pango.FontDescription desc = Pango.FontDescription.FromString("Sans"); //cr.Rotate(90); //Imprimir Orizontalmente rota la hoja cambian las posiciones de las lineas y columna fontSize = 8.0; desc.Size = (int)(fontSize * pangoScale); layout.FontDescription = desc; layout.FontDescription.Weight = Weight.Bold; // Letra negrita cr.MoveTo(05 * escala_en_linux_windows, 05 * escala_en_linux_windows); layout.SetText(classpublic.nombre_empresa); Pango.CairoHelper.ShowLayout(cr, layout); cr.MoveTo(05 * escala_en_linux_windows, 15 * escala_en_linux_windows); layout.SetText(classpublic.direccion_empresa); Pango.CairoHelper.ShowLayout(cr, layout); cr.MoveTo(05 * escala_en_linux_windows, 25 * escala_en_linux_windows); layout.SetText(classpublic.telefonofax_empresa); Pango.CairoHelper.ShowLayout(cr, layout); fontSize = 6.0; desc.Size = (int)(fontSize * pangoScale); layout.FontDescription = desc; cr.MoveTo(650 * escala_en_linux_windows, 05 * escala_en_linux_windows); layout.SetText("Fech.Rpt:" + (string)DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); Pango.CairoHelper.ShowLayout(cr, layout); cr.MoveTo(650 * escala_en_linux_windows, 15 * escala_en_linux_windows); layout.SetText("N° Page :" + numpage.ToString().Trim()); Pango.CairoHelper.ShowLayout(cr, layout); cr.MoveTo(05 * escala_en_linux_windows, 35 * escala_en_linux_windows); layout.SetText("Sistema Hospitalario OSIRIS"); Pango.CairoHelper.ShowLayout(cr, layout); // Cambiando el tamaño de la fuente fontSize = 10.0; desc.Size = (int)(fontSize * pangoScale); layout.FontDescription = desc; cr.MoveTo(240 * escala_en_linux_windows, 25 * escala_en_linux_windows); layout.SetText(titulo); Pango.CairoHelper.ShowLayout(cr, layout); // Creando el Cuadro de Titulos cr.Rectangle(05 * escala_en_linux_windows, 50 * escala_en_linux_windows, 750 * escala_en_linux_windows, 15 * escala_en_linux_windows); cr.FillExtents(); //. FillPreserve(); cr.SetSourceRGB(0, 0, 0); cr.LineWidth = 0.5; cr.Stroke(); fontSize = 7.0; desc.Size = (int)(fontSize * pangoScale); layout.FontDescription = desc; layout.FontDescription.Weight = Weight.Bold; // Letra negrita cr.MoveTo(09 * escala_en_linux_windows, 53 * escala_en_linux_windows); layout.SetText("ID Producto"); Pango.CairoHelper.ShowLayout(cr, layout); //cr.MoveTo(74*escala_en_linux_windows,53*escala_en_linux_windows); layout.SetText("Ingreso"); Pango.CairoHelper.ShowLayout (cr, layout); cr.MoveTo(comienzo_mese + (espacio_mese * 1) * escala_en_linux_windows, 53 * escala_en_linux_windows); layout.SetText("ENE"); Pango.CairoHelper.ShowLayout(cr, layout); cr.MoveTo(comienzo_mese + (espacio_mese * 2) * escala_en_linux_windows, 53 * escala_en_linux_windows); layout.SetText("FEB"); Pango.CairoHelper.ShowLayout(cr, layout); cr.MoveTo(comienzo_mese + (espacio_mese * 3) * escala_en_linux_windows, 53 * escala_en_linux_windows); layout.SetText("MAR"); Pango.CairoHelper.ShowLayout(cr, layout); cr.MoveTo(comienzo_mese + (espacio_mese * 4) * escala_en_linux_windows, 53 * escala_en_linux_windows); layout.SetText("ABR"); Pango.CairoHelper.ShowLayout(cr, layout); cr.MoveTo(comienzo_mese + (espacio_mese * 5) * escala_en_linux_windows, 53 * escala_en_linux_windows); layout.SetText("MAY"); Pango.CairoHelper.ShowLayout(cr, layout); cr.MoveTo(comienzo_mese + (espacio_mese * 6) * escala_en_linux_windows, 53 * escala_en_linux_windows); layout.SetText("JUN"); Pango.CairoHelper.ShowLayout(cr, layout); cr.MoveTo(comienzo_mese + (espacio_mese * 7) * escala_en_linux_windows, 53 * escala_en_linux_windows); layout.SetText("JUL"); Pango.CairoHelper.ShowLayout(cr, layout); cr.MoveTo(comienzo_mese + (espacio_mese * 8) * escala_en_linux_windows, 53 * escala_en_linux_windows); layout.SetText("AGO"); Pango.CairoHelper.ShowLayout(cr, layout); cr.MoveTo(comienzo_mese + (espacio_mese * 9) * escala_en_linux_windows, 53 * escala_en_linux_windows); layout.SetText("SEP"); Pango.CairoHelper.ShowLayout(cr, layout); cr.MoveTo(comienzo_mese + (espacio_mese * 10) * escala_en_linux_windows, 53 * escala_en_linux_windows); layout.SetText("OCT"); Pango.CairoHelper.ShowLayout(cr, layout); cr.MoveTo(comienzo_mese + (espacio_mese * 11) * escala_en_linux_windows, 53 * escala_en_linux_windows); layout.SetText("NUV"); Pango.CairoHelper.ShowLayout(cr, layout); cr.MoveTo(comienzo_mese + (espacio_mese * 12) * escala_en_linux_windows, 53 * escala_en_linux_windows); layout.SetText("DIC"); Pango.CairoHelper.ShowLayout(cr, layout); layout.FontDescription.Weight = Weight.Normal; // Letra Normal }
public CairoContext(IntPtr state, Gtk.Widget widget) : base(state) { layout = Pango.CairoHelper.CreateLayout(this); // We do not honor DPI settings or font sizes (just font name) // User should resize the window font_description = layout.FontDescription = widget.PangoContext.FontDescription.Copy(); FontLineSpace = def_linespace; }
void salto_de_pagina(Cairo.Context cr, Pango.Layout layout) { if (comienzo_linea > 700) { cr.ShowPage(); comienzo_linea = 105; imprime_encabezado(cr, layout); } }
void ejecutar_consulta_reporte(PrintContext context) { Cairo.Context cr = context.CairoContext; Pango.Layout layout = context.CreatePangoLayout(); Pango.FontDescription desc = Pango.FontDescription.FromString("Sans"); // cr.Rotate(90) Imprimir Orizontalmente rota la hoja cambian las posiciones de las lineas y columna fontSize = 8.0; layout = null; layout = context.CreatePangoLayout(); desc.Size = (int)(fontSize * pangoScale); layout.FontDescription = desc; }
public CustomWidget () : base () { icon = null; label = "CustomWidget"; layout = null; stockid = Stock.Execute; HasWindow = false; }
void OnRealized(object o, EventArgs args) { layout = new Pango.Layout(PangoContext); layout.SingleParagraphMode = false; layout.FontDescription = font; layout.Indent = (int)(-Pango.Scale.PangoScale * 20); layout.SetText(text); Render(); }
public CustomWidget () : base () { icon = null; label = "CustomWidget"; layout = null; stockid = Stock.Execute; WidgetFlags |= WidgetFlags.NoWindow; }
public TimeReferenceWidget() { Frames = 1; PixelRatio = 1; FrameRate = 1; this.HeightRequest = SECTION_HEIGHT; layout = new Pango.Layout(this.PangoContext); }
public TimeReferenceWidget() { Frames = 1; PixelRatio = 1; FrameRate = 1; this.HeightRequest= SECTION_HEIGHT; layout = new Pango.Layout(this.PangoContext); }
public CairoContext(IntPtr state, Gtk.Widget widget) : base(state) { layout = Pango.CairoHelper.CreateLayout (this); // We do not honor DPI settings or font sizes (just font name) // User should resize the window font_description = layout.FontDescription = widget.PangoContext.FontDescription.Copy (); FontLineSpace = def_linespace; }
public ListWidget(ListWindow win) { this.win = win; this.Events = EventMask.ButtonPressMask | EventMask.ButtonReleaseMask | EventMask.PointerMotionMask; DefaultCompletionString = ""; layout = new Pango.Layout (this.PangoContext); layout.Wrap = Pango.WrapMode.Char; FontDescription des = this.Style.FontDescription.Copy (); layout.FontDescription = des; }
void Reload () { layout = Layout.Copy (); layout.SetText (ellipsis); layout.GetPixelSize (out ellipsis_width, out tmp); layout.SetText (en_char); layout.GetPixelSize (out en_width, out tmp); }
public virtual void Render(Cairo.Context cr, Layout layout, double x, double y, double w, double h) { cr.Save(); cr.Translate (x,y); // make the background white cr.Color = new Cairo.Color(1, 1, 1); cr.Rectangle(0,0,w,h); cr.Fill(); // calc some values int lw; string prefix = "INV-"+InventoryAbbreviation+"-"; string idString = Id.ToString("0000000000"); // basic text stuff layout.FontDescription = FontDescription.FromString(CalcFont(Layout,layout,h)); layout.Width = (int)(w*Scale.PangoScale); layout.Alignment = Alignment.Center; // draw the description int descH = 0; if(Layout.UseDescription){ Layout descLayout = layout.Copy(); descLayout.SetText (Description); descLayout.GetPixelSize(out lw, out descH); layout.Ellipsize = EllipsizeMode.Middle; layout.Justify = true; cr.Color = new Cairo.Color(0, 0, 0); Pango.CairoHelper.ShowLayout (cr, descLayout); } // draw the barcode text int codeH = 0; if(Layout.UseBarcodeText){ Layout codeLayout = layout.Copy(); codeLayout.SetText (prefix+idString); codeLayout.GetPixelSize(out lw, out codeH); cr.MoveTo(0,h-(double)codeH); cr.Color = new Cairo.Color(0, 0, 0); Pango.CairoHelper.ShowLayout (cr, codeLayout); } // draw the barcode if(Layout.UseBarcode){ double barcodeH = h-((double)codeH+(double)descH+Layout.SpacingSize*2); if(barcodeH>0){ IBarcode bc = new Code128(); bc.WriteString(prefix+idString); bc.WriteEnd(); RenderBarcode(bc,cr,0,descH+Layout.SpacingSize,w,barcodeH); } } cr.Restore(); }
public ListWidget(ListWindow win) { this.win = win; this.Events = EventMask.ButtonPressMask | EventMask.ButtonReleaseMask | EventMask.PointerMotionMask; DefaultCompletionString = ""; layout = new Pango.Layout(this.PangoContext); layout.Wrap = Pango.WrapMode.Char; FontDescription des = this.Style.FontDescription.Copy(); layout.FontDescription = des; }
// Used by GeneratePDF public CairoContext(Cairo.Surface s, string font, int dpis) : base(s) { layout = Pango.CairoHelper.CreateLayout (this); font_description = layout.FontDescription = FontDescription.FromString (font); if (dpis > 0) { Pango.Context c = layout.Context; Pango.CairoHelper.ContextSetResolution (c, dpis); c.Dispose (); } FontLineSpace = def_linespace; }
public static void DrawText(this Gtk.Widget widget, int x, int y, string text, Gdk.Color? color = null) { var layout = new Pango.Layout (widget.PangoContext); layout.Width = Pango.Units.FromPixels(20); layout.Wrap = Pango.WrapMode.Word; layout.Alignment = Pango.Alignment.Center; layout.FontDescription = Pango.FontDescription.FromString ("Sans Bold 8"); layout.SetText(text); widget.GdkWindow.DrawLayout ( widget.Style.TextGC (StateType.Normal), x, y, layout ); }
public ListView () { base.CanFocus = true; this.Events = EventMask.ButtonPressMask | EventMask.ButtonReleaseMask | EventMask.PointerMotionMask | EventMask.ScrollMask; layout = new Pango.Layout (this.PangoContext); layout.Wrap = Pango.WrapMode.Char; FontDescription des = this.Style.FontDescription.Copy(); layout.FontDescription = des; }
public void DrawLabel(int position, string label) { var layout = new Pango.Layout(this.PangoContext); layout.FontDescription = FontDescription.FromString ("Tahoma 16"); layout.SetMarkup(label); int width, height; layout.GetPixelSize(out width, out height); if (width != 0 && height != 0) { _labelPixmap = new Pixmap(GdkWindow, width, height, -1); CalculateXandY(position, width, height); _labelPixmap.DrawDrawable(_gc, _pixmap, _labelX, _labelY, 0, 0, width, height); _labelPixmap.DrawLayout(_gc, 0, 0, layout); QueueDraw(); } }
protected override void OnExpose(object o, ExposeEventArgs args) { using(Cairo.Context cr = Gdk.CairoHelper.Create(GdkWindow)){ // make the background white with a line around double x = 0; double y = 0; double w = Allocation.Width-settings.SectionWidth; double h = Allocation.Height-settings.SectionHeight; Pango.Layout pl = new Pango.Layout(this.PangoContext); DrawPaper(cr,x,y,w,h); ArrayList labels = new ArrayList(); for(int i=0;i < settings.PageLayout.LabelsPerPage;++i){ labels.Add( new PseudoLabelRenderer() ); } GetInnerRegion(ref x,ref y,ref w,ref h); PageLayout layout = new PageLayout(); layout.LabelRepeatX = settings.PageLayout.LabelRepeatX; layout.LabelRepeatY = settings.PageLayout.LabelRepeatY; layout.PaddingX = settings.PageLayout.PaddingX; layout.PaddingY = settings.PageLayout.PaddingY; layout.LabelWidth = (w-2*layout.PaddingX-settings.LabelPadding*(layout.LabelRepeatX-1)) / layout.LabelRepeatX; layout.LabelHeight = (h-2*layout.PaddingY-settings.LabelPadding*(layout.LabelRepeatY-1)) / layout.LabelRepeatY; PageRenderer pr = new PageRenderer(labels,layout); pr.Render(cr,pl,x,y,w,h); //double nn; //DrawVerticalSectionIndicator(settings.PageLayout.LabelRepeatY.ToString()+"x",cr,pl,x+w+sectionPadding,y,out nn,h); //DrawHorizontalSectionIndicator(settings.PageLayout.LabelRepeatX.ToString()+"x",cr,pl,x,y+h+sectionPadding,w,out nn); } }
public ListWidget (ListWindow win) { this.win = win; this.Events = EventMask.ButtonPressMask | EventMask.ButtonReleaseMask | EventMask.PointerMotionMask; DefaultCompletionString = ""; categoryLayout = new Pango.Layout (this.PangoContext); noMatchLayout = new Pango.Layout (this.PangoContext); layout = new Pango.Layout (this.PangoContext); layout.Wrap = Pango.WrapMode.Char; var style = SyntaxModeService.GetColorStyle (IdeApp.Preferences.ColorScheme); SetFont (); textColor = style.CompletionText.Foreground; highlightColor = style.CompletionHighlight.Color; backgroundColor = style.CompletionText.Background; selectedItemColor = style.CompletionSelectedText; selectedItemInactiveColor = style.CompletionSelectedInactiveText; selectionBorderColor = style.CompletionBorder.Color; selectionBorderInactiveColor = style.CompletionInactiveBorder.Color; this.Show (); }
// FIXME Cache the GCs? private void DrawCell (int thumbnail_num, Gdk.Rectangle area) { Gdk.Rectangle bounds = CellBounds (thumbnail_num); if (!bounds.Intersect (area, out area)) return; FSpot.IBrowsableItem photo = collection [thumbnail_num]; string thumbnail_path = FSpot.ThumbnailGenerator.ThumbnailPath (photo.DefaultVersionUri); FSpot.PixbufCache.CacheEntry entry = cache.Lookup (thumbnail_path); if (entry == null) cache.Request (thumbnail_path, thumbnail_num, ThumbnailWidth, ThumbnailHeight); else entry.Data = thumbnail_num; bool selected = selection.Contains (thumbnail_num); StateType cell_state = selected ? (HasFocus ? StateType.Selected : StateType.Active) : State; if (cell_state != State) Style.PaintBox (Style, BinWindow, cell_state, ShadowType.Out, area, this, "IconView", bounds.X, bounds.Y, bounds.Width - 1, bounds.Height - 1); Gdk.Rectangle focus = Gdk.Rectangle.Inflate (bounds, -3, -3); if (HasFocus && thumbnail_num == FocusCell) { Style.PaintFocus(Style, BinWindow, cell_state, area, this, null, focus.X, focus.Y, focus.Width, focus.Height); } Gdk.Rectangle region = Gdk.Rectangle.Zero; Gdk.Rectangle image_bounds = Gdk.Rectangle.Inflate (bounds, -cell_border_width, -cell_border_width); int expansion = ThrobExpansion (thumbnail_num, selected); Gdk.Pixbuf thumbnail = null; if (entry != null) thumbnail = entry.ShallowCopyPixbuf (); if (Gdk.Rectangle.Inflate (image_bounds, expansion + 1, expansion + 1).Intersect (area, out image_bounds) && thumbnail != null) { PixbufUtils.Fit (thumbnail, ThumbnailWidth, ThumbnailHeight, true, out region.Width, out region.Height); region.X = (int) (bounds.X + (bounds.Width - region.Width) / 2); region.Y = (int) bounds.Y + ThumbnailHeight - region.Height + cell_border_width; if (region.Width != thumbnail.Width && region.Height != thumbnail.Height) cache.Reload (entry, thumbnail_num, thumbnail.Width, thumbnail.Height); region = Gdk.Rectangle.Inflate (region, expansion, expansion); Pixbuf temp_thumbnail; region.Width = System.Math.Max (1, region.Width); region.Height = System.Math.Max (1, region.Height); if (region.Width != thumbnail.Width && region.Height != thumbnail.Height) { if (region.Width < thumbnail.Width && region.Height < thumbnail.Height) { /* temp_thumbnail = PixbufUtils.ScaleDown (thumbnail, region.Width, region.Height); */ temp_thumbnail = thumbnail.ScaleSimple (region.Width, region.Height, InterpType.Bilinear); lock (entry) { if (entry.Reload && expansion == 0 && !entry.IsDisposed) { entry.SetPixbufExtended (PixbufUtils.ShallowCopy (temp_thumbnail), false); entry.Reload = true; } } } else { temp_thumbnail = thumbnail.ScaleSimple (region.Width, region.Height, InterpType.Bilinear); } PixbufUtils.CopyThumbnailOptions (thumbnail, temp_thumbnail); } else temp_thumbnail = thumbnail; // FIXME There seems to be a rounding issue between the // scaled thumbnail sizes, we avoid this for now by using // the actual thumnail sizes here. region.Width = temp_thumbnail.Width; region.Height = temp_thumbnail.Height; Gdk.Rectangle draw = Gdk.Rectangle.Inflate (region, 1, 1); if (!temp_thumbnail.HasAlpha) Style.PaintShadow (Style, BinWindow, cell_state, ShadowType.Out, area, this, "IconView", draw.X, draw.Y, draw.Width, draw.Height); if (region.Intersect (area, out draw)) { temp_thumbnail.RenderToDrawable (BinWindow, Style.WhiteGC, draw.X - region.X, draw.Y - region.Y, draw.X, draw.Y, draw.Width, draw.Height, RgbDither.None, draw.X, draw.Y); } if (temp_thumbnail != thumbnail) { temp_thumbnail.Dispose (); } } if (thumbnail != null) { thumbnail.Dispose (); } Gdk.Rectangle layout_bounds = Gdk.Rectangle.Zero; if (DisplayDates) { string date; if (cell_width > 200) { date = photo.Time.ToLocalTime ().ToString (); } else { date = photo.Time.ToLocalTime ().ToShortDateString (); } Pango.Layout layout = (Pango.Layout)date_layouts [date]; if (layout == null) { layout = new Pango.Layout (this.PangoContext); layout.SetText (date); date_layouts [date] = layout; } layout.GetPixelSize (out layout_bounds.Width, out layout_bounds.Height); layout_bounds.Y = bounds.Y + bounds.Height - cell_border_width - layout_bounds.Height + tag_icon_vspacing; layout_bounds.X = bounds.X + (bounds.Width - layout_bounds.Width) / 2; if (DisplayTags) layout_bounds.Y -= tag_icon_size; if (DisplayFilenames) { Pango.FontMetrics metrics = this.PangoContext.GetMetrics (this.Style.FontDescription, Pango.Language.FromString ("en_US")); layout_bounds.Y -= PangoPixels (metrics.Ascent + metrics.Descent); } if (layout_bounds.Intersect (area, out region)) { Style.PaintLayout (Style, BinWindow, cell_state, true, area, this, "IconView", layout_bounds.X, layout_bounds.Y, layout); } } if (DisplayFilenames) { string filename = System.IO.Path.GetFileName (photo.DefaultVersionUri.LocalPath); Pango.Layout layout = new Pango.Layout (this.PangoContext); layout.SetText (filename); layout.GetPixelSize (out layout_bounds.Width, out layout_bounds.Height); layout_bounds.Y = bounds.Y + bounds.Height - cell_border_width - layout_bounds.Height + tag_icon_vspacing; layout_bounds.X = bounds.X + (bounds.Width - layout_bounds.Width) / 2; if (DisplayTags) layout_bounds.Y -= tag_icon_size; if (layout_bounds.Intersect (area, out region)) { Style.PaintLayout (Style, BinWindow, cell_state, true, area, this, "IconView", layout_bounds.X, layout_bounds.Y, layout); } } if (DisplayTags) { Tag [] tags = photo.Tags; Gdk.Rectangle tag_bounds; tag_bounds.X = bounds.X + (bounds.Width + tag_icon_hspacing - tags.Length * (tag_icon_size + tag_icon_hspacing)) / 2; tag_bounds.Y = bounds.Y + bounds.Height - cell_border_width - tag_icon_size + tag_icon_vspacing; tag_bounds.Width = tag_icon_size; tag_bounds.Height = tag_icon_size; foreach (Tag t in tags) { if (t == null) continue; Pixbuf icon = t.Icon; Tag tag_iter = t.Category; while (icon == null && tag_iter != Core.Database.Tags.RootCategory && tag_iter != null) { icon = tag_iter.Icon; tag_iter = tag_iter.Category; } if (icon == null) continue; if (tag_bounds.Intersect (area, out region)) { Pixbuf scaled_icon; if (icon.Width == tag_bounds.Width) { scaled_icon = icon; } else { scaled_icon = icon.ScaleSimple (tag_bounds.Width, tag_bounds.Height, InterpType.Bilinear); } scaled_icon.RenderToDrawable (BinWindow, Style.WhiteGC, region.X - tag_bounds.X, region.Y - tag_bounds.Y, region.X, region.Y, region.Width, region.Height, RgbDither.None, region.X, region.Y); if (scaled_icon != icon) { scaled_icon.Dispose (); } } tag_bounds.X += tag_bounds.Width + tag_icon_hspacing; } } }
public ListWidget (ListWindow win) { this.win = win; this.Events = EventMask.ButtonPressMask | EventMask.ButtonReleaseMask | EventMask.PointerMotionMask; DefaultCompletionString = ""; categoryLayout = new Pango.Layout (this.PangoContext); noMatchLayout = new Pango.Layout (this.PangoContext); layout = new Pango.Layout (this.PangoContext); layout.Wrap = Pango.WrapMode.Char; SetFont (); this.Show (); }
protected override void OnExpose(object o, ExposeEventArgs args) { using(Cairo.Context cr = Gdk.CairoHelper.Create(GdkWindow)){ double x = 0; double y = 0; double w = Allocation.Width-settings.SectionWidth; double h = Allocation.Height-settings.SectionHeight; DrawPaper(cr,x,y,w,h); GetInnerRegion(ref x,ref y,ref w,ref h); Pango.Layout pl = new Pango.Layout(this.PangoContext); double nn; DrawVerticalSectionIndicator(settings.PageLayout.LabelHeight.ToString("N1")+"mm",cr,pl,x+w+settings.SectionPadding,y,out nn,h); DrawHorizontalSectionIndicator(settings.PageLayout.LabelWidth.ToString("N1")+"mm",cr,pl,x,y+h+settings.SectionPadding,w,out nn); LabelRenderer l = new LabelRenderer(settings.LabelLayout); int labelPadding = 3; l.Render(cr,pl, x+labelPadding,y+labelPadding, w-2*labelPadding, h-2*labelPadding); } }
protected override void Render (Gdk.Drawable drawable, Widget widget, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gdk.Rectangle expose_area, CellRendererState flags) { if (source == null || source is SourceManager.GroupSource) { return; } view = widget as SourceView; bool selected = view != null && view.Selection.IterIsSelected (iter); StateType state = RendererStateToWidgetState (widget, flags); RenderSelection (drawable, background_area, selected, state); int title_layout_width = 0, title_layout_height = 0; int count_layout_width = 0, count_layout_height = 0; int max_title_layout_width; int img_padding = 6; int expander_icon_spacing = 3; int x = cell_area.X; bool np_etc = (source.Order + Depth * 100) < 40; if (!np_etc) { x += Depth * img_padding + (int)Xpad; } else { // Don't indent NowPlaying and Play Queue as much x += Math.Max (0, (int)Xpad - 2); } Gdk.GC main_gc = widget.Style.TextGC (state); // Draw the expander if the source has children double exp_h = (cell_area.Height - 2.0*Ypad) / 3.2; double exp_w = exp_h * 1.6; if (view != null && view.Cr != null && source.Children != null && source.Children.Count > 0) { var r = new Gdk.Rectangle (x, cell_area.Y + (int)((cell_area.Height - exp_h) / 2.0), (int)exp_w, (int)exp_h); view.Theme.DrawArrow (view.Cr, r, source.Expanded ? Math.PI/2.0 : 0.0); } if (!np_etc) { x += (int) exp_w; x += 2; // a little spacing after the expander expander_right_x = x; } // Draw icon Pixbuf icon = SourceIconResolver.ResolveIcon (source, RowHeight); bool dispose_icon = false; if (state == StateType.Insensitive) { // Code ported from gtk_cell_renderer_pixbuf_render() var icon_source = new IconSource () { Pixbuf = icon, Size = IconSize.SmallToolbar, SizeWildcarded = false }; icon = widget.Style.RenderIcon (icon_source, widget.Direction, state, (IconSize)(-1), widget, "SourceRowRenderer"); dispose_icon = true; icon_source.Dispose (); } if (icon != null) { x += expander_icon_spacing; drawable.DrawPixbuf (main_gc, icon, 0, 0, x, Middle (cell_area, icon.Height), icon.Width, icon.Height, RgbDither.None, 0, 0); x += icon.Width; if (dispose_icon) { icon.Dispose (); } } // Setup font info for the title/count, and see if we should show the count bool hide_count = source.EnabledCount <= 0 || source.Properties.Get<bool> ("SourceView.HideCount"); FontDescription fd = widget.PangoContext.FontDescription.Copy (); fd.Weight = (ISource)ServiceManager.PlaybackController.NextSource == (ISource)source ? Pango.Weight.Bold : Pango.Weight.Normal; if (view != null && source == view.NewPlaylistSource) { fd.Style = Pango.Style.Italic; hide_count = true; } Pango.Layout title_layout = new Pango.Layout (widget.PangoContext); Pango.Layout count_layout = null; // If we have a count to draw, setup its fonts and see how wide it is to see if we have room if (!hide_count) { count_layout = new Pango.Layout (widget.PangoContext); count_layout.FontDescription = fd; count_layout.SetMarkup (String.Format ("<span size=\"small\">{0}</span>", source.EnabledCount)); count_layout.GetPixelSize (out count_layout_width, out count_layout_height); } // Hide the count if the title has no space max_title_layout_width = cell_area.Width - x - count_layout_width;//(icon == null ? 0 : icon.Width) - count_layout_width - 10; if (!hide_count && max_title_layout_width <= 0) { hide_count = true; } // Draw the source Name title_layout.FontDescription = fd; title_layout.Width = (int)(max_title_layout_width * Pango.Scale.PangoScale); title_layout.Ellipsize = EllipsizeMode.End; title_layout.SetText (source.Name); title_layout.GetPixelSize (out title_layout_width, out title_layout_height); x += img_padding; drawable.DrawLayout (main_gc, x, Middle (cell_area, title_layout_height), title_layout); title_layout.Dispose (); // Draw the count if (!hide_count) { if (view != null && view.Cr != null) { view.Cr.Color = state == StateType.Normal || (view != null && state == StateType.Prelight) ? view.Theme.TextMidColor : view.Theme.Colors.GetWidgetColor (GtkColorClass.Text, state); view.Cr.MoveTo ( cell_area.X + cell_area.Width - count_layout_width - 2, cell_area.Y + 0.5 + (double)(cell_area.Height - count_layout_height) / 2.0); PangoCairoHelper.ShowLayout (view.Cr, count_layout); } count_layout.Dispose (); } fd.Dispose (); }
protected void OnRealized (object o, EventArgs args) { scrollStartPx = imageHeight; layout = new Pango.Layout (this.PangoContext); // FIXME: this seems wrong but works layout.Width = Allocation.Width * (int)Pango.Scale.PangoScale; layout.Wrap = Pango.WrapMode.Word; layout.Alignment = Pango.Alignment.Center; FontDescription fd = FontDescription.FromString ("Tahoma 10"); layout.FontDescription = fd; layout.SetMarkup (CreditText); int widthPx, heightPx; layout.GetPixelSize (out widthPx, out heightPx); this.scrollHeightPx = heightPx + monoLogoSpacing + monoPowered.Height + imageHeight / 2; backGc = new Gdk.GC (GdkWindow); backGc.RgbBgColor = bgColor; }
/** BLOCKING */ static Pango.Layout GetLayout(Context cr, string family, uint fontSize) { Profiler p = new Profiler ("GetFont"); if (layout == null) layout = Pango.CairoHelper.CreateLayout (cr); Pango.CairoHelper.UpdateLayout (cr, layout); layout.FontDescription = CreateFont (family, fontSize); p.Time ("Got font and created layout"); return layout; }
ExecutingGraphData event_execute_initializeVariables( int personID, string personName, string phasesName, string tableName, string event_execute_eventType ) { eventExecuteHideAllTables(); eventExecuteHideImages(); if(Util.IsWindows()) { event_execute_rightMargin = 50; event_execute_arcSystemCorrection = 1; } event_execute_configureColors(); event_graph_label_graph_person.Text = personName; event_graph_label_graph_test.Text = event_execute_eventType; event_execute_textview_message.Buffer = UtilGtk.TextViewPrint(""); //this.event_execute_personName.Text = event_execute_personName; //"Jumps" (rjInterval), "Runs" (runInterval), "Ticks" (pulses), this.event_execute_label_phases_name.Text = phasesName; //"Jumps" (rjInterval), "Runs" (runInterval), "Ticks" (pulses), //"Phases" (simple jumps, dj, simple runs) this.event_execute_personID = personID; this.event_execute_tableName = tableName; this.event_execute_eventType = event_execute_eventType; //finish not sensitive for all events. //Later reactive, interval and pulse will sensitive it when a subevent is done event_execute_button_finish.Sensitive = false; if(event_execute_tableName == Constants.JumpTable) { showJumpSimpleLabels(); } else if(event_execute_tableName == Constants.JumpRjTable) { showJumpReactiveLabels(); } else if(event_execute_tableName == Constants.RunTable) { showRunSimpleLabels(); } else if(event_execute_tableName == Constants.RunIntervalTable) { showRunIntervalLabels(); } else if(event_execute_tableName == Constants.ReactionTimeTable) { showReactionTimeLabels(); } else if(event_execute_tableName == Constants.PulseTable) { showPulseLabels(); } event_execute_button_cancel.Sensitive = true; event_execute_clearDrawingArea(); clearProgressBars(); event_execute_eventbox_jump_simple_tc.ModifyBg(Gtk.StateType.Normal, new Gdk.Color( 255, 0, 0)); event_execute_eventbox_jump_simple_tf.ModifyBg(Gtk.StateType.Normal, new Gdk.Color( 0, 0, 255)); event_execute_eventbox_jump_reactive_tc.ModifyBg(Gtk.StateType.Normal, new Gdk.Color( 255, 0, 0)); event_execute_eventbox_jump_reactive_tf.ModifyBg(Gtk.StateType.Normal, new Gdk.Color( 0, 0, 255)); event_execute_eventbox_run_simple_time.ModifyBg(Gtk.StateType.Normal, new Gdk.Color( 255, 0, 0)); event_execute_eventbox_run_simple_speed.ModifyBg(Gtk.StateType.Normal, new Gdk.Color( 0, 0, 255)); event_execute_eventbox_run_interval_time.ModifyBg(Gtk.StateType.Normal, new Gdk.Color( 255, 0, 0)); event_execute_eventbox_run_interval_speed.ModifyBg(Gtk.StateType.Normal, new Gdk.Color( 0, 0, 255)); event_execute_eventbox_pulse_time.ModifyBg(Gtk.StateType.Normal, new Gdk.Color( 0, 0, 255)); //only one serie in pulse, leave blue layout = new Pango.Layout (event_execute_drawingarea.PangoContext); layout.FontDescription = Pango.FontDescription.FromString ("Courier 7"); eventHasEnded = false; if(videoOn) cameraRecordInitiate(); ExecutingGraphData executingGraphData = new ExecutingGraphData( event_execute_button_cancel, event_execute_button_finish, event_execute_textview_message, event_execute_label_event_value, event_execute_label_time_value, event_execute_progressbar_event, event_execute_progressbar_time); return executingGraphData; }
protected override void OnDestroyed () { base.OnDestroyed (); if (layout != null) { layout.Dispose (); categoryLayout.Dispose (); noMatchLayout.Dispose (); layout = categoryLayout = noMatchLayout = null; } if (itemFont != null) { itemFont.Dispose (); itemFont = null; } }
void OnRealized (object o, EventArgs args) { layout = new Pango.Layout(PangoContext); layout.SingleParagraphMode = false; layout.FontDescription = font; layout.Indent = (int)(-Pango.Scale.PangoScale * 20); layout.SetText(text); Render(); }
private void plotCurvesGraphDoPlotMessage(string message) { Pango.Layout layout_message = new Pango.Layout (encoder_capture_curves_bars_drawingarea.PangoContext); layout_message.FontDescription = Pango.FontDescription.FromString ("Courier 10"); int graphWidth=encoder_capture_curves_bars_drawingarea.Allocation.Width; int graphHeight=encoder_capture_curves_bars_drawingarea.Allocation.Height; layout_message.SetMarkup(message); int textWidth = 1; int textHeight = 1; layout_message.GetPixelSize(out textWidth, out textHeight); int xStart = Convert.ToInt32(graphWidth/2 - textWidth/2); int yStart = Convert.ToInt32(graphHeight/2 - textHeight/2); //draw horizontal line behind (across all graph) Rectangle rect = new Rectangle(0, yStart + textHeight -1, graphWidth, 1); encoder_capture_curves_bars_pixmap.DrawRectangle(pen_yellow_encoder_capture, true, rect); //draw rectangle behind text rect = new Rectangle(xStart -2, yStart -2, textWidth +2, textHeight +2); encoder_capture_curves_bars_pixmap.DrawRectangle(pen_yellow_encoder_capture, true, rect); //write text inside encoder_capture_curves_bars_pixmap.DrawLayout (pen_black_encoder_capture, xStart, yStart, layout_message); }
public void draw(Gdk.Window win, Gdk.Color terr, Gdk.Color textcolor, Pango.Context pango_context) { Gdk.GC textcoloring = new Gdk.GC(win); textcoloring.RgbFgColor = textcolor; int carriedUnits = 0; string extraLabel = ""; GraphicsStorage store = GraphicsStorage.GetInstance(); int cenTerrX = MapTerritory.centerX; int cenTerrY = MapTerritory.centerY; /* Show flag */ Gdk.Pixbuf flag = store.AppropriateFlag(owner.CountryID); if (flag != null && owner.Active) win.DrawPixbuf(textcoloring, flag, 0, 0, cenTerrX, cenTerrY, flag.Width, flag.Height, RgbDither.Normal, 1, 1); /* Draw the map */ MapTerritory.draw(win, terr, textcolor); /* Show radiation if destroyed */ if (destroyed) win.DrawPixbuf(textcoloring, store.Radiation, 0, 0, cenTerrX, cenTerrY, store.Radiation.Width, store.Radiation.Height, RgbDither.Normal, 1, 1); /* Determine personnel carrier status */ foreach(TacticalUnit joe in units) carriedUnits += joe.UnitsAboardCount; if (carriedUnits > 0) extraLabel = "(" + carriedUnits + ")"; /* Draw the first N units staggered, then use a label to show further #'s */ for (int offset=0; offset < units.Count && offset < 3; offset++) { ((TacticalUnit)units[offset]).draw(win, offset*5); } /* Label */ if (units.Count > 1 || carriedUnits > 0) { Pango.Layout label = new Pango.Layout (pango_context); label.Wrap = Pango.WrapMode.Word; label.FontDescription = FontDescription.FromString ("Tahoma 8"); label.SetMarkup ( units.Count.ToString() + extraLabel ); int szX, szY; label.GetPixelSize(out szX, out szY); /*Redraw*/ // win.InvalidateRect(new Gdk.Rectangle(MapTerritory.centerX, MapTerritory.centerY, szX, szY), true); win.DrawLayout (textcoloring, MapTerritory.centerX, MapTerritory.centerY, label); } }
protected void OnRealized (object o, EventArgs args) { int x, y; int w, h; GdkWindow.GetOrigin (out x, out y); GdkWindow.GetSize (out w, out h); textTop = y + image.Height - 30; scrollStart = -(image.Height - textTop); scroll = scrollStart; layout = new Pango.Layout (this.PangoContext); // FIXME: this seems wrong but works layout.Width = w * (int)Pango.Scale.PangoScale; layout.Wrap = Pango.WrapMode.Word; layout.Alignment = Pango.Alignment.Center; FontDescription fd = FontDescription.FromString ("Tahoma 10"); layout.FontDescription = fd; layout.SetMarkup (CreditText); backGc = new Gdk.GC (GdkWindow); backGc.RgbBgColor = new Gdk.Color (49, 49, 74); }
void prepareEncoderGraphs(bool eraseBars, bool eraseSignal) { LogB.Debug("prepareEncoderGraphs() start (should be on first thread: GTK)"); if(eraseBars && encoder_capture_curves_bars_pixmap != null) UtilGtk.ErasePaint(encoder_capture_curves_bars_drawingarea, encoder_capture_curves_bars_pixmap); if(eraseSignal && encoder_capture_signal_pixmap != null) UtilGtk.ErasePaint(encoder_capture_signal_drawingarea, encoder_capture_signal_pixmap); layout_encoder_capture_signal = new Pango.Layout (encoder_capture_signal_drawingarea.PangoContext); layout_encoder_capture_signal.FontDescription = Pango.FontDescription.FromString ("Courier 10"); layout_encoder_capture_curves_bars = new Pango.Layout (encoder_capture_curves_bars_drawingarea.PangoContext); layout_encoder_capture_curves_bars.FontDescription = Pango.FontDescription.FromString ("Courier 10"); layout_encoder_capture_curves_bars_text = new Pango.Layout (encoder_capture_curves_bars_drawingarea.PangoContext); layout_encoder_capture_curves_bars_text.FontDescription = Pango.FontDescription.FromString ("Courier 10"); //defined as encoder_capture_curves_bars_drawingarea instead of encoder_capture_signal_drawingarea //because the 2nd is null if config.EncoderCaptureShowOnlyBars == TRUE pen_black_encoder_capture = new Gdk.GC(encoder_capture_curves_bars_drawingarea.GdkWindow); pen_gray = new Gdk.GC(encoder_capture_curves_bars_drawingarea.GdkWindow); pen_red_encoder_capture = new Gdk.GC(encoder_capture_curves_bars_drawingarea.GdkWindow); pen_red_light_encoder_capture = new Gdk.GC(encoder_capture_curves_bars_drawingarea.GdkWindow); pen_green_encoder_capture = new Gdk.GC(encoder_capture_curves_bars_drawingarea.GdkWindow); pen_blue_encoder_capture = new Gdk.GC(encoder_capture_curves_bars_drawingarea.GdkWindow); pen_white_encoder_capture = new Gdk.GC(encoder_capture_curves_bars_drawingarea.GdkWindow); pen_selected_encoder_capture = new Gdk.GC(encoder_capture_curves_bars_drawingarea.GdkWindow); pen_red_light_encoder_capture = new Gdk.GC(encoder_capture_curves_bars_drawingarea.GdkWindow); pen_red_dark_encoder_capture = new Gdk.GC(encoder_capture_curves_bars_drawingarea.GdkWindow); pen_green_light_encoder_capture = new Gdk.GC(encoder_capture_curves_bars_drawingarea.GdkWindow); pen_green_dark_encoder_capture = new Gdk.GC(encoder_capture_curves_bars_drawingarea.GdkWindow); pen_blue_dark_encoder_capture = new Gdk.GC(encoder_capture_curves_bars_drawingarea.GdkWindow); pen_blue_light_encoder_capture = new Gdk.GC(encoder_capture_curves_bars_drawingarea.GdkWindow); pen_yellow_encoder_capture = new Gdk.GC(encoder_capture_curves_bars_drawingarea.GdkWindow); Gdk.Colormap colormap = Gdk.Colormap.System; colormap.AllocColor (ref UtilGtk.BLACK,true,true); colormap.AllocColor (ref UtilGtk.GRAY,true,true); colormap.AllocColor (ref UtilGtk.RED_PLOTS,true,true); colormap.AllocColor (ref UtilGtk.RED_DARK,true,true); colormap.AllocColor (ref UtilGtk.RED_LIGHT,true,true); colormap.AllocColor (ref UtilGtk.GREEN_PLOTS,true,true); colormap.AllocColor (ref UtilGtk.GREEN_DARK,true,true); colormap.AllocColor (ref UtilGtk.GREEN_LIGHT,true,true); colormap.AllocColor (ref UtilGtk.BLUE_PLOTS,true,true); colormap.AllocColor (ref UtilGtk.BLUE_DARK,true,true); colormap.AllocColor (ref UtilGtk.BLUE_LIGHT,true,true); colormap.AllocColor (ref UtilGtk.YELLOW,true,true); colormap.AllocColor (ref UtilGtk.WHITE,true,true); colormap.AllocColor (ref UtilGtk.SELECTED,true,true); pen_black_encoder_capture.Foreground = UtilGtk.BLACK; pen_gray.Foreground = UtilGtk.GRAY; pen_red_encoder_capture.Foreground = UtilGtk.RED_PLOTS; pen_red_dark_encoder_capture.Foreground = UtilGtk.RED_DARK; pen_red_light_encoder_capture.Foreground = UtilGtk.RED_LIGHT; pen_green_encoder_capture.Foreground = UtilGtk.GREEN_PLOTS; pen_green_dark_encoder_capture.Foreground = UtilGtk.GREEN_DARK; pen_green_light_encoder_capture.Foreground = UtilGtk.GREEN_LIGHT; pen_blue_encoder_capture.Foreground = UtilGtk.BLUE_PLOTS; pen_blue_dark_encoder_capture.Foreground = UtilGtk.BLUE_DARK; pen_blue_light_encoder_capture.Foreground = UtilGtk.BLUE_LIGHT; pen_yellow_encoder_capture.Foreground = UtilGtk.YELLOW; pen_white_encoder_capture.Foreground = UtilGtk.WHITE; pen_selected_encoder_capture.Foreground = UtilGtk.SELECTED; pen_black_encoder_capture.SetLineAttributes (2, Gdk.LineStyle.Solid, Gdk.CapStyle.NotLast, Gdk.JoinStyle.Miter); pen_selected_encoder_capture.SetLineAttributes (2, Gdk.LineStyle.Solid, Gdk.CapStyle.NotLast, Gdk.JoinStyle.Miter); LogB.Debug("prepareEncoderGraphs() end"); }