/// <summary> /// Initializes a new instance of the <see cref="NewLayoutViewModel" /> class. /// </summary> /// <param name="layout">The layout.</param> public NewLayoutViewModel(ILayoutInfo layout) { if (layout != null) { Name = layout.Name; Id = layout.Id; IsAdminLayout = layout.IsAdminLayout ?? false; LayoutString = layout.LayoutDefinition; } }
// // copied the source file by https://github.com/stackprobe/Factory/blob/master/SubTools/CopyLib.c // private static void DrawPic(DDPicture picture, ILayoutInfo layout) { if (Extra.TL == null) { DrawPic_Main(picture, layout); } else { ExtraInfo storedExtra = Extra; Extra.TL.Add(() => { ExtraInfo currExtra = Extra; Extra = storedExtra; DrawPic_Main(picture, layout); Extra = currExtra; return(false); }); } }
// // copied the source file by https://github.com/stackprobe/Factory/blob/master/SubTools/CopyLib.c // private static void DrawPic(DDPicture picture, ILayoutInfo layout_binding) { DrawInfo info = new DrawInfo() { Picture = picture, Layout = layout_binding, Extra = Extra, }; if (Extra.TL == null) { DrawPicMain(info); } else { Extra.TL.Add(() => { DrawPicMain(info); return(false); }); } }
/// <summary> /// Creates layout metadata. /// </summary> /// <param name="layout"> /// The layout. /// </param> /// <param name="includeColumns"> /// True to include column metadata; otherwise, false. /// </param> /// <returns> /// The <see cref="LayoutMetadata"/>. /// </returns> public LayoutMetadata CreateLayoutMetadata(ILayoutInfo layout, bool includeColumns) { var layoutMetadata = new LayoutMetadata { Id = layout.Id, Name = layout.Name, IsAdminLayout = layout.IsAdminLayout ?? false }; if (includeColumns) { var processMetadata = ProcessMetadataRepository.GetProcessMetadata(layout.ProcessSystemName); foreach (var gridColumn in GetGridColumns(layout.LayoutDefinition)) { if (gridColumn.SystemName == Constants.DerivedProcessDisplayNameColumnName) { layoutMetadata.Columns.Add(CreateDerivedProcessDisplayNameColumnMetadata(gridColumn)); continue; } IFieldMetadata field; if (!processMetadata.TryGetField(gridColumn.SystemName, out field)) { continue; } layoutMetadata.Columns.Add(CreateColumnMetadata(gridColumn, field)); if (field.BackcolorField != null) { layoutMetadata.Columns.Add(CreateBackcolorColumnMetadata(field)); } if (field.ColumnType == ColumnTypes.File) { layoutMetadata.Columns.Add(CreateFileUrlColumnMetadata(field)); } } } return layoutMetadata; }
// // copied the source file by https://github.com/stackprobe/Factory/blob/master/SubTools/CopyLib.c // private static void DrawPic_Main(DDPicture picture, ILayoutInfo layout) { // app > @ enter DrawPic // < app if (Extra.A != -1) { SetBlend(DX.DX_BLENDMODE_ALPHA, Extra.A); } else if (Extra.BlendAdd != -1) { SetBlend(DX.DX_BLENDMODE_ADD, Extra.BlendAdd); } else if (Extra.BlendInv) { SetBlend(DX.DX_BLENDMODE_INVSRC, 255); } if (Extra.Mosaic) { DX.SetDrawMode(DX.DX_DRAWMODE_NEAREST); } if (Extra.Bright.R != -1) { SetBright(Extra.Bright.R, Extra.Bright.G, Extra.Bright.B); } { FreeInfo u = layout as FreeInfo; if (u != null) { // ? 失敗 if ( Extra.IntPos ? DX.DrawModiGraph( DoubleTools.ToInt(u.LTX), DoubleTools.ToInt(u.LTY), DoubleTools.ToInt(u.RTX), DoubleTools.ToInt(u.RTY), DoubleTools.ToInt(u.RBX), DoubleTools.ToInt(u.RBY), DoubleTools.ToInt(u.LBX), DoubleTools.ToInt(u.LBY), picture.GetHandle(), 1 ) != 0 : DX.DrawModiGraphF( (float)u.LTX, (float)u.LTY, (float)u.RTX, (float)u.RTY, (float)u.RBX, (float)u.RBY, (float)u.LBX, (float)u.LBY, picture.GetHandle(), 1 ) != 0 ) { if (Extra.IgnoreError == false) { throw new DDError(); } } goto endDraw; } } { RectInfo u = layout as RectInfo; if (u != null) { // ? 失敗 if ( Extra.IntPos ? DX.DrawExtendGraph( DoubleTools.ToInt(u.L), DoubleTools.ToInt(u.T), DoubleTools.ToInt(u.R), DoubleTools.ToInt(u.B), picture.GetHandle(), 1 ) != 0 : DX.DrawExtendGraphF( (float)u.L, (float)u.T, (float)u.R, (float)u.B, picture.GetHandle(), 1 ) != 0 ) { if (Extra.IgnoreError == false) { throw new DDError(); } } goto endDraw; } } { SimpleInfo u = layout as SimpleInfo; if (u != null) { // ? 失敗 if ( Extra.IntPos ? DX.DrawGraph( DoubleTools.ToInt(u.X), DoubleTools.ToInt(u.Y), picture.GetHandle(), 1 ) != 0 : DX.DrawGraphF( (float)u.X, (float)u.Y, picture.GetHandle(), 1 ) != 0 ) { if (Extra.IgnoreError == false) { throw new DDError(); } } goto endDraw; } } throw new DDError(); // ? 不明なレイアウト endDraw: if (Extra.A != -1 || Extra.BlendAdd != -1 || Extra.BlendInv) { ResetBlend(); } if (Extra.Mosaic) { DX.SetDrawMode(DX.DX_DRAWMODE_BILINEAR); } if (Extra.Bright.R != -1) { ResetBright(); } // app > @ leave DrawPic // < app }
// // copied the source file by https://github.com/stackprobe/Factory/blob/master/SubTools/CopyLib.c // private static void DrawPic_Main(DDPicture picture, ILayoutInfo layout) { // app > @ enter DrawPic // < app if (Extra.A != -1) { SetBlend(DX.DX_BLENDMODE_ALPHA, Extra.A); } else if (Extra.BlendAdd != -1) { SetBlend(DX.DX_BLENDMODE_ADD, Extra.BlendAdd); } else if (Extra.BlendInv) { SetBlend(DX.DX_BLENDMODE_INVSRC, 255); } if (Extra.Mosaic) { DX.SetDrawMode(DX.DX_DRAWMODE_NEAREST); } if (Extra.Bright.R != -1) { SetBright(Extra.Bright.R, Extra.Bright.G, Extra.Bright.B); } { FreeInfo u = layout as FreeInfo; if (u != null) { // ? 失敗 if ( Extra.IntPos ? DX.DrawModiGraph( DoubleTools.ToInt(u.LTX), DoubleTools.ToInt(u.LTY), DoubleTools.ToInt(u.RTX), DoubleTools.ToInt(u.RTY), DoubleTools.ToInt(u.RBX), DoubleTools.ToInt(u.RBY), DoubleTools.ToInt(u.LBX), DoubleTools.ToInt(u.LBY), picture.GetHandle(), 1 ) != 0 : DX.DrawModiGraphF( (float)u.LTX, (float)u.LTY, (float)u.RTX, (float)u.RTY, (float)u.RBX, (float)u.RBY, (float)u.LBX, (float)u.LBY, picture.GetHandle(), 1 ) != 0 ) { if (Extra.IgnoreError == false) { throw new DDError(); } } goto endDraw; } } { RectInfo u = layout as RectInfo; if (u != null) { // ? 失敗 if ( Extra.IntPos ? DX.DrawExtendGraph( DoubleTools.ToInt(u.L), DoubleTools.ToInt(u.T), DoubleTools.ToInt(u.R), DoubleTools.ToInt(u.B), picture.GetHandle(), 1 ) != 0 : DX.DrawExtendGraphF( (float)u.L, (float)u.T, (float)u.R, (float)u.B, picture.GetHandle(), 1 ) != 0 ) { if (Extra.IgnoreError == false) { throw new DDError(); } } goto endDraw; } } { SimpleInfo u = layout as SimpleInfo; if (u != null) { // ? 失敗 if ( Extra.IntPos ? DX.DrawGraph( DoubleTools.ToInt(u.X), DoubleTools.ToInt(u.Y), picture.GetHandle(), 1 ) != 0 : DX.DrawGraphF( (float)u.X, (float)u.Y, picture.GetHandle(), 1 ) != 0 ) { if (Extra.IgnoreError == false) { throw new DDError(); } } goto endDraw; } } throw new DDError(); // ? 不明なレイアウト endDraw: if (Extra.A != -1 || Extra.BlendAdd != -1 || Extra.BlendInv) { ResetBlend(); } if (Extra.Mosaic) { DX.SetDrawMode(DX.DX_DRAWMODE_BILINEAR); } if (Extra.Bright.R != -1) { ResetBright(); } // app > @ leave DrawPic { FreeInfo u = layout as FreeInfo; if (u != null) { double l = u.LTX; double t = u.LTY; double r = u.LTX; double b = u.LTY; l = Math.Min(l, u.RTX); l = Math.Min(l, u.RBX); l = Math.Min(l, u.LBX); t = Math.Min(t, u.RTY); t = Math.Min(t, u.RBY); t = Math.Min(t, u.LBY); r = Math.Max(r, u.RTX); r = Math.Max(r, u.RBX); r = Math.Max(r, u.LBX); b = Math.Max(b, u.RTY); b = Math.Max(b, u.RBY); b = Math.Max(b, u.LBY); Charlotte.Games.NamedCrashMgr.LastDrawedCrash = Charlotte.Common.Options.DDCrashUtils.Rect(new D4Rect( l, t, r - l, b - t )); goto endPostDraw; } } { RectInfo u = layout as RectInfo; if (u != null) { double l = u.L; double t = u.T; double r = u.R; double b = u.B; Charlotte.Games.NamedCrashMgr.LastDrawedCrash = Charlotte.Common.Options.DDCrashUtils.Rect(new D4Rect( l, t, r - l, b - t )); goto endPostDraw; } } { SimpleInfo u = layout as SimpleInfo; if (u != null) { Charlotte.Games.NamedCrashMgr.LastDrawedCrash = Charlotte.Common.Options.DDCrashUtils.Rect(new D4Rect( u.X, u.Y, picture.Get_W(), picture.Get_H() )); goto endPostDraw; } } throw new DDError(); // ? 不明なレイアウト endPostDraw: ; // < app }
/// <summary> /// Creates layout metadata. /// </summary> /// <param name="layout"> /// The layout. /// </param> /// <param name="includeColumns"> /// True to include column metadata; otherwise, false. /// </param> /// <returns> /// The <see cref="LayoutMetadata"/>. /// </returns> public LayoutMetadata CreateLayoutMetadata(ILayoutInfo layout, bool includeColumns) { return LayoutMetadataFactory.CreateLayoutMetadata(layout, includeColumns); }