1 // CommonAboutDialog.cs
3 // This file was derived from a file from #Develop.
5 // Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com>
7 // This program is free software; you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation; either version 2 of the License, or
10 // (at your option) any later version.
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 using MonoDevelop
.Core
.Gui
;
25 using MonoDevelop
.Core
;
26 using MonoDevelop
.Ide
.Gui
;
33 namespace MonoDevelop
.Ide
.Gui
.Dialogs
35 internal class ScrollBox
: DrawingArea
41 int monoLogoSpacing
= 30;
46 internal uint TimerHandle
;
48 string[] authors
= new string[]
55 "Andrés G. Aragoneses",
56 "Andre Filipe de Assuncao e Brito",
72 "Jacob Ilsø Christensen",
76 "Jeroen Zwartepoorte",
80 "Jonathan Hernández Velasco",
83 "Marcos David Marín Amador",
84 "Martin Willemoes Hansen",
87 "Maurício de Lemos Rodrigues Collares Neto",
96 "Pedro Abelleira Seco",
110 this.SetSizeRequest (450, 220);
111 this.Realized
+= new EventHandler (OnRealized
);
112 this.ExposeEvent
+= new ExposeEventHandler (OnExposed
);
114 image
= new Gdk
.Pixbuf (GetType().Assembly
, "AboutImage.png");
115 monoPowered
= new Gdk
.Pixbuf (GetType().Assembly
, "mono-powered.png");
117 TimerHandle
= GLib
.Timeout
.Add (50, new TimeoutHandler (ScrollDown
));
122 StringBuilder sb
= new StringBuilder ();
123 sb
.Append (GettextCatalog
.GetString ("<b>Ported and developed by:</b>\n"));
125 for (int n
=0; n
<authors
.Length
; n
++) {
126 sb
.Append (authors
[n
]);
133 string trans
= GettextCatalog
.GetString ("translator-credits");
134 if (trans
!= "translator-credits")
136 sb
.Append (GettextCatalog
.GetString ("\n\n<b>Translated by:</b>\n"));
139 return sb
.ToString ();
145 if (scrollPause
> 0) {
146 if (--scrollPause
== 0)
151 this.GdkWindow
.GetSize (out w
, out h
);
152 this.QueueDrawArea (0, 0, w
, 220);
156 private void DrawImage ()
160 this.GdkWindow
.GetSize (out w
, out h
);
161 this.GdkWindow
.DrawPixbuf (this.Style
.BackgroundGC (StateType
.Normal
), image
, 0, 0, (w
- image
.Width
) / 2, 0, -1, -1, RgbDither
.Normal
, 0, 0);
165 // int GetTextHeight ()
168 // layout.GetPixelSize (out w, out h);
172 private void DrawText ()
175 this.GdkWindow
.GetSize (out w
, out h
);
177 layout
.GetPixelSize (out tw
, out maxHeight
);
179 this.GdkWindow
.DrawLayout (this.Style
.BlackGC
, 0, textTop
- scroll
, layout
);
180 this.GdkWindow
.DrawPixbuf (this.Style
.BackgroundGC (StateType
.Normal
), monoPowered
, 0, 0, (w
/2) - (monoPowered
.Width
/2), textTop
- scroll
+ maxHeight
+ monoLogoSpacing
, -1, -1, RgbDither
.Normal
, 0, 0);
182 if (scroll
== maxHeight
&& scrollPause
== 0)
184 if (scroll
> maxHeight
+ monoLogoSpacing
+ monoPowered
.Height
)
185 scroll
= scrollStart
;
188 protected void OnExposed (object o
, ExposeEventArgs args
)
191 this.GdkWindow
.GetSize (out w
, out h
);
192 this.GdkWindow
.DrawRectangle (this.Style
.WhiteGC
, true, 0, 0, w
, h
);
195 this.GdkWindow
.DrawRectangle (this.Style
.WhiteGC
, true, 0, 210, w
, 10);
198 protected void OnRealized (object o
, EventArgs args
)
202 GdkWindow
.GetOrigin (out x
, out y
);
203 GdkWindow
.GetSize (out w
, out h
);
205 textTop
= y
+ image
.Height
- 30;
206 scrollStart
= -(220 - textTop
);
207 scroll
= scrollStart
;
209 layout
= new Pango
.Layout (this.PangoContext
);
210 // FIXME: this seems wrong but works
211 layout
.Width
= w
* (int)Pango
.Scale
.PangoScale
;
212 layout
.Wrap
= Pango
.WrapMode
.Word
;
213 layout
.Alignment
= Pango
.Alignment
.Center
;
214 FontDescription fd
= FontDescription
.FromString ("Tahoma 10");
215 layout
.FontDescription
= fd
;
216 layout
.SetMarkup (CreditText
);
220 internal class CommonAboutDialog
: Dialog
223 ScrollBox aboutPictureScrollBox
;
225 public CommonAboutDialog ()
227 HasSeparator
= false;
228 this.VBox
.BorderWidth
= 0;
231 this.Title
= GettextCatalog
.GetString ("About MonoDevelop");
232 this.TransientFor
= IdeApp
.Workbench
.RootWindow
;
233 aboutPictureScrollBox
= new ScrollBox ();
235 this.VBox
.PackStart (aboutPictureScrollBox
, false, false, 0);
237 Notebook nb
= new Notebook ();
239 // nb.SetSizeRequest (440, 240);
240 this.ModifyBg (Gtk
.StateType
.Normal
, new Gdk
.Color (255, 255, 255));
241 // nb.ModifyBg (Gtk.StateType.Normal, new Gdk.Color (255, 255, 255));
242 VersionInformationTabPage vinfo
= new VersionInformationTabPage ();
244 nb
.AppendPage (new AboutMonoDevelopTabPage (), new Label (GettextCatalog
.GetString ("About MonoDevelop")));
246 nb
.AppendPage (vinfo
, new Label (GettextCatalog
.GetString ("Version Info")));
247 this.VBox
.PackStart (nb
, true, true, 0);
248 this.AddButton (Gtk
.Stock
.Close
, (int) ResponseType
.Close
);
252 public new int Run ()
254 int tmp
= base.Run ();
255 GLib
.Source
.Remove (aboutPictureScrollBox
.TimerHandle
);