public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Diagrams();

            string fileName = "LayOutShapesInFlowchartStyle.vdx";
            Diagram diagram = new Diagram(dataDir + fileName);

            LayoutOptions flowChartOptions = new LayoutOptions();
            flowChartOptions.LayoutStyle = LayoutStyle.FlowChart;
            flowChartOptions.SpaceShapes = 1f;
            flowChartOptions.EnlargePage = true;

            flowChartOptions.Direction = LayoutDirection.BottomToTop;
            diagram.Layout(flowChartOptions);
            diagram.Save(dataDir + "sample_btm_top.vdx", SaveFileFormat.VDX);

            diagram = new Diagram(dataDir + fileName);
            flowChartOptions.Direction = LayoutDirection.TopToBottom;
            diagram.Layout(flowChartOptions);
            diagram.Save(dataDir + "sample_top_btm.vdx", SaveFileFormat.VDX);

            diagram = new Diagram(dataDir + fileName);
            flowChartOptions.Direction = LayoutDirection.LeftToRight;
            diagram.Layout(flowChartOptions);
            diagram.Save(dataDir + "sample_left_right.vdx", SaveFileFormat.VDX);

            diagram = new Diagram(dataDir + fileName);
            flowChartOptions.Direction = LayoutDirection.RightToLeft;
            diagram.Layout(flowChartOptions);
            diagram.Save(dataDir + "sample_right_left.vdx", SaveFileFormat.VDX);
        }
コード例 #2
0
ファイル: FileHeader.cs プロジェクト: khonsoe/keymagic
        public FileHeader(System.IO.BinaryReader br)
        {
            majorVersion = 0;
            minorVersion = 0;
            stringCount = 0;
            infoCount = 0;
            ruleCount = 0;
            layoutOptions = new LayoutOptions();

            byte[] magicCode = br.ReadBytes(4);
            if (magicCode[0] != 'K' && magicCode[1] != 'M' && magicCode[2] != 'K' && magicCode[3] != 'L')
            {
                throw new Exception("Invalid KeyMagic keyboard layout file.");
            }

            majorVersion = br.ReadByte();
            minorVersion = br.ReadByte();

            if (majorVersion == 1 && minorVersion > 4)
            {
                throw new Exception("Cannot load this keyboard layout file because this is newer version of keyboard layout file.");
            }

            stringCount = br.ReadInt16();
            if (majorVersion == 1 && minorVersion > 3)
            {
                infoCount = br.ReadInt16();
            }
            ruleCount = br.ReadInt16();

            layoutOptions.trackCaps = br.ReadBoolean();
            layoutOptions.autoBksp = br.ReadBoolean();
            layoutOptions.eat = br.ReadBoolean();
            layoutOptions.posBased = br.ReadBoolean();
        }
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Diagrams();

            string fileName = "LayOutShapesInCompactTreeStyle.vdx";
            Diagram diagram = new Diagram(dataDir + fileName);

            LayoutOptions compactTreeOptions = new LayoutOptions();
            compactTreeOptions.LayoutStyle = LayoutStyle.CompactTree;
            compactTreeOptions.EnlargePage = true;

            compactTreeOptions.Direction = LayoutDirection.DownThenRight;
            diagram.Layout(compactTreeOptions);
            diagram.Save(dataDir + "sample_down_right.vdx", SaveFileFormat.VDX);

            diagram = new Diagram(dataDir + fileName);
            compactTreeOptions.Direction = LayoutDirection.DownThenLeft;
            diagram.Layout(compactTreeOptions);
            diagram.Save(dataDir + "sample_down_left.vdx", SaveFileFormat.VDX);

            diagram = new Diagram(dataDir + fileName);
            compactTreeOptions.Direction = LayoutDirection.RightThenDown;
            diagram.Layout(compactTreeOptions);
            diagram.Save(dataDir + "sample_right_down.vdx", SaveFileFormat.VDX);

            diagram = new Diagram(dataDir + fileName);
            compactTreeOptions.Direction = LayoutDirection.LeftThenDown;
            diagram.Layout(compactTreeOptions);
            diagram.Save(dataDir + "sample_left_down.vdx", SaveFileFormat.VDX);
        }
コード例 #4
0
        public static void Main(string[] args)
        {
            // The path to the documents directory.
            string dataDir = Path.GetFullPath("../../../Data/");

            string fileName = "Drawing.vdx";
            Diagram diagram = new Diagram(dataDir + fileName);

            LayoutOptions flowChartOptions = new LayoutOptions();
            flowChartOptions.LayoutStyle = LayoutStyle.FlowChart;
            flowChartOptions.SpaceShapes = 1f;
            flowChartOptions.EnlargePage = true;

            flowChartOptions.Direction = LayoutDirection.BottomToTop;
            diagram.Layout(flowChartOptions);
            diagram.Save(dataDir + "sample_btm_top.vdx", SaveFileFormat.VDX);

            diagram = new Diagram(dataDir + fileName);
            flowChartOptions.Direction = LayoutDirection.TopToBottom;
            diagram.Layout(flowChartOptions);
            diagram.Save(dataDir + "sample_top_btm.vdx", SaveFileFormat.VDX);

            diagram = new Diagram(dataDir + fileName);
            flowChartOptions.Direction = LayoutDirection.LeftToRight;
            diagram.Layout(flowChartOptions);
            diagram.Save(dataDir + "sample_left_right.vdx", SaveFileFormat.VDX);

            diagram = new Diagram(dataDir + fileName);
            flowChartOptions.Direction = LayoutDirection.RightToLeft;
            diagram.Layout(flowChartOptions);
            diagram.Save(dataDir + "sample_right_left.vdx", SaveFileFormat.VDX);
        }
コード例 #5
0
        public static void Main(string[] args)
        {
            // The path to the documents directory.
            string dataDir = Path.GetFullPath("../../../Data/");

            string fileName = "drawing.vdx";
            Diagram diagram = new Diagram(dataDir + fileName);

            LayoutOptions compactTreeOptions = new LayoutOptions();
            compactTreeOptions.LayoutStyle = LayoutStyle.CompactTree;
            compactTreeOptions.EnlargePage = true;

            compactTreeOptions.Direction = LayoutDirection.DownThenRight;
            diagram.Layout(compactTreeOptions);
            diagram.Save(dataDir + "sample_down_right.vdx", SaveFileFormat.VDX);

            diagram = new Diagram(dataDir + fileName);
            compactTreeOptions.Direction = LayoutDirection.DownThenLeft;
            diagram.Layout(compactTreeOptions);
            diagram.Save(dataDir + "sample_down_left.vdx", SaveFileFormat.VDX);

            diagram = new Diagram(dataDir + fileName);
            compactTreeOptions.Direction = LayoutDirection.RightThenDown;
            diagram.Layout(compactTreeOptions);
            diagram.Save(dataDir + "sample_right_down.vdx", SaveFileFormat.VDX);

            diagram = new Diagram(dataDir + fileName);
            compactTreeOptions.Direction = LayoutDirection.LeftThenDown;
            diagram.Layout(compactTreeOptions);
            diagram.Save(dataDir + "sample_left_down.vdx", SaveFileFormat.VDX);
        }
コード例 #6
0
 /// <summary>
 /// Helper method to serialize <see cref="LayoutOptions" /> objects.
 /// </summary>
 public static string LayoutOptionsToString(LayoutOptions layoutOptions)
 {
     return(string.Format(
                CultureInfo.InvariantCulture,
                "{0},{1}",
                (int)layoutOptions.Alignment,
                layoutOptions.Expands));
 }
コード例 #7
0
        protected override LayoutOptions Layout(PaintEventArgs e)
        {
            LayoutOptions layout = PaintLayout(e, /* up = */ false);

            Debug.Assert(layout.GetPreferredSizeCore(LayoutUtils.MaxSize) == PaintLayout(e, /* up = */ true).GetPreferredSizeCore(LayoutUtils.MaxSize),
                         "The state of up should not effect PreferredSize");
            return(layout);
        }
コード例 #8
0
        internal override LayoutOptions CommonLayout()
        {
            LayoutOptions layout = base.CommonLayout();

            layout.checkAlign = Control.CheckAlign;

            return(layout);
        }
コード例 #9
0
        protected override LayoutOptions Layout(PaintEventArgs e)
        {
            LayoutOptions layout = CommonLayout();
            layout.checkSize = (int)(flatCheckSize * GetDpiScaleRatio());
            layout.shadowedText = false;

            return layout;
        }
コード例 #10
0
        /// <summary>
        /// The Execute method.
        /// </summary>
        /// <param name="options">
        /// The options.
        /// </param>
        /// <param name="file">
        /// The file.
        /// </param>
        public void Execute(LayoutOptions options, ICSharpFile file)
        {
            StyleCopTrace.In(options, file);

            Param.RequireNotNull(options, "options");
            Param.RequireNotNull(file, "file");

            bool curlyBracketsForMultiLineStatementsMustNotShareLine  = options.SA1500CurlyBracketsForMultiLineStatementsMustNotShareLine;
            bool openingCurlyBracketsMustNotBePrecededByBlankLine     = options.SA1509OpeningCurlyBracketsMustNotBePrecededByBlankLine;
            bool chainedStatementBlocksMustNotBePrecededByBlankLine   = options.SA1510ChainedStatementBlocksMustNotBePrecededByBlankLine;
            bool whileDoFooterMustNotBePrecededByBlankLine            = options.SA1511WhileDoFooterMustNotBePrecededByBlankLine;
            bool singleLineCommentsMustNotBeFollowedByBlankLine       = options.SA1512SingleLineCommentsMustNotBeFollowedByBlankLine;
            bool closingCurlyBracketMustBeFollowedByBlankLine         = options.SA1513ClosingCurlyBracketMustBeFollowedByBlankLine;
            bool elementDocumentationHeadersMustBePrecededByBlankLine = options.SA1514ElementDocumentationHeaderMustBePrecededByBlankLine;
            bool singleLineCommentsMustBeProceededByBlankLine         = options.SA1515SingleLineCommentMustBeProceededByBlankLine;

            if (singleLineCommentsMustBeProceededByBlankLine)
            {
                this.CommentsMustBePreceededByBlankLine(file.FirstChild);
            }

            if (singleLineCommentsMustNotBeFollowedByBlankLine)
            {
                this.CommentsMustNotBeFollowedByBlankLine(file.FirstChild);
            }

            if (closingCurlyBracketMustBeFollowedByBlankLine)
            {
                ClosingCurlyBracketMustBeFollowedByBlankLine(file.FirstChild);
            }

            if (whileDoFooterMustNotBePrecededByBlankLine)
            {
                this.WhileDoFooterMustNotBePrecededByBlankLine(file.FirstChild);
            }

            if (chainedStatementBlocksMustNotBePrecededByBlankLine)
            {
                this.ChainedStatementBlocksMustNotBePrecededByBlankLine(file.FirstChild);
            }

            if (openingCurlyBracketsMustNotBePrecededByBlankLine)
            {
                this.OpeningCurlyBracketsMustNotBePrecededByBlankLine(file.FirstChild);
            }

            if (elementDocumentationHeadersMustBePrecededByBlankLine)
            {
                this.ElementDocumentationHeadersMustBePrecededByBlankLine(file.FirstChild);
            }

            if (curlyBracketsForMultiLineStatementsMustNotShareLine)
            {
                this.CurlyBracketsForMultiLineStatementsMustNotShareLine(file.FirstChild);
            }

            StyleCopTrace.Out();
        }
コード例 #11
0
 public void InitializeComponent()
 {
     TextColor         = Visual.CaptionForeground;
     VerticalOptions   = new LayoutOptions(LayoutAlignment.End, true);
     HorizontalOptions = new LayoutOptions(LayoutAlignment.Center, true);
     InputTransparent  = true;
     FontSize          = 11;
     FontFamily        = Visual.FontFamily;
 }
コード例 #12
0
 public void InitializeComponent()
 {
     Opacity           = 0.64;
     WidthRequest      = 45;
     HeightRequest     = 45;
     VerticalOptions   = new LayoutOptions(LayoutAlignment.Center, true);
     HorizontalOptions = new LayoutOptions(LayoutAlignment.Center, true);
     InputTransparent  = true;
 }
コード例 #13
0
        LayoutOptions PaintLayout(PaintEventArgs e)
        {
            LayoutOptions layout = CommonLayout();

            layout.graphics         = e.Graphics;
            layout.checkPaddingSize = 1;

            return(layout);
        }
コード例 #14
0
        /// <summary>
        /// Called when the SearchHorizontalOptions property has changed.
        /// </summary>
        /// <param name="obj">bindable object</param>
        /// <param name="oldValue">old value</param>
        /// <param name="newValue">new value</param>
        private static void OnSearchHorizontalOptionsChanged(BindableObject obj, LayoutOptions oldValue, LayoutOptions newValue)
        {
            var autoCompleteView = obj as AutoCompleteView;

            if (autoCompleteView != null)
            {
                autoCompleteView.searchButton.HorizontalOptions = newValue;
            }
        }
コード例 #15
0
        LayoutOptions PaintLayout(PaintEventArgs e)
        {
            LayoutOptions layout = CommonLayout();

            layout.graphics   = e.Graphics;
            layout.hintTextUp = false;

            return(layout);
        }
コード例 #16
0
        public void InitilizeComponent()
        {
            HeightRequest     = 85;
            WidthRequest      = 110;
            VerticalOptions   = new LayoutOptions(LayoutAlignment.Start, true);
            HorizontalOptions = new LayoutOptions(LayoutAlignment.Start, true);

            Children.Add(new SwitchBottomBorder());
        }
コード例 #17
0
        LayoutOptions PaintPopupLayout(PaintEventArgs e)
        {
            LayoutOptions layout = CommonLayout();

            layout.graphics  = e.Graphics;
            layout.checkSize = flatCheckSize;

            return(layout);
        }
コード例 #18
0
        protected override LayoutOptions Layout(PaintEventArgs e)
        {
            LayoutOptions layout = PaintPopupLayout(show3D: true);

            Debug.Assert(layout.GetPreferredSizeCore(LayoutUtils.MaxSize)
                         == PaintPopupLayout(show3D: false).GetPreferredSizeCore(LayoutUtils.MaxSize),
                         "The state of show3D should not effect PreferredSize");
            return(layout);
        }
コード例 #19
0
        /// <summary>
        /// Searches the vertical options changed.
        /// </summary>
        /// <param name="obj">The object.</param>
        /// <param name="oldValue">The old value.</param>
        /// <param name="newValue">The new value.</param>
        private static void SearchVerticalOptionsChanged(BindableObject obj, LayoutOptions oldValue, LayoutOptions newValue)
        {
            var autoCompleteView = obj as AutoCompleteView;

            if (autoCompleteView != null)
            {
                autoCompleteView._btnSearch.VerticalOptions = newValue;
            }
        }
コード例 #20
0
        protected override LayoutOptions Layout(PaintEventArgs e)
        {
            LayoutOptions layout = PaintPopupLayout(e, up: false, 0);

            Debug.Assert(layout.GetPreferredSizeCore(LayoutUtils.s_maxSize)
                         == PaintPopupLayout(e, up: true, 2).GetPreferredSizeCore(LayoutUtils.s_maxSize),
                         "The state of up should not effect PreferredSize");
            return(layout);
        }
コード例 #21
0
        /// <summary>
        /// Texts the horizontal options changed.
        /// </summary>
        /// <param name="obj">The object.</param>
        /// <param name="oldValue">The old value.</param>
        /// <param name="newValue">The new value.</param>
        private static void TextHorizontalOptionsChanged(BindableObject obj, LayoutOptions oldValue, LayoutOptions newValue)
        {
            var autoCompleteView = obj as AutoCompleteView;

            if (autoCompleteView != null)
            {
                autoCompleteView._entText.VerticalOptions = newValue;
            }
        }
コード例 #22
0
 /// <summary>
 /// Initializes a new instance of the <see cref="XTextFormatter"/> class.
 /// </summary>
 public XTextFormatterEx2(XGraphics gfx, LayoutOptions options)
 {
     if (gfx == null)
     {
         throw new ArgumentNullException("gfx");
     }
     _gfx           = gfx;
     _layoutOptions = options;
 }
コード例 #23
0
        private LayoutOptions PaintLayout(PaintEventArgs e, bool up)
        {
            LayoutOptions layout = CommonLayout();

            layout.textOffset          = !up;
            layout.everettButtonCompat = !Application.RenderWithVisualStyles;

            return(layout);
        }
コード例 #24
0
ファイル: GenericsContent.cs プロジェクト: Zepsen/App1
 public static Label GenerateLabelWithLayoutOption(string text, LayoutOptions layoutOption)
 {
     return(new Label
     {
         Text = text,
         HorizontalOptions = LayoutOptions.StartAndExpand,
         TextColor = DefaultAppStyles.DefaultTextColor,
         FontSize = DefaultAppStyles.DefaultFontSize,
     });
 }
コード例 #25
0
        LayoutOptions PaintFlatLayout(PaintEventArgs e)
        {
            LayoutOptions layout = CommonLayout();

            layout.graphics     = e.Graphics;
            layout.checkSize    = flatCheckSize;
            layout.shadowedText = false;

            return(layout);
        }
コード例 #26
0
        protected void RenderConnections()
        {
            var layoutOptions = new LayoutOptions
            {
                GridSize = GridSize
            };
            var connections = visualiseConnections.VisualiseConnections(Circuit.PositionalComponents, layoutOptions);

            ConnectionsVisual.ConnectionPoints = connections;
        }
コード例 #27
0
        internal override LayoutOptions CommonLayout()
        {
            LayoutOptions layout = base.CommonLayout();
            layout.CheckAlign = Control.CheckAlign;
            layout.TextOffset = false;
            layout.ShadowedText = !Control.Enabled;
            layout.LayoutRTL = RightToLeft.Yes == Control.RightToLeft;

            return layout;
        }
コード例 #28
0
        public void UpdateUI(LayoutOptions layoutOptions, string message, string message2, string languageCode, bool isLeft)
        {
            var frame = CreateOutputControls(layoutOptions, message, message2, languageCode, isLeft);

            Device.BeginInvokeOnMainThread(() =>
            {
                frame.WidthRequest = diageScrollView.Width * .8;

                contentStack.Children.Add(frame);
            });
        }
コード例 #29
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            LayoutOptions result = LayoutOptions.Start;

            if (!string.IsNullOrEmpty((string)value) && ((string)value).Equals("EndAndExpand"))
            {
                result = LayoutOptions.EndAndExpand;
            }

            return(result);
        }
コード例 #30
0
        public static Image NewImageByWidth(string source, LayoutOptions horizontalOptions, int width)
        {
            Image image = new Image()
            {
                Source            = source,
                HorizontalOptions = horizontalOptions,
                HeightRequest     = width,
            };

            return(image);
        }
コード例 #31
0
        public static Image NewImageByHeight(string source, LayoutOptions verticalOptions, int height)
        {
            Image image = new Image()
            {
                Source          = source,
                VerticalOptions = verticalOptions,
                HeightRequest   = height,
            };

            return(image);
        }
コード例 #32
0
        public View CreateDatePickerFor(string propertyName, LayoutOptions layout)
        {
            DatePicker iiDatePicker = new DatePicker
            {
                HorizontalOptions = layout,
                BackgroundColor   = Helper.Color.iiGreen.ToFormsColor(),
            };

            iiDatePicker.SetBinding(DatePicker.DateProperty, propertyName);
            return(iiDatePicker);
        }
コード例 #33
0
ファイル: Checkbox.cs プロジェクト: wxjwz/XamarinControls
 public Checkbox()
 {
     InitializeCanvas();
     WidthRequest      = HeightRequest = DEFAULT_SIZE;
     HorizontalOptions = VerticalOptions = new LayoutOptions(LayoutAlignment.Center, false);
     Content           = _skiaView;
     GestureRecognizers.Add(new TapGestureRecognizer
     {
         Command = _toggleCommand
     });
 }
コード例 #34
0
        public override void InitializeComponent()
        {
            base.InitializeComponent();

            VerticalOptions   = new LayoutOptions(LayoutAlignment.End, true);
            HorizontalOptions = new LayoutOptions(LayoutAlignment.Center, true);

            SetBinding(TextColorProperty,
                       new Binding(nameof(SwitchScenarioModel.State),
                                   converter: ConvertersStatic.ValueForeground_StateToColor));
        }
コード例 #35
0
ファイル: RadioButtonPopupAdapter.cs プロジェクト: ash2005/z
        protected override LayoutOptions Layout(PaintEventArgs e)
        {
            LayoutOptions layout = base.Layout(e);

            if (!Control.MouseIsDown && !Control.MouseIsOver)
            {
                layout.shadowedText = true;
            }

            return(layout);
        }
        public static void Run()
        {
            // ExStart:LayOutShapesInFlowchartStyle
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Diagrams();

            // Load an existing Visio diagram
            string fileName = "LayOutShapesInFlowchartStyle.vdx";
            Diagram diagram = new Diagram(dataDir + fileName);

            // Set layout options 
            LayoutOptions flowChartOptions = new LayoutOptions();
            flowChartOptions.LayoutStyle = LayoutStyle.FlowChart;
            flowChartOptions.SpaceShapes = 1f;
            flowChartOptions.EnlargePage = true;

            // Set layout direction as BottomToTop and then save
            flowChartOptions.Direction = LayoutDirection.BottomToTop;
            diagram.Layout(flowChartOptions);
            diagram.Save(dataDir + "sample_btm_top_out.vdx", SaveFileFormat.VDX);

            // Set layout direction as TopToBottom and then save
            diagram = new Diagram(dataDir + fileName);
            flowChartOptions.Direction = LayoutDirection.TopToBottom;
            diagram.Layout(flowChartOptions);
            diagram.Save(dataDir + "sample_top_btm_out.vdx", SaveFileFormat.VDX);

            // Set layout direction as LeftToRight and then save
            diagram = new Diagram(dataDir + fileName);
            flowChartOptions.Direction = LayoutDirection.LeftToRight;
            diagram.Layout(flowChartOptions);
            diagram.Save(dataDir + "sample_left_right_out.vdx", SaveFileFormat.VDX);

            // Set layout direction as RightToLeft and then save
            diagram = new Diagram(dataDir + fileName);
            flowChartOptions.Direction = LayoutDirection.RightToLeft;
            diagram.Layout(flowChartOptions);
            diagram.Save(dataDir + "sample_right_left_out.vdx", SaveFileFormat.VDX);
            // ExEnd:LayOutShapesInFlowchartStyle
        }
        public static void Run()
        {
            // ExStart:LayOutShapesInCompactTreeStyle
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Diagrams();

            string fileName = "LayOutShapesInCompactTreeStyle.vdx";
            // Load an existing Visio diagram
            Diagram diagram = new Diagram(dataDir + fileName);

            // Set layout options 
            LayoutOptions compactTreeOptions = new LayoutOptions();
            compactTreeOptions.LayoutStyle = LayoutStyle.CompactTree;
            compactTreeOptions.EnlargePage = true;

            // Set layout direction as DownThenRight and then save
            compactTreeOptions.Direction = LayoutDirection.DownThenRight;
            diagram.Layout(compactTreeOptions);
            diagram.Save(dataDir + "sample_down_right.vdx", SaveFileFormat.VDX);

            // Set layout direction as DownThenLeft and then save
            diagram = new Diagram(dataDir + fileName);
            compactTreeOptions.Direction = LayoutDirection.DownThenLeft;
            diagram.Layout(compactTreeOptions);
            diagram.Save(dataDir + "sample_down_left.vdx", SaveFileFormat.VDX);

            // Set layout direction as RightThenDown and then save
            diagram = new Diagram(dataDir + fileName);
            compactTreeOptions.Direction = LayoutDirection.RightThenDown;
            diagram.Layout(compactTreeOptions);
            diagram.Save(dataDir + "sample_right_down.vdx", SaveFileFormat.VDX);

            // Set layout direction as LeftThenDown and then save
            diagram = new Diagram(dataDir + fileName);
            compactTreeOptions.Direction = LayoutDirection.LeftThenDown;
            diagram.Layout(compactTreeOptions);
            diagram.Save(dataDir + "sample_left_down.vdx", SaveFileFormat.VDX);
            // ExEnd:LayOutShapesInCompactTreeStyle
        }
 internal virtual LayoutOptions CommonLayout()
 {
     LayoutOptions options = new LayoutOptions {
         client = LayoutUtils.DeflateRect(this.Control.ClientRectangle, this.Control.Padding),
         padding = this.Control.Padding,
         growBorderBy1PxWhenDefault = true,
         isDefault = this.Control.IsDefault,
         borderSize = 2,
         paddingSize = 0,
         maxFocus = true,
         focusOddEvenFixup = false,
         font = this.Control.Font,
         text = this.Control.Text,
         imageSize = (this.Control.Image == null) ? Size.Empty : this.Control.Image.Size,
         checkSize = 0,
         checkPaddingSize = 0,
         checkAlign = ContentAlignment.TopLeft,
         imageAlign = this.Control.ImageAlign,
         textAlign = this.Control.TextAlign,
         hintTextUp = false,
         shadowedText = !this.Control.Enabled,
         layoutRTL = RightToLeft.Yes == this.Control.RightToLeft,
         textImageRelation = this.Control.TextImageRelation,
         useCompatibleTextRendering = this.Control.UseCompatibleTextRendering
     };
     if (this.Control.FlatStyle != FlatStyle.System)
     {
         if (options.useCompatibleTextRendering)
         {
             using (StringFormat format = this.Control.CreateStringFormat())
             {
                 options.StringFormat = format;
                 return options;
             }
         }
         options.gdiTextFormatFlags = this.Control.CreateTextFormatFlags();
     }
     return options;
 }
コード例 #39
0
        private void SetLayout(LayoutOptions layout)
        {
            switch (layout)
            {
                case LayoutOptions.Icons:
                    facadeView.CurrentLayout = GUIFacadeControl.Layout.SmallIcons;
                    break;

                case LayoutOptions.LargeIcons:
                    facadeView.CurrentLayout = GUIFacadeControl.Layout.LargeIcons;
                    break;

                case LayoutOptions.FilmStrip:
                    facadeView.CurrentLayout = GUIFacadeControl.Layout.Filmstrip;
                    break;

                case LayoutOptions.List:
                    facadeView.CurrentLayout = GUIFacadeControl.Layout.List;
                    break;
            }
        }
コード例 #40
0
 private LayoutOptions GetLayoutOptions()
 {
     LayoutOptions options = new LayoutOptions();
     options.LayoutStyle = (LayoutStyle)this.cmbLayoutStyle.SelectedItem;
     if(this.cmbLayoutDirection.SelectedItem!=null)
         options.Direction = (LayoutDirection)this.cmbLayoutDirection.SelectedItem;
     options.EnlargePage = this.chkEnlargePage.Checked;
     float spaseShapes;
     if (!float.TryParse(this.txtSpaseShapes.Text, NumberStyles.Any,
         CultureInfo.InvariantCulture,out spaseShapes))
     {
         this.errorProvider.SetError(txtSpaseShapes, "Value is not valid");
         return null;
     }
     float pageWidth = (float)this.diagram.Pages[this.cmbPagesNumber.SelectedIndex].PageSheet.PageProps.PageWidth.Value;
     float pageHeight = (float)this.diagram.Pages[this.cmbPagesNumber.SelectedIndex].PageSheet.PageProps.PageHeight.Value;
     if ((spaseShapes < 0) ||
         (spaseShapes > pageWidth) ||
         (spaseShapes > pageHeight))
     {
         this.errorProvider.SetError(txtSpaseShapes, "Value is not valid");
         return null;
     }
     options.SpaceShapes = spaseShapes;
     return options;
 }
コード例 #41
0
ファイル: ButtonBaseAdapter.cs プロジェクト: JianwenSun/cc
 internal LayoutData(LayoutOptions options) {
     Debug.Assert(options != null, "must have options");
     this.options = options;
 }
コード例 #42
0
ファイル: ButtonBaseAdapter.cs プロジェクト: JianwenSun/cc
 // used by the DataGridViewButtonCell
 internal static LayoutOptions CommonLayout(Rectangle clientRectangle, Padding padding, bool isDefault, Font font, string text, bool enabled, ContentAlignment textAlign, RightToLeft rtl)
 {
     LayoutOptions layout = new LayoutOptions();
     layout.client             = LayoutUtils.DeflateRect(clientRectangle, padding);
     layout.padding            = padding;
     layout.growBorderBy1PxWhenDefault = true;
     layout.isDefault          = isDefault;
     layout.borderSize         = 2;
     layout.paddingSize        = 0;
     layout.maxFocus           = true;
     layout.focusOddEvenFixup  = false;
     layout.font               = font;
     layout.text               = text;
     layout.imageSize          = Size.Empty;
     layout.checkSize          = 0;
     layout.checkPaddingSize   = 0;
     layout.checkAlign         = ContentAlignment.TopLeft;
     layout.imageAlign         = ContentAlignment.MiddleCenter;
     layout.textAlign          = textAlign;
     layout.hintTextUp         = false;
     layout.shadowedText       = !enabled;
     layout.layoutRTL          = RightToLeft.Yes == rtl;
     layout.textImageRelation  = TextImageRelation.Overlay;
     layout.useCompatibleTextRendering = false;
     return layout;
 }
コード例 #43
0
ファイル: ButtonBaseAdapter.cs プロジェクト: JianwenSun/cc
        internal virtual LayoutOptions CommonLayout() {
            LayoutOptions layout = new LayoutOptions();
            layout.client             = LayoutUtils.DeflateRect(Control.ClientRectangle, Control.Padding);
            layout.padding            = Control.Padding;
            layout.growBorderBy1PxWhenDefault = true;
            layout.isDefault          = Control.IsDefault;
            layout.borderSize         = 2;
            layout.paddingSize        = 0;
            layout.maxFocus           = true;
            layout.focusOddEvenFixup  = false;
            layout.font               = Control.Font;
            layout.text               = Control.Text;
            layout.imageSize          = (Control.Image == null) ? Size.Empty : Control.Image.Size;
            layout.checkSize          = 0;
            layout.checkPaddingSize   = 0;
            layout.checkAlign         = ContentAlignment.TopLeft;
            layout.imageAlign         = Control.ImageAlign;
            layout.textAlign          = Control.TextAlign;
            layout.hintTextUp         = false;
            layout.shadowedText       = !Control.Enabled;
            layout.layoutRTL          = RightToLeft.Yes == Control.RightToLeft;
            layout.textImageRelation  = Control.TextImageRelation;
            layout.useCompatibleTextRendering = Control.UseCompatibleTextRendering;

            if( Control.FlatStyle != FlatStyle.System ) {
                if( layout.useCompatibleTextRendering ) {
                    using( StringFormat format = Control.CreateStringFormat() ) {
                        layout.StringFormat = format;
                    }
                }
                else {
                    layout.gdiTextFormatFlags = Control.CreateTextFormatFlags();
                }
            }
            
            return layout;
        }
コード例 #44
0
        /// <summary>
        /// Change the selected layout.
        /// </summary>
        /// <param name="controlId">Control ID passed during onClick.</param>
        private void OnSwitchLayout(int controlId)
        {
            GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
            if (dlg != null)
            {
                dlg.Reset();
                dlg.SetHeading(792);    // Views menu

                // Add each enum value
                foreach (LayoutOptions value in Enum.GetValues(typeof(LayoutOptions)))
                {
                    dlg.Add(StringEnum.Get(value));
                }

                // set the focus to currently used view
                dlg.SelectedLabel = (int)_currentLayout;

                // show dialog and wait for result
                dlg.DoModal(GetID);
                if (dlg.SelectedId != -1)
                {
                    _currentLayout = (LayoutOptions)dlg.SelectedLabel;

                    SetLayout(_currentLayout);
                    SelectCurrentItem();
                    GUIControl.FocusControl(GetID, controlId);
                }
            }
        }
コード例 #45
0
        public override bool Init()
        {
            bool result = Load(GUIGraphicsContext.Skin + @"\MyMovies.xml");

            try
            {
                using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml")))
                {
                    _currentLayout      = (LayoutOptions)xmlreader.GetValueAsInt("MyMovies", "layout", (int)LayoutOptions.List);
                    _currentView        = (Views)xmlreader.GetValueAsInt("MyMovies", "view", (int)_currentView);
                    _currentSorting     = (Sorting.Options)xmlreader.GetValueAsInt("MyMovies", "sorting", (int)_currentSorting);
                    CurrentUser         = xmlreader.GetValueAsInt("MyMovies", "currentUser", CurrentUser);
                    _sortAscending      = xmlreader.GetValueAsBool("MyMovies", "sortDirection", _sortAscending);
                    _programDataPath    = xmlreader.GetValueAsString("MyMovies", "txtProgramDataPath", @"C:\ProgramData\My Movies\FileStorage");
                    _serverName         = xmlreader.GetValueAsString("MyMovies", "txtServerName", "localhost");
                    _dbInstance         = xmlreader.GetValueAsString("MyMovies", "txtDBInstance", "MYMOVIES");
                    _userName           = xmlreader.GetValueAsString("MyMovies", "txtUserName", string.Empty);
                    _password           = xmlreader.GetValueAsString("MyMovies", "txtPassword", string.Empty);
                    _storedPIN          = xmlreader.GetValueAsString("MyMovies", "txtPINCode", "4321");
                    _chkRemoteWakeup    = xmlreader.GetValueAsBool("MyMovies", "chkRemoteWakeup", false);
                    _macAddress         = MacAddress.Parse(xmlreader.GetValueAsString("MyMovies", "MACAddress", "00-00-00-00-00-00"));
                    _ipAddress          = IPAddress.Parse(xmlreader.GetValueAsString("MyMovies", "IPAddress", "0.0.0.0"));
                    _wakeupRetries      = xmlreader.GetValueAsInt("MyMovies", "wakeupRetries", 3);
                    _wakeupRetryTimeout = xmlreader.GetValueAsInt("MyMovies", "wakeupRetryTimeout", 3000);
                    _maxConfiguredRating= xmlreader.GetValueAsInt("MyMovies", "maximumViewableRating", 4);

                    string xml = xmlreader.GetValueAsString("MyMovies", "xmlPathReplacement", string.Empty);
                    _driveReplacements  = new DriveReplacements(xml);

                    string xmlUsers = xmlreader.GetValueAsString("MyMovies", "xmlUsers", string.Empty);
                    _availableUsers = new Users(xmlUsers);
                }

                Log.Info(string.Format("MyMovies::Init - RemoteWakeup {0}, MAC {1}, IP {2}", _chkRemoteWakeup, _macAddress, _ipAddress));
            }
            catch (Exception ex)
            {
                Log.Error("MyMovies::Init - Cannot load settings");
                Log.Error(ex);
            }

            // Determine the maximum assigned rating within the DB.
            _maxRating = GetMaximumRating();

            g_Player.PlayBackStopped += new g_Player.StoppedHandler(OnPlayBackStopped);
            g_Player.PlayBackChanged += new g_Player.ChangedHandler(OnPlayBackChanged);
            g_Player.PlayBackEnded += new g_Player.EndedHandler(OnPlayBackEnded);

            return result;
        }