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-07-10 19:05:36 +0400
committerLluis Sanchez <lluis@xamarin.com>2013-07-25 01:43:21 +0400
commit912e11580b5a04de888e4fcc8eae305eb646a6cb (patch)
treec211ed69ffd9c10a87f1dbfff17b3f5823c1223f /main/src/core/MonoDevelop.Ide
parent50c6044665d43f2359b6945d3a4fafde529f3a1b (diff)
Pixbuf -> Xwt Image
Diffstat (limited to 'main/src/core/MonoDevelop.Ide')
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockItemTitleTab.cs12
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.PropertyGrid/DefaultPropertyTab.cs4
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.PropertyGrid/PropertyGrid.cs4
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components/DropDownBox.cs13
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components/DropDownBoxListWindow.cs19
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components/ImageButton.cs22
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components/ListView.cs15
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components/PathBar.cs28
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CompletionListWindow.cs4
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ListWidget.cs9
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ListWindow.cs2
11 files changed, 67 insertions, 65 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockItemTitleTab.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockItemTitleTab.cs
index 422a4f460f..dfd5585a49 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockItemTitleTab.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockItemTitleTab.cs
@@ -56,9 +56,9 @@ namespace MonoDevelop.Components.Docking
static Gdk.Cursor fleurCursor = new Gdk.Cursor (Gdk.CursorType.Fleur);
- static Gdk.Pixbuf pixClose;
- static Gdk.Pixbuf pixAutoHide;
- static Gdk.Pixbuf pixDock;
+ static Xwt.Drawing.Image pixClose;
+ static Xwt.Drawing.Image pixAutoHide;
+ static Xwt.Drawing.Image pixDock;
const int TopPadding = 5;
const int BottomPadding = 7;
@@ -69,9 +69,9 @@ namespace MonoDevelop.Components.Docking
static DockItemTitleTab ()
{
- pixClose = Gdk.Pixbuf.LoadFromResource ("stock-close-12.png");
- pixAutoHide = Gdk.Pixbuf.LoadFromResource ("stock-auto-hide.png");
- pixDock = Gdk.Pixbuf.LoadFromResource ("stock-dock.png");
+ pixClose = Xwt.Drawing.Image.FromResource ("stock-close-12.png");
+ pixAutoHide = Xwt.Drawing.Image.FromResource ("stock-auto-hide.png");
+ pixDock = Xwt.Drawing.Image.FromResource ("stock-dock.png");
}
public DockItemTitleTab (DockItem item, DockFrame frame)
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.PropertyGrid/DefaultPropertyTab.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.PropertyGrid/DefaultPropertyTab.cs
index 55737bfa78..65151f404c 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.PropertyGrid/DefaultPropertyTab.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.PropertyGrid/DefaultPropertyTab.cs
@@ -81,12 +81,12 @@ namespace MonoDevelop.Components.PropertyGrid
return GetProperties (component, null);
}
- public Gdk.Pixbuf GetIcon ()
+ public Xwt.Drawing.Image GetIcon ()
{
using (var stream = GetType ().Assembly.GetManifestResourceStream (GetType ().FullName + ".bmp")) {
if (stream != null) {
try {
- return new Gdk.Pixbuf (stream);
+ return new Gdk.Pixbuf (stream).ToXwtImage ();
} catch (Exception e) {
LoggingService.LogError ("Can't create pixbuf from resource:" + GetType ().FullName + ".bmp", e);
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.PropertyGrid/PropertyGrid.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.PropertyGrid/PropertyGrid.cs
index 21bafe2a89..7a68f68795 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.PropertyGrid/PropertyGrid.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.PropertyGrid/PropertyGrid.cs
@@ -234,9 +234,9 @@ namespace MonoDevelop.Components.PropertyGrid
//load image from PropertyTab's bitmap
var icon = tab.GetIcon ();
if (icon != null)
- rtb.Image = new Gtk.Image (icon);
+ rtb.Image = new ImageView (icon);
else
- rtb.Image = new Gtk.Image (Stock.MissingImage, IconSize.Menu);
+ rtb.Image = new ImageView (MonoDevelop.Ide.ImageService.GetIcon (Stock.MissingImage, IconSize.Menu));
rtb.Tab = tab;
rtb.TooltipText = tab.TabName;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/DropDownBox.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/DropDownBox.cs
index 24fb69fab7..cf4467f511 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/DropDownBox.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/DropDownBox.cs
@@ -62,7 +62,7 @@ namespace MonoDevelop.Components
set;
}
- public Gdk.Pixbuf Pixbuf {
+ public Xwt.Drawing.Image Pixbuf {
get;
set;
}
@@ -122,7 +122,7 @@ namespace MonoDevelop.Components
window.GrabFocus ();
}
- public void SetItem (string text, Gdk.Pixbuf icon, object currentItem)
+ public void SetItem (string text, Xwt.Drawing.Image icon, object currentItem)
{
if (currentItem != CurrentItem) {// don't update when the same item is set.
this.Text = text;
@@ -157,8 +157,8 @@ namespace MonoDevelop.Components
layout.GetPixelSize (out width, out height);
if (Pixbuf != null) {
- width += Pixbuf.Width + pixbufSpacing * 2;
- height = System.Math.Max (height, Pixbuf.Height);
+ width += (int)Pixbuf.Width + pixbufSpacing * 2;
+ height = System.Math.Max (height, (int)Pixbuf.Height);
} else {
height = System.Math.Max (height, defaultIconHeight);
}
@@ -276,8 +276,9 @@ namespace MonoDevelop.Components
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;
+ using (var ctx = Gdk.CairoHelper.Create (win))
+ ctx.DrawImage (this, Pixbuf, xPos + pixbufSpacing, Allocation.Y + (Allocation.Height - Pixbuf.Height) / 2);
+ xPos += (int)Pixbuf.Width + pixbufSpacing * 2;
}
//constrain the text area so it doesn't get rendered under the arrows
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/DropDownBoxListWindow.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/DropDownBoxListWindow.cs
index 1306e2ce33..35cfbec32f 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/DropDownBoxListWindow.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/DropDownBoxListWindow.cs
@@ -387,9 +387,9 @@ namespace MonoDevelop.Components
string text = win.DataProvider.GetMarkup (n) ?? "&lt;null&gt;";
layout.SetMarkup (text);
- Gdk.Pixbuf icon = win.DataProvider.GetIcon (n);
- int iconHeight = icon != null ? icon.Height : 24;
- int iconWidth = icon != null ? icon.Width : 0;
+ var icon = win.DataProvider.GetIcon (n);
+ int iconHeight = icon != null ? (int)icon.Height : 24;
+ int iconWidth = icon != null ? (int)icon.Width : 0;
int wi, he, typos, iypos;
layout.GetPixelSize (out wi, out he);
@@ -427,9 +427,10 @@ namespace MonoDevelop.Components
this.GdkWindow.DrawLayout (this.Style.TextGC (StateType.Normal),
xpos + iconWidth + 2, typos, layout);
- if (icon != null)
- this.GdkWindow.DrawPixbuf (this.Style.ForegroundGC (StateType.Normal), icon, 0, 0,
- xpos, iypos, iconWidth, iconHeight, Gdk.RgbDither.None, 0, 0);
+ if (icon != null) {
+ using (var ctx = Gdk.CairoHelper.Create (this.GdkWindow))
+ ctx.DrawImage (this, icon, xpos, iypos);
+ }
ypos += rowHeight;
n++;
@@ -488,8 +489,8 @@ namespace MonoDevelop.Components
layout.SetMarkup (win.DataProvider.GetMarkup (longest) ?? "&lt;null&gt;");
int w, h;
layout.GetPixelSize (out w, out h);
- Gdk.Pixbuf icon = win.DataProvider.GetIcon (longest);
- int iconWidth = icon != null ? icon.Width : 24;
+ var icon = win.DataProvider.GetIcon (longest);
+ int iconWidth = icon != null ? (int) icon.Width : 24;
w += iconWidth + 2 + padding * 2 + margin;
return w;
}
@@ -563,7 +564,7 @@ namespace MonoDevelop.Components
}
void Reset ();
string GetMarkup (int n);
- Gdk.Pixbuf GetIcon (int n);
+ Xwt.Drawing.Image GetIcon (int n);
object GetTag (int n);
void ActivateItem (int n);
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/ImageButton.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/ImageButton.cs
index cd1dcfa137..c9e2d7d0fa 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/ImageButton.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/ImageButton.cs
@@ -30,9 +30,9 @@ namespace MonoDevelop.Components
{
public class ImageButton: Gtk.EventBox
{
- Gdk.Pixbuf image;
- Gdk.Pixbuf inactiveImage;
- Gtk.Image imageWidget;
+ Xwt.Drawing.Image image;
+ Xwt.Drawing.Image inactiveImage;
+ ImageView imageWidget;
bool hasInactiveImage;
bool hover;
bool pressed;
@@ -41,19 +41,19 @@ namespace MonoDevelop.Components
{
Events |= Gdk.EventMask.EnterNotifyMask | Gdk.EventMask.LeaveNotifyMask | Gdk.EventMask.ButtonReleaseMask;
VisibleWindow = false;
- imageWidget = new Gtk.Image ();
+ imageWidget = new ImageView ();
imageWidget.Show ();
Add (imageWidget);
}
- public Gdk.Pixbuf Image {
+ public Xwt.Drawing.Image Image {
get { return image; }
set {
image = value;
- Gdk.Pixbuf oldInactive = null;
+ Xwt.Drawing.Image oldInactive = null;
if (!hasInactiveImage) {
oldInactive = inactiveImage;
- inactiveImage = image != null ? ImageService.MakeTransparent (image, 0.5) : null;
+ inactiveImage = image != null ? image.WithAlpha (0.5) : null;
}
LoadImage ();
if (oldInactive != null)
@@ -61,7 +61,7 @@ namespace MonoDevelop.Components
}
}
- public Gdk.Pixbuf InactiveImage {
+ public Xwt.Drawing.Image InactiveImage {
get { return hasInactiveImage ? inactiveImage : null; }
set {
if (!hasInactiveImage && inactiveImage != null)
@@ -83,11 +83,11 @@ namespace MonoDevelop.Components
{
if (image != null) {
if (hover)
- imageWidget.Pixbuf = image;
+ imageWidget.Image = image;
else
- imageWidget.Pixbuf = inactiveImage;
+ imageWidget.Image = inactiveImage;
} else {
- imageWidget.Pixbuf = null;
+ imageWidget.Image = null;
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/ListView.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/ListView.cs
index 6683802a5b..7347d708c7 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/ListView.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/ListView.cs
@@ -523,9 +523,9 @@ namespace MonoDevelop.Components
bool isSelected = selectedRows.Contains (page + n);
bool hasMarkup = SetLayoutText (page + n, isSelected);
- Gdk.Pixbuf icon = dataProvider.GetIcon (page + n);
- int iconHeight = icon != null? icon.Height : IconWidth;
- int iconWidth = icon != null? icon.Width : IconWidth;
+ Xwt.Drawing.Image icon = dataProvider.GetIcon (page + n);
+ int iconHeight = icon != null? (int)icon.Height : IconWidth;
+ int iconWidth = icon != null? (int)icon.Width : IconWidth;
int wi, he, typos, iypos;
layout.GetPixelSize (out wi, out he);
@@ -556,8 +556,11 @@ namespace MonoDevelop.Components
else
window.DrawLayout (textGCNormal, xpos + iconWidth + ColumnGap, typos, layout);
- if (icon != null)
- window.DrawPixbuf (fgGCNormal, icon, 0, 0, xpos, iypos, iconWidth, iconHeight, RgbDither.None, 0, 0);
+ if (icon != null) {
+ using (var ctx = Gdk.CairoHelper.Create (window)) {
+ ctx.DrawImage (this, icon, xpos, iypos);
+ }
+ }
ypos += rowHeight;
n++;
@@ -666,6 +669,6 @@ namespace MonoDevelop.Components
string GetText (int n);
string GetSelectedText (int n);
bool UseMarkup (int n);
- Gdk.Pixbuf GetIcon (int n);
+ Xwt.Drawing.Image GetIcon (int n);
}
} \ No newline at end of file
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/PathBar.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/PathBar.cs
index edc42584e8..ea991bd40a 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/PathBar.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/PathBar.cs
@@ -43,9 +43,9 @@ namespace MonoDevelop.Components
public class PathEntry
{
- Gdk.Pixbuf darkIcon;
+ Xwt.Drawing.Image darkIcon;
- public Gdk.Pixbuf Icon {
+ public Xwt.Drawing.Image Icon {
get;
private set;
}
@@ -70,7 +70,7 @@ namespace MonoDevelop.Components
set;
}
- public PathEntry (Gdk.Pixbuf icon, string markup)
+ public PathEntry (Xwt.Drawing.Image icon, string markup)
{
this.Icon = icon;
this.Markup = markup;
@@ -100,14 +100,14 @@ namespace MonoDevelop.Components
}
}
- internal Gdk.Pixbuf DarkIcon {
+ internal Xwt.Drawing.Image DarkIcon {
get {
if (darkIcon == null && Icon != null) {
darkIcon = Icon;
- if (Styles.BreadcrumbGreyscaleIcons)
+/* if (Styles.BreadcrumbGreyscaleIcons)
darkIcon = ImageService.MakeGrayscale (darkIcon);
if (Styles.BreadcrumbInvertedIcons)
- darkIcon = ImageService.MakeInverted (darkIcon);
+ darkIcon = ImageService.MakeInverted (darkIcon);*/
}
return darkIcon;
}
@@ -264,10 +264,9 @@ namespace MonoDevelop.Components
int textOffset = 0;
if (leftPath [i].DarkIcon != null) {
- int iy = (height - leftPath [i].DarkIcon.Height) / 2 + topPadding;
- Gdk.CairoHelper.SetSourcePixbuf (ctx, leftPath [i].DarkIcon, x, iy);
- ctx.Paint ();
- textOffset += leftPath [i].DarkIcon.Width + iconSpacing;
+ int iy = (height - (int)leftPath [i].DarkIcon.Height) / 2 + topPadding;
+ ctx.DrawImage (this, leftPath [i].DarkIcon, x, iy);
+ textOffset += (int) leftPath [i].DarkIcon.Width + iconSpacing;
}
layout.Attributes = (i == activeIndex) ? boldAtts : null;
@@ -324,9 +323,8 @@ namespace MonoDevelop.Components
int textOffset = 0;
if (rightPath [i].DarkIcon != null) {
- Gdk.CairoHelper.SetSourcePixbuf (ctx, rightPath [i].DarkIcon, x, ypos);
- ctx.Paint ();
- textOffset += rightPath [i].DarkIcon.Width + padding;
+ ctx.DrawImage (this, rightPath [i].DarkIcon, x, ypos);
+ textOffset += (int) rightPath [i].DarkIcon.Width + padding;
}
layout.Attributes = (i == activeIndex) ? boldAtts : null;
@@ -625,8 +623,8 @@ namespace MonoDevelop.Components
layout.GetPixelSize (out w, out h);
textHeight = Math.Max (h, textHeight);
if (path[i].DarkIcon != null) {
- maxIconHeight = Math.Max (path[i].DarkIcon.Height, maxIconHeight);
- w += path[i].DarkIcon.Width + iconSpacing;
+ maxIconHeight = Math.Max ((int)path[i].DarkIcon.Height, maxIconHeight);
+ w += (int)path[i].DarkIcon.Width + iconSpacing;
}
result[i + index] = w;
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CompletionListWindow.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CompletionListWindow.cs
index 429c1838b5..aeb4922de7 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CompletionListWindow.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CompletionListWindow.cs
@@ -654,12 +654,12 @@ namespace MonoDevelop.Ide.CodeCompletion
return completionDataList[n].CompletionText;
}
- Gdk.Pixbuf IListDataProvider.GetIcon (int n)
+ Xwt.Drawing.Image IListDataProvider.GetIcon (int n)
{
string iconName = ((CompletionData)completionDataList[n]).Icon;
if (string.IsNullOrEmpty (iconName))
return null;
- return ImageService.GetPixbuf (iconName, IconSize.Menu);
+ return ImageService.GetIcon (iconName, IconSize.Menu);
}
#endregion
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ListWidget.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ListWidget.cs
index d2dd831b71..372dc26bb5 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ListWidget.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ListWidget.cs
@@ -514,11 +514,11 @@ namespace MonoDevelop.Ide.CodeCompletion
}
}
- Gdk.Pixbuf icon = win.DataProvider.GetIcon (item);
+ Xwt.Drawing.Image icon = win.DataProvider.GetIcon (item);
int iconHeight, iconWidth;
if (icon != null) {
- iconWidth = icon.Width;
- iconHeight = icon.Height;
+ iconWidth = (int)icon.Width;
+ iconHeight = (int)icon.Height;
} else if (!Gtk.Icon.SizeLookup (Gtk.IconSize.Menu, out iconWidth, out iconHeight)) {
iconHeight = iconWidth = 24;
}
@@ -545,8 +545,7 @@ namespace MonoDevelop.Ide.CodeCompletion
}
if (icon != null) {
- Gdk.CairoHelper.SetSourcePixbuf (context, icon, xpos, iypos);
- context.Paint ();
+ context.DrawImage (this, icon, xpos, iypos);
xpos += iconTextSpacing;
}
context.Color = textColor;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ListWindow.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ListWindow.cs
index dc5b72c8a7..7b0e93ee9a 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ListWindow.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ListWindow.cs
@@ -678,7 +678,7 @@ namespace MonoDevelop.Ide.CodeCompletion
bool HasMarkup (int n);
string GetCompletionText (int n);
string GetDescription (int n);
- Gdk.Pixbuf GetIcon (int n);
+ Xwt.Drawing.Image GetIcon (int n);
}
}