public void Draw(Gdk.Drawable d) { if (!Visible) { return; } Gdk.GC gc = new Gdk.GC(d); Cairo.Context g = Gdk.CairoHelper.Create(d); d.DrawPixbuf(gc, _background, 0, 0, _x, _y, _w, _h, Gdk.RgbDither.None, 0, 0); int x0 = _x, x1 = _x + _w; int y0 = _y, y1 = _y + _h; g.MoveTo(x0 + 3, y0); g.LineTo(x1 - 3, y0); g.LineTo(x1, y0 + 3); g.LineTo(x1, y1 - 3); g.LineTo(x1 - 3, y1); g.LineTo(x0 + 3, y1); g.LineTo(x0, y1 - 3); g.LineTo(x0, y0 + 3); g.LineTo(x0 + 3, y0); g.ClosePath(); g.LineWidth = 6; g.Color = new Color(0.8, 0.8, 0.8, _opaque ? 1 : 0.6); g.Stroke(); ((IDisposable)g.Target).Dispose(); ((IDisposable)g).Dispose(); DrawContents(d); }
protected override void DrawContents(Gdk.Drawable d) { Gdk.GC gc = new Gdk.GC(d); Cairo.Context g = Gdk.CairoHelper.Create(d); g.SelectFontFace("Lucida Console", FontSlant.Normal, FontWeight.Bold); g.SetFontSize(24); TextExtents te; string lvl, hp, hpm, mp, mpm; #region Character Status d.DrawPixbuf(gc, Graphics.GetProfile(Selected.Name), 0, 0, X + xpic, Y + ypic, Graphics.PROFILE_WIDTH, Graphics.PROFILE_HEIGHT, Gdk.RgbDither.None, 0, 0); g.Color = new Color(.3, .8, .8); g.MoveTo(X + x3, Y + ya); g.ShowText("LV"); g.MoveTo(X + x3, Y + yb); g.ShowText("HP"); g.MoveTo(X + x3, Y + yc); g.ShowText("MP"); g.Color = new Color(1, 1, 1); Graphics.ShadowedText(g, Selected.Name, X + x3, Y + y); lvl = Selected.Level.ToString(); hp = Selected.HP.ToString() + "/"; hpm = Selected.MaxHP.ToString(); mp = Selected.MP.ToString() + "/"; mpm = Selected.MaxMP.ToString(); te = g.TextExtents(lvl); Graphics.ShadowedText(g, lvl, X + x4 - te.Width, Y + ya); te = g.TextExtents(hp); Graphics.ShadowedText(g, hp, X + x5 - te.Width, Y + yb); te = g.TextExtents(hpm); Graphics.ShadowedText(g, hpm, X + x6 - te.Width, Y + yb); te = g.TextExtents(mp); Graphics.ShadowedText(g, mp, X + x5 - te.Width, Y + yc); te = g.TextExtents(mpm); Graphics.ShadowedText(g, mpm, X + x6 - te.Width, Y + yc); #endregion Status ((IDisposable)g.Target).Dispose(); ((IDisposable)g).Dispose(); }
public void DrawIcon(Mono.TextEditor.TextEditor editor, Gdk.Drawable win, LineSegment line, int lineNumber, int x, int y, int width, int height) { if (DebuggingService.IsDebugging) { return; } win.DrawPixbuf(editor.Style.BaseGC(Gtk.StateType.Normal), errors.Any(e => e.IsError) ? errorPixbuf : warningPixbuf, 0, 0, x + (width - errorPixbuf.Width) / 2, y + (height - errorPixbuf.Height) / 2, errorPixbuf.Width, errorPixbuf.Height, Gdk.RgbDither.None, 0, 0); }
protected override void Render(Gdk.Drawable window, Widget widget, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gdk.Rectangle expose_area, CellRendererState flags) { if (!Visible) { return; } int x = cell_area.X + 1; int y = cell_area.Y + 1; window.DrawPixbuf(widget.Style.BaseGC(StateType.Normal), pixbuf, 0, 0, x, y, pixbuf.Width, pixbuf.Height, Gdk.RgbDither.None, 0, 0); }
protected override bool OnExposeEvent(Gdk.EventExpose args) { Gdk.Drawable win = args.Window; int width, height; layout.GetPixelSize(out width, out height); int arrowHeight = height / 2; int arrowWidth = arrowHeight + 1; int arrowXPos = this.Allocation.X + this.Allocation.Width - arrowWidth; if (DrawRightBorder) { arrowXPos -= 2; } //HACK: don't ever draw insensitive, only active/prelight/normal, because insensitive generally looks really ugly //this *might* cause some theme issues with the state of the text/arrows rendering on top of it var state = window != null? StateType.Active : State == StateType.Insensitive? StateType.Normal : State; //HACK: paint the button background as if it were bigger, but it stays clipped to the real area, // so we get the content but not the border. This might break with crazy themes. //FIXME: we can't use the style's actual internal padding because GTK# hasn't wrapped GtkBorder AFAICT // (default-border, inner-border, default-outside-border, etc - see http://git.gnome.org/browse/gtk+/tree/gtk/gtkbutton.c) const int padding = 4; Style.PaintBox(Style, args.Window, state, ShadowType.None, args.Area, this, "button", Allocation.X - padding, Allocation.Y - padding, Allocation.Width + padding * 2, Allocation.Height + padding * 2); int xPos = Allocation.Left; if (Pixbuf != null) { win.DrawPixbuf(this.Style.BaseGC(StateType.Normal), Pixbuf, 0, 0, xPos + pixbufSpacing, Allocation.Y + (Allocation.Height - Pixbuf.Height) / 2, Pixbuf.Width, Pixbuf.Height, Gdk.RgbDither.None, 0, 0); xPos += Pixbuf.Width + pixbufSpacing * 2; } //constrain the text area so it doesn't get rendered under the arrows var textArea = new Gdk.Rectangle(xPos, Allocation.Y + ySpacing, arrowXPos - xPos - 2, Allocation.Height - ySpacing); Style.PaintLayout(Style, win, state, true, textArea, this, "", textArea.X, textArea.Y, layout); state = Sensitive ? StateType.Normal : StateType.Insensitive; Gtk.Style.PaintArrow(this.Style, win, state, ShadowType.None, args.Area, this, "", ArrowType.Up, true, arrowXPos, Allocation.Y + (Allocation.Height) / 2 - arrowHeight, arrowWidth, arrowHeight); Gtk.Style.PaintArrow(this.Style, win, state, ShadowType.None, args.Area, this, "", ArrowType.Down, true, arrowXPos, Allocation.Y + (Allocation.Height) / 2, arrowWidth, arrowHeight); if (DrawRightBorder) { win.DrawLine(this.Style.DarkGC(StateType.Normal), Allocation.X + Allocation.Width - 1, Allocation.Y, Allocation.X + Allocation.Width - 1, Allocation.Y + Allocation.Height); } return(false); }
protected override void DrawContents(Gdk.Drawable d) { Gdk.GC gc = new Gdk.GC(d); Cairo.Context g = Gdk.CairoHelper.Create(d); g.SelectFontFace("Lucida Console", FontSlant.Normal, FontWeight.Bold); g.SetFontSize(24); TextExtents te; Character c = Globals.Party[2]; if (c != null) { d.DrawPixbuf(gc, Graphics.GetProfileSmall(c.Name), 0, 0, X + xpic, Y + ypic, Graphics.PROFILE_WIDTH_SMALL, Graphics.PROFILE_HEIGHT_SMALL, Gdk.RgbDither.None, 0, 0); Graphics.ShadowedText(g, c.Name, X + x1, Y + y0); Graphics.ShadowedText(g, "Level:", X + x2, Y + y1); string lvl = c.Level.ToString(); te = g.TextExtents(lvl); Graphics.ShadowedText(g, lvl, X + x3 - te.Width, Y + y1); string temp = "Exp:"; te = g.TextExtents(temp); Graphics.ShadowedText(g, temp, X + x4 - te.Width, Y + y0); temp = "For level up:"; te = g.TextExtents(temp); Graphics.ShadowedText(g, temp, X + x4 - te.Width, Y + y1); string exp = c.Exp.ToString() + "p"; te = g.TextExtents(exp); Graphics.ShadowedText(g, exp, X + x5 - te.Width, Y + y0); string expNext = c.ToNextLevel.ToString() + "p"; te = g.TextExtents(expNext); Graphics.ShadowedText(g, expNext, X + x5 - te.Width, Y + y1); } ((IDisposable)g.Target).Dispose(); ((IDisposable)g).Dispose(); }
public override void Render(Gdk.Drawable window, Gdk.Rectangle bounds, Gtk.StateType state) { int iy = bounds.Y + (bounds.Height - imgSize) / 2; if (image != null) { int dy = (imgSize - image.Height) / 2; int dx = (imgSize - image.Width) / 2; window.DrawPixbuf(Container.Style.BackgroundGC(state), image, 0, 0, bounds.X + dx, iy + dy, -1, -1, Gdk.RgbDither.None, 0, 0); } window.DrawRectangle(Container.Style.DarkGC(state), false, bounds.X, iy, imgSize - 1, imgSize - 1); bounds.X += imgSize + spacing; base.Render(window, bounds, state); }
public void DrawWindowFrame(Gtk.Widget w, string caption, int x, int y, int width, int height) { Gdk.Drawable drawable = w.GdkWindow; Gdk.Pixmap pix = new Gdk.Pixmap(drawable, width, height, drawable.Depth); Gdk.GC gcc = new Gdk.GC(pix); gcc.Foreground = w.Style.Backgrounds [(int)Gtk.StateType.Normal]; pix.DrawRectangle(gcc, true, 0, 0, width, height); IntPtr hdc = gdk_win32_hdc_get(pix.Handle, gcc.Handle, 0); RECT r = new RECT(0, 0, width, height); SIZE size; GetThemePartSize(hTheme, hdc, WP_CAPTION, CS_ACTIVE, ref r, 1, out size); r.Bottom = size.cy; DrawThemeBackground(hTheme, hdc, WP_CAPTION, CS_ACTIVE, ref r, ref r); RECT rf = new RECT(FrameBorder, FrameBorder, width - FrameBorder * 2, size.cy); LOGFONT lf = new LOGFONT(); GetThemeSysFont(hTheme, TMT_CAPTIONFONT, ref lf); IntPtr titleFont = CreateFontIndirect(ref lf); IntPtr oldFont = SelectObject(hdc, titleFont); SetBkMode(hdc, 1 /*TRANSPARENT*/); DrawThemeText(hTheme, hdc, WP_CAPTION, CS_ACTIVE, caption, -1, DT_LEFT | DT_SINGLELINE | DT_WORD_ELLIPSIS, 0, ref rf); SelectObject(hdc, oldFont); DeleteObject(titleFont); int ny = r.Bottom; r = new RECT(0, ny, width, height); DrawThemeBackground(hTheme, hdc, WP_FRAMEBOTTOM, 0, ref r, ref r); gdk_win32_hdc_release(pix.Handle, gcc.Handle, 0); Gdk.Pixbuf img = Gdk.Pixbuf.FromDrawable(pix, pix.Colormap, 0, 0, 0, 0, width, height); drawable.DrawPixbuf(new Gdk.GC(drawable), img, 0, 0, x, y, width, height, Gdk.RgbDither.None, 0, 0); drawable.DrawRectangle(w.Style.BackgroundGC(Gtk.StateType.Normal), true, x + FrameBorder, y + size.cy, width - FrameBorder * 2, height - FrameBorder - size.cy); }
protected override void Render(Gdk.Drawable window, Widget widget, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gdk.Rectangle expose_area, CellRendererState flags) { base.Render(window, widget, background_area, cell_area, expose_area, flags); int xPos = cell_area.X; if (this.Pixbuf != null) { window.DrawPixbuf(widget.Style.MidGC(StateType.Normal), this.Pixbuf, 0, 0, xPos + 1, cell_area.Y + 1, 16, 16, Gdk.RgbDither.Normal, 0, 0); xPos += 20; } using (var layout = new Pango.Layout(widget.PangoContext)) { layout.Alignment = Pango.Alignment.Left; layout.SetText(this.Text ?? ""); StateType state = flags.HasFlag(CellRendererState.Selected) ? widget.IsFocus ? StateType.Selected : StateType.Active : StateType.Normal; window.DrawLayout(widget.Style.TextGC(state), xPos, cell_area.Y + 2, layout); } }
public void Draw(Gdk.Drawable d, Cairo.Context g, int width, int height, bool screenChanged) { if (!_visible) { return; } if (_w > 0 && _h > 0) { Gdk.GC gc = new Gdk.GC(d); d.DrawPixbuf(gc, _background, 0, 0, _x, _y, _w, _h, Gdk.RgbDither.None, 0, 0); int x0 = _x, x1 = _x + _w; int y0 = _y, y1 = _y + _h; g.MoveTo(x0 + 3, y0); g.LineTo(x1 - 3, y0); g.LineTo(x1, y0 + 3); g.LineTo(x1, y1 - 3); g.LineTo(x1 - 3, y1); g.LineTo(x0 + 3, y1); g.LineTo(x0, y1 - 3); g.LineTo(x0, y0 + 3); g.LineTo(x0 + 3, y0); g.ClosePath(); g.LineWidth = 6; g.Color = BorderColor; g.Stroke(); } g.Save(); DrawContents(d, g, width, height, screenChanged); g.Restore(); }
/// <summary> /// Render the cell in the window /// </summary> /// <param name="window">The owning window</param> /// <param name="widget">The widget</param> /// <param name="background_area">Background area</param> /// <param name="cell_area">The cell area</param> /// <param name="expose_area">Expose the area</param> /// <param name="flags">Render flags</param> protected override void Render(Gdk.Drawable window, Widget widget, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gdk.Rectangle expose_area, CellRendererState flags) { lastRect = new Gdk.Rectangle(cell_area.X, cell_area.Y, cell_area.Width, cell_area.Height); Gdk.GC gc = new Gdk.GC(window); window.DrawPixbuf(gc, Pixbuf, 0, 0, cell_area.X, cell_area.Y, Pixbuf.Width, Pixbuf.Height, Gdk.RgbDither.Normal, 0, 0); }
public bool DrawBackground(TextEditor editor, Gdk.Drawable win, TextViewMargin.LayoutWrapper layout2, int selectionStart, int selectionEnd, int startOffset, int endOffset, int y, int startXPos, int endXPos, ref bool drawBg) { if (!IsVisible || DebuggingService.IsDebugging) { return(true); } EnsureLayoutCreated(editor); int x = editor.TextViewMargin.XOffset; int right = editor.Allocation.Width; int errorCounterWidth = 0; bool isCaretInLine = startOffset <= editor.Caret.Offset && editor.Caret.Offset <= endOffset; int ew = 0, eh = 0; if (errors.Count > 1 && errorCountLayout != null) { errorCountLayout.GetPixelSize(out ew, out eh); errorCounterWidth = ew + 10; } int x2 = System.Math.Max(right - LayoutWidth - border - (ShowIconsInBubble ? errorPixbuf.Width : 0) - errorCounterWidth, fitsInSameLine ? editor.TextViewMargin.XOffset + editor.LineHeight / 2 : editor.TextViewMargin.XOffset); bool isEolSelected = editor.IsSomethingSelected && editor.SelectionMode != SelectionMode.Block ? editor.SelectionRange.Contains(lineSegment.Offset + lineSegment.EditableLength) : false; int active = editor.Document.GetTextAt(lineSegment) == initialText ? 0 : 1; int highlighted = active == 0 && isCaretInLine ? 1 : 0; int selected = 0; int topSize = editor.LineHeight / 2; int bottomSize = editor.LineHeight / 2 + editor.LineHeight % 2; using (var g = Gdk.CairoHelper.Create(win)) { g.LineWidth = Math.Max(1.0, editor.Options.Zoom); if (!fitsInSameLine) { if (isEolSelected) { x -= (int)editor.HAdjustment.Value; editor.TextViewMargin.DrawRectangleWithRuler(win, x, new Gdk.Rectangle(x, y + editor.LineHeight, editor.TextViewMargin.TextStartPosition, editor.LineHeight), editor.ColorStyle.Default.BackgroundColor, true); editor.TextViewMargin.DrawRectangleWithRuler(win, x + editor.TextViewMargin.TextStartPosition, new Gdk.Rectangle(x + editor.TextViewMargin.TextStartPosition, y + editor.LineHeight, editor.Allocation.Width + (int)editor.HAdjustment.Value, editor.LineHeight), editor.ColorStyle.Selection.BackgroundColor, true); x += (int)editor.HAdjustment.Value; } else { editor.TextViewMargin.DrawRectangleWithRuler(win, x, new Gdk.Rectangle(x, y + editor.LineHeight, x2, editor.LineHeight), editor.ColorStyle.Default.BackgroundColor, true); } } DrawRectangle(g, x, y, right, topSize); g.Color = colorMatrix[active, TOP, LIGHT, highlighted, selected]; g.Fill(); DrawRectangle(g, x, y + topSize, right, bottomSize); g.Color = colorMatrix[active, BOTTOM, LIGHT, highlighted, selected]; g.Fill(); g.MoveTo(new Cairo.PointD(x, y + 0.5)); g.LineTo(new Cairo.PointD(x + right, y + 0.5)); g.Color = colorMatrix[active, TOP, LINE, highlighted, selected]; g.Stroke(); g.MoveTo(new Cairo.PointD(x, y + editor.LineHeight - 0.5)); g.LineTo(new Cairo.PointD((fitsInSameLine ? x + right : x2 + 1), y + editor.LineHeight - 0.5)); g.Color = colorMatrix[active, BOTTOM, LINE, highlighted, selected]; g.Stroke(); if (editor.Options.ShowRuler) { int divider = Math.Max(editor.TextViewMargin.XOffset, x + editor.TextViewMargin.RulerX); g.MoveTo(new Cairo.PointD(divider + 0.5, y)); g.LineTo(new Cairo.PointD(divider + 0.5, y + editor.LineHeight)); g.Color = colorMatrix[active, BOTTOM, LINE, highlighted, selected]; g.Stroke(); } // draw background if (layout2.StartSet || selectionStart == endOffset) { int startX; int endX; if (selectionStart != endOffset) { var start = layout2.Layout.IndexToPos((int)layout2.SelectionStartIndex); startX = (int)(start.X / Pango.Scale.PangoScale); var end = layout2.Layout.IndexToPos((int)layout2.SelectionEndIndex); endX = (int)(end.X / Pango.Scale.PangoScale); } else { startX = x2; endX = startX; } if (editor.MainSelection.SelectionMode == SelectionMode.Block && startX == endX) { endX = startX + 2; } startX += startXPos; endX += startXPos; startX = Math.Max(editor.TextViewMargin.XOffset, startX); // clip region to textviewmargin start if (isEolSelected) { endX = editor.Allocation.Width + (int)editor.HAdjustment.Value; } if (startX < endX) { DrawRectangle(g, startX, y, endX - startX, topSize); g.Color = colorMatrix[active, TOP, LIGHT, highlighted, 1]; g.Fill(); DrawRectangle(g, startX, y + topSize, endX - startX, bottomSize); g.Color = colorMatrix[active, BOTTOM, LIGHT, highlighted, 1]; g.Fill(); g.MoveTo(new Cairo.PointD(startX, y + 0.5)); g.LineTo(new Cairo.PointD(endX, y + 0.5)); g.Color = colorMatrix[active, TOP, LINE, highlighted, 1]; g.Stroke(); if (startX < x2) { g.MoveTo(new Cairo.PointD(startX, y + editor.LineHeight - 0.5)); g.LineTo(new Cairo.PointD(System.Math.Min(endX, x2 + 1), y + editor.LineHeight - 0.5)); g.Color = colorMatrix[active, BOTTOM, LINE, highlighted, 1]; g.Stroke(); if (x2 + 1 < endX) { g.MoveTo(new Cairo.PointD(x2 + 1, y + editor.LineHeight - 0.5)); g.LineTo(new Cairo.PointD(endX, y + editor.LineHeight - 0.5)); g.Color = colorMatrix[active, BOTTOM, LIGHT, highlighted, 1]; g.Stroke(); } } if (editor.Options.ShowRuler) { int divider = Math.Max(editor.TextViewMargin.XOffset, x + editor.TextViewMargin.RulerX); g.MoveTo(new Cairo.PointD(divider + 0.5, y)); g.LineTo(new Cairo.PointD(divider + 0.5, y + editor.LineHeight)); g.Color = colorMatrix[active, BOTTOM, LINE, highlighted, 1]; g.Stroke(); } } } if (!fitsInSameLine) { y += editor.LineHeight; } double y2 = y + 0.5; double y2Bottom = y2 + editor.LineHeight - 1; selected = isEolSelected && (CollapseExtendedErrors || errors.Count == 1) ? 1 : 0; // draw message text background if (CollapseExtendedErrors || errors.Count == 1) { if (!fitsInSameLine) { // draw box below line g.MoveTo(new Cairo.PointD(x2 + 0.5, y2 - 1)); g.LineTo(new Cairo.PointD(x2 + 0.5, y2Bottom)); g.LineTo(new Cairo.PointD(right, y2Bottom)); g.LineTo(new Cairo.PointD(right, y2 - 1)); g.ClosePath(); g.Color = colorMatrix[active, BOTTOM, LIGHT, highlighted, selected]; g.Fill(); g.MoveTo(new Cairo.PointD(x2 + 0.5, y2 - 1)); g.LineTo(new Cairo.PointD(x2 + 0.5, y2Bottom)); g.LineTo(new Cairo.PointD(right, y2Bottom)); g.Color = colorMatrix[active, BOTTOM, LINE, highlighted, selected]; g.Stroke(); } else { // draw 'arrow marker' in the same line g.MoveTo(new Cairo.PointD(x2 + 0.5, y2)); double mid = y2 + topSize; g.LineTo(new Cairo.PointD(x2 - editor.LineHeight / 2 + 0.5, mid)); g.LineTo(new Cairo.PointD(right, mid)); g.LineTo(new Cairo.PointD(right, y2)); g.ClosePath(); g.Color = colorMatrix[active, TOP, DARK, highlighted, selected]; g.Fill(); g.MoveTo(new Cairo.PointD(x2 + 0.5, y2Bottom)); g.LineTo(new Cairo.PointD(x2 - editor.LineHeight / 2 + 0.5, mid)); g.LineTo(new Cairo.PointD(right, mid)); g.LineTo(new Cairo.PointD(right, y2Bottom)); g.ClosePath(); g.Color = colorMatrix[active, BOTTOM, DARK, highlighted, selected]; g.Fill(); // draw border g.MoveTo(new Cairo.PointD(x2 + 0.5, y2)); g.LineTo(new Cairo.PointD(x2 - editor.LineHeight / 2 + 0.5, y2 + editor.LineHeight / 2)); g.LineTo(new Cairo.PointD(x2 + 0.5, y2Bottom)); g.LineTo(new Cairo.PointD(right, y2Bottom)); g.LineTo(new Cairo.PointD(right, y2)); g.ClosePath(); g.Color = colorMatrix[active, BOTTOM, LINE, highlighted, selected]; g.Stroke(); } } else { if (!fitsInSameLine) { // draw box below line g.MoveTo(new Cairo.PointD(x2 + 0.5, y2 - 1)); g.LineTo(new Cairo.PointD(x2 + 0.5, y2Bottom)); g.LineTo(new Cairo.PointD(right, y2Bottom)); g.LineTo(new Cairo.PointD(right, y2 - 1)); g.ClosePath(); } else { // draw filled arrow box g.MoveTo(new Cairo.PointD(x2 + 0.5, y2)); g.LineTo(new Cairo.PointD(x2 - editor.LineHeight / 2 + 0.5, y2 + editor.LineHeight / 2)); g.LineTo(new Cairo.PointD(x2 + 0.5, y2Bottom)); g.LineTo(new Cairo.PointD(right, y2Bottom)); g.LineTo(new Cairo.PointD(right, y2)); g.ClosePath(); } g.Color = colorMatrix[active, BOTTOM, LIGHT, highlighted, selected]; g.Fill(); // draw light bottom line g.MoveTo(new Cairo.PointD(right, y2Bottom)); g.LineTo(new Cairo.PointD(x2 + 0.5, y2Bottom)); g.Stroke(); // stroke left line if (fitsInSameLine) { g.MoveTo(new Cairo.PointD(x2 + 0.5, y2)); g.LineTo(new Cairo.PointD(x2 - editor.LineHeight / 2 + 0.5, y2 + editor.LineHeight / 2)); g.LineTo(new Cairo.PointD(x2 + 0.5, y2Bottom)); } else { g.MoveTo(new Cairo.PointD(x2 + 0.5, y2 - 1)); g.LineTo(new Cairo.PointD(x2 + 0.5, y2Bottom + 1)); } g.Color = colorMatrix[active, BOTTOM, LINE, highlighted, selected]; g.Stroke(); // stroke top line if (fitsInSameLine) { g.Color = colorMatrix[active, BOTTOM, LINE, highlighted, selected]; g.MoveTo(new Cairo.PointD(right, y2)); g.LineTo(new Cairo.PointD(x2 + 0.5, y2)); g.Stroke(); } } if (editor.Options.ShowRuler) { int divider = Math.Max(editor.TextViewMargin.XOffset, x + editor.TextViewMargin.RulerX); if (divider >= x2) { g.MoveTo(new Cairo.PointD(divider + 0.5, y2)); g.LineTo(new Cairo.PointD(divider + 0.5, y2Bottom)); g.Color = colorMatrix[active, BOTTOM, DARK, highlighted, selected]; g.Stroke(); } } if (errors.Count > 1 && errorCountLayout != null) { int rX = x2 + (ShowIconsInBubble ? errorPixbuf.Width : 0) + border + LayoutWidth; int rY = y + editor.LineHeight / 6; int rW = errorCounterWidth - 2; int rH = editor.LineHeight * 3 / 4; BookmarkMarker.DrawRoundRectangle(g, rX, rY, 8, rW, rH); g.Color = oldIsOver ? new Cairo.Color(0.3, 0.3, 0.3) : new Cairo.Color(0.5, 0.5, 0.5); g.Fill(); if (CollapseExtendedErrors) { win.DrawLayout(gcLight, x2 + (ShowIconsInBubble ? errorPixbuf.Width : 0) + border + LayoutWidth + 4, y + (editor.LineHeight - eh) / 2 + eh % 2, errorCountLayout); } else { g.MoveTo(rX + rW / 2 - rW / 4, rY + rH - rH / 4); g.LineTo(rX + rW / 2 + rW / 4, rY + rH - rH / 4); g.LineTo(rX + rW / 2, rY + rH / 4); g.ClosePath(); g.Color = new Cairo.Color(1, 1, 1); g.Fill(); } } for (int i = 0; i < layouts.Count; i++) { LayoutDescriptor layout = layouts[i]; x2 = right - layout.Width - border - errorPixbuf.Width; if (i == 0) { x2 -= errorCounterWidth; } x2 = System.Math.Max(x2, fitsInSameLine ? editor.TextViewMargin.XOffset + editor.LineHeight / 2 : editor.TextViewMargin.XOffset); if (i > 0) { editor.TextViewMargin.DrawRectangleWithRuler(win, x, new Gdk.Rectangle(x, y, right, editor.LineHeight), isEolSelected ? editor.ColorStyle.Selection.BackgroundColor : editor.ColorStyle.Default.BackgroundColor, true); g.MoveTo(new Cairo.PointD(x2 + 0.5, y)); g.LineTo(new Cairo.PointD(x2 + 0.5, y + editor.LineHeight)); g.LineTo(new Cairo.PointD(right, y + editor.LineHeight)); g.LineTo(new Cairo.PointD(right, y)); g.ClosePath(); if (CollapseExtendedErrors) { Cairo.Gradient pat = new Cairo.LinearGradient(x2, y, x2, y + editor.LineHeight); pat.AddColorStop(0, colorMatrix[active, TOP, LIGHT, highlighted, selected]); pat.AddColorStop(1, colorMatrix[active, BOTTOM, LIGHT, highlighted, selected]); g.Pattern = pat; } else { g.Color = colorMatrix[active, TOP, LIGHT, highlighted, selected]; } g.Fill(); if (editor.Options.ShowRuler) { int divider = Math.Max(editor.TextViewMargin.XOffset, x + editor.TextViewMargin.RulerX); if (divider >= x2) { g.MoveTo(new Cairo.PointD(divider + 0.5, y)); g.LineTo(new Cairo.PointD(divider + 0.5, y + editor.LineHeight)); g.Color = colorMatrix[active, BOTTOM, DARK, highlighted, selected]; g.Stroke(); } } } int lw, lh; layout.Layout.GetPixelSize(out lw, out lh); win.DrawLayout(selected == 0 ? gc : gcSelected, x2 + errorPixbuf.Width + border, y + (editor.LineHeight - layout.Height) / 2 + layout.Height % 2, layout.Layout); if (ShowIconsInBubble) { win.DrawPixbuf(editor.Style.BaseGC(Gtk.StateType.Normal), errors[i].IsError ? errorPixbuf : warningPixbuf, 0, 0, x2, y + (editor.LineHeight - errorPixbuf.Height) / 2, errorPixbuf.Width, errorPixbuf.Height, Gdk.RgbDither.None, 0, 0); } y += editor.LineHeight; if (!UseVirtualLines) { break; } } } return(true); }
public static void RenderProfile(Gdk.Drawable d, int x, int y, Character c) { Gdk.GC gc = new Gdk.GC(d); d.DrawPixbuf(gc, c.Profile, 0, 0, x, y, c.Profile.Width, c.Profile.Height, Gdk.RgbDither.None, 0, 0); }
public void Draw(TextEditor editor, Gdk.Drawable win, int lineNr, Gdk.Rectangle lineArea) { EnsureLayoutCreated(editor); int lineNumber = editor.Document.OffsetToLineNumber(lineSegment.Offset); int errorNumber = lineNr - lineNumber; int x = editor.TextViewMargin.XOffset; int y = lineArea.Y; int right = editor.Allocation.Width; int errorCounterWidth = 0; int ew = 0, eh = 0; if (errors.Count > 1 && errorCountLayout != null) { errorCountLayout.GetPixelSize(out ew, out eh); errorCounterWidth = ew + 10; } int x2 = System.Math.Max(right - LayoutWidth - border - (ShowIconsInBubble ? errorPixbuf.Width : 0) - errorCounterWidth, fitsInSameLine ? editor.TextViewMargin.XOffset + editor.LineHeight / 2 : editor.TextViewMargin.XOffset); // bool isEolSelected = editor.IsSomethingSelected && editor.SelectionMode != SelectionMode.Block ? editor.SelectionRange.Contains (lineSegment.Offset + lineSegment.EditableLength) : false; int active = editor.Document.GetTextAt(lineSegment) == initialText ? 0 : 1; bool isCaretInLine = lineSegment.Offset <= editor.Caret.Offset && editor.Caret.Offset <= lineSegment.EndOffset; int highlighted = active == 0 && isCaretInLine ? 1 : 0; int selected = 0; LayoutDescriptor layout = layouts[errorNumber]; x2 = right - LayoutWidth - border - (ShowIconsInBubble ? errorPixbuf.Width : 0); x2 -= errorCounterWidth; x2 = System.Math.Max(x2, fitsInSameLine ? editor.TextViewMargin.XOffset + editor.LineHeight / 2 : editor.TextViewMargin.XOffset); using (var g = Gdk.CairoHelper.Create(win)) { g.LineWidth = Math.Max(1.0, editor.Options.Zoom); g.MoveTo(new Cairo.PointD(x2 + 0.5, y)); g.LineTo(new Cairo.PointD(x2 + 0.5, y + editor.LineHeight)); g.LineTo(new Cairo.PointD(right, y + editor.LineHeight)); g.LineTo(new Cairo.PointD(right, y)); g.ClosePath(); g.Color = colorMatrix[active, BOTTOM, LIGHT, highlighted, selected]; g.Fill(); g.Color = colorMatrix[active, BOTTOM, LINE, highlighted, selected]; g.MoveTo(new Cairo.PointD(x2 + 0.5, y)); g.LineTo(new Cairo.PointD(x2 + 0.5, y + editor.LineHeight)); if (errorNumber == errors.Count - 1) { g.LineTo(new Cairo.PointD(lineArea.Right, y + editor.LineHeight)); } g.Stroke(); if (editor.Options.ShowRuler) { int divider = Math.Max(editor.TextViewMargin.XOffset, x + editor.TextViewMargin.RulerX); if (divider >= x2) { g.MoveTo(new Cairo.PointD(divider + 0.5, y)); g.LineTo(new Cairo.PointD(divider + 0.5, y + editor.LineHeight)); g.Color = colorMatrix[active, BOTTOM, DARK, highlighted, selected]; g.Stroke(); } } } win.DrawLayout(selected == 0 ? gc : gcSelected, x2 + (ShowIconsInBubble ? errorPixbuf.Width : 0) + border, y + (editor.LineHeight - layout.Height) / 2 + layout.Height % 2, layout.Layout); if (ShowIconsInBubble) { win.DrawPixbuf(editor.Style.BaseGC(Gtk.StateType.Normal), errors[errorNumber].IsError ? errorPixbuf : warningPixbuf, 0, 0, x2, y + (editor.LineHeight - errorPixbuf.Height) / 2, errorPixbuf.Width, errorPixbuf.Height, Gdk.RgbDither.None, 0, 0); } }
protected override void DrawContents(Gdk.Drawable d) { Gdk.GC gc = new Gdk.GC(d); Cairo.Context g = Gdk.CairoHelper.Create(d); g.SelectFontFace("Lucida Console", FontSlant.Normal, FontWeight.Bold); g.SetFontSize(24); TextExtents te; string lvl, hp, hpm, mp, mpm; string weapon, armor, acc; #region Character Status d.DrawPixbuf(gc, Graphics.GetProfile(Selected.Name), 0, 0, X + xpic, Y + ypic, Graphics.PROFILE_WIDTH, Graphics.PROFILE_HEIGHT, Gdk.RgbDither.None, 0, 0); g.Color = new Color(.3, .8, .8); g.MoveTo(X + x3, Y + y + ya); g.ShowText("LV"); g.MoveTo(X + x3, Y + y + yb); g.ShowText("HP"); g.MoveTo(X + x3, Y + y + yc); g.ShowText("MP"); g.Color = new Color(1, 1, 1); Graphics.ShadowedText(g, Selected.Name, X + x3, Y + y); lvl = Selected.Level.ToString(); hp = Selected.HP.ToString() + "/"; hpm = Selected.MaxHP.ToString(); mp = Selected.MP.ToString() + "/"; mpm = Selected.MaxMP.ToString(); te = g.TextExtents(lvl); Graphics.ShadowedText(g, lvl, X + x4 - te.Width, Y + y + ya); te = g.TextExtents(hp); Graphics.ShadowedText(g, hp, X + x5 - te.Width, Y + y + yb); te = g.TextExtents(hpm); Graphics.ShadowedText(g, hpm, X + x6 - te.Width, Y + y + yb); te = g.TextExtents(mp); Graphics.ShadowedText(g, mp, X + x5 - te.Width, Y + y + yc); te = g.TextExtents(mpm); Graphics.ShadowedText(g, mpm, X + x6 - te.Width, Y + y + yc); #endregion Status #region Equipment g.Color = new Color(.3, .8, .8); g.MoveTo(X + x7, Y + yi); g.ShowText("Wpn."); g.MoveTo(X + x7, Y + yj); g.ShowText("Arm."); g.MoveTo(X + x7, Y + yk); g.ShowText("Acc."); g.Color = new Color(1, 1, 1); weapon = Selected.Weapon.Name; armor = Selected.Armor.Name; acc = Selected.Accessory.Name; te = g.TextExtents(weapon); Graphics.ShadowedText(g, weapon, X + x8, Y + yi); te = g.TextExtents(armor); Graphics.ShadowedText(g, armor, X + x8, Y + yj); te = g.TextExtents(acc); Graphics.ShadowedText(g, acc, X + x8, Y + yk); #endregion Equipment if (IsControl) { Graphics.RenderCursor(g, X + cx, Y + cy - 10); } ((IDisposable)g.Target).Dispose(); ((IDisposable)g).Dispose(); }
public override void DrawEditor(IBitmapView view) { if (view.Image == null || view.Image.Width == 0 || view.Image.Height == 0) { return; } Gdk.Drawable target = ((FloatPixmapViewWidget)view).GdkWindow; Gdk.Rectangle image_position = ((FloatPixmapViewWidget)view).CurrentImagePosition; CrotateStageOperationParameters pm = ((CrotateStageOperationParameters)Parameters); Gdk.GC gc = new Gdk.GC(target); // Draw center square dot Point C = new Point(pm.Center.X, pm.Center.Y); int scr_c_x = image_position.X + (int)(image_position.Width * C.X); int scr_c_y = image_position.Y + (int)(image_position.Height * C.Y); // Calculating new picture's real dimensions int trueWidth = image_position.Width, trueHeight = image_position.Height; double w1, h1; w1 = pm.CropWidth * image_position.Width; h1 = pm.CropHeight * image_position.Height; double asp_rat; if (pm.AspectRatioCustom) { asp_rat = pm.AspectRatio; } else { asp_rat = pm.PresetAspectRatioValues[pm.AspectRatioPreset]; } switch (pm.Mode) { case CatEye.Core.CrotateStageOperation.Mode.Disproportional: trueWidth = (int)w1; trueHeight = (int)h1; break; case CatEye.Core.CrotateStageOperation.Mode.ProportionalWidthFixed: trueWidth = (int)w1; trueHeight = (int)(w1 / asp_rat); break; case CatEye.Core.CrotateStageOperation.Mode.ProportionalHeightFixed: trueWidth = (int)(h1 * asp_rat); trueHeight = (int)h1; break; } // Calculating new corners positions and "round" dot position double ang = pm.Angle / 180 * Math.PI; CatEye.Core.Point lt_corner = new CatEye.Core.Point( -trueWidth / 2, -trueHeight / 2); lt_corner_rot = CatEye.Core.Point.Rotate(lt_corner, ang, new Point(0, 0)); Gdk.Point scr_lt = new Gdk.Point( (int)(scr_c_x + lt_corner_rot.X), (int)(scr_c_y + lt_corner_rot.Y)); CatEye.Core.Point rt_corner = new CatEye.Core.Point( +trueWidth / 2, -trueHeight / 2); rt_corner_rot = CatEye.Core.Point.Rotate(rt_corner, ang, new Point(0, 0)); Gdk.Point scr_rt = new Gdk.Point( (int)(scr_c_x + rt_corner_rot.X), (int)(scr_c_y + rt_corner_rot.Y)); CatEye.Core.Point rb_corner = new CatEye.Core.Point( +trueWidth / 2, +trueHeight / 2); rb_corner_rot = CatEye.Core.Point.Rotate(rb_corner, ang, new Point(0, 0)); Gdk.Point scr_rb = new Gdk.Point( (int)(scr_c_x + rb_corner_rot.X), (int)(scr_c_y + rb_corner_rot.Y)); CatEye.Core.Point lb_corner = new CatEye.Core.Point( -trueWidth / 2, +trueHeight / 2); lb_corner_rot = CatEye.Core.Point.Rotate(lb_corner, ang, new Point(0, 0)); Gdk.Point scr_lb = new Gdk.Point( (int)(scr_c_x + lb_corner_rot.X), (int)(scr_c_y + lb_corner_rot.Y)); Gdk.Point scr_rnd = new Gdk.Point( (int)(scr_c_x + (rt_corner_rot.X + rb_corner_rot.X) / 2), (int)(scr_c_y + (rt_corner_rot.Y + rb_corner_rot.Y) / 2)); // Drawing frame using (Cairo.Context cc = Gdk.CairoHelper.Create(target)) { cc.LineCap = Cairo.LineCap.Round; cc.LineJoin = Cairo.LineJoin.Round; cc.Color = new Cairo.Color(0, 0, 0, 0.5); cc.LineWidth = 3; cc.MoveTo(scr_lt.X, scr_lt.Y); cc.LineTo(scr_lb.X, scr_lb.Y); cc.LineTo(scr_rb.X, scr_rb.Y); cc.LineTo(scr_rt.X, scr_rt.Y); cc.LineTo(scr_lt.X, scr_lt.Y); cc.ClosePath(); cc.Stroke(); cc.Color = new Cairo.Color(1, 1, 1, 1); cc.LineWidth = 1; cc.SetDash(new double[] { 3, 3 }, 0); cc.MoveTo(scr_lt.X, scr_lt.Y); cc.LineTo(scr_lb.X, scr_lb.Y); cc.LineTo(scr_rb.X, scr_rb.Y); cc.LineTo(scr_rt.X, scr_rt.Y); cc.LineTo(scr_lt.X, scr_lt.Y); cc.ClosePath(); cc.Stroke(); } // Drawing center "triangle" dot. using (Gdk.Pixbuf buf = Gdk.Pixbuf.LoadFromResource("CatEye.UI.Gtk.Widgets.res.triangle_dot.png")) { target.DrawPixbuf(gc, buf, 0, 0, (int)(scr_c_x - buf.Width / 2), (int)(scr_c_y - buf.Height / 2), buf.Width, buf.Height, Gdk.RgbDither.None, 0, 0); } // Drawing side "round" dot. using (Gdk.Pixbuf buf = Gdk.Pixbuf.LoadFromResource("CatEye.UI.Gtk.Widgets.res.round_dot.png")) { target.DrawPixbuf(gc, buf, 0, 0, (int)(scr_rnd.X - buf.Width / 2), (int)(scr_rnd.Y - buf.Height / 2), buf.Width, buf.Height, Gdk.RgbDither.None, 0, 0); } // Drawing corner "square" dot. using (Gdk.Pixbuf buf = Gdk.Pixbuf.LoadFromResource("CatEye.UI.Gtk.Widgets.res.square_dot.png")) { target.DrawPixbuf(gc, buf, 0, 0, (int)(scr_rb.X - buf.Width / 2), (int)(scr_rb.Y - buf.Height / 2), buf.Width, buf.Height, Gdk.RgbDither.None, 0, 0); } }
protected override void DrawContents(Gdk.Drawable d) { Gdk.GC gc = new Gdk.GC(d); Cairo.Context g = Gdk.CairoHelper.Create(d); g.SelectFontFace("Lucida Console", FontSlant.Normal, FontWeight.Bold); g.SetFontSize(24); TextExtents te; string lvl, hp, hpm, mp, mpm; #region Character 1 if (Globals.Party[0] != null) { d.DrawPixbuf(gc, Graphics.GetProfile(Globals.Party[0].Name), 0, 0, X + x1, Y + yp, Graphics.PROFILE_WIDTH, Graphics.PROFILE_HEIGHT, Gdk.RgbDither.None, 0, 0); g.Color = new Color(.3, .8, .8); g.MoveTo(X + x3, Y + y0 + ya); g.ShowText("LV"); g.MoveTo(X + x3, Y + y0 + yb); g.ShowText("HP"); g.MoveTo(X + x3, Y + y0 + yc); g.ShowText("MP"); g.Color = new Color(1, 1, 1); if (Globals.Party[0].Fury) { Graphics.ShadowedText(g, new Color(.7, 0, .7), "[Fury]", X + x7, Y + y0); } else if (Globals.Party[0].Sadness) { Graphics.ShadowedText(g, new Color(.7, 0, .7), "[Sadness]", X + x7, Y + y0); } Color namec = new Color(1, 1, 1); if (Globals.Party[0].Death) { namec = new Color(0.8, 0, 0); } else if (Globals.Party[0].NearDeath) { namec = new Color(.8, .8, 0); } Graphics.ShadowedText(g, namec, Globals.Party[0].Name, X + x3, Y + y0); lvl = Globals.Party[0].Level.ToString(); hp = Globals.Party[0].HP.ToString() + "/"; hpm = Globals.Party[0].MaxHP.ToString(); mp = Globals.Party[0].MP.ToString() + "/"; mpm = Globals.Party[0].MaxMP.ToString(); te = g.TextExtents(lvl); Graphics.ShadowedText(g, lvl, X + x4 - te.Width, Y + y0 + ya); te = g.TextExtents(hp); Graphics.ShadowedText(g, hp, X + x5 - te.Width, Y + y0 + yb); te = g.TextExtents(hpm); Graphics.ShadowedText(g, hpm, X + x6 - te.Width, Y + y0 + yb); te = g.TextExtents(mp); Graphics.ShadowedText(g, mp, X + x5 - te.Width, Y + y0 + yc); te = g.TextExtents(mpm); Graphics.ShadowedText(g, mpm, X + x6 - te.Width, Y + y0 + yc); } #endregion Character 1 #region Character 2 if (Globals.Party[1] != null) { d.DrawPixbuf(gc, Graphics.GetProfile(Globals.Party[1].Name), 0, 0, X + x1, Y + yp + (y1 - y0), Graphics.PROFILE_WIDTH, Graphics.PROFILE_HEIGHT, Gdk.RgbDither.None, 0, 0); g.Color = new Color(.3, .8, .8); g.MoveTo(X + x3, Y + y1 + ya); g.ShowText("LV"); g.MoveTo(X + x3, Y + y1 + yb); g.ShowText("HP"); g.MoveTo(X + x3, Y + y1 + yc); g.ShowText("MP"); g.Color = new Color(1, 1, 1); if (Globals.Party[1].Fury) { Graphics.ShadowedText(g, new Color(.7, 0, .7), "[Fury]", X + x7, Y + y1); } else if (Globals.Party[1].Sadness) { Graphics.ShadowedText(g, new Color(.7, 0, .7), "[Sadness]", X + x7, Y + y1); } Color namec = new Color(1, 1, 1); if (Globals.Party[1].Death) { namec = new Color(0.8, 0, 0); } else if (Globals.Party[1].NearDeath) { namec = new Color(.8, .8, 0); } Graphics.ShadowedText(g, namec, Globals.Party[1].Name, X + x3, Y + y1); lvl = Globals.Party[1].Level.ToString(); hp = Globals.Party[1].HP.ToString() + "/"; hpm = Globals.Party[1].MaxHP.ToString(); mp = Globals.Party[1].MP.ToString() + "/"; mpm = Globals.Party[1].MaxMP.ToString(); te = g.TextExtents(lvl); Graphics.ShadowedText(g, lvl, X + x4 - te.Width, Y + y1 + ya); te = g.TextExtents(hp); Graphics.ShadowedText(g, hp, X + x5 - te.Width, Y + y1 + yb); te = g.TextExtents(hpm); Graphics.ShadowedText(g, hpm, X + x6 - te.Width, Y + y1 + yb); te = g.TextExtents(mp); Graphics.ShadowedText(g, mp, X + x5 - te.Width, Y + y1 + yc); te = g.TextExtents(mpm); Graphics.ShadowedText(g, mpm, X + x6 - te.Width, Y + y1 + yc); } #endregion Character 2 #region Character 3 if (Globals.Party[2] != null) { d.DrawPixbuf(gc, Graphics.GetProfile(Globals.Party[2].Name), 0, 0, X + x1, Y + yp + (y2 - y0), Graphics.PROFILE_WIDTH, Graphics.PROFILE_HEIGHT, Gdk.RgbDither.None, 0, 0); g.Color = new Color(.3, .8, .8); g.MoveTo(X + x3, Y + y2 + ya); g.ShowText("LV"); g.MoveTo(X + x3, Y + y2 + yb); g.ShowText("HP"); g.MoveTo(X + x3, Y + y2 + yc); g.ShowText("MP"); g.Color = new Color(1, 1, 1); if (Globals.Party[2].Fury) { Graphics.ShadowedText(g, new Color(.7, 0, .7), "[Fury]", X + x7, Y + y2); } else if (Globals.Party[2].Sadness) { Graphics.ShadowedText(g, new Color(.7, 0, .7), "[Sadness]", X + x7, Y + y2); } Color namec = new Color(1, 1, 1); if (Globals.Party[2].Death) { namec = new Color(0.8, 0, 0); } else if (Globals.Party[2].NearDeath) { namec = new Color(.8, .8, 0); } Graphics.ShadowedText(g, namec, Globals.Party[2].Name, X + x3, Y + y2); lvl = Globals.Party[2].Level.ToString(); hp = Globals.Party[2].HP.ToString() + "/"; hpm = Globals.Party[2].MaxHP.ToString(); mp = Globals.Party[2].MP.ToString() + "/"; mpm = Globals.Party[2].MaxMP.ToString(); te = g.TextExtents(lvl); Graphics.ShadowedText(g, lvl, X + x4 - te.Width, Y + y2 + ya); te = g.TextExtents(hp); Graphics.ShadowedText(g, hp, X + x5 - te.Width, Y + y2 + yb); te = g.TextExtents(hpm); Graphics.ShadowedText(g, hpm, X + x6 - te.Width, Y + y2 + yb); te = g.TextExtents(mp); Graphics.ShadowedText(g, mp, X + x5 - te.Width, Y + y2 + yc); te = g.TextExtents(mpm); Graphics.ShadowedText(g, mpm, X + x6 - te.Width, Y + y2 + yc); } #endregion Character 3 if (IsControl) { Graphics.RenderCursor(g, X + cx, Y + cy); } ((IDisposable)g.Target).Dispose(); ((IDisposable)g).Dispose(); }
protected override void DrawContents(Gdk.Drawable d) { Gdk.GC gc = new Gdk.GC(d); Cairo.Context g = Gdk.CairoHelper.Create(d); g.SelectFontFace("Lucida Console", FontSlant.Normal, FontWeight.Bold); g.SetFontSize(24); TextExtents te; Cairo.Color greenish = new Color(.3, .8, .8); Cairo.Color gray = new Color(.4, .4, .4); Cairo.Color white = new Color(1, 1, 1); string lvl, hp, hpm, mp, mpm, s; #region Character Status d.DrawPixbuf(gc, Graphics.GetProfile(Selected.Name), 0, 0, X + xpic, Y + ypic, Graphics.PROFILE_WIDTH, Graphics.PROFILE_HEIGHT, Gdk.RgbDither.None, 0, 0); g.Color = new Color(.3, .8, .8); g.MoveTo(X + x3, Y + ya); g.ShowText("LV"); g.MoveTo(X + x3, Y + yb); g.ShowText("HP"); g.MoveTo(X + x3, Y + yc); g.ShowText("MP"); g.Color = new Color(1, 1, 1); Graphics.ShadowedText(g, Selected.Name, X + x3, Y + y); lvl = Selected.Level.ToString(); hp = Selected.HP.ToString() + "/"; hpm = Selected.MaxHP.ToString(); mp = Selected.MP.ToString() + "/"; mpm = Selected.MaxMP.ToString(); te = g.TextExtents(lvl); Graphics.ShadowedText(g, lvl, X + x4 - te.Width, Y + ya); te = g.TextExtents(hp); Graphics.ShadowedText(g, hp, X + x5 - te.Width, Y + yb); te = g.TextExtents(hpm); Graphics.ShadowedText(g, hpm, X + x6 - te.Width, Y + yb); te = g.TextExtents(mp); Graphics.ShadowedText(g, mp, X + x5 - te.Width, Y + yc); te = g.TextExtents(mpm); Graphics.ShadowedText(g, mpm, X + x6 - te.Width, Y + yc); #endregion Status Graphics.ShadowedText(g, greenish, "Attack", X + x0, Y + ym); Graphics.ShadowedText(g, greenish, "Halve", X + x0, Y + yn); Graphics.ShadowedText(g, greenish, "Void", X + x0, Y + yo); Graphics.ShadowedText(g, greenish, "Absorb", X + x0, Y + yp); g.SetFontSize(16); double x = (double)x1; double r = (double)(ym + ys); foreach (Element e in Enum.GetValues(typeof(Element))) { if (x > W - stop) { x = x1; r = r + ys; } s = e.ToString() + " "; te = g.TextExtents(s); if (Selected.Halves(e)) { Graphics.ShadowedText(g, white, e.ToString(), X + x, Y + r); } else { Graphics.ShadowedText(g, gray, e.ToString(), X + x, Y + r); } x += te.XAdvance; } x = (double)x1; r = (double)(yn + ys); foreach (Element e in Enum.GetValues(typeof(Element))) { if (x > W - stop) { x = x1; r = r + ys; } s = e.ToString() + " "; te = g.TextExtents(s); if (Selected.Halves(e)) { Graphics.ShadowedText(g, white, e.ToString(), X + x, Y + r); } else { Graphics.ShadowedText(g, gray, e.ToString(), X + x, Y + r); } x += te.XAdvance; } x = (double)x1; r = (double)(yo + ys); foreach (Element e in Enum.GetValues(typeof(Element))) { if (x > W - stop) { x = x1; r = r + ys; } s = e.ToString() + " "; te = g.TextExtents(s); if (Selected.Voids(e)) { Graphics.ShadowedText(g, white, e.ToString(), X + x, Y + r); } else { Graphics.ShadowedText(g, gray, e.ToString(), X + x, Y + r); } x += te.XAdvance; } x = (double)x1; r = (double)(yp + ys); foreach (Element e in Enum.GetValues(typeof(Element))) { if (x > W - stop) { x = x1; r = r + ys; } s = e.ToString() + " "; te = g.TextExtents(s); if (Selected.Absorbs(e)) { Graphics.ShadowedText(g, white, e.ToString(), X + x, Y + r); } else { Graphics.ShadowedText(g, gray, e.ToString(), X + x, Y + r); } x += te.XAdvance; } ((IDisposable)g.Target).Dispose(); ((IDisposable)g).Dispose(); }
protected override void DrawContents(Gdk.Drawable d) { Gdk.GC gc = new Gdk.GC(d); Cairo.Context g = Gdk.CairoHelper.Create(d); g.SelectFontFace("Lucida Console", FontSlant.Normal, FontWeight.Bold); g.SetFontSize(24); TextExtents te; string lvl, hp, hpm, mp, mpm; string weapon, armor; #region Slots g.Color = new Color(.1, .1, .2); g.Rectangle(x9, yi, 8 * xs, yj - yi); g.Fill(); g.Rectangle(x9, yk, 8 * xs, yl - yk); g.Fill(); Cairo.Color gray1 = new Color(.2, .2, .2); Cairo.Color gray2 = new Color(.7, .7, .8); int links, slots; slots = Selected.Weapon.Slots.Length; links = Selected.Weapon.Links; for (int j = 0; j < links; j++) { Graphics.RenderLine(g, gray2, 3, X + x9 + (xs / 2) + (j * 2 * xs), Y + yi - ys - zs, X + x9 + (xs / 2) + ((j * 2 + 1) * xs), Y + yi - ys - zs); Graphics.RenderLine(g, gray2, 3, X + x9 + (xs / 2) + (j * 2 * xs), Y + yi - ys, X + x9 + (xs / 2) + ((j * 2 + 1) * xs), Y + yi - ys); Graphics.RenderLine(g, gray2, 3, X + x9 + (xs / 2) + (j * 2 * xs), Y + yi - ys + zs, X + x9 + (xs / 2) + ((j * 2 + 1) * xs), Y + yi - ys + zs); } for (int i = 0; i < slots; i++) { Graphics.RenderCircle(g, gray2, 14, X + x9 + (i * xs) + (xs / 2), Y + yi - ys); if (Selected.Weapon.Slots[i] == null) { Graphics.RenderCircle(g, gray1, 10, X + x9 + (i * xs) + (xs / 2), Y + yi - ys); } else { Graphics.RenderCircle(g, Selected.Weapon.Slots[i].Color, 10, X + x9 + (i * xs) + (xs / 2), Y + yi - ys); } } slots = Selected.Armor.Slots.Length; links = Selected.Armor.Links; for (int j = 0; j < links; j++) { Graphics.RenderLine(g, gray2, 3, X + x9 + (xs / 2) + (j * 2 * xs), Y + yk - ys - zs, X + x9 + (xs / 2) + ((j * 2 + 1) * xs), Y + yk - ys - zs); Graphics.RenderLine(g, gray2, 3, X + x9 + (xs / 2) + (j * 2 * xs), Y + yk - ys, X + x9 + (xs / 2) + ((j * 2 + 1) * xs), Y + yk - ys); Graphics.RenderLine(g, gray2, 3, X + x9 + (xs / 2) + (j * 2 * xs), Y + yk - ys + zs, X + x9 + (xs / 2) + ((j * 2 + 1) * xs), Y + yk - ys + zs); } for (int i = 0; i < slots; i++) { Graphics.RenderCircle(g, gray2, 14, X + x9 + (i * xs) + (xs / 2), Y + yk - ys); if (Selected.Armor.Slots[i] == null) { Graphics.RenderCircle(g, gray1, 10, X + x9 + (i * xs) + (xs / 2), Y + yk - ys); } else { Graphics.RenderCircle(g, Selected.Armor.Slots[i].Color, 10, X + x9 + (i * xs) + (xs / 2), Y + yk - ys); } } #endregion #region Character Status d.DrawPixbuf(gc, Graphics.GetProfile(Selected.Name), 0, 0, X + xpic, Y + ypic, Graphics.PROFILE_WIDTH, Graphics.PROFILE_HEIGHT, Gdk.RgbDither.None, 0, 0); g.Color = new Color(.3, .8, .8); g.MoveTo(X + x3, Y + y + ya); g.ShowText("LV"); g.MoveTo(X + x3, Y + y + yb); g.ShowText("HP"); g.MoveTo(X + x3, Y + y + yc); g.ShowText("MP"); g.Color = new Color(1, 1, 1); Graphics.ShadowedText(g, Selected.Name, X + x3, Y + y); lvl = Selected.Level.ToString(); hp = Selected.HP.ToString() + "/"; hpm = Selected.MaxHP.ToString(); mp = Selected.MP.ToString() + "/"; mpm = Selected.MaxMP.ToString(); te = g.TextExtents(lvl); Graphics.ShadowedText(g, lvl, X + x4 - te.Width, Y + y + ya); te = g.TextExtents(hp); Graphics.ShadowedText(g, hp, X + x5 - te.Width, Y + y + yb); te = g.TextExtents(hpm); Graphics.ShadowedText(g, hpm, X + x6 - te.Width, Y + y + yb); te = g.TextExtents(mp); Graphics.ShadowedText(g, mp, X + x5 - te.Width, Y + y + yc); te = g.TextExtents(mpm); Graphics.ShadowedText(g, mpm, X + x6 - te.Width, Y + y + yc); #endregion Status #region Equipment g.Color = new Color(.3, .8, .8); g.MoveTo(X + x7, Y + yh); g.ShowText("Wpn."); g.MoveTo(X + x7, Y + yj); g.ShowText("Arm."); g.Color = new Color(1, 1, 1); Graphics.ShadowedText(g, "Check", x7a, yja); Graphics.ShadowedText(g, "Arr.", x7a, yla); weapon = Selected.Weapon.Name; armor = Selected.Armor.Name; te = g.TextExtents(weapon); Graphics.ShadowedText(g, weapon, X + x8, Y + yh); te = g.TextExtents(armor); Graphics.ShadowedText(g, armor, X + x8, Y + yj); #endregion if (IsControl) { Graphics.RenderCursor(g, X + cx, Y + cy - ys); } ((IDisposable)g.Target).Dispose(); ((IDisposable)g).Dispose(); }
protected override void DrawContents(Gdk.Drawable d) { Gdk.GC gc = new Gdk.GC(d); Cairo.Context g = Gdk.CairoHelper.Create(d); g.SelectFontFace("Lucida Console", FontSlant.Normal, FontWeight.Bold); g.SetFontSize(24); TextExtents te; string lvl, hp, hpm, mp, mpm, exp, next, llvl; #region Top Row d.DrawPixbuf(gc, Graphics.GetProfile(Selected.Name), 0, 0, X + xpic, Y + ypic, Graphics.PROFILE_WIDTH, Graphics.PROFILE_HEIGHT, Gdk.RgbDither.None, 0, 0); g.Color = new Color(.3, .8, .8); g.MoveTo(X + x3, Y + ya); g.ShowText("LV"); g.MoveTo(X + x3, Y + yb); g.ShowText("HP"); g.MoveTo(X + x3, Y + yc); g.ShowText("MP"); g.Color = new Color(1, 1, 1); Graphics.ShadowedText(g, Selected.Name, X + x3, Y + y); lvl = Selected.Level.ToString(); hp = Selected.HP.ToString() + "/"; hpm = Selected.MaxHP.ToString(); mp = Selected.MP.ToString() + "/"; mpm = Selected.MaxMP.ToString(); exp = Selected.Exp.ToString(); next = Selected.ToNextLevel.ToString(); llvl = Selected.LimitLevel.ToString(); te = g.TextExtents(lvl); Graphics.ShadowedText(g, lvl, X + x4 - te.Width, Y + ya); te = g.TextExtents(hp); Graphics.ShadowedText(g, hp, X + x5 - te.Width, Y + yb); te = g.TextExtents(hpm); Graphics.ShadowedText(g, hpm, X + x6 - te.Width, Y + yb); te = g.TextExtents(mp); Graphics.ShadowedText(g, mp, X + x5 - te.Width, Y + yc); te = g.TextExtents(mpm); Graphics.ShadowedText(g, mpm, X + x6 - te.Width, Y + yc); Graphics.ShadowedText(g, "Exp:", X + x8, Y + ya); Graphics.ShadowedText(g, "Next lvl:", X + x8, Y + yb); Graphics.ShadowedText(g, "Limit lvl:", X + x8, Y + yc); te = g.TextExtents(exp); Graphics.ShadowedText(g, exp, X + x12 - te.Width, Y + ya); te = g.TextExtents(next); Graphics.ShadowedText(g, next, X + x12 - te.Width, Y + yb); te = g.TextExtents(llvl); Graphics.ShadowedText(g, llvl, X + x11 - te.Width, Y + yc); #endregion Top #region Left string str, vit, dex, mag, spi, lck; string atk, atkp, def, defp, mat, mdf, mdfp; str = Selected.Strength.ToString(); vit = Selected.Vitality.ToString(); dex = Selected.Dexterity.ToString(); mag = Selected.Magic.ToString(); spi = Selected.Spirit.ToString(); lck = Selected.Luck.ToString(); atk = Ally.Attack(Selected).ToString(); atkp = Ally.AttackPercent(Selected).ToString(); def = Ally.Defense(Selected).ToString(); defp = Ally.DefensePercent(Selected).ToString(); mat = Ally.MagicAttack(Selected).ToString(); mdf = Ally.MagicDefense(Selected).ToString(); mdfp = Ally.MagicDefensePercent(Selected).ToString(); Cairo.Color greenish = new Color(.3, .8, .8); Graphics.ShadowedText(g, greenish, "Strength", X + x0, Y + yq + (line * 0)); Graphics.ShadowedText(g, greenish, "Vitality", X + x0, Y + yq + (line * 1)); Graphics.ShadowedText(g, greenish, "Dexterity", X + x0, Y + yq + (line * 2)); Graphics.ShadowedText(g, greenish, "Magic", X + x0, Y + yq + (line * 3)); Graphics.ShadowedText(g, greenish, "Spirit", X + x0, Y + yq + (line * 4)); Graphics.ShadowedText(g, greenish, "Luck", X + x0, Y + yq + (line * 5)); Graphics.ShadowedText(g, greenish, "Attack", X + x0, Y + yr + (line * 0)); Graphics.ShadowedText(g, greenish, "Attack %", X + x0, Y + yr + (line * 1)); Graphics.ShadowedText(g, greenish, "Defense", X + x0, Y + yr + (line * 2)); Graphics.ShadowedText(g, greenish, "Defense %", X + x0, Y + yr + (line * 3)); Graphics.ShadowedText(g, greenish, "Magic", X + x0, Y + yr + (line * 4)); Graphics.ShadowedText(g, greenish, "Magic def", X + x0, Y + yr + (line * 5)); Graphics.ShadowedText(g, greenish, "Magic def %", X + x0, Y + yr + (line * 6)); te = g.TextExtents(str); Graphics.ShadowedText(g, str, X + x1 - te.Width, Y + yq + (line * 0)); te = g.TextExtents(vit); Graphics.ShadowedText(g, vit, X + x1 - te.Width, Y + yq + (line * 1)); te = g.TextExtents(dex); Graphics.ShadowedText(g, dex, X + x1 - te.Width, Y + yq + (line * 2)); te = g.TextExtents(mag); Graphics.ShadowedText(g, mag, X + x1 - te.Width, Y + yq + (line * 3)); te = g.TextExtents(spi); Graphics.ShadowedText(g, spi, X + x1 - te.Width, Y + yq + (line * 4)); te = g.TextExtents(lck); Graphics.ShadowedText(g, lck, X + x1 - te.Width, Y + yq + (line * 5)); te = g.TextExtents(atk); Graphics.ShadowedText(g, atk, X + x1 - te.Width, Y + yr + (line * 0)); te = g.TextExtents(atkp); Graphics.ShadowedText(g, atkp, X + x1 - te.Width, Y + yr + (line * 1)); te = g.TextExtents(def); Graphics.ShadowedText(g, def, X + x1 - te.Width, Y + yr + (line * 2)); te = g.TextExtents(defp); Graphics.ShadowedText(g, defp, X + x1 - te.Width, Y + yr + (line * 3)); te = g.TextExtents(mat); Graphics.ShadowedText(g, mat, X + x1 - te.Width, Y + yr + (line * 4)); te = g.TextExtents(mdf); Graphics.ShadowedText(g, mdf, X + x1 - te.Width, Y + yr + (line * 5)); te = g.TextExtents(mdfp); Graphics.ShadowedText(g, mdfp, X + x1 - te.Width, Y + yr + (line * 6)); #endregion Left #region Right g.Color = new Color(.1, .1, .2); g.Rectangle(x9, yi, 8 * xs, yj - yi); g.Fill(); g.Rectangle(x9, yk, 8 * xs, yl - yk); g.Fill(); Cairo.Color gray1 = new Color(.2, .2, .2); Cairo.Color gray2 = new Color(.7, .7, .8); int links, slots; slots = Selected.Weapon.Slots.Length; links = Selected.Weapon.Links; for (int j = 0; j < links; j++) { Graphics.RenderLine(g, gray2, 3, X + x9 + (xs / 2) + (j * 2 * xs), Y + yi - ys - zs, X + x9 + (xs / 2) + ((j * 2 + 1) * xs), Y + yi - ys - zs); Graphics.RenderLine(g, gray2, 3, X + x9 + (xs / 2) + (j * 2 * xs), Y + yi - ys, X + x9 + (xs / 2) + ((j * 2 + 1) * xs), Y + yi - ys); Graphics.RenderLine(g, gray2, 3, X + x9 + (xs / 2) + (j * 2 * xs), Y + yi - ys + zs, X + x9 + (xs / 2) + ((j * 2 + 1) * xs), Y + yi - ys + zs); } for (int i = 0; i < slots; i++) { Graphics.RenderCircle(g, gray2, 14, X + x9 + (i * xs) + (xs / 2), Y + yi - ys); if (Selected.Weapon.Slots[i] == null) { Graphics.RenderCircle(g, gray1, 10, X + x9 + (i * xs) + (xs / 2), Y + yi - ys); } else { Graphics.RenderCircle(g, Selected.Weapon.Slots[i].Color, 10, X + x9 + (i * xs) + (xs / 2), Y + yi - ys); } } slots = Selected.Armor.Slots.Length; links = Selected.Armor.Links; for (int j = 0; j < links; j++) { Graphics.RenderLine(g, gray2, 3, X + x9 + (xs / 2) + (j * 2 * xs), Y + yk - ys - zs, X + x9 + (xs / 2) + ((j * 2 + 1) * xs), Y + yk - ys - zs); Graphics.RenderLine(g, gray2, 3, X + x9 + (xs / 2) + (j * 2 * xs), Y + yk - ys, X + x9 + (xs / 2) + ((j * 2 + 1) * xs), Y + yk - ys); Graphics.RenderLine(g, gray2, 3, X + x9 + (xs / 2) + (j * 2 * xs), Y + yk - ys + zs, X + x9 + (xs / 2) + ((j * 2 + 1) * xs), Y + yk - ys + zs); } for (int i = 0; i < slots; i++) { Graphics.RenderCircle(g, gray2, 14, X + x9 + (i * xs) + (xs / 2), Y + yk - ys); if (Selected.Armor.Slots[i] == null) { Graphics.RenderCircle(g, gray1, 10, X + x9 + (i * xs) + (xs / 2), Y + yk - ys); } else { Graphics.RenderCircle(g, Selected.Armor.Slots[i].Color, 10, X + x9 + (i * xs) + (xs / 2), Y + yk - ys); } } g.Color = new Color(.3, .8, .8); g.MoveTo(X + x7, Y + yh); g.ShowText("Wpn."); g.MoveTo(X + x7, Y + yj); g.ShowText("Arm."); g.MoveTo(X + x7, Y + yl); g.ShowText("Acc."); g.Color = new Color(1, 1, 1); Graphics.ShadowedText(g, Selected.Weapon.Name, X + x8, Y + yh); Graphics.ShadowedText(g, Selected.Armor.Name, X + x8, Y + yj); Graphics.ShadowedText(g, Selected.Accessory.Name, X + x8, Y + yl); #endregion Right ((IDisposable)g.Target).Dispose(); ((IDisposable)g).Dispose(); }