AboutDialog.cs (pinta-2.0) | : | AboutDialog.cs (pinta-2.0.1) | ||
---|---|---|---|---|
skipping to change at line 51 | skipping to change at line 51 | |||
namespace Pinta | namespace Pinta | |||
{ | { | |||
internal class ScrollBox : DrawingArea | internal class ScrollBox : DrawingArea | |||
{ | { | |||
Pixbuf image; | Pixbuf image; | |||
Pixbuf image_top; | Pixbuf image_top; | |||
Pixbuf monoPowered; | Pixbuf monoPowered; | |||
int scroll; | int scroll; | |||
Pango.Layout layout = null!; // NRT - Set by OnRealized | Pango.Layout layout = null!; // NRT - Set by OnRealized | |||
int monoLogoSpacing = 5; | ||||
int textTop; | ||||
int scrollPause; | ||||
int scrollStart; | int scrollStart; | |||
internal uint TimerHandle; | internal uint TimerHandle; | |||
string[] authors = new string[] { | string[] authors = new string[] { | |||
"Cameron White (@cameronwhite)", | "Cameron White (@cameronwhite)", | |||
"Jonathan Pobst (@jpobst)", | "Jonathan Pobst (@jpobst)", | |||
"Mykola Franchuk (@thekolian1996)", | "Mykola Franchuk (@thekolian1996)", | |||
"@darkdragon-001", | "@darkdragon-001", | |||
"@iangzh", | "@iangzh", | |||
skipping to change at line 202 | skipping to change at line 199 | |||
sb.AppendLine (); | sb.AppendLine (); | |||
sb.AppendLine (); | sb.AppendLine (); | |||
sb.AppendFormat ("<b>{0}</b>\n", Translations.Get String ("Powered by Mono:")); | sb.AppendFormat ("<b>{0}</b>\n", Translations.Get String ("Powered by Mono:")); | |||
return sb.ToString (); | return sb.ToString (); | |||
} | } | |||
} | } | |||
bool ScrollDown () | bool ScrollDown () | |||
{ | { | |||
//if (scrollPause > 0) { | --scroll; | |||
// if (--scrollPause == 0) | ||||
// ++scroll; | ||||
//} else | ||||
++scroll; | ||||
this.QueueDrawArea (0, 0, Window.FrameExtents.Width, imag e.Height); | this.QueueDrawArea (0, 0, AllocatedWidth, image.Height); | |||
return true; | return true; | |||
} | } | |||
private void DrawImage (Cairo.Context ctx) | private void DrawImage (Cairo.Context ctx) | |||
{ | { | |||
if (image != null) { | if (image != null) { | |||
Gdk.CairoHelper.SetSourcePixbuf (ctx, image, 0, 0 ); | Gdk.CairoHelper.SetSourcePixbuf (ctx, image, 0, 0 ); | |||
ctx.Paint (); | ctx.Paint (); | |||
} | } | |||
} | } | |||
skipping to change at line 230 | skipping to change at line 223 | |||
private void DrawImageTop (Cairo.Context ctx) | private void DrawImageTop (Cairo.Context ctx) | |||
{ | { | |||
if (image != null) { | if (image != null) { | |||
Gdk.CairoHelper.SetSourcePixbuf (ctx, image_top, 0, 0); | Gdk.CairoHelper.SetSourcePixbuf (ctx, image_top, 0, 0); | |||
ctx.Paint (); | ctx.Paint (); | |||
} | } | |||
} | } | |||
private void DrawText (Cairo.Context ctx) | private void DrawText (Cairo.Context ctx) | |||
{ | { | |||
int width = Window.FrameExtents.Width; | const int monoLogoSpacing = 5; | |||
int height = Window.FrameExtents.Height; | ||||
int widthPixel, heightPixel; | layout.GetPixelSize (out int text_width, out int text_hei | |||
layout.GetPixelSize (out widthPixel, out heightPixel); | ght); | |||
ctx.SetSourceColor (new Cairo.Color (1, 1, 1)); | ctx.SetSourceColor (new Cairo.Color (1, 1, 1)); | |||
ctx.MoveTo (0, textTop - scroll); | ctx.MoveTo (0, scroll); | |||
Pango.CairoHelper.ShowLayout (ctx, layout); | Pango.CairoHelper.ShowLayout (ctx, layout); | |||
Gdk.CairoHelper.SetSourcePixbuf (ctx, monoPowered, (width / 2) - (monoPowered.Width / 2), textTop - scroll + heightPixel + monoLogoSpacin g); | Gdk.CairoHelper.SetSourcePixbuf (ctx, monoPowered, (Alloc atedWidth / 2) - (monoPowered.Width / 2), scroll + text_height + monoLogoSpacing ); | |||
ctx.Paint (); | ctx.Paint (); | |||
heightPixel = heightPixel - 80 + image.Height; | var scroll_dist = scrollStart - scroll; | |||
if (scroll_dist > text_height + monoLogoSpacing + monoPow | ||||
if ((scroll == heightPixel) && (scrollPause == 0)) | ered.Height + 200) | |||
scrollPause = 60; | ||||
if (scroll > heightPixel + monoLogoSpacing + monoPowered. | ||||
Height + 200) | ||||
scroll = scrollStart; | scroll = scrollStart; | |||
} | } | |||
protected override bool OnDrawn (Cairo.Context ctx) | protected override bool OnDrawn (Cairo.Context ctx) | |||
{ | { | |||
this.DrawImage (ctx); | this.DrawImage (ctx); | |||
this.DrawText (ctx); | this.DrawText (ctx); | |||
this.DrawImageTop (ctx); | this.DrawImageTop (ctx); | |||
return false; | return false; | |||
} | } | |||
protected void OnRealized (object? o, EventArgs args) | protected void OnRealized (object? o, EventArgs args) | |||
{ | { | |||
int x, y; | scrollStart = image.Height; | |||
int w, h; | ||||
Window.GetOrigin (out x, out y); | ||||
w = Window.FrameExtents.Width; | ||||
h = Window.FrameExtents.Height; | ||||
textTop = y + image.Height - 30; | ||||
scrollStart = -(image.Height - textTop); | ||||
scroll = scrollStart; | scroll = scrollStart; | |||
layout = new Pango.Layout (this.PangoContext); | layout = new Pango.Layout (PangoContext) { | |||
// FIXME: this seems wrong but works | Width = AllocatedWidth * (int) Pango.Scale.PangoS | |||
layout.Width = w * (int) Pango.Scale.PangoScale; | cale, | |||
layout.Wrap = Pango.WrapMode.Word; | Wrap = Pango.WrapMode.Word, | |||
layout.Alignment = Pango.Alignment.Center; | Alignment = Pango.Alignment.Center | |||
}; | ||||
layout.SetMarkup (CreditText); | layout.SetMarkup (CreditText); | |||
} | } | |||
} | } | |||
internal class AboutDialog : Dialog | internal class AboutDialog : Dialog | |||
{ | { | |||
ScrollBox aboutPictureScrollBox; | ScrollBox aboutPictureScrollBox; | |||
Pixbuf imageSep; | Pixbuf imageSep; | |||
End of changes. 10 change blocks. | ||||
34 lines changed or deleted | 17 lines changed or added |