Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLluis Sanchez <lluis@xamarin.com>2013-09-17 11:34:06 +0400
committerLluis Sanchez <lluis@xamarin.com>2013-09-17 11:34:06 +0400
commit5aa4640453e52c2c6a305331d81db9a8811dbbc2 (patch)
tree6928d78c04e688a31142f00d41103cdc84bf8278 /main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage
parent6c3fa1115e63cf6dafd7027b0cf5368e1a54f1a7 (diff)
[Ide] Make rendering of welcome page icons retina aware
Diffstat (limited to 'main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage')
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/WelcomePageListButton.cs36
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/WelcomePageRecentProjectsList.cs14
2 files changed, 24 insertions, 26 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/WelcomePageListButton.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/WelcomePageListButton.cs
index 3a1fdbf0ef..599110cda0 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/WelcomePageListButton.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/WelcomePageListButton.cs
@@ -35,16 +35,16 @@ namespace MonoDevelop.Ide.WelcomePage
{
private static Gdk.Cursor hand_cursor = new Gdk.Cursor(Gdk.CursorType.Hand1);
string title, subtitle, actionUrl;
- Gdk.Pixbuf icon;
+ Xwt.Drawing.Image icon;
bool mouseOver;
bool pinned;
Gdk.Rectangle starRect;
bool mouseOverStar;
- static Gdk.Pixbuf starNormal;
- static Gdk.Pixbuf starNormalHover;
- static Gdk.Pixbuf starPinned;
- static Gdk.Pixbuf starPinnedHover;
+ static readonly Xwt.Drawing.Image starNormal;
+ static readonly Xwt.Drawing.Image starNormalHover;
+ static readonly Xwt.Drawing.Image starPinned;
+ static readonly Xwt.Drawing.Image starPinnedHover;
public event EventHandler PinClicked;
@@ -58,13 +58,13 @@ namespace MonoDevelop.Ide.WelcomePage
static WelcomePageListButton ()
{
- starNormal = Gdk.Pixbuf.LoadFromResource ("star-normal.png");
- starNormalHover = Gdk.Pixbuf.LoadFromResource ("star-normal-hover.png");
- starPinned = Gdk.Pixbuf.LoadFromResource ("star-pinned.png");
- starPinnedHover = Gdk.Pixbuf.LoadFromResource ("star-pinned-hover.png");
+ starNormal = Xwt.Drawing.Image.FromResource ("star-normal.png");
+ starNormalHover = Xwt.Drawing.Image.FromResource ("star-normal-hover.png");
+ starPinned = Xwt.Drawing.Image.FromResource ("star-pinned.png");
+ starPinnedHover = Xwt.Drawing.Image.FromResource ("star-pinned-hover.png");
}
- public WelcomePageListButton (string title, string subtitle, Gdk.Pixbuf icon, string actionUrl)
+ public WelcomePageListButton (string title, string subtitle, Xwt.Drawing.Image icon, string actionUrl)
{
VisibleWindow = false;
this.title = title;
@@ -174,12 +174,11 @@ namespace MonoDevelop.Ide.WelcomePage
// Draw the icon
int x = Allocation.X + InternalPadding;
- int y = Allocation.Y + (Allocation.Height - icon.Height) / 2;
- Gdk.CairoHelper.SetSourcePixbuf (ctx, icon, x, y);
- ctx.Paint ();
+ int y = Allocation.Y + (Allocation.Height - (int)icon.Height) / 2;
+ ctx.DrawImage (this, icon, x, y);
if (AllowPinning && (mouseOver || pinned)) {
- Gdk.Pixbuf star;
+ Xwt.Drawing.Image star;
if (pinned) {
if (mouseOverStar)
star = starPinnedHover;
@@ -191,11 +190,10 @@ namespace MonoDevelop.Ide.WelcomePage
else
star = starNormal;
}
- x = x + icon.Width - star.Width + 3;
- y = y + icon.Height - star.Height + 3;
- Gdk.CairoHelper.SetSourcePixbuf (ctx, star, x, y);
- ctx.Paint ();
- starRect = new Gdk.Rectangle (x, y, star.Width, star.Height);
+ x = x + (int)icon.Width - (int)star.Width + 3;
+ y = y + (int)icon.Height - (int)star.Height + 3;
+ ctx.DrawImage (this, star, x, y);
+ starRect = new Gdk.Rectangle (x, y, (int)star.Width, (int)star.Height);
}
// Draw the text
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/WelcomePageRecentProjectsList.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/WelcomePageRecentProjectsList.cs
index e16036de62..290aeae847 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/WelcomePageRecentProjectsList.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/WelcomePageRecentProjectsList.cs
@@ -37,16 +37,16 @@ namespace MonoDevelop.Ide.WelcomePage
public class WelcomePageRecentProjectsList : WelcomePageSection
{
bool destroyed;
- EventHandler recentChangesHandler;
- VBox box;
+ readonly EventHandler recentChangesHandler;
+ readonly VBox box;
int itemCount = 10;
- Gdk.Pixbuf openProjectIcon;
- Gdk.Pixbuf newProjectIcon;
+ readonly Xwt.Drawing.Image openProjectIcon;
+ readonly Xwt.Drawing.Image newProjectIcon;
public WelcomePageRecentProjectsList (string title = null, int count = 10): base (title)
{
- openProjectIcon = Gdk.Pixbuf.LoadFromResource ("open_solution.png");
- newProjectIcon = Gdk.Pixbuf.LoadFromResource ("new_solution.png");
+ openProjectIcon = Xwt.Drawing.Image.FromResource ("open_solution.png");
+ newProjectIcon = Xwt.Drawing.Image.FromResource ("new_solution.png");
box = new VBox ();
@@ -99,7 +99,7 @@ namespace MonoDevelop.Ide.WelcomePage
foreach (var recent in DesktopService.RecentFiles.GetProjects ().Take (itemCount)) {
var filename = recent.FileName;
var accessed = recent.TimeStamp;
- var pixbuf = ImageService.GetPixbuf (GetIcon (filename), IconSize.Dnd);
+ var pixbuf = ImageService.GetIcon (GetIcon (filename), IconSize.Dnd);
var button = new WelcomePageListButton (recent.DisplayName, System.IO.Path.GetDirectoryName (filename), pixbuf, "project://" + filename);
button.BorderPadding = 2;
button.AllowPinning = true;