From 319757df14c81d3a151c757630d1886db3b1f722 Mon Sep 17 00:00:00 2001 From: test Date: Mon, 4 Jan 2021 20:54:33 +0900 Subject: [PATCH] =?utf8?q?=E3=83=A1=E3=83=88=E3=83=AD=E7=89=88=E3=81=AF?= =?utf8?q?=E3=82=82=E3=81=AF=E3=82=84=E4=BD=BF=E3=81=A3=E3=81=A6=E3=82=8B?= =?utf8?q?=E4=BA=BA=E3=81=8C=E3=81=84=E3=81=AA=E3=81=84=E3=81=AE=E3=81=A7?= =?utf8?q?=E5=89=8A=E9=99=A4=E3=81=99=E3=82=8B=E3=81=93=E3=81=A8=E3=81=AB?= =?utf8?q?=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Installer/install.cmd | 2 - Metro/FooEditEngine/Direct2D/D2DRender.cs | 197 -- Metro/FooEditEngine/Direct2D/D2DRenderBase.cs | 169 -- Metro/FooEditEngine/FooEditEngine.csproj | 171 -- Metro/FooEditEngine/FooPrintText.cs | 104 -- Metro/FooEditEngine/FooTextBox.cs | 1915 -------------------- Metro/FooEditEngine/Print/ComInterface.cs | 89 - Metro/FooEditEngine/Print/D2DPrintPreviewRender.cs | 138 -- Metro/FooEditEngine/Print/D2DPrintRender.cs | 120 -- Metro/FooEditEngine/Print/DocumentSource.cs | 302 --- Metro/FooEditEngine/Print/PrintOptionBuilder.cs | 135 -- Metro/FooEditEngine/Properties/AssemblyInfo.cs | 29 - Metro/FooEditEngine/Themes/Generic.xaml | 86 - Metro/FooEditEngine/strings/en-US/Resources.resw | 153 -- Metro/FooEditEngine/strings/ja-JP/Resources.resw | 153 -- Metro/Test.sln | 89 - Metro/Test/App.xaml | 20 - Metro/Test/App.xaml.cs | 135 -- Metro/Test/AppSettings.cs | 176 -- Metro/Test/Assets/Logo.png | Bin 801 -> 0 bytes Metro/Test/Assets/SmallLogo.png | Bin 329 -> 0 bytes Metro/Test/Assets/SplashScreen.png | Bin 2146 -> 0 bytes Metro/Test/Assets/StoreLogo.png | Bin 429 -> 0 bytes Metro/Test/Common/StandardStyles.xaml | 1832 ------------------- Metro/Test/MainPage.xaml | 25 - Metro/Test/MainPage.xaml.cs | 149 -- Metro/Test/Package.appxmanifest | 54 - Metro/Test/Properties/AssemblyInfo.cs | 29 - Metro/Test/SettingsFlyout.xaml | 28 - Metro/Test/SettingsFlyout.xaml.cs | 40 - Metro/Test/Test.csproj | 169 -- Metro/Test/Test_TemporaryKey.pfx | Bin 2504 -> 0 bytes 32 files changed, 6509 deletions(-) delete mode 100644 Metro/FooEditEngine/Direct2D/D2DRender.cs delete mode 100644 Metro/FooEditEngine/Direct2D/D2DRenderBase.cs delete mode 100644 Metro/FooEditEngine/FooEditEngine.csproj delete mode 100644 Metro/FooEditEngine/FooPrintText.cs delete mode 100644 Metro/FooEditEngine/FooTextBox.cs delete mode 100644 Metro/FooEditEngine/Print/ComInterface.cs delete mode 100644 Metro/FooEditEngine/Print/D2DPrintPreviewRender.cs delete mode 100644 Metro/FooEditEngine/Print/D2DPrintRender.cs delete mode 100644 Metro/FooEditEngine/Print/DocumentSource.cs delete mode 100644 Metro/FooEditEngine/Print/PrintOptionBuilder.cs delete mode 100644 Metro/FooEditEngine/Properties/AssemblyInfo.cs delete mode 100644 Metro/FooEditEngine/Themes/Generic.xaml delete mode 100644 Metro/FooEditEngine/strings/en-US/Resources.resw delete mode 100644 Metro/FooEditEngine/strings/ja-JP/Resources.resw delete mode 100644 Metro/Test.sln delete mode 100644 Metro/Test/App.xaml delete mode 100644 Metro/Test/App.xaml.cs delete mode 100644 Metro/Test/AppSettings.cs delete mode 100644 Metro/Test/Assets/Logo.png delete mode 100644 Metro/Test/Assets/SmallLogo.png delete mode 100644 Metro/Test/Assets/SplashScreen.png delete mode 100644 Metro/Test/Assets/StoreLogo.png delete mode 100644 Metro/Test/Common/StandardStyles.xaml delete mode 100644 Metro/Test/MainPage.xaml delete mode 100644 Metro/Test/MainPage.xaml.cs delete mode 100644 Metro/Test/Package.appxmanifest delete mode 100644 Metro/Test/Properties/AssemblyInfo.cs delete mode 100644 Metro/Test/SettingsFlyout.xaml delete mode 100644 Metro/Test/SettingsFlyout.xaml.cs delete mode 100644 Metro/Test/Test.csproj delete mode 100644 Metro/Test/Test_TemporaryKey.pfx diff --git a/Installer/install.cmd b/Installer/install.cmd index c1f5594..2ddfe09 100644 --- a/Installer/install.cmd +++ b/Installer/install.cmd @@ -12,8 +12,6 @@ if "%1"=="" set BUILD_TYPE=Release if errorlevel 1 goto end "%IDE_PATH%\devenv" /build "%BUILD_TYPE%" ..\WPF\FooEditEngine.sln if errorlevel 1 goto end -:"%IDE_PATH%\devenv" /build "%BUILD_TYPE%|%CPU_TYPE%" ..\Metro\Test.sln -:if errorlevel 1 goto end "%IDE_PATH%\devenv" /build "%BUILD_TYPE%|%CPU_TYPE%" ..\UWP\FooEditEngine.UWP.sln if errorlevel 1 goto end "%BUILD_PATH%\MSBuild.exe" /p:Configuration=Release ..\Help\fooeditengine_api.shfbproj diff --git a/Metro/FooEditEngine/Direct2D/D2DRender.cs b/Metro/FooEditEngine/Direct2D/D2DRender.cs deleted file mode 100644 index 42990bf..0000000 --- a/Metro/FooEditEngine/Direct2D/D2DRender.cs +++ /dev/null @@ -1,197 +0,0 @@ -/* - * Copyright (C) 2013 FooProject - * * This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along with this program. If not, see . - */ -using System; -using System.Collections.Generic; -using Windows.Graphics.Display; -using Windows.UI.Xaml.Media; -using Windows.UI.Xaml.Media.Imaging; -using SharpDX; -using DXGI = SharpDX.DXGI; -using D2D = SharpDX.Direct2D1; -using D3D = SharpDX.Direct3D; -using D3D11 = SharpDX.Direct3D11; -using FooEditEngine.Metro; -using DotNetTextStore; -using DotNetTextStore.UnmanagedAPI.TSF; -using DotNetTextStore.UnmanagedAPI.WinDef; - -namespace FooEditEngine -{ - sealed class D2DRender : D2DRenderBase,IEditorRender - { - SurfaceImageSource SurfaceImage; - DXGI.ISurfaceImageSourceNative SurfaceImageNative; - D2D.Device D2DDevice; - D2D.DeviceContext D2DContext; - D2D.Bitmap1 Bitmap; - Size Size = new Size(); - DXGI.Surface Surface; - TextStore2 store; - - public D2DRender(FooTextBox textbox,Windows.UI.Xaml.Shapes.Rectangle rect,TextStore2 store) - : base() - { - this.ConstructDeviceResource(rect.ActualWidth,rect.ActualHeight); - this.InitTextFormat(textbox.FontFamily, textbox.FontSize); - - this.store = store; - - this.Size.Width = rect.ActualWidth; - this.Size.Height = rect.ActualHeight; - - this.CreateSurface(rect, rect.ActualWidth, rect.ActualHeight); - - base.PreDrawOneLine = D2DRender_PreDrawOneLine; - - this.Foreground = D2DRenderBase.ToColor4( textbox.Foreground); - this.Background = D2DRenderBase.ToColor4(textbox.Background); - this.Hilight = D2DRenderBase.ToColor4(textbox.Hilight); - this.Keyword1 = D2DRenderBase.ToColor4(textbox.Keyword1); - this.Keyword2 = D2DRenderBase.ToColor4(textbox.Keyword2); - this.Literal = D2DRenderBase.ToColor4(textbox.Literal); - this.Url = D2DRenderBase.ToColor4(textbox.URL); - this.ControlChar = D2DRenderBase.ToColor4(textbox.ControlChar); - this.Comment = D2DRenderBase.ToColor4(textbox.Comment); - this.InsertCaret = D2DRenderBase.ToColor4(textbox.InsertCaret); - this.OverwriteCaret = D2DRenderBase.ToColor4(textbox.OverwriteCaret); - this.LineMarker = D2DRenderBase.ToColor4(textbox.LineMarker); - this.UpdateArea = D2DRenderBase.ToColor4(textbox.UpdateArea); - this.LineNumber = D2DRenderBase.ToColor4(textbox.LineNumber); - } - - void D2DRender_PreDrawOneLine(MyTextLayout layout,LineToIndexTable lti, int row, double x, double y) - { - using (Unlocker locker = this.store.LockDocument(false)) - { - int lineIndex = lti.GetIndexFromLineNumber(row); - int lineLength = lti.GetLengthFromLineNumber(row); - foreach (TextDisplayAttribute attr in this.store.EnumAttributes(lineIndex, lineIndex + lineLength)) - { - if (attr.startIndex == attr.endIndex) - continue; - int length = attr.endIndex - attr.startIndex; - int start = attr.startIndex - lineIndex; - - HilightType type = HilightType.None; - Color4? color = null; - switch (attr.attribute.lsStyle) - { - case TF_DA_LINESTYLE.TF_LS_DOT: - type = HilightType.Dot; - color = this.Foreground; - break; - case TF_DA_LINESTYLE.TF_LS_SOLID: - type = HilightType.Sold; - color = this.Foreground; - break; - case TF_DA_LINESTYLE.TF_LS_DASH: - type = HilightType.Dash; - color = this.Foreground; - break; - case TF_DA_LINESTYLE.TF_LS_SQUIGGLE: - type = HilightType.Squiggle; - color = this.Foreground; - break; - } - - if (attr.attribute.crBk.type != TF_DA_COLORTYPE.TF_CT_NONE) - { - type = HilightType.Select; - color = this.Hilight; - } - - this.DrawMarkerEffect(layout, type, start, length, x, y, attr.attribute.fBoldLine, color); - } - } - } - - public override void GetDpi(out float dpix, out float dpiy) - { - Util.GetDpi(out dpix, out dpiy); - } - - public bool Resize(Windows.UI.Xaml.Shapes.Rectangle rect, double width, double height) - { - if (this.Size.Width == width && this.Size.Height == height) - return false; - this.ReConstructDeviceResource(width, height); - this.CreateSurface(rect, width, height); - return true; - } - - public bool IsCanDraw() - { - return this.Size.Height != 0 && this.Size.Width != 0; - } - - public void DrawContent(EditView view,bool IsEnabled,Rectangle updateRect) - { - SharpDX.Mathematics.Interop.RawPoint offset; - this.Surface = this.SurfaceImageNative.BeginDraw( - new SharpDX.Rectangle(0, 0, (int)this.Size.Width, (int)this.Size.Height), out offset); - float dpix, dpiy; - this.GetDpi(out dpix, out dpiy); - D2D.BitmapProperties1 prop = new D2D.BitmapProperties1(new D2D.PixelFormat(DXGI.Format.B8G8R8A8_UNorm, D2D.AlphaMode.Premultiplied), - dpix, dpiy, D2D.BitmapOptions.Target | D2D.BitmapOptions.CannotDraw); - this.Bitmap = new D2D.Bitmap1(this.D2DContext, this.Surface, prop); - this.D2DContext.Target = this.Bitmap; - this.D2DContext.Transform = Matrix3x2.Translation(offset.X, offset.Y); - base.BegineDraw(); - - if (IsEnabled) - view.Draw(updateRect); - else - this.FillBackground(updateRect); - - base.EndDraw(); - this.Surface.Dispose(); - this.Bitmap.Dispose(); - this.SurfaceImageNative.EndDraw(); - } - - void CreateSurface(Windows.UI.Xaml.Shapes.Rectangle rect, double width, double height) - { - if (this.SurfaceImageNative != null) - this.SurfaceImageNative.Dispose(); - this.SurfaceImage = new SurfaceImageSource((int)width, (int)height); - this.SurfaceImageNative = ComObject.As(this.SurfaceImage); - this.SurfaceImageNative.Device = this.DXGIDevice; - this.Size.Width = width; - this.Size.Height = height; - ImageBrush brush = new ImageBrush(); - brush.ImageSource = this.SurfaceImage; - rect.Fill = brush; - } - - protected override D2D.RenderTarget ConstructRender(D2D.Factory1 factory, D2D.RenderTargetProperties prop, double width, double height) - { - this.D2DDevice = new D2D.Device(factory,this.DXGIDevice); - this.D2DContext = new D2D.DeviceContext(this.D2DDevice, D2D.DeviceContextOptions.None); - return this.D2DContext; - } - - protected override void ConstrctedResource() - { - } - - protected override void DestructRender() - { - if (this.D2DDevice != null) - this.D2DDevice.Dispose(); - if (this.D2DContext != null) - this.D2DContext.Dispose(); - } - - protected override void ReCreateTarget() - { - } - } -} diff --git a/Metro/FooEditEngine/Direct2D/D2DRenderBase.cs b/Metro/FooEditEngine/Direct2D/D2DRenderBase.cs deleted file mode 100644 index 709cd6d..0000000 --- a/Metro/FooEditEngine/Direct2D/D2DRenderBase.cs +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Copyright (C) 2013 FooProject - * * This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along with this program. If not, see . - */ -using System; -using System.Collections.Generic; -using Windows.Graphics.Display; -using Windows.UI.Text; -using Windows.UI.Xaml.Media; -using Windows.UI.Xaml.Media.Imaging; -using SharpDX; -using DXGI = SharpDX.DXGI; -using D2D = SharpDX.Direct2D1; -using DW = SharpDX.DirectWrite; -using D3D = SharpDX.Direct3D; -using D3D11 = SharpDX.Direct3D11; -using FooEditEngine.Metro; - -namespace FooEditEngine -{ - class D2DRenderBase: D2DRenderCommon,IDisposable - { - public const int MiniumeWidth = 40; //これ以上ないと誤操作が起こる - - protected DXGI.Device DXGIDevice; - protected D3D11.Device1 D3DDevice; - Windows.UI.Color ForegroundColor, BackgroundColor, HilightColor, Keyword1Color, Keyword2Color, LiteralColor, UrlColor, ControlCharColor, CommentColor, InsertCaretColor, OverwriteCaretColor, LineMarkerColor,UpdateAreaColor; - FontFamily fontFamily; - FontStyle fontStyle = FontStyle.Normal; - FontWeight fontWeigth; - double fontSize; - - public D2DRenderBase() - { - var creationFlags = SharpDX.Direct3D11.DeviceCreationFlags.VideoSupport | SharpDX.Direct3D11.DeviceCreationFlags.BgraSupport; - D3D.FeatureLevel[] featureLevels ={D3D.FeatureLevel.Level_11_1, - D3D.FeatureLevel.Level_11_0, - D3D.FeatureLevel.Level_10_1, - D3D.FeatureLevel.Level_10_0, - D3D.FeatureLevel.Level_9_3, - D3D.FeatureLevel.Level_9_2, - D3D.FeatureLevel.Level_9_1}; - using (var device = new D3D11.Device(D3D.DriverType.Hardware, creationFlags, featureLevels)) - { - this.D3DDevice = device.QueryInterface(); - } - this.DXGIDevice = this.D3DDevice.QueryInterface(); - } - - public void InitTextFormat(string fontName, double size) - { - base.InitTextFormat(fontName, (float)size); - this.fontSize = size; - } - - public void InitTextFormat(FontFamily font, double size) - { - base.InitTextFormat(font.Source, (float)size); - this.fontFamily = font; - this.fontSize = size; - } - - public override void Dispose() - { - if (this.DXGIDevice != null) - this.DXGIDevice.Dispose(); - if (this.D3DDevice != null) - this.D3DDevice.Dispose(); - base.Dispose(); - } - - public FontFamily FontFamily - { - get { return this.fontFamily; } - set - { - this.fontFamily = value; - this.InitTextFormat(this.fontFamily.Source, (float)this.fontSize, this.GetDWFontWeigth(this.fontWeigth), this.GetDWFontStyle(this.fontStyle)); - this.TabWidthChar = this.TabWidthChar; - } - } - - public double FontSize - { - get { return this.fontSize; } - set - { - this.fontSize = value; - this.InitTextFormat(this.fontFamily.Source, (float)this.fontSize, this.GetDWFontWeigth(this.fontWeigth), this.GetDWFontStyle(this.fontStyle)); - this.TabWidthChar = this.TabWidthChar; - } - } - - public FontWeight FontWeigth - { - get - { - return this.fontWeigth; - } - set - { - this.fontWeigth = value; - this.InitTextFormat(this.fontFamily.Source, (float)this.fontSize, this.GetDWFontWeigth(value), this.GetDWFontStyle(this.fontStyle)); - } - } - - public FontStyle FontStyle - { - get - { - return this.fontStyle; - } - set - { - this.fontStyle = value; - this.InitTextFormat(this.fontFamily.Source, (float)this.fontSize, this.GetDWFontWeigth(this.fontWeigth), this.GetDWFontStyle(this.fontStyle)); - } - } - - DW.FontStyle GetDWFontStyle(FontStyle style) - { - return (DW.FontStyle)Enum.Parse(typeof(DW.FontStyle), style.ToString()); - } - - DW.FontWeight GetDWFontWeigth(FontWeight weigth) - { - if (weigth.Weight == 0) - return (DW.FontWeight)400; - else - return (DW.FontWeight)weigth.Weight; - } - - public static Color4 ToColor4(Windows.UI.Color color) - { - return new Color4(color.R / 255.0f, color.G / 255.0f, color.B / 255.0f, color.A / 255.0f); - } - - protected PreDrawOneLineHandler PreDrawOneLine; - - public override void CacheContent() - { - } - - public override void DrawCachedBitmap(Rectangle rect) - { - } - - public override bool IsVaildCache() - { - return false; - } - - public void DrawOneLine(Document doc,LineToIndexTable lti, int row, double x, double y) - { - this.DrawOneLine(doc, - lti, - row, - x, - y, - this.PreDrawOneLine); - } - } -} diff --git a/Metro/FooEditEngine/FooEditEngine.csproj b/Metro/FooEditEngine/FooEditEngine.csproj deleted file mode 100644 index ec3e3ec..0000000 --- a/Metro/FooEditEngine/FooEditEngine.csproj +++ /dev/null @@ -1,171 +0,0 @@ - - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {AC23EBF4-4CD0-43EA-9808-0E6DCD12E791} - Library - Properties - FooEditEngine - FooEditEngine.Metro - ja-JP - 512 - {BC8A1FFA-BEE3-4634-8014-F334798102B3};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - 8.1 - 12 - - - - true - full - false - bin\Debug\ - TRACE;DEBUG;NETFX_CORE,METRO,ENABLE_AUTMATION - prompt - 4 - bin\Debug\FooEditEngine.Metro.XML - - - pdbonly - true - bin\Release\ - TRACE;NETFX_CORE,METRO,ENABLE_AUTMATION - prompt - 4 - bin\Release\FooEditEngine.Metro.XML - - - true - bin\ARM\Debug\ - DEBUG;TRACE;NETFX_CORE - ;2008 - full - ARM - false - prompt - true - - - bin\ARM\Release\ - TRACE;NETFX_CORE - true - ;2008 - pdbonly - ARM - false - prompt - true - - - true - bin\x64\Debug\ - DEBUG;TRACE;NETFX_CORE - ;2008 - full - x64 - false - prompt - true - - - bin\x64\Release\ - TRACE;NETFX_CORE - true - ;2008 - pdbonly - x64 - false - prompt - true - - - true - bin\x86\Debug\ - DEBUG;TRACE;NETFX_CORE - ;2008 - full - x86 - false - prompt - true - - - bin\x86\Release\ - TRACE;NETFX_CORE - true - ;2008 - pdbonly - x86 - false - prompt - true - - - - - MSBuild:Compile - Designer - - - - - - - - - - - - - - - - - - - - - - - {453c491e-ef3a-41ad-a725-8855c1cb2c84} - DotNetTextStore.Metro - - - - - False - ..\..\Libs\StoreApp\SharpDX.dll - - - False - ..\..\Libs\StoreApp\SharpDX.Direct2D1.dll - - - False - ..\..\Libs\StoreApp\SharpDX.Direct3D11.dll - - - False - ..\..\Libs\StoreApp\SharpDX.DXGI.dll - - - False - ..\..\Libs\StoreApp\SharpDX.Mathematics.dll - - - - - 12.0 - - - - \ No newline at end of file diff --git a/Metro/FooEditEngine/FooPrintText.cs b/Metro/FooEditEngine/FooPrintText.cs deleted file mode 100644 index 703a39f..0000000 --- a/Metro/FooEditEngine/FooPrintText.cs +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (C) 2013 FooProject - * * This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along with this program. If not, see . - */ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using FooEditEngine; -using Windows.UI.Core; -using Windows.Foundation; -using Windows.Graphics.Printing; -using Windows.Graphics.Printing.OptionDetails; - -namespace FooEditEngine.Metro -{ - /// - /// 印刷を行うクラス - /// - public class FooPrintText - { - /// - /// コンストラクター - /// - public FooPrintText() - { - this.PrintStart += (s, e) => { }; - this.PrintComplete += (s, e) => { }; - this.ParseHF = (s, e) => { return e.Original; }; - } - - DocumentSource source; - /// - /// ヘッダーやフッターを処理する - /// - public ParseCommandHandler ParseHF; - - /// - /// ヘッダー - /// - public string Header; - - /// - /// フッター - /// - public string Fotter; - - /// - /// 余白 - /// - public Padding Padding; - - /// - /// 印刷が開始したことを表す - /// - public event EventHandler PrintStart; - - /// - /// 印刷が完了したことを表す - /// - public event EventHandler PrintComplete; - - /// - /// 印刷する - /// - /// PrintTaskRequestオブジェクト - /// タイトル - /// 印刷対象のテキストボックス - public void Print(PrintTaskRequest req,string title,FooTextBox textbox) - { - IAsyncAction async = textbox.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => - { - this.PrintStart(this, null); - source = new DocumentSource(textbox,this.Padding); - source.ParseHF = ParseHF; - source.Header = Header; - source.Fotter = Fotter; - - PrintTask task = null; - task = req.CreatePrintTask(title, (e) => - { - e.SetSource(source); - }); - task.Completed += async (sender, e) => { - source.Dispose(); - await textbox.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { - this.PrintComplete(this, null); - }); - }; - PrintOptionBuilder builder = new PrintOptionBuilder(source); - builder.BuildPrintOption(PrintTaskOptionDetails.GetFromPrintTaskOptions(task.Options)); - }); - Task t = WindowsRuntimeSystemExtensions.AsTask(async); - t.Wait(); - } - } -} diff --git a/Metro/FooEditEngine/FooTextBox.cs b/Metro/FooEditEngine/FooTextBox.cs deleted file mode 100644 index b15ff8e..0000000 --- a/Metro/FooEditEngine/FooTextBox.cs +++ /dev/null @@ -1,1915 +0,0 @@ -/* - * Copyright (C) 2013 FooProject - * * This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along with this program. If not, see . - */ -using System; -using System.Text; -using System.ComponentModel; -using System.Threading.Tasks; -using Windows.ApplicationModel.Resources.Core; -using Windows.Devices.Input; -using Windows.System; -using Windows.ApplicationModel.DataTransfer; -using Windows.Foundation; -using Windows.UI; -using Windows.UI.Input; -using Windows.UI.Core; -using Windows.UI.Popups; -using Windows.UI.Text; -using Windows.UI.Xaml.Media; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Controls.Primitives; -using Windows.UI.Xaml.Input; -using DotNetTextStore; -using DotNetTextStore.UnmanagedAPI.TSF; -using DotNetTextStore.UnmanagedAPI.WinDef; - -// テンプレート コントロールのアイテム テンプレートについては、http://go.microsoft.com/fwlink/?LinkId=234235 を参照してください - -namespace FooEditEngine.Metro -{ - /// - /// テキストボックスコントロール - /// - public sealed class FooTextBox : Control,IDisposable - { - EditView View; - Controller _Controller; - D2DRender Render; - ScrollBar horizontalScrollBar, verticalScrollBar; - Windows.UI.Xaml.Shapes.Rectangle rectangle; - GestureRecognizer gestureRecongnizer = new GestureRecognizer(); - TextStore2 textStore; - FooTextBoxAutomationPeer peer; - bool nowCaretMove = false; - Document _Document; - DispatcherTimer timer = new DispatcherTimer(); - - /// - /// コンストラクター - /// - public FooTextBox() - { - this.DefaultStyleKey = typeof(FooTextBox); - - this.textStore = new TextStore2(); - this.textStore.IsLoading += textStore_IsLoading; - this.textStore.IsReadOnly += textStore_IsReadOnly; - this.textStore.GetStringLength += () => this.Document.Length; - this.textStore.GetString += _textStore_GetString; - this.textStore.GetSelectionIndex += _textStore_GetSelectionIndex; - this.textStore.SetSelectionIndex += _textStore_SetSelectionIndex; - this.textStore.InsertAtSelection += _textStore_InsertAtSelection; - this.textStore.GetScreenExtent += _textStore_GetScreenExtent; - this.textStore.GetStringExtent += _textStore_GetStringExtent; - this.textStore.CompositionStarted += textStore_CompositionStarted; - this.textStore.CompositionUpdated += textStore_CompositionUpdated; - this.textStore.CompositionEnded += textStore_CompositionEnded; - - this.rectangle = new Windows.UI.Xaml.Shapes.Rectangle(); - this.rectangle.Margin = this.Padding; - this.Render = new D2DRender(this,this.rectangle,this.textStore); - - this.Document = new Document(); - - this.View = new EditView(this.Document, this.Render, new Padding(5, Gripper.HitAreaWidth, Gripper.HitAreaWidth / 2, Gripper.HitAreaWidth)); - this.View.SrcChanged += View_SrcChanged; - this.View.InsertMode = this.InsertMode; - this.Document.DrawLineNumber = this.DrawLineNumber; - this.View.HideCaret = !this.DrawCaret; - this.View.HideLineMarker = !this.DrawCaretLine; - this.Document.HideRuler = !this.DrawRuler; - this.Document.UrlMark = this.MarkURL; - this.Document.TabStops = this.TabChars; - - this._Controller = new Controller(this.Document, this.View); - this.Document.SelectionChanged += Controller_SelectionChanged; - - this.gestureRecongnizer.GestureSettings = GestureSettings.Drag | - GestureSettings.RightTap | - GestureSettings.Tap | - GestureSettings.DoubleTap | - GestureSettings.ManipulationTranslateX | - GestureSettings.ManipulationTranslateY | - GestureSettings.ManipulationScale | - GestureSettings.ManipulationTranslateInertia | - GestureSettings.ManipulationScaleInertia; - this.gestureRecongnizer.RightTapped += gestureRecongnizer_RightTapped; - this.gestureRecongnizer.Tapped += gestureRecongnizer_Tapped; - this.gestureRecongnizer.Dragging += gestureRecongnizer_Dragging; - this.gestureRecongnizer.ManipulationInertiaStarting += GestureRecongnizer_ManipulationInertiaStarting; ; - this.gestureRecongnizer.ManipulationStarted += gestureRecongnizer_ManipulationStarted; - this.gestureRecongnizer.ManipulationUpdated += gestureRecongnizer_ManipulationUpdated; - this.gestureRecongnizer.ManipulationCompleted += gestureRecongnizer_ManipulationCompleted; - - this.timer.Interval = new TimeSpan(0, 0, 0, 0, 500); - this.timer.Tick += this.timer_Tick; - this.timer.Start(); - - //Viewの初期化が終わった直後に置かないと例外が発生する - this.Document.Update += Document_Update; - - Window.Current.CoreWindow.CharacterReceived += CoreWindow_CharacterReceived; - - this.SizeChanged += FooTextBox_SizeChanged; - - this.Loaded += FooTextBox_Loaded; - } - - /// - /// ファイナライザー - /// - ~FooTextBox() - { - this.Dispose(false); - } - - /// - /// アンマネージドリソースを解放する - /// - public void Dispose() - { - this.Dispose(true); - GC.SuppressFinalize(this); - } - - bool Disposed = false; - private void Dispose(bool disposing) - { - if (this.Disposed) - return; - if (disposing) - { - this.textStore.Dispose(); - this.View.Dispose(); - this.Render.Dispose(); - } - } - - /// - /// ドキュメントを選択する - /// - /// 開始インデックス - /// 長さ - public void Select(int start, int length) - { - this.Document.Select(start, length); - } - - /// - /// キャレットを指定した行に移動させます - /// - /// インデックス - /// このメソッドを呼び出すと選択状態は解除されます - public void JumpCaret(int index) - { - this._Controller.JumpCaret(index); - } - /// - /// キャレットを指定した行と桁に移動させます - /// - /// 行番号 - /// 桁 - /// このメソッドを呼び出すと選択状態は解除されます - public void JumpCaret(int row, int col) - { - this._Controller.JumpCaret(row, col); - } - - /// - /// 選択中のテキストをクリップボードにコピーします - /// - public void Copy() - { - string text = this._Controller.SelectedText; - if (text != null && text != string.Empty) - { - DataPackage dataPackage = new DataPackage(); - dataPackage.RequestedOperation = DataPackageOperation.Copy; - dataPackage.SetText(text); - - Clipboard.SetContent(dataPackage); - } - } - - /// - /// 選択中のテキストをクリップボードに切り取ります - /// - public void Cut() - { - string text = this._Controller.SelectedText; - if (text != null && text != string.Empty) - { - DataPackage dataPackage = new DataPackage(); - dataPackage.RequestedOperation = DataPackageOperation.Copy; - dataPackage.SetText(text); - - Clipboard.SetContent(dataPackage); - - this._Controller.SelectedText = ""; - } - } - - /// - /// 選択中のテキストを貼り付けます - /// - public async Task PasteAsync() - { - var dataPackageView = Clipboard.GetContent(); - if (dataPackageView.Contains(StandardDataFormats.Text)) - { - this._Controller.SelectedText = await dataPackageView.GetTextAsync(); - } - } - - /// - /// すべて選択する - /// - public void SelectAll() - { - this.Document.Select(0, this.Document.Length); - } - - /// - /// 選択を解除する - /// - public void DeSelectAll() - { - this._Controller.DeSelectAll(); - } - - /// - /// 対応する座標を返します - /// - /// テキストポイント - /// 座標 - /// テキストポイントがクライアント領域の原点より外にある場合、返される値は原点に丸められます - public Windows.Foundation.Point GetPostionFromTextPoint(TextPoint tp) - { - if (this.Document.FireUpdateEvent == false) - throw new InvalidOperationException(""); - return this.View.GetPostionFromTextPoint(tp); - } - - /// - /// 対応するテキストポイントを返します - /// - /// クライアント領域の原点を左上とする座標 - /// テキストポイント - public TextPoint GetTextPointFromPostion(Windows.Foundation.Point p) - { - if (this.Document.FireUpdateEvent == false) - throw new InvalidOperationException(""); - return this.View.GetTextPointFromPostion(p); - } - - /// - /// 行の高さを取得します - /// - /// レイアウト行 - /// 行の高さ - public double GetLineHeight(int row) - { - if (this.Document.FireUpdateEvent == false) - throw new InvalidOperationException(""); - return this.View.LayoutLines.GetLayout(row).Height; ; - } - - /// - /// インデックスに対応する座標を得ます - /// - /// インデックス - /// 座標を返す - public Windows.Foundation.Point GetPostionFromIndex(int index) - { - if (this.Document.FireUpdateEvent == false) - throw new InvalidOperationException(""); - TextPoint tp = this.View.GetLayoutLineFromIndex(index); - return this.View.GetPostionFromTextPoint(tp); - } - - /// - /// 座標からインデックスに変換します - /// - /// 座標 - /// インデックスを返す - public int GetIndexFromPostion(Windows.Foundation.Point p) - { - if (this.Document.FireUpdateEvent == false) - throw new InvalidOperationException(""); - TextPoint tp = this.View.GetTextPointFromPostion(p); - return this.View.GetIndexFromLayoutLine(tp); - } - - /// - /// 再描写する - /// - public void Refresh() - { - this.Refresh(this.View.PageBound); - } - - /// - /// レイアウト行をすべて破棄し、再度レイアウトを行う - /// - public void PerfomLayouts() - { - this.View.PerfomLayouts(); - } - - /// - /// 指定行までスクロールする - /// - /// 行 - /// 指定行を画面上に置くなら真。そうでないなら偽 - public void ScrollIntoView(int row, bool alignTop) - { - this.View.ScrollIntoView(row, alignTop); - } - - /// - /// ファイルからドキュメントを構築する - /// - /// StremReader - /// Taskオブジェクト - public async Task LoadFileAsync(System.IO.StreamReader sr, System.Threading.CancellationTokenSource token) - { - await this.Document.LoadAsync(sr, token); - } - - /// - /// ドキュメントの内容をファイルに保存する - /// - /// StreamWriter - /// キャンセル用トークン - /// Taskオブジェクト - public async Task SaveFile(System.IO.StreamWriter sw, System.Threading.CancellationTokenSource token) - { - await this.Document.SaveAsync(sw, token); - } - - #region command - void CopyCommand() - { - this.Copy(); - } - - void CutCommand() - { - this.Cut(); - this.Refresh(); - } - - async Task PasteCommand() - { - await this.PasteAsync(); - this.Refresh(); - } - - #endregion - - #region event - /// - protected override Windows.UI.Xaml.Automation.Peers.AutomationPeer OnCreateAutomationPeer() - { - this.peer = new FooTextBoxAutomationPeer(this); - return this.peer; - } - - /// - protected override void OnApplyTemplate() - { - base.OnApplyTemplate(); - - Grid grid = this.GetTemplateChild("PART_Grid") as Grid; - if (grid != null) - { - Grid.SetRow(this.rectangle, 0); - Grid.SetColumn(this.rectangle, 0); - grid.Children.Add(this.rectangle); - } - - this.horizontalScrollBar = this.GetTemplateChild("PART_HorizontalScrollBar") as ScrollBar; - if (this.horizontalScrollBar != null) - { - this.horizontalScrollBar.SmallChange = 10; - this.horizontalScrollBar.LargeChange = 100; - this.horizontalScrollBar.Maximum = this.horizontalScrollBar.LargeChange + 1; - this.horizontalScrollBar.Scroll += new ScrollEventHandler(horizontalScrollBar_Scroll); - } - this.verticalScrollBar = this.GetTemplateChild("PART_VerticalScrollBar") as ScrollBar; - if (this.verticalScrollBar != null) - { - this.verticalScrollBar.SmallChange = 1; - this.verticalScrollBar.LargeChange = 10; - this.verticalScrollBar.Maximum = this.View.LayoutLines.Count; - this.verticalScrollBar.Scroll += new ScrollEventHandler(verticalScrollBar_Scroll); - } - } - - /// - protected override void OnGotFocus(RoutedEventArgs e) - { - base.OnGotFocus(e); - this.textStore.SetFocus(); - this.View.IsFocused = true; - this.Refresh(); - } - - /// - protected override void OnLostFocus(RoutedEventArgs e) - { - base.OnLostFocus(e); - this.View.IsFocused = false; - this.Refresh(); - } - - /// - protected override async void OnKeyDown(KeyRoutedEventArgs e) - { - bool isControlPressed = this.IsModiferKeyPressed(VirtualKey.Control); - bool isShiftPressed = this.IsModiferKeyPressed(VirtualKey.Shift); - bool isMovedCaret = false; - switch (e.Key) - { - case VirtualKey.Up: - this._Controller.MoveCaretVertical(-1, isShiftPressed); - this.Refresh(); - e.Handled = true; - isMovedCaret = true; - break; - case VirtualKey.Down: - this._Controller.MoveCaretVertical(+1, isShiftPressed); - this.Refresh(); - e.Handled = true; - isMovedCaret = true; - break; - case VirtualKey.Left: - this._Controller.MoveCaretHorizontical(-1, isShiftPressed, isControlPressed); - this.Refresh(); - e.Handled = true; - isMovedCaret = true; - break; - case VirtualKey.Right: - this._Controller.MoveCaretHorizontical(1, isShiftPressed, isControlPressed); - this.Refresh(); - e.Handled = true; - isMovedCaret = true; - break; - case VirtualKey.PageUp: - this._Controller.Scroll(ScrollDirection.Up, this.View.LineCountOnScreen, isShiftPressed, true); - this.Refresh(); - isMovedCaret = true; - break; - case VirtualKey.PageDown: - this._Controller.Scroll(ScrollDirection.Down, this.View.LineCountOnScreen, isShiftPressed, true); - this.Refresh(); - isMovedCaret = true; - break; - case VirtualKey.Home: - if (isControlPressed) - this._Controller.JumpToHead(isShiftPressed); - else - this.Controller.JumpToLineHead(this.Document.CaretPostion.row,isShiftPressed); - this.Refresh(); - isMovedCaret = true; - break; - case VirtualKey.End: - if (isControlPressed) - this._Controller.JumpToEnd(isShiftPressed); - else - this.Controller.JumpToLineEnd(this.Document.CaretPostion.row,isShiftPressed); - this.Refresh(); - isMovedCaret = true; - break; - case VirtualKey.Tab: - if (!isControlPressed) - { - if (this._Controller.SelectionLength == 0) - this._Controller.DoInputChar('\t'); - else if (isShiftPressed) - this._Controller.DownIndent(); - else - this._Controller.UpIndent(); - this.Refresh(); - e.Handled = true; - } - break; - case VirtualKey.Enter: - this._Controller.DoEnterAction(); - this.Refresh(); - e.Handled = true; - break; - case VirtualKey.Insert: - if(this.View.InsertMode) - this.View.InsertMode = false; - else - this.View.InsertMode = true; - this.Refresh(); - e.Handled = true; - break; - case VirtualKey.A: - if (isControlPressed) - { - this.SelectAll(); - this.Refresh(); - e.Handled = true; - } - break; - case VirtualKey.B: - if (isControlPressed) - { - if (this._Controller.RectSelection) - this._Controller.RectSelection = false; - else - this._Controller.RectSelection = true; - this.Refresh(); - e.Handled = true; - } - break; - case VirtualKey.C: - if (isControlPressed) - { - this.CopyCommand(); - e.Handled = true; - } - break; - case VirtualKey.X: - if (isControlPressed) - { - this.CutCommand(); - e.Handled = true; - } - break; - case VirtualKey.V: - if (isControlPressed) - { - await this.PasteCommand(); - e.Handled = true; - } - break; - case VirtualKey.Y: - if (isControlPressed) - { - this.Document.UndoManager.redo(); - this.Refresh(); - e.Handled = true; - } - break; - case VirtualKey.Z: - if (isControlPressed) - { - this.Document.UndoManager.undo(); - this.Refresh(); - e.Handled = true; - } - break; - case VirtualKey.Back: - this._Controller.DoBackSpaceAction(); - this.Refresh(); - e.Handled = true; - break; - case VirtualKey.Delete: - this._Controller.DoDeleteAction(); - this.Refresh(); - e.Handled = true; - break; - } - if (isMovedCaret && this.peer != null) - this.peer.OnNotifyCaretChanged(); - base.OnKeyDown(e); - } - - /// - protected override void OnPointerPressed(PointerRoutedEventArgs e) - { - this.CapturePointer(e.Pointer); - this.gestureRecongnizer.ProcessDownEvent(e.GetCurrentPoint(this)); - e.Handled = true; - } - - /// - protected override void OnPointerMoved(PointerRoutedEventArgs e) - { - this.gestureRecongnizer.ProcessMoveEvents(e.GetIntermediatePoints(this)); - e.Handled = true; - - if (e.Pointer.PointerDeviceType == PointerDeviceType.Mouse) - { - Point p = e.GetCurrentPoint(this).Position; - if (this.View.HitTextArea(p.X, p.Y)) - { - TextPoint tp = this.View.GetTextPointFromPostion(p); - if (this._Controller.IsMarker(tp, HilightType.Url)) - Window.Current.CoreWindow.PointerCursor = new CoreCursor(CoreCursorType.Hand, 101); - else - Window.Current.CoreWindow.PointerCursor = new CoreCursor(CoreCursorType.IBeam, 101); - } - else - { - Window.Current.CoreWindow.PointerCursor = new CoreCursor(CoreCursorType.Arrow, 101); - } - } - } - - /// - protected override void OnPointerReleased(PointerRoutedEventArgs e) - { - this.gestureRecongnizer.ProcessUpEvent(e.GetCurrentPoint(this)); - e.Handled = true; - } - - /// - protected override void OnPointerCanceled(PointerRoutedEventArgs e) - { - this.gestureRecongnizer.CompleteGesture(); - e.Handled = true; - } - - /// - protected override void OnPointerWheelChanged(PointerRoutedEventArgs e) - { - bool shift = (e.KeyModifiers & Windows.System.VirtualKeyModifiers.Shift) == - Windows.System.VirtualKeyModifiers.Shift; - bool ctrl = (e.KeyModifiers & Windows.System.VirtualKeyModifiers.Control) == - Windows.System.VirtualKeyModifiers.Control; - this.gestureRecongnizer.ProcessMouseWheelEvent(e.GetCurrentPoint(this), shift, ctrl); - e.Handled = true; - } - - void CoreWindow_CharacterReceived(CoreWindow sender, CharacterReceivedEventArgs args) - { - if (this.FocusState == FocusState.Unfocused || !this.IsEnabled) - return; - if (args.KeyCode >= 00 && args.KeyCode <= 0x1f) - return; - this._Controller.DoInputString(Char.ConvertFromUtf32((int)args.KeyCode)); - this.Refresh(); - } - - bool textStore_IsReadOnly() - { - return false; - } - - bool textStore_IsLoading() - { - return false; - } - - void textStore_CompositionEnded() - { - TextStoreHelper.EndCompostion(this.Document); - this.Refresh(); - } - - void textStore_CompositionUpdated(int start, int end) - { - if (TextStoreHelper.ScrollToCompstionUpdated(this.textStore, this.View, start, end)) - this.Refresh(); - } - bool textStore_CompositionStarted() - { - return TextStoreHelper.StartCompstion(this.Document); - } - - string _textStore_GetString(int start, int length) - { - return this.Document.ToString(start, length); - } - - void _textStore_GetStringExtent( - int i_startIndex, - int i_endIndex, - out POINT o_topLeft, - out POINT o_bottomRight - ) - { - Point startPos, endPos; - TextStoreHelper.GetStringExtent(this.Document, this.View, i_startIndex, i_endIndex, out startPos, out endPos); - - double scale = Util.GetScale(); - - //DIPを渡すと予測候補の位置がおかしくなるので、デバイス依存の座標に変換する - var screenStartPos = Util.GetScreentPoint(startPos, this).Scale(scale); - var screenEndPos = Util.GetScreentPoint(endPos, this).Scale(scale); - o_topLeft = new POINT((int)(screenStartPos.X), (int)(screenStartPos.Y)); - o_bottomRight = new POINT((int)(screenEndPos.X), (int)(screenEndPos.Y)); - } - - void _textStore_GetScreenExtent(out POINT o_topLeft, out POINT o_bottomRight) - { - var pointTopLeft = new Point(0, 0); - var pointBottomRight = new Point(this.RenderSize.Width, this.RenderSize.Height); - - var gt = this.TransformToVisual(Window.Current.Content); - pointTopLeft = gt.TransformPoint(pointTopLeft); - pointBottomRight = gt.TransformPoint(pointBottomRight); - - o_topLeft = new POINT((int)pointTopLeft.X, (int)pointTopLeft.Y); - o_bottomRight = new POINT((int)pointBottomRight.X, (int)pointBottomRight.Y); - } - - void _textStore_GetSelectionIndex(int start_index, int max_count, out DotNetTextStore.TextSelection[] sels) - { - TextRange selRange; - TextStoreHelper.GetSelection(this._Controller, this.View.Selections, out selRange); - - sels = new DotNetTextStore.TextSelection[1]; - sels[0] = new DotNetTextStore.TextSelection(); - sels[0].start = selRange.Index; - sels[0].end = selRange.Index + selRange.Length; - } - - void _textStore_SetSelectionIndex(DotNetTextStore.TextSelection[] sels) - { - TextStoreHelper.SetSelectionIndex(this._Controller, this.View, sels[0].start, sels[0].end); - this.Refresh(); - } - - void _textStore_InsertAtSelection(string i_value,ref int o_stratIndex,ref int o_endIndex) - { - TextStoreHelper.InsertTextAtSelection(this._Controller, i_value); - this.Refresh(); - } - - void Controller_SelectionChanged(object sender, EventArgs e) - { - //こうしないと選択できなくなってしまう - this.nowCaretMove = true; - SetValue(SelectedTextProperty, this._Controller.SelectedText); - SetValue(CaretPostionPropertyKey, this.Document.CaretPostion); - this.nowCaretMove = false; - if (this.textStore.IsLocked() == false) - this.textStore.NotifySelectionChanged(); - } - - Gripper hittedGripper; - void gestureRecongnizer_ManipulationStarted(GestureRecognizer sender, ManipulationStartedEventArgs e) - { - //Updateedの段階でヒットテストしてしまうとグリッパーを触ってもヒットしないことがある - this.hittedGripper = this.View.HitGripperFromPoint(e.Position); - } - - private void GestureRecongnizer_ManipulationInertiaStarting(GestureRecognizer sender, ManipulationInertiaStartingEventArgs args) - { - //sender.InertiaTranslationDeceleration = 0.001f; - //sender.InertiaExpansionDeceleration = 100.0f * 96.0f / 1000.0f; - //sender.InertiaRotationDeceleration = 720.0f / (1000.0f * 1000.0f); - } - - void gestureRecongnizer_ManipulationUpdated(GestureRecognizer sender, ManipulationUpdatedEventArgs e) - { - if (this._Controller.MoveCaretAndGripper(e.Position, this.hittedGripper)) - { - if (this.peer != null) - this.peer.OnNotifyCaretChanged(); - this.Refresh(); - return; - } - - if (e.Delta.Scale < 1) - { - double newSize = this.Render.FontSize - 1; - if (newSize < 1) - newSize = 1; - this.Render.FontSize = newSize; - this.Refresh(); - SetValue(MagnificationPowerPropertyKey, this.Render.FontSize / this.FontSize); - return; - } - - if (e.Delta.Scale > 1) - { - double newSize = this.Render.FontSize + 1; - if (newSize > 72) - newSize = 72; - this.Render.FontSize = newSize; - this.Refresh(); - SetValue(MagnificationPowerPropertyKey, this.Render.FontSize / this.FontSize); - return; - } - - Point translation = e.Delta.Translation; - - //Xの絶対値が大きければ横方向のスクロールで、そうでなければ縦方向らしい - if (Math.Abs(e.Cumulative.Translation.X) < Math.Abs(e.Cumulative.Translation.Y)) - { - int deltay = (int)Math.Abs(Math.Ceiling(translation.Y)); - if (translation.Y < 0) - this._Controller.ScrollByPixel(ScrollDirection.Down, deltay, false, false); - else - this._Controller.ScrollByPixel(ScrollDirection.Up, deltay, false, false); - this.Refresh(); - return; - } - - int deltax = (int)Math.Abs(Math.Ceiling(translation.X)); - if (deltax != 0) - { - if (translation.X < 0) - this._Controller.Scroll(ScrollDirection.Left, deltax, false, false); - else - this._Controller.Scroll(ScrollDirection.Right, deltax, false, false); - this.Refresh(); - } - } - - void gestureRecongnizer_ManipulationCompleted(GestureRecognizer sender, ManipulationCompletedEventArgs e) - { - } - - async void gestureRecongnizer_RightTapped(GestureRecognizer sender, RightTappedEventArgs e) - { - ResourceMap map = ResourceManager.Current.MainResourceMap.GetSubtree("FooEditEngine.Metro/Resources"); - ResourceContext context = ResourceContext.GetForCurrentView(); - if (this.View.HitTextArea(e.Position.X, e.Position.Y)) - { - FooContextMenuEventArgs args = new FooContextMenuEventArgs(e.Position); - if (this.ContextMenuOpening != null) - this.ContextMenuOpening(this, args); - if (!args.Handled) - { - PopupMenu ContextMenu = new PopupMenu(); - ContextMenu.Commands.Add(new UICommand(map.GetValue("CopyMenuName", context).ValueAsString, (command) => - { - this.CopyCommand(); - })); - ContextMenu.Commands.Add(new UICommand(map.GetValue("CutMenuName", context).ValueAsString, (command) => - { - this.CutCommand(); - })); - ContextMenu.Commands.Add(new UICommand(map.GetValue("PasteMenuName", context).ValueAsString, async (command) => - { - await this.PasteCommand(); - })); - if (this._Controller.RectSelection) - { - ContextMenu.Commands.Add(new UICommand(map.GetValue("LineSelectMenuName", context).ValueAsString, (command) => - { - this._Controller.RectSelection = false; - })); - } - else - { - ContextMenu.Commands.Add(new UICommand(map.GetValue("RectSelectMenuName", context).ValueAsString, (command) => - { - this._Controller.RectSelection = true; - })); - } - await ContextMenu.ShowAsync(Util.GetScreentPoint(e.Position,this)); - } - } - } - - void gestureRecongnizer_Tapped(GestureRecognizer sender, TappedEventArgs e) - { - bool touched = e.PointerDeviceType == PointerDeviceType.Touch; - this.Document.SelectGrippers.BottomLeft.Enabled = false; - this.Document.SelectGrippers.BottomRight.Enabled = touched; - this.JumpCaret(e.Position); - System.Diagnostics.Debug.WriteLine(e.TapCount); - if (e.TapCount == 2) - { - this.Document.SelectGrippers.BottomLeft.Enabled = touched; - //タッチスクリーンでダブルタップした場合、アンカーインデックスを単語の先頭にしないとバグる - this.Document.SelectWord(this.Controller.SelectionStart, touched); - this.Refresh(); - } - } - - void JumpCaret(Point p) - { - TextPoint tp = this.View.GetTextPointFromPostion(p); - if (tp == TextPoint.Null) - return; - - int index = this.View.LayoutLines.GetIndexFromTextPoint(tp); - - FoldingItem foldingData = this.View.HitFoldingData(p.X, tp.row); - if (foldingData != null) - { - if (foldingData.Expand) - this.View.LayoutLines.FoldingCollection.Collapse(foldingData); - else - this.View.LayoutLines.FoldingCollection.Expand(foldingData); - this._Controller.JumpCaret(foldingData.Start, false); - } - else - { - this._Controller.JumpCaret(tp.row, tp.col, false); - } - if (this.peer != null) - this.peer.OnNotifyCaretChanged(); - this.View.IsFocused = true; - this.Focus(FocusState.Programmatic); - this.Refresh(); - } - - void gestureRecongnizer_Dragging(GestureRecognizer sender, DraggingEventArgs e) - { - Point p = e.Position; - TextPointSearchRange searchRange; - if (this.View.HitTextArea(p.X, p.Y)) - searchRange = TextPointSearchRange.TextAreaOnly; - else if (this._Controller.SelectionLength > 0) - searchRange = TextPointSearchRange.Full; - else - return; - TextPoint tp = this.View.GetTextPointFromPostion(p, searchRange); - this._Controller.MoveCaretAndSelect(tp); - if (this.peer != null) - this.peer.OnNotifyCaretChanged(); - this.Refresh(); - } - - bool IsModiferKeyPressed(VirtualKey key) - { - CoreVirtualKeyStates state = Window.Current.CoreWindow.GetKeyState(key); - return (state & CoreVirtualKeyStates.Down) == CoreVirtualKeyStates.Down; - } - void Refresh(Rectangle updateRect) - { - if (this.rectangle.ActualWidth == 0 || this.rectangle.ActualHeight == 0 || this.Visibility == Windows.UI.Xaml.Visibility.Collapsed) - return; - - this.Render.DrawContent(this.View, this.IsEnabled, updateRect); - } - - - bool Resize(double width, double height) - { - if (width == 0 || height == 0) - throw new ArgumentOutOfRangeException(); - if (this.Render.Resize(this.rectangle, width, height)) - { - this.View.PageBound = new Rectangle(0, 0, width, height); - - if (this.horizontalScrollBar != null) - { - this.horizontalScrollBar.LargeChange = this.View.PageBound.Width; - this.horizontalScrollBar.Maximum = this.View.LongestWidth + this.horizontalScrollBar.LargeChange + 1; - } - if (this.verticalScrollBar != null) - { - this.verticalScrollBar.LargeChange = this.View.LineCountOnScreen; - this.verticalScrollBar.Maximum = this.View.LayoutLines.Count + this.verticalScrollBar.LargeChange + 1; - } - return true; - } - return false; - } - - void View_SrcChanged(object sender, EventArgs e) - { - if (this.horizontalScrollBar == null || this.verticalScrollBar == null) - return; - EditView view = this.View; - if (view.Src.Row > this.verticalScrollBar.Maximum) - this.verticalScrollBar.Maximum = view.Src.Row + view.LineCountOnScreen + 1; - double absoulteX = Math.Abs(view.Src.X); - if (absoulteX > this.horizontalScrollBar.Maximum) - this.horizontalScrollBar.Maximum = absoulteX + view.PageBound.Width + 1; - if (view.Src.Row != this.verticalScrollBar.Value) - this.verticalScrollBar.Value = view.Src.Row; - if (view.Src.X != this.horizontalScrollBar.Value) - this.horizontalScrollBar.Value = Math.Abs(view.Src.X); - } - - void FooTextBox_SizeChanged(object sender, SizeChangedEventArgs e) - { - if (this.Resize(this.rectangle.ActualWidth, this.rectangle.ActualHeight)) - { - this.Refresh(); - return; - } - } - - void horizontalScrollBar_Scroll(object sender, ScrollEventArgs e) - { - if (this.horizontalScrollBar == null) - return; - double toX; - if (this.FlowDirection == FlowDirection.LeftToRight) - toX = this.horizontalScrollBar.Value; - else - toX = -this.horizontalScrollBar.Value; - this._Controller.Scroll(toX, this.View.Src.Row, false, false); - this.Refresh(); - } - - void verticalScrollBar_Scroll(object sender, ScrollEventArgs e) - { - if (this.verticalScrollBar == null) - return; - int newRow = (int)this.verticalScrollBar.Value; - if (newRow >= this.View.LayoutLines.Count) - return; - this._Controller.Scroll(this.View.Src.X, newRow, false, false); - this.Refresh(); - } - - void Document_Update(object sender, DocumentUpdateEventArgs e) - { - if (this.textStore.IsLocked()) - return; - if (e.type == UpdateType.Replace) - TextStoreHelper.NotifyTextChanged(this.textStore, e.startIndex, e.removeLength, e.insertLength); - if(this.peer != null) - this.peer.OnNotifyTextChanged(); - } - - void FooTextBox_Loaded(object sender, RoutedEventArgs e) - { - this.Focus(FocusState.Programmatic); - } - - void timer_Tick(object sender, object e) - { - if (this.View.LayoutLines.HilightAll() || this.View.LayoutLines.GenerateFolding()) - this.Refresh(this.View.PageBound); - } - - /// - public static void OnPropertyChanged(object sender, DependencyPropertyChangedEventArgs e) - { - FooTextBox source = (FooTextBox)sender; - if(e.Property.Equals(SelectedTextProperty) && !source.nowCaretMove) - source._Controller.SelectedText = source.SelectedText; - if(e.Property.Equals(HilighterProperty)) - source.View.Hilighter = source.Hilighter; - if (e.Property.Equals(TextAntialiasModeProperty)) - source.Render.TextAntialiasMode = source.TextAntialiasMode; - if (e.Property.Equals(FoldingStrategyProperty)) - source.View.LayoutLines.FoldingStrategy = source.FoldingStrategy; - if (e.Property.Equals(IndentModeProperty)) - source.Controller.IndentMode = source.IndentMode; - if (e.Property.Equals(SelectionProperty) && !source.nowCaretMove) - source.Document.Select(source.Selection.Index,source.Selection.Length); - if (e.Property.Equals(CaretPostionPropertyKey) && !source.nowCaretMove) - source.JumpCaret(source.CaretPostion.row, source.CaretPostion.col); - if (e.Property.Equals(InsertModeProperty)) - source.View.InsertMode = source.InsertMode; - if (e.Property.Equals(TabCharsProperty)) - source.Document.TabStops = source.TabChars; - if (e.Property.Equals(RectSelectModeProperty)) - source._Controller.RectSelection = source.RectSelectMode; - if (e.Property.Equals(DrawCaretProperty)) - source.View.HideCaret = !source.DrawCaret; - if (e.Property.Equals(DrawCaretLineProperty)) - source.View.HideLineMarker = !source.DrawCaretLine; - if (e.Property.Equals(DrawLineNumberProperty)) - source.Document.DrawLineNumber = source.DrawLineNumber; - if(e.Property.Equals(MagnificationPowerPropertyKey)) - source.Render.FontSize = source.FontSize * source.MagnificationPower; - if (e.Property.Equals(FontFamilyProperty)) - source.Render.FontFamily = source.FontFamily; - if (e.Property.Equals(FontStyleProperty)) - source.Render.FontStyle = source.FontStyle; - if (e.Property.Equals(FontWeightProperty)) - source.Render.FontWeigth = source.FontWeight; - if (e.Property.Equals(FontSizeProperty)) - source.Render.FontSize = source.FontSize; - if (e.Property.Equals(ForegroundProperty)) - source.Render.Foreground = D2DRenderBase.ToColor4(source.Foreground); - if (e.Property.Equals(BackgroundProperty)) - source.Render.Background = D2DRenderBase.ToColor4(source.Background); - if (e.Property.Equals(ControlCharProperty)) - source.Render.ControlChar = D2DRenderBase.ToColor4(source.ControlChar); - if (e.Property.Equals(HilightProperty)) - source.Render.Hilight = D2DRenderBase.ToColor4(source.Hilight); - if (e.Property.Equals(Keyword1Property)) - source.Render.Keyword1 = D2DRenderBase.ToColor4(source.Keyword1); - if (e.Property.Equals(Keyword2Property)) - source.Render.Keyword2 = D2DRenderBase.ToColor4(source.Keyword2); - if (e.Property.Equals(CommentProperty)) - source.Render.Comment = D2DRenderBase.ToColor4(source.Comment); - if (e.Property.Equals(LiteralProperty)) - source.Render.Literal = D2DRenderBase.ToColor4(source.Literal); - if (e.Property.Equals(URLProperty)) - source.Render.Url = D2DRenderBase.ToColor4(source.URL); - if (e.Property.Equals(InsertCaretProperty)) - source.Render.InsertCaret = D2DRenderBase.ToColor4(source.InsertCaret); - if (e.Property.Equals(OverwriteCaretProperty)) - source.Render.OverwriteCaret = D2DRenderBase.ToColor4(source.OverwriteCaret); - if (e.Property.Equals(PaddingProperty)) - source.View.Padding = new Padding((int)source.Padding.Left, (int)source.Padding.Top, (int)source.Padding.Right, (int)source.Padding.Bottom); - if (e.Property.Equals(LineMarkerProperty)) - source.Render.LineMarker = D2DRenderBase.ToColor4(source.LineMarker); - if (e.Property.Equals(MarkURLProperty)) - source.Document.UrlMark = source.MarkURL; - if (e.Property.Equals(ShowFullSpaceProperty)) - source.Render.ShowFullSpace = source.ShowFullSpace; - if (e.Property.Equals(ShowHalfSpaceProperty)) - source.Render.ShowHalfSpace = source.ShowHalfSpace; - if (e.Property.Equals(ShowTabProperty)) - source.Render.ShowTab = source.ShowTab; - if (e.Property.Equals(ShowLineBreakProperty)) - source.Render.ShowLineBreak = source.ShowLineBreak; - if (e.Property.Equals(LineBreakProperty)) - source.Document.LineBreak = source.LineBreakMethod; - if (e.Property.Equals(LineBreakCharCountProperty)) - source.Document.LineBreakCharCount = source.LineBreakCharCount; - if (e.Property.Equals(UpdateAreaProperty)) - source.Render.UpdateArea = D2DRenderBase.ToColor4(source.UpdateArea); - if (e.Property.Equals(LineNumberProperty)) - source.Render.LineNumber = D2DRenderBase.ToColor4(source.LineNumber); - if (e.Property.Equals(FlowDirectionProperty)) - { - source.Document.RightToLeft = source.FlowDirection == Windows.UI.Xaml.FlowDirection.RightToLeft; - if(source.horizontalScrollBar != null) - source.horizontalScrollBar.FlowDirection = source.FlowDirection; - } - if (e.Property.Equals(DrawRulerProperty)) - { - source.Document.HideRuler = !source.DrawRuler; - source._Controller.JumpCaret(source.Document.CaretPostion.row, source.Document.CaretPostion.col); - } - } - #endregion - - #region event - - /// - /// コンテキストメニューが表示されるときに呼び出されます - /// - public event EventHandler ContextMenuOpening; - - #endregion - - #region property - - internal Controller Controller - { - get - { - return this._Controller; - } - } - - /// - /// 文字列の描写に使用されるアンチエイリアシング モードを表します - /// - public TextAntialiasMode TextAntialiasMode - { - get { return (TextAntialiasMode)GetValue(TextAntialiasModeProperty); } - set { SetValue(TextAntialiasModeProperty, value); } - } - - /// - /// TextAntialiasModeの依存プロパティを表す - /// - public static readonly DependencyProperty TextAntialiasModeProperty = - DependencyProperty.Register("TextAntialiasMode", typeof(TextAntialiasMode), typeof(FooTextBox), new PropertyMetadata(TextAntialiasMode.Default, OnPropertyChanged)); - - /// - /// シンタックスハイライターを表す - /// - public IHilighter Hilighter - { - get { return (IHilighter)GetValue(HilighterProperty); } - set { SetValue(HilighterProperty, value); } - } - - /// - /// Hilighterの依存プロパティを表す - /// - public static readonly DependencyProperty HilighterProperty = - DependencyProperty.Register("Hilighter", typeof(IHilighter), typeof(FooTextBox), new PropertyMetadata(null, OnPropertyChanged)); - - /// - /// フォールティングを作成するインターフェイスを表す - /// - public IFoldingStrategy FoldingStrategy - { - get { return (IFoldingStrategy)GetValue(FoldingStrategyProperty); } - set { SetValue(FoldingStrategyProperty, value); } - } - - /// - /// FoldingStrategyの依存プロパティ - /// - public static readonly DependencyProperty FoldingStrategyProperty = - DependencyProperty.Register("FoldingStrategy", typeof(IFoldingStrategy), typeof(FooTextBox), new PropertyMetadata(null,OnPropertyChanged)); - - /// - /// マーカーパターンセットを表す - /// - public MarkerPatternSet MarkerPatternSet - { - get - { - return this.Document.MarkerPatternSet; - } - } - - /// - /// ドキュメントを表す - /// - public Document Document - { - get - { - return this._Document; - } - set - { - Document old_doc = this._Document; - int oldLength = 0; - if (this._Document != null) - { - old_doc.Update -= new DocumentUpdateEventHandler(Document_Update); - old_doc.LoadProgress -= _Document_LoadProgress; - oldLength = old_doc.Length; - } - - this._Document = value; - this._Document.LayoutLines.Render = this.Render; - this._Document.Update += new DocumentUpdateEventHandler(Document_Update); - this._Document.LoadProgress += _Document_LoadProgress; - //初期化が終わっていればすべて存在する - if (this.Controller != null && this.View != null && this.textStore != null) - { - this.Controller.Document = value; - this.View.Document = value; - this.Controller.AdjustCaret(); - this.textStore.NotifyTextChanged(oldLength, value.Length); - - //依存プロパティとドキュメント内容が食い違っているので再設定する - this.ShowFullSpace = value.ShowFullSpace; - this.ShowHalfSpace = value.ShowHalfSpace; - this.ShowLineBreak = value.ShowLineBreak; - this.ShowTab = value.ShowTab; - this.FlowDirection = value.RightToLeft ? FlowDirection.RightToLeft : FlowDirection.LeftToRight; - this.IndentMode = value.IndentMode; - this.DrawCaretLine = !value.HideLineMarker; - this.InsertMode = value.InsertMode; - this.DrawRuler = !value.HideRuler; - this.DrawLineNumber = value.DrawLineNumber; - this.MarkURL = value.UrlMark; - this.LineBreakMethod = value.LineBreak; - this.LineBreakCharCount = value.LineBreakCharCount; - this.TabChars = value.TabStops; - - this.Refresh(); - } - } - } - - private void _Document_LoadProgress(object sender, ProgressEventArgs e) - { - if(e.state == ProgressState.Start) - this.IsEnabled = false; - else if(e.state == ProgressState.Complete) - { - TextStoreHelper.NotifyTextChanged(this.textStore, 0, 0, this.Document.Length); - if (this.verticalScrollBar != null) - this.verticalScrollBar.Maximum = this.View.LayoutLines.Count; - this.View.CalculateLineCountOnScreen(); - this.IsEnabled = true; - } - } - - /// - /// レイアウト行を表す - /// - public LineToIndexTable LayoutLineCollection - { - get { return this.View.LayoutLines; } - } - - /// - /// 選択中の文字列を表す - /// - public string SelectedText - { - get { return (string)GetValue(SelectedTextProperty); } - set { SetValue(SelectedTextProperty, value); } - } - - /// - /// SelectedTextの依存プロパティを表す - /// - public static readonly DependencyProperty SelectedTextProperty = - DependencyProperty.Register("SelectedText", typeof(string), typeof(FooTextBox), new PropertyMetadata(null, OnPropertyChanged)); - - /// - /// インデントの方法を表す - /// - public IndentMode IndentMode - { - get { return (IndentMode)GetValue(IndentModeProperty); } - set { SetValue(IndentModeProperty, value); } - } - - /// - /// IndentModeの依存プロパティを表す - /// - public static readonly DependencyProperty IndentModeProperty = - DependencyProperty.Register("IndentMode", typeof(IndentMode), typeof(FooTextBox), new PropertyMetadata(IndentMode.Tab,OnPropertyChanged)); - - /// - /// 選択範囲を表す - /// - /// - /// Lengthが0の場合はキャレット位置を表します。 - /// 矩形選択モードの場合、選択範囲の文字数ではなく、開始位置から終了位置までの長さとなります - /// - public TextRange Selection - { - get { return (TextRange)GetValue(SelectionProperty); } - set { SetValue(SelectionProperty, value); } - } - - /// - /// Selectionの依存プロパティを表す - /// - public static readonly DependencyProperty SelectionProperty = - DependencyProperty.Register("Selection", typeof(TextRange), typeof(FooTextBox), new PropertyMetadata(TextRange.Null, OnPropertyChanged)); - - /// - /// 拡大率を表す - /// - public double MagnificationPower - { - get { return (double)GetValue(MagnificationPowerPropertyKey); } - set { SetValue(MagnificationPowerPropertyKey, value); } - } - - /// - /// 拡大率を表す依存プロパティ - /// - public static readonly DependencyProperty MagnificationPowerPropertyKey = - DependencyProperty.Register("MagnificationPower", typeof(double), typeof(FooTextBox), new PropertyMetadata(1.0, OnPropertyChanged)); - - /// - /// キャレット位置を表す - /// - public TextPoint CaretPostion - { - get { return (TextPoint)GetValue(CaretPostionPropertyKey); } - set { SetValue(CaretPostionPropertyKey, value); } - } - - static readonly DependencyProperty CaretPostionPropertyKey = - DependencyProperty.Register("CaretPostion", typeof(TextPoint), typeof(FooTextBox), new PropertyMetadata(new TextPoint(), OnPropertyChanged)); - - /// - /// レタリング方向を表す - /// - public new FlowDirection FlowDirection - { - get { return (FlowDirection)GetValue(FlowDirectionProperty); } - set { SetValue(FlowDirectionProperty, value); } - } - - /// - /// レタリング方向を表す。これは依存プロパティです - /// - public new static readonly DependencyProperty FlowDirectionProperty = - DependencyProperty.Register("FlowDirection", typeof(FlowDirection), typeof(FooTextBox), new PropertyMetadata(FlowDirection.LeftToRight,OnPropertyChanged)); - - /// - /// フォントファミリーを表す - /// - public new FontFamily FontFamily - { - get { return (FontFamily)GetValue(FontFamilyProperty); } - set { SetValue(FontFamilyProperty, value); } - } - - /// - /// FontFamilyの依存プロパティを表す - /// - public new static readonly DependencyProperty FontFamilyProperty = - DependencyProperty.Register("FontFamily", typeof(FontFamily), typeof(FooTextBox), new PropertyMetadata(new FontFamily("Cambria"), OnPropertyChanged)); - - /// - /// フォントサイズを表す - /// - public new double FontSize - { - get { return (double)GetValue(FontSizeProperty); } - set { SetValue(FontSizeProperty, value); } - } - - /// - /// FontSizeの依存プロパティを表す - /// - public new static readonly DependencyProperty FontSizeProperty = - DependencyProperty.Register("FontSize", typeof(double), typeof(FooTextBox), new PropertyMetadata(12.0,OnPropertyChanged)); - - /// - /// フォントスタイルを表す - /// - public new FontStyle FontStyle - { - get { return (FontStyle)GetValue(FontStyleProperty); } - set { SetValue(FontStyleProperty, value); } - } - - /// - /// FontStyleの依存プロパティを表す - /// - public new static readonly DependencyProperty FontStyleProperty = - DependencyProperty.Register("FontStyle", typeof(FontStyle), typeof(FooTextBox), new PropertyMetadata(FontStyle.Normal,OnPropertyChanged)); - - /// - /// フォントの幅を表す - /// - public new FontWeight FontWeight - { - get { return (FontWeight)GetValue(FontWeightProperty); } - set { SetValue(FontWeightProperty, value); } - } - - /// - /// FontWeigthの依存プロパティを表す - /// - public new static readonly DependencyProperty FontWeightProperty = - DependencyProperty.Register("FontWeigth", typeof(FontWeight), typeof(FooTextBox), new PropertyMetadata(FontWeights.Normal,OnPropertyChanged)); - - /// - /// デフォルトの文字色を表す。これは依存プロパティです - /// - public new Windows.UI.Color Foreground - { - get { return (Windows.UI.Color)GetValue(ForegroundProperty); } - set { SetValue(ForegroundProperty, value); } - } - - /// - /// Foregroundの依存プロパティを表す - /// - public new static readonly DependencyProperty ForegroundProperty = - DependencyProperty.Register("Foreground", typeof(Windows.UI.Color), typeof(FooTextBox), new PropertyMetadata(Colors.Black, OnPropertyChanged)); - - /// - /// 背景色を表す。これは依存プロパティです - /// - public new Windows.UI.Color Background - { - get { return (Windows.UI.Color)GetValue(BackgroundProperty); } - set { SetValue(BackgroundProperty, value); } - } - - /// - /// Backgroundの依存プロパティを表す - /// - public new static readonly DependencyProperty BackgroundProperty = - DependencyProperty.Register("Background", typeof(Windows.UI.Color), typeof(FooTextBox), new PropertyMetadata(Colors.White, OnPropertyChanged)); - - /// - /// コントロールコードの文字色を表す。これは依存プロパティです - /// - public Windows.UI.Color ControlChar - { - get { return (Windows.UI.Color)GetValue(ControlCharProperty); } - set { SetValue(ControlCharProperty, value); } - } - - /// - /// ControlCharの依存プロパティを表す - /// - public static readonly DependencyProperty ControlCharProperty = - DependencyProperty.Register("ControlChar", typeof(Windows.UI.Color), typeof(FooTextBox), new PropertyMetadata(Colors.Gray, OnPropertyChanged)); - - /// - /// 選択時の背景色を表す。これは依存プロパティです - /// - public Windows.UI.Color Hilight - { - get { return (Windows.UI.Color)GetValue(HilightProperty); } - set { SetValue(HilightProperty, value); } - } - - /// - /// Hilightの依存プロパティを表す - /// - public static readonly DependencyProperty HilightProperty = - DependencyProperty.Register("Hilight", typeof(Windows.UI.Color), typeof(FooTextBox), new PropertyMetadata(Colors.DeepSkyBlue, OnPropertyChanged)); - - /// - /// キーワード1の文字色を表す。これは依存プロパティです - /// - public Windows.UI.Color Keyword1 - { - get { return (Windows.UI.Color)GetValue(Keyword1Property); } - set { SetValue(Keyword1Property, value); } - } - - /// - /// Keyword1の依存プロパティを表す - /// - public static readonly DependencyProperty Keyword1Property = - DependencyProperty.Register("Keyword1", typeof(Windows.UI.Color), typeof(FooTextBox), new PropertyMetadata(Colors.Blue, OnPropertyChanged)); - - /// - /// キーワード2の文字色を表す。これは依存プロパティです - /// - public Windows.UI.Color Keyword2 - { - get { return (Windows.UI.Color)GetValue(Keyword2Property); } - set { SetValue(Keyword2Property, value); } - } - - /// - /// Keyword2の依存プロパティを表す - /// - public static readonly DependencyProperty Keyword2Property = - DependencyProperty.Register("Keyword2", typeof(Windows.UI.Color), typeof(FooTextBox), new PropertyMetadata(Colors.DarkCyan, OnPropertyChanged)); - - /// - /// コメントの文字色を表す。これは依存プロパティです - /// - public Windows.UI.Color Comment - { - get { return (Windows.UI.Color)GetValue(CommentProperty); } - set { SetValue(CommentProperty, value); } - } - - /// - /// Commentの依存プロパティを表す - /// - public static readonly DependencyProperty CommentProperty = - DependencyProperty.Register("Comment", typeof(Windows.UI.Color), typeof(FooTextBox), new PropertyMetadata(Colors.Green, OnPropertyChanged)); - - /// - /// 文字リテラルの文字色を表す。これは依存プロパティです - /// - public Windows.UI.Color Literal - { - get { return (Windows.UI.Color)GetValue(LiteralProperty); } - set { SetValue(LiteralProperty, value); } - } - - /// - /// Literalの依存プロパティを表す - /// - public static readonly DependencyProperty LiteralProperty = - DependencyProperty.Register("Literal", typeof(Windows.UI.Color), typeof(FooTextBox), new PropertyMetadata(Colors.Brown, OnPropertyChanged)); - - /// - /// URLの文字色を表す。これは依存プロパティです - /// - public Windows.UI.Color URL - { - get { return (Windows.UI.Color)GetValue(URLProperty); } - set { SetValue(URLProperty, value); } - } - - /// - /// URLの依存プロパティを表す - /// - public static readonly DependencyProperty URLProperty = - DependencyProperty.Register("URL", typeof(Windows.UI.Color), typeof(FooTextBox), new PropertyMetadata(Colors.Blue, OnPropertyChanged)); - - /// - /// 行更新フラグの色を表す - /// - public Windows.UI.Color UpdateArea - { - get { return (Windows.UI.Color)GetValue(UpdateAreaProperty); } - set { SetValue(UpdateAreaProperty, value); } - } - - /// - /// UpdateAreaの依存プロパティを表す - /// - public static readonly DependencyProperty UpdateAreaProperty = - DependencyProperty.Register("UpdateArea", typeof(Windows.UI.Color), typeof(FooTextBox), new PropertyMetadata(Colors.MediumSeaGreen, OnPropertyChanged)); - - /// - /// ラインマーカーの色を表す - /// - public Windows.UI.Color LineMarker - { - get { return (Windows.UI.Color)GetValue(LineMarkerProperty); } - set { SetValue(LineMarkerProperty, value); } - } - - /// - /// LineMarkerの依存プロパティを表す - /// - public static readonly DependencyProperty LineMarkerProperty = - DependencyProperty.Register("LineMarker", typeof(Windows.UI.Color), typeof(FooTextBox), new PropertyMetadata(Colors.Gray, OnPropertyChanged)); - - /// - /// 挿入モード時のキャレットの色を表す - /// - public Windows.UI.Color InsertCaret - { - get { return (Windows.UI.Color)GetValue(InsertCaretProperty); } - set { SetValue(InsertCaretProperty, value); } - } - - /// - /// InsertCaretの依存プロパティを表す - /// - public static readonly DependencyProperty InsertCaretProperty = - DependencyProperty.Register("InsertCaret", typeof(Windows.UI.Color), typeof(FooTextBox), new PropertyMetadata(Colors.Black, OnPropertyChanged)); - - /// - /// 上書きモード時のキャレット職を表す - /// - public Windows.UI.Color OverwriteCaret - { - get { return (Windows.UI.Color)GetValue(OverwriteCaretProperty); } - set { SetValue(OverwriteCaretProperty, value); } - } - - /// - /// OverwriteCaretの依存プロパティを表す - /// - public static readonly DependencyProperty OverwriteCaretProperty = - DependencyProperty.Register("OverwriteCaret", typeof(Windows.UI.Color), typeof(FooTextBox), new PropertyMetadata(Colors.Black, OnPropertyChanged)); - - /// - /// 行番号の色を表す - /// - public Windows.UI.Color LineNumber - { - get { return (Windows.UI.Color)GetValue(LineNumberProperty); } - set { SetValue(LineNumberProperty, value); } - } - - /// - /// Using a DependencyProperty as the backing store for LineNumber. This enables animation, styling, binding, etc... - /// - public static readonly DependencyProperty LineNumberProperty = - DependencyProperty.Register("LineNumber", typeof(Windows.UI.Color), typeof(FooTextBox), new PropertyMetadata(Colors.DimGray,OnPropertyChanged)); - - /// - /// 余白を表す - /// - public new Thickness Padding - { - get { return (Thickness)GetValue(PaddingProperty); } - set { SetValue(PaddingProperty, value); } - } - - /// - /// Paddingの依存プロパティを表す - /// - public new static readonly DependencyProperty PaddingProperty = - DependencyProperty.Register("Padding", typeof(Thickness), typeof(FooTextBox), new PropertyMetadata(new Thickness(),OnPropertyChanged)); - - /// - /// 挿入モードなら真を返し、そうでないなら、偽を返す。これは依存プロパティです - /// - public bool InsertMode - { - get { return (bool)GetValue(InsertModeProperty); } - set { SetValue(InsertModeProperty, value); } - } - - /// - /// InsertModeの依存プロパティを表す - /// - public static readonly DependencyProperty InsertModeProperty = - DependencyProperty.Register("InsertMode", - typeof(bool), - typeof(FooTextBox), - new PropertyMetadata(true, OnPropertyChanged)); - - /// - /// タブの文字数を表す。これは依存プロパティです - /// - public int TabChars - { - get { return (int)GetValue(TabCharsProperty); } - set { SetValue(TabCharsProperty, value); } - } - - /// - /// TabCharsの依存プロパティを表す - /// - public static readonly DependencyProperty TabCharsProperty = - DependencyProperty.Register("TabChars", - typeof(int), - typeof(FooTextBox), - new PropertyMetadata(4, OnPropertyChanged)); - - /// - /// 矩形選択モードなら真を返し、そうでないなら偽を返す。これは依存プロパティです - /// - public bool RectSelectMode - { - get { return (bool)GetValue(RectSelectModeProperty); } - set { SetValue(RectSelectModeProperty, value); } - } - - /// - /// RectSelectModeの依存プロパティを表す - /// - public static readonly DependencyProperty RectSelectModeProperty = - DependencyProperty.Register("RectSelectMode", typeof(bool), typeof(FooTextBox), new PropertyMetadata(false, OnPropertyChanged)); - - /// - /// 折り返しの方法を指定する - /// - /// - /// 変更した場合、レイアウトの再構築を行う必要があります - /// - public LineBreakMethod LineBreakMethod - { - get { return (LineBreakMethod)GetValue(LineBreakProperty); } - set { SetValue(LineBreakProperty, value); } - } - - /// - /// LineBreakMethodの依存プロパティを表す - /// - public static readonly DependencyProperty LineBreakProperty = - DependencyProperty.Register("LineBreakMethod", typeof(LineBreakMethod), typeof(FooTextBox), new PropertyMetadata(LineBreakMethod.None, OnPropertyChanged)); - - - /// - /// 折り返しの幅を指定する。LineBreakMethod.CharUnit以外の時は無視されます - /// - /// - /// 変更した場合、レイアウトの再構築を行う必要があります - /// - public int LineBreakCharCount - { - get { return (int)GetValue(LineBreakCharCountProperty); } - set { SetValue(LineBreakCharCountProperty, value); } - } - - /// - /// LineBreakCharCountの依存プロパティを表す - /// - public static readonly DependencyProperty LineBreakCharCountProperty = - DependencyProperty.Register("LineBreakCharCount", typeof(int), typeof(FooTextBox), new PropertyMetadata(80, OnPropertyChanged)); - - /// - /// キャレットを描くなら真。そうでないなら偽を返す。これは依存プロパティです - /// - public bool DrawCaret - { - get { return (bool)GetValue(DrawCaretProperty); } - set { SetValue(DrawCaretProperty, value); } - } - - /// - /// DrawCaretの依存プロパティを表す - /// - public static readonly DependencyProperty DrawCaretProperty = - DependencyProperty.Register("DrawCaret", typeof(bool), typeof(FooTextBox), new PropertyMetadata(true, OnPropertyChanged)); - - - /// - /// キャレットラインを描くなら真。そうでないなら偽を返す。これは依存プロパティです - /// - public bool DrawCaretLine - { - get { return (bool)GetValue(DrawCaretLineProperty); } - set { SetValue(DrawCaretLineProperty, value); } - } - - /// - /// DrawCaretLineの依存プロパティを表す - /// - public static readonly DependencyProperty DrawCaretLineProperty = - DependencyProperty.Register("DrawCaretLine", typeof(bool), typeof(FooTextBox), new PropertyMetadata(false, OnPropertyChanged)); - - /// - /// 行番号を描くなら真。そうでなければ偽。これは依存プロパティです - /// - public bool DrawLineNumber - { - get { return (bool)GetValue(DrawLineNumberProperty); } - set { SetValue(DrawLineNumberProperty, value); } - } - - /// - /// ルーラーを描くなら真。そうでなければ偽。これは依存プロパティです - /// - public bool DrawRuler - { - get { return (bool)GetValue(DrawRulerProperty); } - set { SetValue(DrawRulerProperty, value); } - } - - /// - /// DrawRulerの依存プロパティを表す - /// - public static readonly DependencyProperty DrawRulerProperty = - DependencyProperty.Register("DrawRuler", typeof(bool), typeof(FooTextBox), new PropertyMetadata(false, OnPropertyChanged)); - - - /// - /// DrawLineNumberの依存プロパティを表す - /// - public static readonly DependencyProperty DrawLineNumberProperty = - DependencyProperty.Register("DrawLineNumber", typeof(bool), typeof(FooTextBox), new PropertyMetadata(false, OnPropertyChanged)); - - /// - /// URLに下線を引くなら真。そうでないなら偽を表す。これは依存プロパティです - /// - public bool MarkURL - { - get { return (bool)GetValue(MarkURLProperty); } - set { SetValue(MarkURLProperty, value); } - } - - /// - /// MarkURLの依存プロパティを表す - /// - public static readonly DependencyProperty MarkURLProperty = - DependencyProperty.Register("MarkURL", typeof(bool), typeof(FooTextBox), new PropertyMetadata(false, OnPropertyChanged)); - - /// - /// 全角スペースを表示するなら真。そうでないなら偽 - /// - public bool ShowFullSpace - { - get { return (bool)GetValue(ShowFullSpaceProperty); } - set { SetValue(ShowFullSpaceProperty, value); } - } - - /// - /// ShowFullSpaceの依存プロパティを表す - /// - public static readonly DependencyProperty ShowFullSpaceProperty = - DependencyProperty.Register("ShowFullSpace", typeof(bool), typeof(FooTextBox), new PropertyMetadata(false, OnPropertyChanged)); - - /// - /// 半角スペースを表示するなら真。そうでないなら偽 - /// - public bool ShowHalfSpace - { - get { return (bool)GetValue(ShowHalfSpaceProperty); } - set { SetValue(ShowHalfSpaceProperty, value); } - } - - /// - /// ShowHalfSpaceの依存プロパティを表す - /// - public static readonly DependencyProperty ShowHalfSpaceProperty = - DependencyProperty.Register("ShowHalfSpace", typeof(bool), typeof(FooTextBox), new PropertyMetadata(false, OnPropertyChanged)); - - /// - /// タブを表示するなら真。そうでないなら偽 - /// - public bool ShowTab - { - get { return (bool)GetValue(ShowTabProperty); } - set { SetValue(ShowTabProperty, value); } - } - - /// - /// ShowTabの依存プロパティを表す - /// - public static readonly DependencyProperty ShowTabProperty = - DependencyProperty.Register("ShowTab", typeof(bool), typeof(FooTextBox), new PropertyMetadata(false, OnPropertyChanged)); - - /// - /// 改行マークを表示するなら真。そうでないなら偽 - /// - public bool ShowLineBreak - { - get { return (bool)GetValue(ShowLineBreakProperty); } - set { SetValue(ShowLineBreakProperty, value); } - } - - /// - /// ShowLineBreakの依存プロパティを表す - /// - public static readonly DependencyProperty ShowLineBreakProperty = - DependencyProperty.Register("ShowLineBreak", typeof(bool), typeof(FooTextBox), new PropertyMetadata(false,OnPropertyChanged)); - - - #endregion - - } - /// - /// コンテキストメニューのイベントデーターを表す - /// - public class FooContextMenuEventArgs - { - /// - /// 処理済みなら真。そうでないなら偽 - /// - public bool Handled = false; - /// - /// コンテキストメニューを表示すべき座標を表す - /// - public Windows.Foundation.Point Postion; - /// - /// コンストラクター - /// - /// - public FooContextMenuEventArgs(Windows.Foundation.Point pos) - { - this.Postion = pos; - } - } -} diff --git a/Metro/FooEditEngine/Print/ComInterface.cs b/Metro/FooEditEngine/Print/ComInterface.cs deleted file mode 100644 index 8cef6c3..0000000 --- a/Metro/FooEditEngine/Print/ComInterface.cs +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (C) 2013 FooProject - * * This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along with this program. If not, see . - */ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Security; -using System.Runtime.InteropServices; - -namespace FooEditEngine -{ - [ComImport] - [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] - [Guid("1b8efec4-3019-4c27-964e-367202156906")] - [SecurityCritical] - interface IPrintDocumentPackageTarget - { - void GetPackageTargetTypes([Out] out UInt32 targetCount, [Out] out Guid targetTypes); - void GetPackageTarget([In]ref Guid guidTargetType,[In]ref Guid riid,[Out] out IntPtr ppvTarget); - void Cancel(); - - }; - - [ComImport] - [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] - [Guid("0b31cc62-d7ec-4747-9d6e-f2537d870f2b")] - [SecurityCritical] - interface IPrintPreviewPageCollection - { - void Paginate( - [In] UInt32 currentJobPage, - [In, MarshalAs(UnmanagedType.Interface)] object printTaskOptions); - void MakePage( - [In] UInt32 desiredJobPage, - [In] float width, - [In]float height); - - }; - - [ComImport] - [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] - [Guid("a96bb1db-172e-4667-82b5-ad97a252318f")] - [SecurityCritical] - interface IPrintDocumentPageSource - { - void GetPreviewPageCollection([In, MarshalAs(UnmanagedType.Interface)]IPrintDocumentPackageTarget docPackageTarget, [Out, MarshalAs(UnmanagedType.Interface)] out IPrintPreviewPageCollection docPageCollection); - void MakeDocument([In, MarshalAs(UnmanagedType.Interface)] object printTaskOptions, [In, MarshalAs(UnmanagedType.Interface)]IPrintDocumentPackageTarget docPackageTarget); - } - - enum PageCountType - { - FinalPageCount = 0, - IntermediatePageCount = 1 - }; - - [ComImport] - [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] - [Guid("1a6dd0ad-1e2a-4e99-a5ba-91f17818290e")] //IID_PREVIEWPACKAGETARGET_DXGIと同じ - [SecurityCritical] - interface IPrintPreviewDxgiPackageTarget - { - void SetJobPageCount( - [In] PageCountType countType, - UInt32 count); - - void DrawPage( - [In]UInt32 jobPageNumber, - [In] IntPtr dxgiSurface, - float dpiX, - float dpiY); - - void InvalidatePreview(); - - }; - - static class PreviewPackageIds - { - public static string IID_PREVIEWPACKAGETARGET_DXGI = "1a6dd0ad-1e2a-4e99-a5ba-91f17818290e"; - } -} diff --git a/Metro/FooEditEngine/Print/D2DPrintPreviewRender.cs b/Metro/FooEditEngine/Print/D2DPrintPreviewRender.cs deleted file mode 100644 index 71d13f8..0000000 --- a/Metro/FooEditEngine/Print/D2DPrintPreviewRender.cs +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (C) 2013 FooProject - * * This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along with this program. If not, see . - */ -using System; -using System.Collections.Generic; -using Windows.Graphics.Display; -using Windows.UI.Xaml.Media; -using Windows.UI.Xaml.Media.Imaging; -using SharpDX; -using SharpDX.WIC; -using DXGI = SharpDX.DXGI; -using D2D = SharpDX.Direct2D1; -using D3D = SharpDX.Direct3D; -using D3D11 = SharpDX.Direct3D11; -using FooEditEngine.Metro; -using DotNetTextStore; -using DotNetTextStore.UnmanagedAPI.TSF; -using DotNetTextStore.UnmanagedAPI.WinDef; - -namespace FooEditEngine -{ - sealed class D2DPrintPreviewRender : D2DRenderBase, ITextRender, IPrintableTextRender - { - DXGI.Surface Surface; - D3D11.Texture2D Texture; - D2D.Device D2DDevice; - D2D.DeviceContext D2DContext; - D2D.Bitmap1 Bitmap; - Size Size; - float dpi; - - public D2DPrintPreviewRender(string fontName, double fontSize, Size size,float dpi) - : base() - { - this.Size = size; - this.dpi = dpi; - - base.ConstructDeviceResource(size.Width, size.Height); - base.InitTextFormat(fontName, (float)fontSize); - } - - public override void GetDpi(out float dpix, out float dpiy) - { - dpix = this.dpi; - dpiy = this.dpi; - } - - public void DrawContent(PrintableView view, IPrintPreviewDxgiPackageTarget target, uint page) - { - base.BegineDraw(); - view.Draw(view.PageBound); - base.EndDraw(); - target.DrawPage(page, this.Surface.NativePointer, this.dpi, this.dpi); - } - - public void Resize(float width,float height) - { - this.ReConstructDeviceResource(width, height); - } - - public void SetScale(float scale) - { - this.D2DContext.Transform = Matrix3x2.Scaling(1/scale); - } - - protected override D2D.RenderTarget ConstructRender(D2D.Factory1 factory, D2D.RenderTargetProperties prop, double width, double height) - { - D3D11.Texture2DDescription desc = new D3D11.Texture2DDescription(); - desc.Width = (int)(width * this.dpi / 96); - desc.Height = (int)(height * this.dpi / 96); - desc.Format = DXGI.Format.B8G8R8A8_UNorm; - desc.BindFlags = D3D11.BindFlags.RenderTarget | D3D11.BindFlags.ShaderResource; - desc.ArraySize = 1; - desc.MipLevels = 1; - desc.Usage = D3D11.ResourceUsage.Default; - desc.CpuAccessFlags = 0; - desc.SampleDescription = new DXGI.SampleDescription(1, 0); - this.Texture = new D3D11.Texture2D(base.D3DDevice, desc); - - this.Surface = this.Texture.QueryInterface(); - - this.D2DDevice = new D2D.Device(factory, this.DXGIDevice); - - this.D2DContext = new D2D.DeviceContext(this.D2DDevice, D2D.DeviceContextOptions.None); - - this.D2DContext.DotsPerInch = new Size2F(this.dpi, this.dpi); - - D2D.BitmapProperties1 bmpProp = new D2D.BitmapProperties1(); - bmpProp.BitmapOptions = D2D.BitmapOptions.Target | D2D.BitmapOptions.CannotDraw; - bmpProp.PixelFormat = new D2D.PixelFormat(DXGI.Format.B8G8R8A8_UNorm, D2D.AlphaMode.Premultiplied); - - this.Bitmap = new D2D.Bitmap1(this.D2DContext, this.Surface, bmpProp); - - this.D2DContext.Target = this.Bitmap; - - return this.D2DContext; - } - - protected override void ConstrctedResource() - { - } - - protected override void DestructRender() - { - if (this.Texture != null) - this.Texture.Dispose(); - if (this.Surface != null) - this.Surface.Dispose(); - if (this.Bitmap != null) - this.Bitmap.Dispose(); - if (this.D2DDevice != null) - this.D2DDevice.Dispose(); - if (this.D2DContext != null) - this.D2DContext.Dispose(); - } - - protected override void ReCreateTarget() - { - } - - public float HeaderHeight - { - get { return (float)this.emSize.Height; } - } - - public float FooterHeight - { - get { return (float)this.emSize.Height; } - } - } -} diff --git a/Metro/FooEditEngine/Print/D2DPrintRender.cs b/Metro/FooEditEngine/Print/D2DPrintRender.cs deleted file mode 100644 index 5db0156..0000000 --- a/Metro/FooEditEngine/Print/D2DPrintRender.cs +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright (C) 2013 FooProject - * * This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along with this program. If not, see . - */ -using System; -using System.Collections.Generic; -using Windows.Graphics.Display; -using Windows.UI.Xaml.Media; -using Windows.UI.Xaml.Media.Imaging; -using SharpDX; -using SharpDX.WIC; -using DXGI = SharpDX.DXGI; -using D2D = SharpDX.Direct2D1; -using D3D = SharpDX.Direct3D; -using D3D11 = SharpDX.Direct3D11; -using FooEditEngine.Metro; -using DotNetTextStore; -using DotNetTextStore.UnmanagedAPI.TSF; -using DotNetTextStore.UnmanagedAPI.WinDef; - -namespace FooEditEngine -{ - sealed class D2DPrintRender : D2DRenderBase, ITextRender, IPrintableTextRender - { - D2D.Device D2DDevice; - D2D.DeviceContext D2DContext; - D2D.PrintControl Control; - D2D.CommandList CommandList; - Size2F Size; - ImagingFactory WICFactory = new ImagingFactory(); - int dpi; - - public D2DPrintRender(string fontName,double fontSize, Size size, uint dpi, IPrintDocumentPackageTarget docPackageTarget) - : base() - { - base.ConstructDeviceResource(size.Width, size.Height); - base.InitTextFormat(fontName, (float)fontSize); - - this.CreateSurface(size,dpi,docPackageTarget); - } - - public override void GetDpi(out float dpix, out float dpiy) - { - dpix = this.dpi; - dpiy = this.dpi; - } - - public void DrawContent(PrintableView view) - { - this.CommandList = new D2D.CommandList(this.D2DContext); - this.D2DContext.Target = this.CommandList; - base.BegineDraw(); - view.Draw(view.PageBound); - base.EndDraw(); - this.CommandList.Close(); - this.Control.AddPage(this.CommandList, this.Size); - this.CommandList.Dispose(); - } - - void CreateSurface(Size size, uint dpi, IPrintDocumentPackageTarget docPackageTarget) - { - D2D.PrintControlProperties printControlProperties = new D2D.PrintControlProperties(); - printControlProperties.RasterDPI = dpi; - printControlProperties.ColorSpace = D2D.ColorSpace.SRgb; - printControlProperties.FontSubset = D2D.PrintFontSubsetMode.Default; - - this.Control = new D2D.PrintControl(this.D2DDevice, this.WICFactory, new ComObject(docPackageTarget), printControlProperties); - - this.Size = new Size2F((float)size.Width, (float)size.Height); - - this.dpi = (int)dpi; - } - - protected override D2D.RenderTarget ConstructRender(D2D.Factory1 factory, D2D.RenderTargetProperties prop, double width, double height) - { - this.D2DDevice = new D2D.Device(factory,this.DXGIDevice); - this.D2DContext = new D2D.DeviceContext(this.D2DDevice, D2D.DeviceContextOptions.None); - return this.D2DContext; - } - - protected override void ConstrctedResource() - { - } - - protected override void DestructRender() - { - if (this.Control != null) - { - this.Control.Close(); - this.Control.Dispose(); - } - if (this.WICFactory != null) - this.WICFactory.Dispose(); - if (this.D2DDevice != null) - this.D2DDevice.Dispose(); - if (this.D2DContext != null) - this.D2DContext.Dispose(); - } - - protected override void ReCreateTarget() - { - } - - public float HeaderHeight - { - get { return (float)this.emSize.Height; } - } - - public float FooterHeight - { - get { return (float)this.emSize.Height; } - } - } -} diff --git a/Metro/FooEditEngine/Print/DocumentSource.cs b/Metro/FooEditEngine/Print/DocumentSource.cs deleted file mode 100644 index ad90e81..0000000 --- a/Metro/FooEditEngine/Print/DocumentSource.cs +++ /dev/null @@ -1,302 +0,0 @@ -/* - * Copyright (C) 2013 FooProject - * * This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along with this program. If not, see . - */ -using System; -using Windows.Graphics.Display; -using Windows.Graphics.Printing; -using System.Runtime.InteropServices; -using Windows.UI; -using FooEditEngine.Metro; - -namespace FooEditEngine -{ - /// - /// イベントデータ - /// - public sealed class ParseCommandEventArgs - { - /// - /// 印刷中のページ番号 - /// - public int PageNumber; - /// - /// ページ範囲内で許容されている最大の番号 - /// - public int MaxPageNumber; - /// - /// 処理前の文字列 - /// - public string Original; - /// - /// コンストラクター - /// - /// 印刷中のページ番号 - /// 印刷すべき最大のページ番号 - /// 処理前の文字列 - public ParseCommandEventArgs(int nowPage, int maxPage, string org) - { - this.PageNumber = nowPage; - this.MaxPageNumber = maxPage; - this.Original = org; - } - } - - /// - /// コマンド処理用デリゲート - /// - /// 送信元のクラス - /// イベントデータ - /// 処理後の文字列 - public delegate string ParseCommandHandler(object sender, ParseCommandEventArgs e); - - - sealed class PrintableViewFactory - { - Windows.UI.Color foreground, comment, keyword1, keyword2, literal, url; - string fontName; - double fontSize; - LineBreakMethod lineBreakMethod; - int lineBreakCharCount, tabCount; - Document document; - bool urlMark; - IHilighter hilighter; - float displayDpi; - Padding padding; - public PrintableViewFactory(FooTextBox textbox,Padding padding) - { - this.foreground = textbox.Foreground; - this.comment = textbox.Comment; - this.keyword1 = textbox.Keyword1; - this.keyword2 = textbox.Keyword2; - this.literal = textbox.Literal; - this.url = textbox.URL; - this.fontName = textbox.FontFamily.Source; - this.fontSize = textbox.FontSize; - this.tabCount = textbox.TabChars; - this.document = textbox.Document; - this.lineBreakMethod = textbox.LineBreakMethod; - this.lineBreakCharCount = textbox.LineBreakCharCount; - this.drawLineNumber = textbox.DrawLineNumber; - this.urlMark = textbox.MarkURL; - this.hilighter = textbox.Hilighter; - this.displayDpi = DisplayInformation.GetForCurrentView().LogicalDpi; - this.padding = padding; - this.EnableHilight = true; - } - public D2DPrintRender CreateRender(PrintPageDescription pagedesc, IPrintDocumentPackageTarget docPackageTarget) - { - D2DPrintRender render; - Size size = new Size(pagedesc.ImageableRect.Width, pagedesc.ImageableRect.Height); - render = new D2DPrintRender(this.fontName, this.fontSize, size, Math.Min(pagedesc.DpiX, pagedesc.DpiY), docPackageTarget); - render.Foreground = D2DRenderBase.ToColor4(this.foreground); - render.Comment = D2DRenderBase.ToColor4(this.comment); - render.Keyword1 = D2DRenderBase.ToColor4(this.keyword1); - render.Keyword2 = D2DRenderBase.ToColor4(this.keyword2); - render.Literal = D2DRenderBase.ToColor4(this.literal); - render.Url = D2DRenderBase.ToColor4(this.url); - return render; - } - public D2DPrintPreviewRender CreateRender(PrintPageDescription pagedesc) - { - D2DPrintPreviewRender render; - Size size = new Size(pagedesc.ImageableRect.Width, pagedesc.ImageableRect.Height); - render = new D2DPrintPreviewRender(this.fontName, this.fontSize, size, this.displayDpi); - render.Foreground = D2DRenderBase.ToColor4(this.foreground); - render.Comment = D2DRenderBase.ToColor4(this.comment); - render.Keyword1 = D2DRenderBase.ToColor4(this.keyword1); - render.Keyword2 = D2DRenderBase.ToColor4(this.keyword2); - render.Literal = D2DRenderBase.ToColor4(this.literal); - render.Url = D2DRenderBase.ToColor4(this.url); - return render; - } - public PrintableView CreateView(PrintPageDescription pagedesc, IPrintableTextRender render, string header, string footer) - { - Document documentSnap = new Document(this.document); - documentSnap.LayoutLines.Render = render; - PrintableView view = new PrintableView(documentSnap, render,padding); - view.Header = header; - view.Footer = footer; - view.PageBound = new Rectangle(pagedesc.ImageableRect.X, pagedesc.ImageableRect.Y, pagedesc.ImageableRect.Width, pagedesc.ImageableRect.Height); - view.Hilighter = this.EnableHilight ? this.hilighter : null; - documentSnap.DrawLineNumber = this.drawLineNumber; - view.PerfomLayouts(); - - return view; - } - - public bool drawLineNumber - { - get; - set; - } - - public bool EnableHilight - { - get; - set; - } - } - - sealed class DocumentSource : IPrintDocumentPageSource, IPrintPreviewPageCollection, IPrintDocumentSource,IPrintPreviewSource - { - IPrintPreviewDxgiPackageTarget dxgiPreviewTarget; - bool paginateCalled = false; - Size imageRect; - PrintableViewFactory factory; - D2DPrintPreviewRender previewRender; - PrintableView previewView; - int maxPreviePageCount; - - public ParseCommandHandler ParseHF; - public string Header = string.Empty; - public string Fotter = string.Empty; - - public DocumentSource(FooTextBox textbox,Padding padding) - { - this.factory = new PrintableViewFactory(textbox, padding); - } - - internal enum SyntaxHilightApplibility - { - Apply, - NoApply, - } - - [DisplayPrintOptionResourceID("SyntaxHilight")] - internal SyntaxHilightApplibility EnableHilight - { - get - { - return this.factory.EnableHilight ? SyntaxHilightApplibility.Apply : SyntaxHilightApplibility.NoApply; - } - set - { - this.factory.EnableHilight = value == SyntaxHilightApplibility.Apply; - } - } - - internal enum LineNumberVisiblity - { - Visible, - Hidden - } - - [DisplayPrintOptionResourceID("ShowLineNumber")] - internal LineNumberVisiblity ShowLineNumber - { - get - { - return this.factory.drawLineNumber ? LineNumberVisiblity.Visible : LineNumberVisiblity.Hidden; - } - set - { - this.factory.drawLineNumber = value == LineNumberVisiblity.Visible; - } - } - - public void GetPreviewPageCollection(IPrintDocumentPackageTarget docPackageTarget, out IPrintPreviewPageCollection docPageCollection) - { - Guid guid = new Guid(PreviewPackageIds.IID_PREVIEWPACKAGETARGET_DXGI); - IntPtr target; - docPackageTarget.GetPackageTarget(guid, guid, out target); - this.dxgiPreviewTarget = (IPrintPreviewDxgiPackageTarget)Marshal.GetObjectForIUnknown(target); - docPageCollection = (IPrintPreviewPageCollection)this; - } - - public void MakeDocument(object printTaskOptions, IPrintDocumentPackageTarget docPackageTarget) - { - PrintTaskOptions options = (PrintTaskOptions)printTaskOptions; - PrintPageDescription pagedesc = options.GetPageDescription(1); - - D2DPrintRender render = this.factory.CreateRender(pagedesc, docPackageTarget); - PrintableView view = this.factory.CreateView(pagedesc, render, this.Header, this.Fotter); - - bool result = false; - int currentPage = 0; - - while (!result) - { - if(!string.IsNullOrEmpty(this.Header)) - view.Header = this.ParseHF(this, new ParseCommandEventArgs(currentPage, this.maxPreviePageCount, this.Header)); - if (!string.IsNullOrEmpty(this.Fotter)) - view.Footer = this.ParseHF(this, new ParseCommandEventArgs(currentPage, this.maxPreviePageCount, this.Fotter)); - - render.DrawContent(view); - - result = view.TryPageDown(); - currentPage++; - } - - render.Dispose(); - view.Dispose(); - } - - public void Paginate(uint currentJobPage, object printTaskOptions) - { - PrintTaskOptions options = (PrintTaskOptions)printTaskOptions; - PrintPageDescription pagedesc = options.GetPageDescription(currentJobPage); - - this.imageRect = new Size(pagedesc.ImageableRect.Width, pagedesc.ImageableRect.Height); - - this.previewRender = this.factory.CreateRender(pagedesc); - this.previewView = this.factory.CreateView(pagedesc, this.previewRender, this.Header, this.Fotter); - - int maxPage = 1; - while (!this.previewView.TryPageDown()) - maxPage++; - - this.dxgiPreviewTarget.SetJobPageCount(PageCountType.FinalPageCount, (uint)maxPage); - - this.dxgiPreviewTarget.InvalidatePreview(); - - this.maxPreviePageCount = maxPage; - - this.paginateCalled = true; - } - - public void InvalidatePreview() - { - this.dxgiPreviewTarget.InvalidatePreview(); - } - - public void MakePage(uint desiredJobPage, float width, float height) - { - if (width <= 0 || height <= 0) - throw new COMException("", 0x70057/*E_INVALIDARG*/); - if (!this.paginateCalled) - return; - if (desiredJobPage == 0xFFFFFFFF) - desiredJobPage = 1; - - this.previewView.TryScroll(0, 0); //元に戻さないとページ番号が変わった時に正しく動作しない - - for (int i = 1; i < desiredJobPage; i++) - this.previewView.TryPageDown(); - - if (!string.IsNullOrEmpty(this.Header)) - this.previewView.Header = this.ParseHF(this, new ParseCommandEventArgs((int)desiredJobPage, this.maxPreviePageCount, this.Header)); - if (!string.IsNullOrEmpty(this.Fotter)) - this.previewView.Footer = this.ParseHF(this, new ParseCommandEventArgs((int)desiredJobPage, this.maxPreviePageCount, this.Fotter)); - - this.previewRender.Resize(width, height); - this.previewRender.SetScale((float)(this.previewView.PageBound.Width / width)); //BeginDraw()で倍率が1に戻る - - this.previewRender.DrawContent(this.previewView, this.dxgiPreviewTarget, desiredJobPage); - } - - public void Dispose() - { - if (this.previewView != null) - this.previewView.Dispose(); - if (this.previewRender != null) - this.previewRender.Dispose(); - } - } -} diff --git a/Metro/FooEditEngine/Print/PrintOptionBuilder.cs b/Metro/FooEditEngine/Print/PrintOptionBuilder.cs deleted file mode 100644 index 37c6041..0000000 --- a/Metro/FooEditEngine/Print/PrintOptionBuilder.cs +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (C) 2013 FooProject - * * This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along with this program. If not, see . - */ -using System; -using Windows.Graphics.Printing.OptionDetails; -using System.Reflection; -using Windows.ApplicationModel.Resources.Core; - -namespace FooEditEngine -{ - /// - /// 表示に使用するリソースID - /// - sealed class DisplayPrintOptionResourceIDAttribute : Attribute - { - public string ResourceID - { - get; - private set; - } - /// - /// コンストラクター - /// - /// リソースID - public DisplayPrintOptionResourceIDAttribute(string resourceID) - { - this.ResourceID = resourceID; - } - } - /// - /// IPrintPreviewSourceインターフェイス - /// - interface IPrintPreviewSource - { - /// - /// 再描写する - /// - void InvalidatePreview(); - } - /// - /// 印刷プレビューのカスタムオプションリストビルダー - /// - /// 印刷プレビューに表示させたいプロパティには「DisplayPrintOptionResourceID」属性を付ける必要があります。 - /// また、このプロパティはenumを継承した型でなければならず、リソースに「型名.値」という形で印刷プレビューに表示される名前を定義する必要があります。 - /// 定義しない場合、値がそのまま表示されます - /// - /// - /// IPrintPreviewSourceを継承したクラス - sealed class PrintOptionBuilder where T : IPrintPreviewSource - { - T PrintDocument; - /// - /// コンストラクター - /// - /// 対象となるオブジェクト - public PrintOptionBuilder(T source) - { - this.PrintDocument = source; - } - - /// - /// 印刷プレビューのオプションを作成する - /// - /// PrintTaskOptionDetailsオブジェクト - public void BuildPrintOption(PrintTaskOptionDetails details) - { - ResourceMap map = ResourceManager.Current.MainResourceMap.GetSubtree("FooEditEngine.Metro/Resources"); - ResourceContext context = ResourceContext.GetForCurrentView(); - - var properties = this.PrintDocument.GetType().GetRuntimeProperties(); - foreach(PropertyInfo property in properties) - { - DisplayPrintOptionResourceIDAttribute attr = property.GetCustomAttribute(); - if (attr == null) - continue; - string resourceName; - if(property.PropertyType.GetTypeInfo().IsEnum) - { - PrintCustomItemListOptionDetails iteminfo = details.CreateItemListOption(property.Name, map.GetValue(attr.ResourceID, context).ValueAsString); - foreach (var enumvalue in Enum.GetValues(property.PropertyType)) - { - string enumvalueStr = enumvalue.ToString(); - //リソース内部の"."は"/"に変換される - resourceName = property.PropertyType.Name + "/" + enumvalueStr; - ResourceCandidate resValue = map.GetValue(resourceName, context); -#if DEBUG - if(resValue == null) - System.Diagnostics.Debug.WriteLine("{0} is not defined by resource",resourceName.Replace('/','.')); -#endif - iteminfo.AddItem(enumvalueStr, resValue != null ? resValue.ValueAsString : enumvalueStr); - } - iteminfo.TrySetValue(property.GetValue(this.PrintDocument).ToString()); - details.DisplayedOptions.Add(property.Name); - } - } - - details.OptionChanged += details_OptionChanged; - } - - void details_OptionChanged(PrintTaskOptionDetails sender, PrintTaskOptionChangedEventArgs args) - { - string optionID = args.OptionId as string; - if (optionID == null) - return; - string optionValue = sender.Options[optionID].Value as string; - var property = this.GetRuntimeProperty(this.PrintDocument.GetType(),optionID); - if (property == null) - return; - if (property.PropertyType.GetTypeInfo().IsEnum) - { - Enum output = (Enum)Enum.Parse(property.PropertyType, optionValue); - property.SetMethod.Invoke(this.PrintDocument, new object[] { output }); - } - - this.PrintDocument.InvalidatePreview(); - } - - PropertyInfo GetRuntimeProperty(Type t,string name) - { - foreach(PropertyInfo property in t.GetRuntimeProperties()) - { - if (property.Name == name) - return property; - } - return null; - } - } -} diff --git a/Metro/FooEditEngine/Properties/AssemblyInfo.cs b/Metro/FooEditEngine/Properties/AssemblyInfo.cs deleted file mode 100644 index af65906..0000000 --- a/Metro/FooEditEngine/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// アセンブリに関する情報は、次の属性のセットを通して制御されます。 -// アセンブリに関連付けられている情報を変更するには、 -// これらの属性値を変更してください。 -[assembly: AssemblyTitle("FooEditEngnine")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("FooEditEngnine")] -[assembly: AssemblyCopyright("Copyright © 2013")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// アセンブリのバージョン情報は、以下の 4 つの値で構成されています: -// -// メジャー バージョン -// マイナー バージョン -// ビルド番号 -// リビジョン -// -// すべての値を指定するか、以下のように '*' を使用してビルドおよびリビジョン番号を -// 既定値にすることができます: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.20.0.0")] -[assembly: AssemblyFileVersion("1.20.0.0")] -[assembly: ComVisible(false)] \ No newline at end of file diff --git a/Metro/FooEditEngine/Themes/Generic.xaml b/Metro/FooEditEngine/Themes/Generic.xaml deleted file mode 100644 index b6b7f27..0000000 --- a/Metro/FooEditEngine/Themes/Generic.xaml +++ /dev/null @@ -1,86 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Metro/FooEditEngine/strings/en-US/Resources.resw b/Metro/FooEditEngine/strings/en-US/Resources.resw deleted file mode 100644 index 28533c4..0000000 --- a/Metro/FooEditEngine/strings/en-US/Resources.resw +++ /dev/null @@ -1,153 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Copy - - - Cut - - - Hidden - - - Visible - - - LineSelect - - - Paste - - - RectangleSelect - - - LineNumber - - - SyntaxHilight - - - Apply - - - Not Apply - - \ No newline at end of file diff --git a/Metro/FooEditEngine/strings/ja-JP/Resources.resw b/Metro/FooEditEngine/strings/ja-JP/Resources.resw deleted file mode 100644 index e0b8dc9..0000000 --- a/Metro/FooEditEngine/strings/ja-JP/Resources.resw +++ /dev/null @@ -1,153 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - コピー - - - 切り取り - - - 表示しない - - - 表示する - - - 行選択 - - - 貼り付け - - - 矩形選択 - - - 行番号 - - - シンタックスハイライト - - - 反映させる - - - 反映させない - - \ No newline at end of file diff --git a/Metro/Test.sln b/Metro/Test.sln deleted file mode 100644 index 0369201..0000000 --- a/Metro/Test.sln +++ /dev/null @@ -1,89 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.23107.0 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "Test\Test.csproj", "{D5A54EBE-15AC-48E9-819B-99314266B683}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FooEditEngine", "FooEditEngine\FooEditEngine.csproj", "{AC23EBF4-4CD0-43EA-9808-0E6DCD12E791}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotNetTextStore.Metro", "..\DotNetTextStore\DotNetTextStore.Metro.csproj", "{453C491E-EF3A-41AD-A725-8855C1CB2C84}" -EndProject -Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Core", "..\Core\Core.shproj", "{C244F4E5-45D2-4C1F-BD2A-A5CC90D9421B}" -EndProject -Global - GlobalSection(SharedMSBuildProjectFiles) = preSolution - ..\Core\Core.projitems*{ac23ebf4-4cd0-43ea-9808-0e6dcd12e791}*SharedItemsImports = 4 - ..\Core\Core.projitems*{c244f4e5-45d2-4c1f-bd2a-a5cc90d9421b}*SharedItemsImports = 13 - EndGlobalSection - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Debug|ARM = Debug|ARM - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|Any CPU = Release|Any CPU - Release|ARM = Release|ARM - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {D5A54EBE-15AC-48E9-819B-99314266B683}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D5A54EBE-15AC-48E9-819B-99314266B683}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D5A54EBE-15AC-48E9-819B-99314266B683}.Debug|Any CPU.Deploy.0 = Debug|Any CPU - {D5A54EBE-15AC-48E9-819B-99314266B683}.Debug|ARM.ActiveCfg = Debug|ARM - {D5A54EBE-15AC-48E9-819B-99314266B683}.Debug|ARM.Build.0 = Debug|ARM - {D5A54EBE-15AC-48E9-819B-99314266B683}.Debug|ARM.Deploy.0 = Debug|ARM - {D5A54EBE-15AC-48E9-819B-99314266B683}.Debug|x64.ActiveCfg = Debug|x64 - {D5A54EBE-15AC-48E9-819B-99314266B683}.Debug|x64.Build.0 = Debug|x64 - {D5A54EBE-15AC-48E9-819B-99314266B683}.Debug|x64.Deploy.0 = Debug|x64 - {D5A54EBE-15AC-48E9-819B-99314266B683}.Debug|x86.ActiveCfg = Debug|x86 - {D5A54EBE-15AC-48E9-819B-99314266B683}.Debug|x86.Build.0 = Debug|x86 - {D5A54EBE-15AC-48E9-819B-99314266B683}.Debug|x86.Deploy.0 = Debug|x86 - {D5A54EBE-15AC-48E9-819B-99314266B683}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D5A54EBE-15AC-48E9-819B-99314266B683}.Release|Any CPU.Deploy.0 = Release|Any CPU - {D5A54EBE-15AC-48E9-819B-99314266B683}.Release|ARM.ActiveCfg = Release|ARM - {D5A54EBE-15AC-48E9-819B-99314266B683}.Release|ARM.Build.0 = Release|ARM - {D5A54EBE-15AC-48E9-819B-99314266B683}.Release|ARM.Deploy.0 = Release|ARM - {D5A54EBE-15AC-48E9-819B-99314266B683}.Release|x64.ActiveCfg = Release|x64 - {D5A54EBE-15AC-48E9-819B-99314266B683}.Release|x64.Build.0 = Release|x64 - {D5A54EBE-15AC-48E9-819B-99314266B683}.Release|x64.Deploy.0 = Release|x64 - {D5A54EBE-15AC-48E9-819B-99314266B683}.Release|x86.ActiveCfg = Release|x86 - {D5A54EBE-15AC-48E9-819B-99314266B683}.Release|x86.Build.0 = Release|x86 - {D5A54EBE-15AC-48E9-819B-99314266B683}.Release|x86.Deploy.0 = Release|x86 - {AC23EBF4-4CD0-43EA-9808-0E6DCD12E791}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {AC23EBF4-4CD0-43EA-9808-0E6DCD12E791}.Debug|Any CPU.Build.0 = Debug|Any CPU - {AC23EBF4-4CD0-43EA-9808-0E6DCD12E791}.Debug|ARM.ActiveCfg = Debug|ARM - {AC23EBF4-4CD0-43EA-9808-0E6DCD12E791}.Debug|ARM.Build.0 = Debug|ARM - {AC23EBF4-4CD0-43EA-9808-0E6DCD12E791}.Debug|x64.ActiveCfg = Debug|x64 - {AC23EBF4-4CD0-43EA-9808-0E6DCD12E791}.Debug|x64.Build.0 = Debug|x64 - {AC23EBF4-4CD0-43EA-9808-0E6DCD12E791}.Debug|x86.ActiveCfg = Debug|x86 - {AC23EBF4-4CD0-43EA-9808-0E6DCD12E791}.Debug|x86.Build.0 = Debug|x86 - {AC23EBF4-4CD0-43EA-9808-0E6DCD12E791}.Release|Any CPU.ActiveCfg = Release|Any CPU - {AC23EBF4-4CD0-43EA-9808-0E6DCD12E791}.Release|Any CPU.Build.0 = Release|Any CPU - {AC23EBF4-4CD0-43EA-9808-0E6DCD12E791}.Release|ARM.ActiveCfg = Release|ARM - {AC23EBF4-4CD0-43EA-9808-0E6DCD12E791}.Release|ARM.Build.0 = Release|ARM - {AC23EBF4-4CD0-43EA-9808-0E6DCD12E791}.Release|x64.ActiveCfg = Release|x64 - {AC23EBF4-4CD0-43EA-9808-0E6DCD12E791}.Release|x64.Build.0 = Release|x64 - {AC23EBF4-4CD0-43EA-9808-0E6DCD12E791}.Release|x86.ActiveCfg = Release|x86 - {AC23EBF4-4CD0-43EA-9808-0E6DCD12E791}.Release|x86.Build.0 = Release|x86 - {453C491E-EF3A-41AD-A725-8855C1CB2C84}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {453C491E-EF3A-41AD-A725-8855C1CB2C84}.Debug|Any CPU.Build.0 = Debug|Any CPU - {453C491E-EF3A-41AD-A725-8855C1CB2C84}.Debug|ARM.ActiveCfg = Debug|Any CPU - {453C491E-EF3A-41AD-A725-8855C1CB2C84}.Debug|ARM.Build.0 = Debug|Any CPU - {453C491E-EF3A-41AD-A725-8855C1CB2C84}.Debug|x64.ActiveCfg = Debug|Any CPU - {453C491E-EF3A-41AD-A725-8855C1CB2C84}.Debug|x64.Build.0 = Debug|Any CPU - {453C491E-EF3A-41AD-A725-8855C1CB2C84}.Debug|x86.ActiveCfg = Debug|Any CPU - {453C491E-EF3A-41AD-A725-8855C1CB2C84}.Debug|x86.Build.0 = Debug|Any CPU - {453C491E-EF3A-41AD-A725-8855C1CB2C84}.Release|Any CPU.ActiveCfg = Release|Any CPU - {453C491E-EF3A-41AD-A725-8855C1CB2C84}.Release|Any CPU.Build.0 = Release|Any CPU - {453C491E-EF3A-41AD-A725-8855C1CB2C84}.Release|ARM.ActiveCfg = Release|Any CPU - {453C491E-EF3A-41AD-A725-8855C1CB2C84}.Release|ARM.Build.0 = Release|Any CPU - {453C491E-EF3A-41AD-A725-8855C1CB2C84}.Release|x64.ActiveCfg = Release|Any CPU - {453C491E-EF3A-41AD-A725-8855C1CB2C84}.Release|x64.Build.0 = Release|Any CPU - {453C491E-EF3A-41AD-A725-8855C1CB2C84}.Release|x86.ActiveCfg = Release|Any CPU - {453C491E-EF3A-41AD-A725-8855C1CB2C84}.Release|x86.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/Metro/Test/App.xaml b/Metro/Test/App.xaml deleted file mode 100644 index ef3fa2d..0000000 --- a/Metro/Test/App.xaml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - diff --git a/Metro/Test/App.xaml.cs b/Metro/Test/App.xaml.cs deleted file mode 100644 index e1273c9..0000000 --- a/Metro/Test/App.xaml.cs +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (C) 2013 FooProject - * * This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along with this program. If not, see . - */ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using Windows.ApplicationModel; -using Windows.ApplicationModel.Activation; -using Windows.Foundation; -using Windows.Foundation.Collections; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Controls.Primitives; -using Windows.UI.Xaml.Data; -using Windows.UI.Xaml.Input; -using Windows.UI.Xaml.Media; -using Windows.UI.Xaml.Navigation; -using Windows.UI.ApplicationSettings; -using Windows.UI.Popups; - -// 空のアプリケーション テンプレートについては、http://go.microsoft.com/fwlink/?LinkId=234227 を参照してください - -namespace Test -{ - /// - /// 既定の Application クラスを補完するアプリケーション固有の動作を提供します。 - /// - sealed partial class App : Application - { - bool SettingRegistored; - Popup Popup; - - /// - /// 単一アプリケーション オブジェクトを初期化します。これは、実行される作成したコードの - /// 最初の行であり、main() または WinMain() と論理的に等価です。 - /// - public App() - { - this.InitializeComponent(); - this.Suspending += OnSuspending; - } - - /// - /// アプリケーションがエンド ユーザーによって正常に起動されたときに呼び出されます。他のエントリ ポイントは、 - /// アプリケーションが特定のファイルを開くために呼び出されたときに - /// 検索結果やその他の情報を表示するために使用されます。 - /// - /// 起動要求とプロセスの詳細を表示します。 - protected override void OnLaunched(LaunchActivatedEventArgs args) - { - Frame rootFrame = Window.Current.Content as Frame; - - // ウィンドウに既にコンテンツが表示されている場合は、アプリケーションの初期化を繰り返さずに、 - // ウィンドウがアクティブであることだけを確認してください - if (rootFrame == null) - { - // ナビゲーション コンテキストとして動作するフレームを作成し、最初のページに移動します - rootFrame = new Frame(); - - if (args.PreviousExecutionState == ApplicationExecutionState.Terminated) - { - //TODO: 以前中断したアプリケーションから状態を読み込みます。 - } - - // フレームを現在のウィンドウに配置します - Window.Current.Content = rootFrame; - } - - if (rootFrame.Content == null) - { - // ナビゲーション スタックが復元されていない場合、最初のページに移動します。 - // このとき、必要な情報をナビゲーション パラメーターとして渡して、新しいページを - // 構成します - if (!rootFrame.Navigate(typeof(MainPage), args.Arguments)) - { - throw new Exception("Failed to create initial page"); - } - } - if (!this.SettingRegistored) - { - SettingsPane.GetForCurrentView().CommandsRequested += OnCommandsRequested; - this.SettingRegistored = true; - } - // 現在のウィンドウがアクティブであることを確認します - Window.Current.Activate(); - } - - void OnCommandsRequested(SettingsPane settingsPane, SettingsPaneCommandsRequestedEventArgs eventArgs) - { - var handler = new UICommandInvokedHandler(OnSettingsCommand); - - var policyCommand = new SettingsCommand("setting", "設定", handler); - eventArgs.Request.ApplicationCommands.Add(policyCommand); - } - - private void OnSettingsCommand(IUICommand command) - { - var settingsCommand = (SettingsCommand)command; - switch (settingsCommand.Id.ToString()) - { - case "setting": - ShowSettingsFlyout(); - break; - } - } - - void ShowSettingsFlyout() - { - var flyout = new Test.SettingsFlyout1(); - flyout.Show(); - } - - /// - /// アプリケーションの実行が中断されたときに呼び出されます。アプリケーションの状態は、 - /// アプリケーションが終了されるのか、メモリの内容がそのままで再開されるのか - /// わからない状態で保存されます。 - /// - /// 中断要求の送信元。 - /// 中断要求の詳細。 - private void OnSuspending(object sender, SuspendingEventArgs e) - { - var deferral = e.SuspendingOperation.GetDeferral(); - //TODO: アプリケーションの状態を保存してバックグラウンドの動作があれば停止します - deferral.Complete(); - } - } -} diff --git a/Metro/Test/AppSettings.cs b/Metro/Test/AppSettings.cs deleted file mode 100644 index 320bee5..0000000 --- a/Metro/Test/AppSettings.cs +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Copyright (C) 2013 FooProject - * * This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along with this program. If not, see . - */ -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using FooEditEngine; - -namespace Test -{ - public class AppSettings - { - public static AppSettings _thisInstance = new AppSettings(); - public static AppSettings Current - { - get - { - if (_thisInstance._LineBreakMethodList == null) - { - _thisInstance._LineBreakMethodList = new ObservableCollection(); - _thisInstance._LineBreakMethodList.Add(new LineBreakMethodItem("折りたたまない", LineBreakMethod.None)); - _thisInstance._LineBreakMethodList.Add(new LineBreakMethodItem("右端で折りたたむ", LineBreakMethod.PageBound)); - _thisInstance._LineBreakMethodList.Add(new LineBreakMethodItem("50字で折りたたむ", LineBreakMethod.CharUnit)); - _thisInstance._CurrentLineBreakMethod = _thisInstance._LineBreakMethodList[0]; - } - return _thisInstance; - } - } - - bool _IsRTL, _ShowRuler, _ShowLineNumber, _ShowLineMarker, _HilightXML, _IsVisible = true; - ObservableCollection _LineBreakMethodList; - LineBreakMethodItem _CurrentLineBreakMethod; - - public ObservableCollection LineBreakMethodList - { - get - { - return _LineBreakMethodList; - } - } - - public LineBreakMethodItem CurrentLineBreakMethod - { - get - { - return _CurrentLineBreakMethod; - } - set - { - this._CurrentLineBreakMethod = value; - if (ChangedSetting != null) - ChangedSetting(this, null); - } - } - - public bool IsVisible - { - get - { - return this._IsVisible; - } - set - { - this._IsVisible = value; - if (ChangedSetting != null) - ChangedSetting(this, null); - } - } - - public bool IsRTL - { - get - { - return _IsRTL; - } - set - { - _IsRTL = value; - if (ChangedSetting != null) - ChangedSetting(this, null); - } - } - - public bool ShowRuler - { - get - { - return _ShowRuler; - } - set - { - _ShowRuler = value; - if(ChangedSetting != null) - ChangedSetting(this, null); - } - } - - public bool ShowLineNumber - { - get - { - return _ShowLineNumber; - } - set - { - _ShowLineNumber = value; - if (ChangedSetting != null) - ChangedSetting(this, null); - } - } - - public bool ShowLineMarker - { - get - { - return _ShowLineMarker; - } - set - { - _ShowLineMarker = value; - if (ChangedSetting != null) - ChangedSetting(this, null); - } - } - - public bool HilightXML - { - get - { - return _HilightXML; - } - set - { - _HilightXML = value; - if (ChangedSetting != null) - ChangedSetting(this, null); - } - } - - public event EventHandler ChangedSetting; - } - public struct LineBreakMethodItem - { - string _Title; - LineBreakMethod _Method; - public string Title - { - get - { - return this._Title; - } - } - public LineBreakMethod Method - { - get - { - return this._Method; - } - } - public LineBreakMethodItem(string title, LineBreakMethod method) - { - this._Title = title; - this._Method = method; - } - } -} diff --git a/Metro/Test/Assets/Logo.png b/Metro/Test/Assets/Logo.png deleted file mode 100644 index e26771cb33a49bbef824aa333737181b0a5b09a3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 801 zcmeAS@N?(olHy`uVBq!ia0vp^(?FPm4M^HB7Cr(}k|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*9U+m=1foIEGZ*dUJQLud<^=L*gE#63Ho!PGzwUb%GPK6&5iF zt!p@aGNX}6(PVh|N)M-?0RNcTbjaWgEU8noxUax-n>&3Ay)#!y&O11y2sKEF zt72@XC1)RvT6Xw=y_`Ce)`nGULLL^lI$kwi^E+dQT7YeXY4GvlRR%kj1x$VZi%Bdd zz}2Giy=-_$h+v#(S+};)DuE4EM?_^qB_eDeo@&q%StD1F>L|*0ZC2sb-}llSMTM?O z6{b3iid~yk@VE7q7Wb+P8?H5IYp?pSVcLE~18m#ygK20HL@6W5woI~Fjlw$fX1U{xQA5a+t0 zH$WNIb=fNpWHo}M9#;K6eszDZKty_|-?j4iocj5#zotrWc;@;w`H@=mjsvS2wXX0_ zY}l$4@^sE?UcC)ji*L=Z&}P!xaL&2((OQlj2dv~pV-ifAS;ZsH1{`D!GY%yys5WH)f>ZLo5m%6XjuXdbKMR7MEHSyb{m!_{Afji&MT$_sz7 z>1{~MlIFe28FRN(GC_~;#Jp4ADipP+9hh|P#-&`vO-Upt3jE0@YLh(^55uYWl9g)Z RA3>Rb!PC{xWt~$(69A&hN*MqE diff --git a/Metro/Test/Assets/SmallLogo.png b/Metro/Test/Assets/SmallLogo.png deleted file mode 100644 index 1eb0d9d528c42f132872e8af4dc563081b0b9aff..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 329 zcmV-P0k-~$P)q$gGRCwC#*X;?zAP@%N+|i#I!$mrh zlQ>KU$Rdu>|JH&931_?y6Djl{gb>4nCV5pzDJ?S!mq|4ZejKj%i@j$H{#ML~2Y{DF z$=}bKPaz+UGt{v(4CTQQXym}&iW8{s!ew~XIE7NLjQpy#I2S$rous$~?f%DHT#B*+ zq=#!zc5=0FEqWFpB%UE(L807on!pidHPLgYO}XEgorrg;PB=8ipgQ5u5`&g_MQaRd zaU7Ao8XQMuuN21-s0PPTs1%38x_Yl3Fs-|Y4!C-;M-8g@n*v@1|s#GQ665=9@Rxy?u0YW0&WN+~=RXpPbVXXL4m7Aq=E6I0%{06TwRn=U9d8>exk> zD-Z%M3DNQ`bTLSEF=%NFyoHcAkD*CiXqljo*0E?o$GiDC4q}}|%*0WghLlK#npw?hecrM}Mw?`E(z5C8< z8&*b^!{>5?4aT89vdrgBgSc-x6JZD3F^l#*G(@OO*^1D%Eu7?HAy<3kTLqW9N{^#6vso zVQwY48q7)m{~xQ64RV7{E7Y=&T~?^05Ky`5oNQ8bLgFCPq9co^R09BVRS1OAmH;hU zC#q(N!gNqm!zU#%sv{r5mm-Uv8b-~a1F-;p^>)pnXfKge4s9?;;MFIr*fixPG}NBA z6_G5BEmeO6XXh(emkciB{7tA;iwC2^s^VzyU_h0@ae84ACMY`cIDEju=<`q|2QAEv zW_)W|i|9aknqdmS=#w73eW_csQ$8IhT^vY1^1;X3&J0{%*tcQq!gJpr3w?TJc~@5= zKV5sM{$3k>b#S$@CTkhIF*{v*u(F&$&Yq1naHxt8Mz2N%7aQ3(^VNRZahk1||7?Bl z*idzO_u)FhRj4cPzDO>YA>>lxAGaciEiX8Xzp1SVPv91};$OG3cC&8!v3{Jq^kH@8 UTIccK;hzT5*3#}uZuEx!0OwrBv;Y7A diff --git a/Metro/Test/Assets/StoreLogo.png b/Metro/Test/Assets/StoreLogo.png deleted file mode 100644 index dcb672712c6823a0c91548ded70a8acb85536b4d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 429 zcmV;e0aE^nP)NtYJa1l)bQ5qwGXpZbs7%2oRMd4y35$s&66(fxhNg8W02!vSn zdlrL2h^Fx+3=$z;kK{0D#MyeJ8WRWZcLSf(PcQ_mLOhrmC}O-tX^0c>5`YvCUZVsc zG-6#78ubjJ5nA;OX&^K(q=i6ZNE3m?kTwE^AqxZoLskfB3|S&1F=UO9!cY$g2@Lgu z;9{sJ1P9|X2L`r1#Gs8R{E^$PRrMaC86q| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Mouse - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Metro/Test/MainPage.xaml b/Metro/Test/MainPage.xaml deleted file mode 100644 index 493c59b..0000000 --- a/Metro/Test/MainPage.xaml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/Metro/Test/MainPage.xaml.cs b/Metro/Test/MainPage.xaml.cs deleted file mode 100644 index 3a1f40e..0000000 --- a/Metro/Test/MainPage.xaml.cs +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright (C) 2013 FooProject - * * This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along with this program. If not, see . - */ -using System; -using System.Collections.Generic; -using System.Text; -using System.IO; -using Windows.Graphics.Printing; -using Windows.Storage.Pickers; -using Windows.Storage; -using Windows.UI.ViewManagement; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Navigation; -using Windows.UI.ApplicationSettings; -using FooEditEngine; -using FooEditEngine.Metro; -using FooEditEngine.Test; - -// 空白ページのアイテム テンプレートについては、http://go.microsoft.com/fwlink/?LinkId=234238 を参照してください - -namespace Test -{ - /// - /// それ自体で使用できる空白ページまたはフレーム内に移動できる空白ページ。 - /// - public sealed partial class MainPage : Page - { - public MainPage() - { - this.InitializeComponent(); - this.Current_ChangedSetting(AppSettings.Current, null); - InputPane currentView = InputPane.GetForCurrentView(); - currentView.Showing += currentView_Showing; - currentView.Hiding += currentView_Hiding; - PrintManager.GetForCurrentView().PrintTaskRequested += MainPage_PrintTaskRequested; - } - - void MainPage_PrintTaskRequested(PrintManager sender, PrintTaskRequestedEventArgs args) - { - FooPrintText printtext = new FooPrintText(); - printtext.Fotter = "fotter"; - printtext.Header = "header"; - printtext.Padding = new FooEditEngine.Padding(20, 20, 20, 20); - printtext.Print(args.Request, "Text Print", this.fooTextBox); - } - - /// - /// このページがフレームに表示されるときに呼び出されます。 - /// - /// このページにどのように到達したかを説明するイベント データ。Parameter - /// プロパティは、通常、ページを構成するために使用します。 - protected override void OnNavigatedTo(NavigationEventArgs e) - { - AppSettings.Current.ChangedSetting += Current_ChangedSetting; - } - - void currentView_Hiding(InputPane sender, InputPaneVisibilityEventArgs args) - { - this.fooTextBox.Margin = new Thickness(0); - args.EnsuredFocusedElementInView = true; - } - - void currentView_Showing(InputPane sender, InputPaneVisibilityEventArgs args) - { - this.fooTextBox.Margin = new Thickness(0, 0, 0, args.OccludedRect.Height); - args.EnsuredFocusedElementInView = true; - } - - void Current_ChangedSetting(object sender, EventArgs e) - { - AppSettings setting = (AppSettings)sender; - this.fooTextBox.FlowDirection = setting.IsRTL ? FlowDirection.RightToLeft : FlowDirection.LeftToRight; - this.fooTextBox.DrawCaretLine = setting.ShowLineMarker; - this.fooTextBox.DrawLineNumber = setting.ShowLineNumber; - this.fooTextBox.DrawRuler = setting.ShowRuler; - if (setting.HilightXML) - { - System.Diagnostics.Debug.WriteLine("hilight enable"); - this.fooTextBox.Hilighter = new XmlHilighter(); - this.fooTextBox.LayoutLineCollection.HilightAll(); - } - else - { - System.Diagnostics.Debug.WriteLine("hilight disable"); - this.fooTextBox.Hilighter = null; - this.fooTextBox.LayoutLineCollection.ClearHilight(); - } - this.fooTextBox.Visibility = setting.IsVisible ? Visibility.Visible : Visibility.Collapsed; - this.fooTextBox.LineBreakMethod = setting.CurrentLineBreakMethod.Method; - this.fooTextBox.LineBreakCharCount = 50; - this.fooTextBox.PerfomLayouts(); - this.fooTextBox.Refresh(); - } - - private async void Button_Click(object sender, RoutedEventArgs e) - { - FileOpenPicker openPicker = new FileOpenPicker(); - - openPicker.ViewMode = PickerViewMode.List; - - // ファイル形式 - openPicker.FileTypeFilter.Add("*"); - - // 最初に表示される場所 - openPicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary; - - StorageFile file = await openPicker.PickSingleFileAsync(); - if (file != null) - { - this.fooTextBox.IsEnabled = false; - using (Stream stream = await file.OpenStreamForReadAsync()) - using(StreamReader reader = new StreamReader(stream)) - { - await this.fooTextBox.LoadFileAsync(reader,null); - this.fooTextBox.FoldingStrategy = new CharFoldingMethod('{', '}'); - this.fooTextBox.LayoutLineCollection.GenerateFolding(); - this.fooTextBox.IsEnabled = true; - this.fooTextBox.Refresh(); - } - } - } - - private async void Button_Click_1(object sender, RoutedEventArgs e) - { - FileSavePicker savePicker = new FileSavePicker(); - savePicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary; - savePicker.FileTypeChoices.Add("Text Types", new List() { ".txt" }); - savePicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary; - StorageFile file = await savePicker.PickSaveFileAsync(); - if (file != null) - { - using (Stream stream = await file.OpenStreamForWriteAsync()) - using (StreamWriter writer = new StreamWriter(stream)) - { - await this.fooTextBox.SaveFile(writer,null); - } - } - } - - } -} diff --git a/Metro/Test/Package.appxmanifest b/Metro/Test/Package.appxmanifest deleted file mode 100644 index 672d623..0000000 --- a/Metro/Test/Package.appxmanifest +++ /dev/null @@ -1,54 +0,0 @@ - - - - - Test - rirufa - Assets\StoreLogo.png - - - 6.3.0 - 6.3.0 - - - - - - - - - - - - - - - - - - - - - - - - - .txt - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Metro/Test/Properties/AssemblyInfo.cs b/Metro/Test/Properties/AssemblyInfo.cs deleted file mode 100644 index 6b6db9d..0000000 --- a/Metro/Test/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// アセンブリに関する情報は、次の属性のセットを通して制御されます。 -// アセンブリに関連付けられている情報を変更するには、 -// これらの属性値を変更してください。 -[assembly: AssemblyTitle("Test")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Test")] -[assembly: AssemblyCopyright("Copyright © 2013")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// アセンブリのバージョン情報は、以下の 4 つの値で構成されています: -// -// メジャー バージョン -// マイナー バージョン -// ビルド番号 -// リビジョン -// -// すべての値を指定するか、以下のように '*' を使用してビルドおよびリビジョン番号を -// 既定値にすることができます: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] -[assembly: ComVisible(false)] \ No newline at end of file diff --git a/Metro/Test/SettingsFlyout.xaml b/Metro/Test/SettingsFlyout.xaml deleted file mode 100644 index c2f2c5a..0000000 --- a/Metro/Test/SettingsFlyout.xaml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Metro/Test/SettingsFlyout.xaml.cs b/Metro/Test/SettingsFlyout.xaml.cs deleted file mode 100644 index 981b652..0000000 --- a/Metro/Test/SettingsFlyout.xaml.cs +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2013 FooProject - * * This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along with this program. If not, see . - */ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using Windows.Foundation; -using Windows.Foundation.Collections; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Controls.Primitives; -using Windows.UI.Xaml.Data; -using Windows.UI.Xaml.Input; -using Windows.UI.Xaml.Media; -using Windows.UI.Xaml.Navigation; - -// 空白ページのアイテム テンプレートについては、http://go.microsoft.com/fwlink/?LinkId=234238 を参照してください - -namespace Test -{ - /// - /// それ自体で使用できる空白ページまたはフレーム内に移動できる空白ページ。 - /// - public sealed partial class SettingsFlyout1 : SettingsFlyout - { - public SettingsFlyout1() - { - this.InitializeComponent(); - this.Content.DataContext = AppSettings.Current; - } - } -} diff --git a/Metro/Test/Test.csproj b/Metro/Test/Test.csproj deleted file mode 100644 index 575d20b..0000000 --- a/Metro/Test/Test.csproj +++ /dev/null @@ -1,169 +0,0 @@ - - - - - Debug - AnyCPU - {D5A54EBE-15AC-48E9-819B-99314266B683} - AppContainerExe - Properties - Test - Test - ja-JP - 512 - {BC8A1FFA-BEE3-4634-8014-F334798102B3};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Test_TemporaryKey.pfx - False - 8.1 - 12 - - EA35893B9079E8FF7C38A44C19AD824F8A9E3DDC - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE;NETFX_CORE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE;NETFX_CORE - prompt - 4 - - - true - bin\ARM\Debug\ - DEBUG;TRACE;NETFX_CORE - ;2008 - full - ARM - false - prompt - true - - - bin\ARM\Release\ - TRACE;NETFX_CORE - true - ;2008 - pdbonly - ARM - false - prompt - true - - - true - bin\x64\Debug\ - DEBUG;TRACE;NETFX_CORE - ;2008 - full - x64 - false - prompt - true - - - bin\x64\Release\ - TRACE;NETFX_CORE - true - ;2008 - pdbonly - x64 - false - prompt - true - - - true - bin\x86\Debug\ - DEBUG;TRACE;NETFX_CORE - ;2008 - full - x86 - false - prompt - true - - - bin\x86\Release\ - TRACE;NETFX_CORE - true - ;2008 - pdbonly - x86 - false - prompt - true - - - - App.xaml - - - - MainPage.xaml - - - - SettingsFlyout.xaml - - - - - Designer - - - - - - - - - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - Designer - MSBuild:Compile - - - - - {ac23ebf4-4cd0-43ea-9808-0e6dcd12e791} - FooEditEngine - - - - - - - 12.0 - - - - \ No newline at end of file diff --git a/Metro/Test/Test_TemporaryKey.pfx b/Metro/Test/Test_TemporaryKey.pfx deleted file mode 100644 index 67483226288122e3dd17db79ec9acef5053c7597..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2504 zcmY*Zc|6qX8~x5=%ozI`!(1{nOj9%VeJqu&u`e~*!-OI(k|j*CMkHIZWlc!jk+K%0 zYu8XHOJlo*OP7!#ck1)|-TS$JJm)>|I^}FhSE5e*!CQ|W?;zw?c(MFfs1L-?*tljmmmq_`oGOSoEHi| z4q0DYl8n*?gE@zxH0b!oa*L%HeILt;wVSJ#DqZdwaLXs%iBa7N%3Vx&tJZtVQc?YE zNW)NH+@g3|b;e|$d+-yj2)p}{-d07V)&OTN|(GyZu?YqUy4|62@c`|q?$7UU7tzW1eG}M23A|J(du(&5+HgdL8_?yYO zgg{IkXe7aS9*aiZ%lMU#`Bm1O-?BixHxtb#sR~a|Tus{h){D^m5|+l=LZGW2Uk`e1 z`2J7}?V8BWmBEw6r8-#{ZOPeL#YQ?zo%qcJ>*(B)r)D-PoGSudQ_~0-=*;{J%W{L^ z-y3=hNyU1cy?@kckBb*vsskbA3ZA;CpSJgo~OP@b{}QjcH?1gFAhQ9~TOZnSX5NU>=wsN;zC!!C7rXn9z3-0)-ruYx0|I=*ZsSaM{Tny|H@Gv zyV43cjJeu>NbW*}10sbivmBeU*s(tDZNQqsKFOc^_4SeUjVjqb!HsmQMYHUFE_{lJ zHQGWYR*S=dh826;!GmQswf!;Kq4aXK@E4l{t(b-K*nRG*5@JV8zsglUnIbnA{8SxM z;4c64PFt4YDLPNkjp@ojoh}yd-NcUzP-W!3r)GgB*<0tuIr*&OK5VSM?;R02;v#gP zKB@T(DK1$p@?z@=t~$*~aXmOnVBckvtco)zng+Rgrewyhtd5kJ-YX4Ydhh1HVD=c0 z#}H>~xnybOwKyNfVW$7|?(~wRm*%Z27P_&ZYL2^Wl$XK{=a-l-!ULZ)4kX0=fwtf^ zMcO3g#n(wZJ5yuvn^>?(g=?Dgf&o)nt#zPD54E-O${(3?Ff-KKroLb{a=!akMyQh& z;D2-?jcmu@R3$%vs^8!1X`cIfrS|o{2jD25f7HdLz?`^o`50S!7DFr;ZD4dWm3|OnEnHSB@#&KJR{TZHIQr~P&-30Hy^2~TV zdg%nbB4z}&=u>&@fOY=6bCjbiQz^q|w;1&mHp;a#&!>v(_+@NKc9cHH!em^`sFi>h z&~JNi6JrMmLjS}iLWBr|LO}ok5FGzCg^6Zp6F?d8V3!x50;mE?Y=#Fk08c;@P-8Qd zpFIMbd9bxN8}V#Z0nW3P7kgTX?GS&W62TdUz`;OJ5KUbGM6^O%0A#?2Js1Q80Kc-! z8wduZ0b4fyaQp!(TN$zWRp2t)3t;OYz@5!6{M;oCSpA#}Wh+niRY3$Ag!<3RIbp># z$Qia}2L=J`h5T;^^qKF8KyCq3ltW>vafKG+lAC@bpo9FLww= zx~?-h(Uv$W&51e?)NJvQI9pieeAS*)Aok*h@DodIBIZd2W zZhV(X`mXfgjH_(?pq?V>q;l%A_1coHDN*B8fVF7DHg!-jhz^drJ(}v+wAD`>Z!~EP z2|B{;5VGvuLC#PeWSYan>Te(;+r3C-9@QZUL|rWyOc0zRS^{VfSUXFt=o64)~Kc)-zl0t*aZ$fB94T zE+R~i5=0vlZI(i{caK0jTFNF`uMqjF-@dh!-?H#NZKF|P6A1)oCLfm+QIZ(+n2hYs z!W`P6^xjpty-TTy)Ckn`dj4r9xPgDM#z`~2#0nQ9NX^+!(yD{d86V%X zdS^;^ce>*3zB%q^YK*82)NdAJB&HTTbPgQ%uFRZEskq_UExFTrUooC5w^qRQjfUq& zTb1^y0%_$X?*e{Za%LquO1a) z%+#40b}&gqHD4Ug{4`phIE|0sZG#s#c6u$Lk3|ch*819Q>HWUphoJbs`d7y;b?3Db zx2Cf?6t=2go-Fg5auRz-(mPQ|!zF9kH;tFIl-vlxH{_v%%Xi4Vc4zmNH;V+oAz`D3DuHfrhc6_UNGO;*=Kn}EakKP1JSL0ajX3+Cj)u#~2$ zb75iifoqBMtms^oX{u#ola%JY069pz_F+2r{D5UhCq~5_y>ROy{N&PJ{6ymCOYOX0 z2-<{S2%Inu94`bc0TrhEYcF%O!+iWmuHw2AksWF2o8nO6NsViRPFxrX{I&3Fl{4tw L9t~d8A0O;*fX!EO -- 2.11.0