diff options
author | Cody Russell <cody@jhu.edu> | 2016-01-15 05:35:57 +0300 |
---|---|---|
committer | Cody Russell <cody@jhu.edu> | 2016-01-15 05:35:57 +0300 |
commit | d43a15c087519bd84e584c22d5fe1810d4c118ad (patch) | |
tree | 216f063c4bc67e420aeee3d1b88c82841f20edc2 | |
parent | ebd0adca1a25725a35d75feb479708e60abf2e67 (diff) |
Remove Windows-specific pixel scaleremove-pixel-scale
10 files changed, 43 insertions, 91 deletions
diff --git a/main/src/addins/AspNet/Projects/GtkAspNetProjectTemplateWizardPageWidget.cs b/main/src/addins/AspNet/Projects/GtkAspNetProjectTemplateWizardPageWidget.cs index 26eaa8c6c8..564985bbb0 100644 --- a/main/src/addins/AspNet/Projects/GtkAspNetProjectTemplateWizardPageWidget.cs +++ b/main/src/addins/AspNet/Projects/GtkAspNetProjectTemplateWizardPageWidget.cs @@ -61,12 +61,10 @@ namespace MonoDevelop.AspNet.Projects includeUnitTestProjectDescriptionLeftHandPadding.WidthRequest = leftPaddingWidth;
}
- double scale = GtkWorkarounds.GetPixelScale ();
-
backgroundImage = Xwt.Drawing.Image.FromResource ("aspnet-wizard-page.png");
backgroundImageView = new ImageView (backgroundImage);
- backgroundImageView.Xalign = (float)(1/scale);
- backgroundImageView.Yalign = (float)(1/scale);
+ backgroundImageView.Xalign = 1.0f;
+ backgroundImageView.Yalign = 1.0f;
backgroundLargeImageVBox.PackStart (backgroundImageView, true, true, 0);
var separatorColor = new Color (176, 178, 181);
@@ -77,9 +75,6 @@ namespace MonoDevelop.AspNet.Projects configurationTableEventBox.ModifyBg (StateType.Normal, backgroundColor);
configurationBottomEventBox.ModifyBg (StateType.Normal, backgroundColor);
backgroundLargeImageEventBox.ModifyBg (StateType.Normal, backgroundColor);
-
- if (Platform.IsWindows && scale > 1.0)
- ScaleWidgets (scale);
}
public GtkAspNetProjectTemplateWizardPageWidget (AspNetProjectTemplateWizardPage wizardPage)
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockNotebook/TabStrip.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockNotebook/TabStrip.cs index 72d7254f64..5a6449b95e 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockNotebook/TabStrip.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockNotebook/TabStrip.cs @@ -68,14 +68,13 @@ namespace MonoDevelop.Components.DockNotebook public Button NextButton; public MenuButton DropDownButton; - static readonly double PixelScale = GtkWorkarounds.GetPixelScale (); - static readonly int TopBarPadding = (int)(3 * PixelScale); - static readonly int BottomBarPadding = (int)(3 * PixelScale); - static readonly int LeftRightPadding = (int)(10 * PixelScale); - static readonly int TopPadding = (int)(8 * PixelScale); - static readonly int BottomPadding = (int)(8 * PixelScale); - static readonly int LeftBarPadding = (int)(58 * PixelScale); - static readonly int VerticalTextSize = (int)(11 * PixelScale); + static readonly int TopBarPadding = 3; + static readonly int BottomBarPadding = 3; + static readonly int LeftRightPadding = 10; + static readonly int TopPadding = 8; + static readonly int BottomPadding = 8; + static readonly int LeftBarPadding = 58; + static readonly int VerticalTextSize = 11; const int TabSpacing = -1; const int Radius = 2; const int LeanWidth = 18; 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 61bf7e6e9a..695cdfd8d7 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockItemTitleTab.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockItemTitleTab.cs @@ -61,8 +61,6 @@ namespace MonoDevelop.Components.Docking static Xwt.Drawing.Image pixAutoHide; static Xwt.Drawing.Image pixDock; - static double PixelScale = GtkWorkarounds.GetPixelScale (); - const int TopPadding = 5; const int BottomPadding = 7; const int TopPaddingActive = 5; @@ -135,7 +133,7 @@ namespace MonoDevelop.Components.Docking WidthRequest = r; if (visualStyle != null) - HeightRequest = visualStyle.PadTitleHeight != null ? (int)(visualStyle.PadTitleHeight.Value * PixelScale) : -1; + HeightRequest = visualStyle.PadTitleHeight != null ? (int)visualStyle.PadTitleHeight.Value : -1; } public void SetLabel (Gtk.Widget page, Xwt.Drawing.Image icon, string label) diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/MainToolbar.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/MainToolbar.cs index 711c07c15d..7f1492705d 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/MainToolbar.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/MainToolbar.cs @@ -182,12 +182,10 @@ namespace MonoDevelop.Components.MainToolbar if (toplevel == null) return; - var pixel_scale = GtkWorkarounds.GetPixelScale (); - int windowWidth = toplevel.Allocation.Width; int center = windowWidth / 2; - int left = Math.Max (center - (int)(300 * pixel_scale), args.Allocation.Left); - int right = Math.Min (left + (int)(600 * pixel_scale), args.Allocation.Right); + int left = Math.Max (center - 300, args.Allocation.Left); + int right = Math.Min (left + 600, args.Allocation.Right); uint left_padding = (uint) (left - args.Allocation.Left); uint right_padding = (uint) (args.Allocation.Right - right); @@ -230,7 +228,7 @@ namespace MonoDevelop.Components.MainToolbar align.Add (contentBox); Add (align); - SetDefaultSizes (-1, (int)(21 * GtkWorkarounds.GetPixelScale ())); + SetDefaultSizes (-1, 21); configurationCombo.Changed += (o, e) => { if (ConfigurationChanged != null) diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/GtkWorkarounds.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/GtkWorkarounds.cs index 0cc488b9c8..733da236f6 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/GtkWorkarounds.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/GtkWorkarounds.cs @@ -1225,18 +1225,6 @@ namespace MonoDevelop.Components return GetScaleFactor (Gdk.Screen.Default, 0); } - public static double GetPixelScale () - { - return 1d; - } - - public static int ConvertToPixelScale (int size) - { - double scale = GetPixelScale (); - - return (int)(size * scale); - } - public static Gdk.Pixbuf RenderIcon (this Gtk.IconSet iconset, Gtk.Style style, Gtk.TextDirection direction, Gtk.StateType state, Gtk.IconSize size, Gtk.Widget widget, string detail, double scale) { if (scale == 1d) diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/ImageView.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/ImageView.cs index 8b9bc5a851..694f8dc459 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/ImageView.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/ImageView.cs @@ -55,7 +55,7 @@ namespace MonoDevelop.Components public float Xalign { get { return xalign; } set { - xalign = (float)(value * IconScale); + xalign = (float)value; QueueDraw (); } } @@ -64,20 +64,16 @@ namespace MonoDevelop.Components public float Yalign { get { return yalign; } set { - yalign = (float)(value * IconScale); + yalign = (float)value; QueueDraw (); } } - double IconScale { - get { return GtkWorkarounds.GetPixelScale (); } - } - protected override void OnSizeRequested (ref Gtk.Requisition requisition) { if (image != null) { - requisition.Width = (int)(image.Width * IconScale); - requisition.Height = (int)(image.Height * IconScale); + requisition.Width = (int)image.Width; + requisition.Height = (int)image.Height; } } @@ -85,11 +81,10 @@ namespace MonoDevelop.Components { if (image != null) { using (var ctx = CairoHelper.Create (evnt.Window)) { - var x = Math.Round (Allocation.X + (Allocation.Width - image.Width * IconScale) * Xalign); - var y = Math.Round (Allocation.Y + (Allocation.Height - image.Height * IconScale) * Yalign); + var x = Math.Round (Allocation.X + (Allocation.Width - image.Width) * Xalign); + var y = Math.Round (Allocation.Y + (Allocation.Height - image.Height) * Yalign); ctx.Save (); - ctx.Scale (IconScale, IconScale); - ctx.DrawImage (this, image, x / IconScale, y / IconScale); + ctx.DrawImage (this, image, x, y); ctx.Restore (); } } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Styles.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Styles.cs index ef54b8b8b3..568e50cfbc 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Styles.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Styles.cs @@ -110,12 +110,10 @@ namespace MonoDevelop.Ide.Gui public static readonly Pango.FontDescription StatusFont = Pango.FontDescription.FromString ("Normal");
- public static int StatusFontPixelHeight { get { return (int)(11 * PixelScale); } } - public static int ProgressBarHeight { get { return (int)(18 * PixelScale); } } - public static int ProgressBarInnerPadding { get { return (int)(4 * PixelScale); } } - public static int ProgressBarOuterPadding { get { return (int)(4 * PixelScale); } } - - static readonly double PixelScale = GtkWorkarounds.GetPixelScale (); + public static readonly int StatusFontPixelHeight = 11; + public static readonly int ProgressBarHeight = 18; + public static readonly int ProgressBarInnerPadding = 4; + public static readonly int ProgressBarOuterPadding = 4; // Toolbar diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/GtkNewProjectDialogBackend.UI.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/GtkNewProjectDialogBackend.UI.cs index c1f28ff9ba..c129a3cdd7 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/GtkNewProjectDialogBackend.UI.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/GtkNewProjectDialogBackend.UI.cs @@ -72,8 +72,8 @@ namespace MonoDevelop.Ide.Projects void Build ()
{
BorderWidth = 0;
- WidthRequest = GtkWorkarounds.ConvertToPixelScale (901);
- HeightRequest = GtkWorkarounds.ConvertToPixelScale (632);
+ WidthRequest = 901;
+ HeightRequest = 632;
Name = "wizard_dialog";
Title = GettextCatalog.GetString ("New Project");
@@ -86,7 +86,7 @@ namespace MonoDevelop.Ide.Projects // Top banner of dialog.
var topLabelEventBox = new EventBox (); topLabelEventBox.Name = "topLabelEventBox";
- topLabelEventBox.HeightRequest = GtkWorkarounds.ConvertToPixelScale (52); + topLabelEventBox.HeightRequest = 52; topLabelEventBox.ModifyBg (StateType.Normal, bannerBackgroundColor);
topLabelEventBox.ModifyFg (StateType.Normal, whiteColor);
topLabelEventBox.BorderWidth = 0;
@@ -130,7 +130,7 @@ namespace MonoDevelop.Ide.Projects var templateCategoriesVBox = new VBox ();
templateCategoriesVBox.Name = "templateCategoriesVBox";
templateCategoriesVBox.BorderWidth = 0;
- templateCategoriesVBox.WidthRequest = GtkWorkarounds.ConvertToPixelScale (220);
+ templateCategoriesVBox.WidthRequest = 220;
var templateCategoriesScrolledWindow = new ScrolledWindow ();
templateCategoriesScrolledWindow.Name = "templateCategoriesScrolledWindow";
templateCategoriesScrolledWindow.HscrollbarPolicy = PolicyType.Never;
@@ -150,7 +150,7 @@ namespace MonoDevelop.Ide.Projects // Templates.
var templatesVBox = new VBox (); templatesVBox.Name = "templatesVBox";
- templatesVBox.WidthRequest = GtkWorkarounds.ConvertToPixelScale (400); + templatesVBox.WidthRequest = 400; templatesHBox.PackStart (templatesVBox, false, false, 0);
var templatesScrolledWindow = new ScrolledWindow ();
templatesScrolledWindow.Name = "templatesScrolledWindow";
@@ -180,21 +180,21 @@ namespace MonoDevelop.Ide.Projects // Template large image.
templateImage = new ImageView (); templateImage.Name = "templateImage";
- templateImage.HeightRequest = GtkWorkarounds.ConvertToPixelScale (140);
- templateImage.WidthRequest = GtkWorkarounds.ConvertToPixelScale (240); + templateImage.HeightRequest = 140;
+ templateImage.WidthRequest = 240; templateVBox.PackStart (templateImage, false, false, 10);
// Template description.
templateNameLabel = new Label (); templateNameLabel.Name = "templateNameLabel";
- templateNameLabel.WidthRequest = GtkWorkarounds.ConvertToPixelScale (240); + templateNameLabel.WidthRequest = 240; templateNameLabel.Wrap = true;
templateNameLabel.Xalign = 0;
templateNameLabel.Markup = MarkupTemplateName ("TemplateName");
templateVBox.PackStart (templateNameLabel, false, false, 0);
templateDescriptionLabel = new Label (); templateDescriptionLabel.Name = "templateDescriptionLabel";
- templateDescriptionLabel.WidthRequest = GtkWorkarounds.ConvertToPixelScale (240); + templateDescriptionLabel.WidthRequest = 240; templateDescriptionLabel.Wrap = true;
templateDescriptionLabel.Xalign = 0;
templateVBox.PackStart (templateDescriptionLabel, false, false, 0);
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/GtkTemplateCellRenderer.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/GtkTemplateCellRenderer.cs index 2d02ec48ae..3b083ab991 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/GtkTemplateCellRenderer.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/GtkTemplateCellRenderer.cs @@ -118,8 +118,7 @@ namespace MonoDevelop.Ide.Projects SetMarkup (layout, GetSelectedLanguage ());
layout.GetPixelSize (out textWidth, out textHeight);
- double scale = GtkWorkarounds.GetPixelScale ();
- languageRect = GetLanguageButtonRectangle (window, widget, cell_area, textHeight, textWidth, scale);
+ languageRect = GetLanguageButtonRectangle (window, widget, cell_area, textHeight, textWidth);
DrawTemplateNameText (window, widget, cell_area, iconRect, languageRect, flags);
@@ -127,7 +126,7 @@ namespace MonoDevelop.Ide.Projects SetSourceColor (ctx, LanguageButtonBackgroundColor.ToCairoColor ());
ctx.Fill ();
- int languageTextX = languageRect.X + GetLanguageLeftHandPadding (scale);
+ int languageTextX = languageRect.X + languageLeftHandPadding;
if (!TemplateHasMultipleLanguages ()) {
languageTextX = languageRect.X + (languageRect.Width - textWidth) / 2;
}
@@ -136,22 +135,14 @@ namespace MonoDevelop.Ide.Projects window.DrawLayout (widget.Style.TextGC (StateType.Normal), languageTextX, languageTextY, layout);
if (TemplateHasMultipleLanguages ()) {
- int triangleX = languageTextX + textWidth + GetLanguageRightHandPadding (scale);
- int triangleY = languageRect.Y + (languageRect.Height - ((int)(scale * dropdownTriangleHeight))) / 2;
- DrawTriangle (ctx, triangleX, triangleY, scale);
+ int triangleX = languageTextX + textWidth + languageRightHandPadding;
+ int triangleY = languageRect.Y + (languageRect.Height - dropdownTriangleHeight) / 2;
+ DrawTriangle (ctx, triangleX, triangleY);
}
}
}
}
- int GetLanguageLeftHandPadding (double scale)
- {
- if (Platform.IsWindows && scale > 1.0) {
- return (int)(scale * (languageLeftHandPadding + 3));
- }
- return languageLeftHandPadding;
- }
-
int GetLanguageRightHandPadding (double scale)
{
if (Platform.IsWindows && scale > 1.0) {
@@ -249,7 +240,7 @@ namespace MonoDevelop.Ide.Projects layout.SetMarkup (markup);
}
- Rectangle GetLanguageButtonRectangle (Drawable window, Widget widget, Rectangle cell_area, int textHeight, int textWidth, double scale)
+ Rectangle GetLanguageButtonRectangle (Drawable window, Widget widget, Rectangle cell_area, int textHeight, int textWidth)
{
int languageRectangleHeight = cell_area.Height - 8;
int languageRectangleWidth = textWidth + languageLeftHandPadding;
@@ -260,8 +251,6 @@ namespace MonoDevelop.Ide.Projects languageRectangleWidth = Math.Max (languageRectangleWidth, minLanguageRectWidth);
}
- languageRectangleWidth = (int)(scale * languageRectangleWidth);
-
var dy = (cell_area.Height - languageRectangleHeight) / 2 - 1;
var y = cell_area.Y + dy;
var x = widget.Allocation.Width - languageRectangleWidth - (int)Xpad;
@@ -274,15 +263,12 @@ namespace MonoDevelop.Ide.Projects return Template.AvailableLanguages.Count > 1;
}
- void DrawTriangle (Cairo.Context ctx, int x, int y, double scale)
+ void DrawTriangle (Cairo.Context ctx, int x, int y)
{
- int width = (int)(scale * dropdownTriangleWidth);
- int height = (int)(scale * dropdownTriangleHeight);
-
SetSourceColor (ctx, triangleColor.ToCairoColor ());
ctx.MoveTo (x, y);
- ctx.LineTo (x + width, y);
- ctx.LineTo (x + (width / 2), y + height);
+ ctx.LineTo (x + dropdownTriangleWidth, y);
+ ctx.LineTo (x + (dropdownTriangleWidth / 2), y + dropdownTriangleHeight);
ctx.LineTo (x, y);
ctx.Fill ();
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ImageService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ImageService.cs index 83c08b3d37..78b9db70e5 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ImageService.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ImageService.cs @@ -489,12 +489,7 @@ namespace MonoDevelop.Ide Gtk.IconSource source = new Gtk.IconSource (); Gtk.IconSource source2x = null; - if (Platform.IsWindows) { - var pixel_scale = GtkWorkarounds.GetPixelScale (); - source.Pixbuf = pixbuf.ScaleSimple ((int)(pixbuf.Width * pixel_scale), (int)(pixbuf.Height * pixel_scale), Gdk.InterpType.Bilinear); - } else { - source.Pixbuf = pixbuf; - } + source.Pixbuf = pixbuf; source.Size = iconSize; source.SizeWildcarded = iconSize == Gtk.IconSize.Invalid; |