Commit 40aeaaf1 authored by Ghislain MARY's avatar Ghislain MARY
Browse files

Remove useless code.

parent cd8f9044
EXPORTS
DllGetClassObject PRIVATE
DllCanUnloadNow PRIVATE
DllRegisterServer PRIVATE
DllUnregisterServer PRIVATE
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|ARM">
<Configuration>Debug</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM">
<Configuration>Release</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{bbabeea1-494c-4618-96e3-399873a5558b}</ProjectGuid>
<RootNamespace>CoreProxyStub</RootNamespace>
<DefaultLanguage>en-US</DefaultLanguage>
<VCTargetsPath Condition="'$(VCTargetsPath11)' != '' and '$(VSVersion)' == '' and '$(VisualStudioVersion)' == ''">$(VCTargetsPath11)</VCTargetsPath>
<MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion>
<TargetPlatformIdentifier>Windows Phone</TargetPlatformIdentifier>
<TargetPlatformVersion>8.0</TargetPlatformVersion>
<ProjectName>CoreProxyStub</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v110_wp80</PlatformToolset>
<IgnoreImportLibrary>false</IgnoreImportLibrary>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v110_wp80</PlatformToolset>
<IgnoreImportLibrary>false</IgnoreImportLibrary>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<PropertyGroup>
<TargetName>Linphone.$(ProjectName)</TargetName>
<OutDir>$(SolutionDir)$(PlatformTarget)\$(Configuration)\$(MSBuildProjectName)\</OutDir>
<IntDir>$(PlatformTarget)\$(Configuration)\</IntDir>
<ExtensionsToDeleteOnClean>*winmd;*.c;*.h;$(ExtensionsToDeleteOnClean)</ExtensionsToDeleteOnClean>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<PreprocessorDefinitions>WIN32_LEAN_AND_MEAN;WIN32;REGISTER_PROXY_DLL;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<CompileAsWinRT>false</CompileAsWinRT>
<AdditionalUsingDirectories>$(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
<AdditionalIncludeDirectories>$(ProjectDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<AdditionalDependencies>windowsphonecore.lib;runtimeobject.lib;rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateWindowsMetadata>false</GenerateWindowsMetadata>
<ModuleDefinitionFile>$(ProjectName).def</ModuleDefinitionFile>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
<ClCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
<ClCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Platform)'=='ARM'">
<ClCompile>
<PreprocessorDefinitions>_ARM_;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup>
<Reference Include="Windows">
<IsWinMDFile>true</IsWinMDFile>
</Reference>
<Reference Include="platform.winmd">
<IsWinMDFile>true</IsWinMDFile>
<Private>false</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<ClCompile Include="dlldata.c" />
<ClCompile Include="Linphone.Core.OutOfProcess_i.c" />
<ClCompile Include="Linphone.Core.OutOfProcess_p.c" />
<ClCompile Include="Linphone.Core_i.c" />
<ClCompile Include="Linphone.Core_p.c" />
<ClCompile Include="Mediastreamer2.WP8Video_i.c" />
<ClCompile Include="Mediastreamer2.WP8Video_p.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="Linphone.Core.h" />
<ClInclude Include="Linphone.Core.OutOfProcess.h" />
<ClInclude Include="Mediastreamer2.WP8Video.h" />
</ItemGroup>
<ItemGroup>
<None Include="CoreProxyStub.def" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsPhone\v$(TargetPlatformVersion)\Microsoft.Cpp.WindowsPhone.$(TargetPlatformVersion).targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<FullDeploy>true</FullDeploy>
</PropertyGroup>
</Project>
\ No newline at end of file
using ScreenSizeSupport.Misc;
using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
namespace ScreenSizeSupport
{
public class DisplayInformationEmulator : INotifyPropertyChanged
{
DisplayInformationEx displayInformationEx;
public DisplayInformationEx DisplayInformationEx
{
get { return displayInformationEx; }
set { displayInformationEx = value; RaisePropertyChanged(); RaiseDisplayInformationExChanged(); }
}
private ScreenInfo screenInfo;
[TypeConverter(typeof(StringToScreenInfoConverter))]
public ScreenInfo EmulatedScreenInfo
{
get { return screenInfo; }
set
{
screenInfo = value;
DisplayInformationEx = new DisplayInformationEx(screenInfo.PhysicalSize, screenInfo.PhysicalResolution);
RaisePropertyChanged();
}
}
public DisplayInformationEmulator()
{
DisplayInformationEx = DisplayInformationEx.Default;
}
void RaisePropertyChanged([CallerMemberName] string property = "")
{
var handler = PropertyChanged;
if (handler != null)
handler(this, new PropertyChangedEventArgs(property));
}
void RaiseDisplayInformationExChanged()
{
var handler = DisplayInformationExChanged;
if (handler != null)
handler(this, EventArgs.Empty);
}
public event PropertyChangedEventHandler PropertyChanged;
public event EventHandler DisplayInformationExChanged;
}
}
using Microsoft.Phone.Info;
using ScreenSizeSupport.Misc;
using System;
using System.ComponentModel;
using System.Windows;
namespace ScreenSizeSupport
{
public enum DisplayInformationSource
{
Hardware,
LegacyDefault,
DesignTimeFallback,
Custom,
}
public class DisplayInformationEx
{
private static readonly string RawDpiValueName = "RawDpiX";
private static readonly string PhysicalScreenResolutionName = "PhysicalScreenResolution";
public double PhysicalDiagonal { get; private set; }
public Size PhysicalSize { get; private set; }
public Size PhysicalResolution { get; private set; }
public Size ViewResolution { get; private set; }
public double ViewPixelsPerInch { get; private set; }
public double RawDpi { get; private set; }
public double AspectRatio { get; private set; }
public double RawPixelsPerViewPixel { get; private set; }
// Un-normalized value; avoid in most cases
public double AbsoluteScaleFactorBeforeNormalizing { get; private set; }
public double ViewPixelsPerHostPixel { get; private set; }
public double HostPixelsPerViewPixel { get; private set; }
public DisplayInformationSource InformationSource { get; private set; }
public double GetViewPixelsForPhysicalSize(double inches)
{
return inches * ViewPixelsPerInch;
}
public static DisplayInformationEx Default { get; private set; }
public DisplayInformationEx()
{
PhysicalDiagonal = Default.PhysicalDiagonal;
PhysicalSize = Default.PhysicalSize;
PhysicalResolution = Default.PhysicalResolution;
ViewResolution = Default.ViewResolution;
ViewPixelsPerInch = Default.ViewPixelsPerInch;
RawDpi = Default.RawDpi;
AspectRatio = Default.AspectRatio;
RawPixelsPerViewPixel = Default.RawPixelsPerViewPixel;
AbsoluteScaleFactorBeforeNormalizing = Default.AbsoluteScaleFactorBeforeNormalizing;
ViewPixelsPerHostPixel = Default.ViewPixelsPerHostPixel;
HostPixelsPerViewPixel = Default.HostPixelsPerViewPixel;
InformationSource = Default.InformationSource;
}
public DisplayInformationEx(Size physicalSize, Size physicalResolution) :
this(physicalSize, physicalResolution, DisplayInformationSource.Custom)
{
}
private DisplayInformationEx(Size physicalSize, Size physicalResolution, DisplayInformationSource informationSource)
{
PhysicalSize = physicalSize;
PhysicalDiagonal = PhysicalSize.GetHypotenuse();
PhysicalResolution = physicalResolution;
AspectRatio = physicalSize.Height / physicalSize.Width;
if (!(AspectRatio.IsCloseEnoughTo(physicalResolution.Height / physicalResolution.Width)))
throw new ArgumentOutOfRangeException("physicalResolution", "only square pixels supported");
RawDpi = physicalResolution.Width / physicalSize.Width;
AbsoluteScaleFactorBeforeNormalizing = PhysicalSize.Width / DisplayConstants.BaselineWidthInInches;
RawPixelsPerViewPixel = GenerateRawPixelsPerViewPixel();
ViewResolution = new Size(PhysicalResolution.Width / RawPixelsPerViewPixel, PhysicalResolution.Height / RawPixelsPerViewPixel);
ViewPixelsPerInch = RawDpi / RawPixelsPerViewPixel;
// Adjust for different aspect ratio, if necessary
ViewPixelsPerHostPixel = Math.Min(ViewResolution.Width / Application.Current.Host.Content.ActualWidth,
ViewResolution.Height / Application.Current.Host.Content.ActualHeight);
HostPixelsPerViewPixel = 1 / ViewPixelsPerHostPixel;
InformationSource = informationSource;
}
static DisplayInformationEx()
{
if (!DesignerProperties.IsInDesignTool)
{
Default = CreateForHardwareOrLegacyFallback();
return;
}
var size = SizeHelpers.MakeSizeFromDiagonal(DisplayConstants.BaselineDiagonalInInches15To9HighRes, DisplayConstants.AspectRatio15To9);
var resolution = SizeHelpers.MakeSize(SizeHelpers.WxgaPhysicalResolution.Width, DisplayConstants.AspectRatio15To9);
Default = new DisplayInformationEx(size, resolution, DisplayInformationSource.DesignTimeFallback);
}
static DisplayInformationEx CreateForHardwareOrLegacyFallback()
{
Size screenResolution;
double rawDpi;
object temp;
if (!DeviceExtendedProperties.TryGetValue(PhysicalScreenResolutionName, out temp))
return CreateForLegacyHardware();
screenResolution = (Size)temp;
if (!DeviceExtendedProperties.TryGetValue(RawDpiValueName, out temp) || (double)temp == 0d)
return CreateForLegacyHardware();
rawDpi = (double)temp;
var physicalSize = new Size(screenResolution.Width / rawDpi, screenResolution.Height / rawDpi);
return new DisplayInformationEx(physicalSize, screenResolution, DisplayInformationSource.Hardware);
}
static DisplayInformationEx CreateForLegacyHardware()
{
var scaleFactor = Application.Current.Host.Content.ScaleFactor / 100d;
var resolutionWidth = Application.Current.Host.Content.ActualWidth * scaleFactor;
var resolutionHeight = Application.Current.Host.Content.ActualHeight * scaleFactor;
var aspectRatio = resolutionHeight / resolutionWidth;
var screenResolultion = new Size(resolutionWidth, resolutionHeight);
double widthInInches;
if (aspectRatio.IsCloseEnoughTo(DisplayConstants.AspectRatio15To9))
if (scaleFactor > 1)
widthInInches = DisplayConstants.BaselineDiagonalInInches15To9HighRes * DisplayConstants.DiagonalToWidthRatio15To9;
else
widthInInches = DisplayConstants.BaselineDiagonalInInches15To9LoRes * DisplayConstants.DiagonalToWidthRatio15To9;
else
widthInInches = DisplayConstants.BaselineDiagonalInInches16To9 * DisplayConstants.DiagonalToWidthRatio16To9;
var physicalSize = new Size(widthInInches, widthInInches * aspectRatio);
return new DisplayInformationEx(physicalSize, screenResolultion, DisplayInformationSource.LegacyDefault);
}
double GenerateRawPixelsPerViewPixel()
{
// Never return less than 1
var scale = Math.Max(1, PhysicalSize.Width / DisplayConstants.BaselineWidthInInches);
// Never return more view pixels than physical pixels
var idealViewWidth = Math.Min(DisplayConstants.BaselineWidthInViewPixels * scale, PhysicalResolution.Width);
var idealScale = PhysicalResolution.Width / idealViewWidth;
var bucketizedScale = idealScale.NudgeToClosestPoint(1);
return bucketizedScale;
}
}
}
Licence
MICROSOFT LIMITED PUBLIC LICENSE version 1.1
This license governs use of code marked as “sample” or “example” available on this web site without a license agreement, as provided under the section above titled “NOTICE SPECIFIC TO SOFTWARE AVAILABLE ON THIS WEB SITE.” If you use such code (the “software”), you accept this license. If you do not accept the license, do not use the software.
1. Definitions
The terms “reproduce,” “reproduction,” “derivative works,” and “distribution” have the same meaning here as under U.S. copyright law.
A “contribution” is the original software, or any additions or changes to the software.
A “contributor” is any person that distributes its contribution under this license.
“Licensed patents” are a contributor’s patent claims that read directly on its contribution.
2. Grant of Rights
(A) Copyright Grant - Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create.
(B) Patent Grant - Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software.
3. Conditions and Limitations
(A) No Trademark License- This license does not grant you rights to use any contributors’ name, logo, or trademarks.
(B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically.
(C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software.
(D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license.
(E) The software is licensed “as-is.” You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement.
(F) Platform Limitation - The licenses granted in sections 2(A) and 2(B) extend only to the software or derivative works that you create that run directly on a Microsoft Windows operating system product, Microsoft run-time technology (such as the .NET Framework or Silverlight), or Microsoft application platform (such as Microsoft Office or Microsoft Dynamics).
\ No newline at end of file
using System;
using System.Windows.Data;
namespace ScreenSizeSupport.Misc
{
public class AspectRatioConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return (SizeHelpers.GetFriendlyAspectRatio((double)value));
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
var str = (string)value;
double aspectRatio = 0;
if (double.TryParse(str, out aspectRatio))
return aspectRatio;
// look for friendly name
return SizeHelpers.GetAspectRatioFromFriendlyName(str);
}
}
}
using System;
using System.Windows.Data;
namespace ScreenSizeSupport.Misc
{
public class DecimalRoundingConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
double number;
var requestedPlaces = parameter as string;
if (!double.TryParse(value.ToString(), out number))
return value;
int decimalPlaces = 2;
if (!string.IsNullOrEmpty(requestedPlaces))
int.TryParse(requestedPlaces, out decimalPlaces);
var decimalFormat = "";
if (decimalPlaces >= 1)
{
decimalFormat = "0";
for (int place = 1; place < decimalPlaces; place++)
decimalFormat += "#";
}
return string.Format("{0:." + decimalFormat + "}", number);
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
}
}

using System;
namespace ScreenSizeSupport.Misc
{
public static class DisplayConstants
{
public const double AspectRatio16To9 = 16.0 / 9.0;
public const double AspectRatio15To9 = 15.0 / 9.0;
public static readonly double DiagonalToWidthRatio16To9 = 9.0 / Math.Sqrt(Math.Pow(16, 2) + Math.Pow(9, 2));
public static readonly double DiagonalToWidthRatio15To9 = 9.0 / Math.Sqrt(Math.Pow(15, 2) + Math.Pow(9, 2));
public const double BaselineDiagonalInInches15To9HighRes = 4.5; // Lumia 920
public const double BaselineDiagonalInInches15To9LoRes = 4.0; // Lumia 520
public const double BaselineDiagonalInInches16To9 = 4.3; // HTC 8X
// We use 15:9 aspect ratio, 4.5" diagonal with 480px view resolution as the baseline for scaling / relayout
// * Any size less than 4.5" will get scaled down
// * Any size greater than 4.5" will get more layout space
// Note that 16:9 displays are skinnier than 15:9, so the cutover isn't exactly 4.5" for them
internal static readonly double BaselineWidthInInches = BaselineDiagonalInInches15To9HighRes * DiagonalToWidthRatio15To9;
internal const int BaselineWidthInViewPixels = 480;
}
}
using System;
namespace ScreenSizeSupport.Misc
{
public static class MathHelpers
{
public const double Epsilon = 0.001;
public static bool IsCloseEnoughTo(this double d1, double d2)
{
return (Math.Abs(d1 - d2) < Epsilon);
}
public static bool IsCloseEnoughOrSmallerThan(this double d1, double d2)
{
return d1 < (d2 + Epsilon);
}
public static double NudgeToClosestPoint(this double currentValue, int nudgeValue)
{
var newValue = currentValue * 10 / nudgeValue;
newValue = Math.Floor(newValue + Epsilon);
return newValue / 10 * nudgeValue;
}
}
}
using System;
using System.Windows;
namespace ScreenSizeSupport.Misc
{
public class ScreenInfo
{
public static readonly ScreenInfo NullValue = new ScreenInfo(0, 0, 0);
public Size PhysicalSize { get; private set; }
public Size PhysicalResolution { get; private set; }
public double AspectRatio { get; private set; }
public ScreenInfo(double physicalDiagonal, double physicalResolutionWidth, double aspectRatio)
: this(SizeHelpers.MakeSizeFromDiagonal(physicalDiagonal, aspectRatio), SizeHelpers.MakeSize(physicalResolutionWidth, aspectRatio))
{
}
public ScreenInfo(Size physicalSize, Size physicalResolution)
{
PhysicalSize = physicalSize;
PhysicalResolution = physicalResolution;
if (PhysicalResolution.Width == 0)
{
AspectRatio = 0;
return;
}
AspectRatio = physicalSize.Height / physicalSize.Width;
if (!AspectRatio.IsCloseEnoughTo(physicalResolution.Height / physicalResolution.Width))
throw new ArgumentOutOfRangeException("physicalResolution", "only square pixels supported");
}
}
}
using System;
using System.Windows;
namespace ScreenSizeSupport.Misc
{
public static class SizeHelpers
{
public static double GetHypotenuse(this Size rect)
{
return Math.Sqrt(Math.Pow(rect.Width, 2) + Math.Pow(rect.Height, 2));
}
public static readonly Size WvgaPhysicalResolution = new Size(480, 800);
public static readonly Size Hd720PhysicalResolution = new Size(720, 1280);
public static readonly Size WxgaPhysicalResolution = new Size(768, 1280);
public static readonly Size FullHd1080PhysicalResolution = new Size(1080, 1920);
public static Size Scale(this Size size, double scaleFactor)
{
Size scaledSize = new Size();
var h = size.Height;
scaledSize.Height = Double.IsInfinity(h) ? h : h * scaleFactor;
var w = size.Width;
scaledSize.Width = Double.IsInfinity(w) ? w : w * scaleFactor;
return scaledSize;
}
public static double GetWidthInInchesFromDiagonal(double diagonal, double aspectRatio)
{
if (aspectRatio.IsCloseEnoughTo(DisplayConstants.AspectRatio16To9))
return diagonal * DisplayConstants.DiagonalToWidthRatio16To9;
if (aspectRatio.IsCloseEnoughTo(DisplayConstants.AspectRatio15To9))
return diagonal * DisplayConstants.DiagonalToWidthRatio15To9;
if (aspectRatio.IsCloseEnoughTo(0))
return 0;
throw new ArgumentOutOfRangeException("aspectRatio");
}
public static string GetFriendlyAspectRatio(double aspectRatio)
{
if (aspectRatio.IsCloseEnoughTo(DisplayConstants.AspectRatio16To9))
return "16:9";
if (aspectRatio.IsCloseEnoughTo(DisplayConstants.AspectRatio15To9))
return "15:9";