Beispiel #1
0
        public static void Init(bool force = false)
        {
            if (hasInit && !force)
            {
                return;
            }
            hasInit = true;
            Registrar.Handlers.Register <Button, GenericViewHandler>();
            Registrar.Handlers.Register <ContentView, GenericViewHandler>();
            Registrar.Handlers.Register <Image, GenericViewHandler>();
            Registrar.Handlers.Register <HStack, GenericViewHandler>();
            Registrar.Handlers.Register <ListView, GenericViewHandler>();
            Registrar.Handlers.Register <Text, TextHandler>();
            Registrar.Handlers.Register <TextField, TextFieldHandler>();
            Registrar.Handlers.Register <ProgressBar, ProgressBarHandler>();
            Registrar.Handlers.Register <SecureField, SecureFieldHandler>();
            Registrar.Handlers.Register <ScrollView, GenericViewHandler>();
            Registrar.Handlers.Register <Slider, SliderHandler>();
            Registrar.Handlers.Register <Toggle, GenericViewHandler>();
            Registrar.Handlers.Register <View, GenericViewHandler>();
            Registrar.Handlers.Register <VStack, GenericViewHandler>();
            Registrar.Handlers.Register <ZStack, GenericViewHandler>();

            ThreadHelper.JoinableTaskContext = new Microsoft.VisualStudio.Threading.JoinableTaskContext();
            HotReloadHelper.IsEnabled        = true;

            //Set Default Style
            var style = new Styles.Style();

            style.Apply();
        }
        protected override Styles.Style GetBaseStyle()
        {
            Styles.Style style = base.GetBaseStyle();
            style.Font.FontBold = true;

            return(style);
        }
        public void Layout(PDFLayoutContext context, Styles.Style fullstyle)
        {
            bool first = true;

            PDFPageNumberOptions opts = fullstyle.CreatePageNumberOptions();
            PDFPageNumberGroup   grp  = null;

            if (null != opts && opts.HasPageNumbering)
            {
                grp = context.DocumentLayout.Numbers.PushPageNumber(opts);
            }


            foreach (PageBase pg in this._group.Pages)
            {
                if (pg.Visible)
                {
                    this.LayoutAPage(pg, first);
                    first = false;
                }

                if (!this.ContinueLayout)
                {
                    break;
                }
            }

            if (null != opts && opts.HasPageNumbering)
            {
                context.DocumentLayout.Numbers.PopNumberStyle(grp);
            }
        }
 /// <summary>
 /// Overrides the base style to apply a bold font to any text in the header
 /// </summary>
 /// <returns></returns>
 protected override Styles.Style GetBaseStyle()
 {
     Styles.Style style = base.GetBaseStyle();
     style.Table.RowRepeat = TableRowRepeat.RepeatAtTop;
     style.Font.FontBold   = true;
     return(style);
 }
        protected override Styles.Style GetBaseStyle()
        {
            Styles.Style style = base.GetBaseStyle();
            style.Size.FullWidth = true;

            return(style);
        }
Beispiel #6
0
        public static void Init()
        {
            if (_hasInitialized)
            {
                return;
            }
            _hasInitialized = true;

            // Controls
            Registrar.Handlers.Register <ActivityIndicator, ActivityIndicatorHandler>();
            Registrar.Handlers.Register <Button, ButtonHandler>();
            Registrar.Handlers.Register <Image, ImageHandler>();
            Registrar.Handlers.Register <ProgressBar, ProgressBarHandler>();
            Registrar.Handlers.Register <SecureField, SecureFieldHandler>();
            Registrar.Handlers.Register <ShapeView, ShapeViewHandler>();
            Registrar.Handlers.Register <Slider, SliderHandler>();
            Registrar.Handlers.Register <Stepper, StepperHandler>();
            Registrar.Handlers.Register <DatePicker, DatePickerHandler>();
            Registrar.Handlers.Register <Text, TextHandler>();
            Registrar.Handlers.Register <TextField, TextFieldHandler>();
            Registrar.Handlers.Register <Toggle, ToggleHandler>();
            Registrar.Handlers.Register <RadioButton, RadioButtonHandler>();
            //Registrar.Handlers.Register<WebView, WebViewHandler> ();

            // Containers
            Registrar.Handlers.Register <ContentView, ContentViewHandler>();
            Registrar.Handlers.Register <ListView, ListViewHandler>();
            Registrar.Handlers.Register <ScrollView, ScrollViewHandler>();
            Registrar.Handlers.Register <View, ViewHandler>();
            Registrar.Handlers.Register <ViewRepresentable, ViewRepresentableHandler>();
            Registrar.Handlers.Register <TabView, TabViewHandler>();

            // Managed Layout
            Registrar.Handlers.Register <HStack, HStackHandler>();
            Registrar.Handlers.Register <VStack, VStackHandler>();
            Registrar.Handlers.Register <ZStack, ZStackHandler>();
            Registrar.Handlers.Register <Grid, GridHandler>();
            Registrar.Handlers.Register <Spacer, SpacerHandler>();
            Registrar.Handlers.Register <RadioGroup, RadioGroupHandler>();

            // Device Features
            ModalView.PerformPresent = (o) => {
                PresentingViewController.PresentViewController(o.ToViewController(), true, null);
            };
            ModalView.PerformDismiss = () => PresentingViewController.DismissModalViewController(true);

            ThreadHelper.JoinableTaskContext = new Microsoft.VisualStudio.Threading.JoinableTaskContext();
            ThreadHelper.SetFireOnMainThread(_invoker.BeginInvokeOnMainThread);

            Device.FontService     = new iOSFontService();
            Device.GraphicsService = new iOSGraphicsService();
            Device.BitmapService   = new iOSBitmapService();

            AnimationManger.SetTicker(new iOSTicker());

            //Set Default Style
            var style = new Styles.Style();

            style.Apply();
        }
Beispiel #7
0
        //public static MenuItem GetRemoveSubStyleMenuItem()
        //{
        //    var command = new ObservedCommand(RemoveSubStyle, () => true);
        //    return GetMenuItem("Remove", "/GisEditorPluginCore;component/Images/unload.png", command);
        //}

        private static void RemoveSubStyle()
        {
            if (GisEditor.LayerListManager.SelectedLayerListItem == null)
            {
                return;
            }
            Styles.Style style = GisEditor.LayerListManager.SelectedLayerListItem.ConcreteObject as Styles.Style;
            object       parentActualObject = GisEditor.LayerListManager.SelectedLayerListItem.Parent.ConcreteObject;

            if (style != null)
            {
                if (parentActualObject is ValueStyle)
                {
                    var valueStyle      = (ValueStyle)parentActualObject;
                    var resultValueItem = valueStyle.ValueItems.Where(valueItem => valueItem.CustomStyles.Contains(style)).FirstOrDefault();
                    valueStyle.ValueItems.Remove(resultValueItem);
                }
                else if (parentActualObject is ClassBreakStyle)
                {
                    var classBreakStyle  = (ClassBreakStyle)parentActualObject;
                    var resultClassBreak = classBreakStyle.ClassBreaks.Where(classBreak => classBreak.CustomStyles.Contains(style)).FirstOrDefault();
                    classBreakStyle.ClassBreaks.Remove(resultClassBreak);
                }
                else if (parentActualObject is RegexStyle)
                {
                    var regexStyle      = (RegexStyle)parentActualObject;
                    var resultRegexItem = regexStyle.RegexItems.Where(regexItem => regexItem.CustomStyles.Contains(style)).FirstOrDefault();
                    regexStyle.RegexItems.Remove(resultRegexItem);
                }

                LayerListHelper.InvalidateTileOverlay();
                GisEditor.UIManager.InvokeRefreshPlugins(new RefreshArgs(GisEditor.LayerListManager.SelectedLayerListItem, RefreshArgsDescriptions.RemoveSubStyleDescription));
            }
        }
Beispiel #8
0
        private void FillActionAnnotations(PDFLayoutContext context, Styles.Style style,
                                           PDFAction action, List <object> entries,
                                           Layout.PDFLayoutPage pg, ComponentList contents)
        {
            foreach (Component comp in contents)
            {
                PDFAnnotationLinkEntry annot;
                ComponentList          inner;
                if (IsContainer(comp, out inner))
                {
                    FillActionAnnotations(context, style, action, entries, pg, inner);
                }
                else
                {
                    //TODO: Test with data source within link
                    annot        = new PDFAnnotationLinkEntry(comp, style);
                    annot.Action = action;

                    if (!string.IsNullOrEmpty(this.AlternateText))
                    {
                        annot.AlternateText = this.AlternateText;
                    }

                    object entry = pg.RegisterPageEntry(context, PDFArtefactTypes.Annotations, annot);

                    if (null != entry)
                    {
                        entries.Add(entry);
                    }
                }
            }
        }
        private static IEnumerable <LayerListItem> GetStyleLayerListItem(ZoomLevel zoomLevel)
        {
            var result = new Collection <LayerListItem>();

            for (int i = 0; i < zoomLevel.CustomStyles.Count; i++)
            {
                Styles.Style style = zoomLevel.CustomStyles[i];
                if (!style.CheckIsValid())
                {
                    zoomLevel.CustomStyles.Remove(style);
                    i = i - 1;
                }
            }
            var from                  = GisEditor.ActiveMap.GetSnappedZoomLevelIndex(zoomLevel.Scale, false) + 1;
            var to                    = (int)zoomLevel.ApplyUntilZoomLevel;
            var zoomLevelText         = string.Format("  ({0} to {1})", from, to);
            var currentZoomLevelIndex = GisEditor.ActiveMap.GetSnappedZoomLevelIndex(GisEditor.ActiveMap.CurrentScale, false) + 1;

            foreach (var style in zoomLevel.CustomStyles.Reverse())
            {
                var styleItem = GisEditor.StyleManager.GetStyleLayerListItem(style);
                if (styleItem != null)
                {
                    CreateComponentStyleEntity(styleItem);
                    styleItem.ZoomLevelRange = zoomLevelText;
                    if (from <= currentZoomLevelIndex && to >= currentZoomLevelIndex)
                    {
                        styleItem.FontWeight = System.Windows.FontWeights.Bold;
                    }
                    result.Add(styleItem);
                }
            }
            return(result);
        }
Beispiel #10
0
        //
        // methods
        //

        #region protected override Text.PDFTextReader CreateReader(PDFLayoutContext context, Styles.PDFStyle fullstyle)

        /// <summary>
        /// overrides the default implementation to create a text reader for the Number in the correct format
        /// </summary>
        /// <param name="context"></param>
        /// <param name="fullstyle"></param>
        /// <returns></returns>
        protected override Text.PDFTextReader CreateReader(PDFLayoutContext context, Styles.Style fullstyle)
        {
            string val;
            string format = fullstyle.GetValue(StyleKeys.TextNumberFormatKey, string.Empty);

            if (null == this.FormatProvider)
            {
                if (!string.IsNullOrEmpty(format))
                {
                    val = this.Value.ToString(format);
                }
                else
                {
                    val = this.Value.ToString();
                }
            }
            else
            {
                if (!string.IsNullOrEmpty(format))
                {
                    val = this.Value.ToString(format, this.FormatProvider);
                }
                else
                {
                    val = this.Value.ToString(this.FormatProvider);
                }
            }
            return(Scryber.Text.PDFTextReader.Create(val, TextFormat.Plain, false, context.TraceLog));
        }
Beispiel #11
0
 /// <summary>
 /// Overrides the base implementation to apply the Decimals numbering group type
 /// </summary>
 /// <returns></returns>
 protected override Styles.Style GetBaseStyle()
 {
     Styles.Style style = base.GetBaseStyle();
     style.List.NumberingStyle  = ListNumberingGroupStyle.Bullet;
     style.List.NumberAlignment = HorizontalAlignment.Right;
     return(style);
 }
        protected override Styles.Style GetBaseStyle()
        {
            Styles.Style style = base.GetBaseStyle();
            style.List.NumberingStyle = ListNumberingGroupStyle.Labels;
            style.List.NumberInset    = Const.DefaultDefinitionListInset;

            return(style);
        }
Beispiel #13
0
                static void CreateParagraphStyle()
                {
                    // paragraphs should have a preference for left alignment
                    mParagraph = new Styles.Style( );
                    mParagraph.Initialize();

                    mParagraph.mAlignment = Styles.Alignment.Left;
                }
Beispiel #14
0
                static void CreateStackPanelStyle()
                {
                    // like paragraphs, stack panels shouldn't care about anything but alignment
                    mStackPanel = new Styles.Style( );
                    mStackPanel.Initialize( );

                    mStackPanel.mAlignment = Styles.Alignment.Left;
                }
Beispiel #15
0
        /// <summary>
        /// overrides base implementation to return a position mode of block
        /// </summary>
        /// <returns></returns>
        protected override Styles.Style GetBaseStyle()
        {
            Styles.Style b = base.GetBaseStyle();
            b.Position.PositionMode = Drawing.PositionMode.Block;
            b.Margins.Top           = new Drawing.PDFUnit(5, Drawing.PageUnits.Points);

            b.Size.FullWidth = true;
            return(b);
        }
Beispiel #16
0
        public Style(Styles.Style style)
        {
            if (style == null)
            {
                Value = Styles.StyleRegistry.DefaultStyle;
            }

            Value = style;
        }
Beispiel #17
0
                static void CreateListStyle()
                {
                    mList = new Styles.Style( );
                    mList.Initialize( );

                    mList.mAlignment     = Styles.Alignment.Left;
                    mList.mListBullet    = "•"; //we want a nice looking bullet as default
                    mList.mListIndention = 25.0f;
                }
Beispiel #18
0
                static void CreateCanvasStyle()
                {
                    // like stacks and paragraphs, canvas shouldn't care about anything
                    // but alignment
                    mCanvas = new Styles.Style( );
                    mCanvas.Initialize( );

                    mCanvas.mAlignment = Styles.Alignment.Left;
                }
Beispiel #19
0
        private object[] AddActionAnnotationToChildren(PDFLayoutContext context, Styles.Style style, PDFAction action)
        {
            List <object> entries = new List <object>();

            Layout.PDFLayoutPage pg = context.DocumentLayout.CurrentPage;

            FillActionAnnotations(context, style, action, entries, pg, this.Contents);
            return(entries.ToArray());
        }
        public T CreateLayer()
        {
            var layer = CreateLayerCore();

            layer.Name = TableName;
            layer.AddBlankZoomLevels();
            layer.DrawingMarginInPixel = 200;
            layer.Open();
            var simpleShapeType = GetSimpleShapeType(layer);

            Styles.Style shapeStyle = null;

            switch (simpleShapeType)
            {
            case SimpleShapeType.Point:
                shapeStyle = GetDefaultStyle <PointStyle>(StyleCategories.Point);
                if (shapeStyle == null)
                {
                    shapeStyle      = PointStyles.CreateSimpleCircleStyle(RandomColor(), 6);
                    shapeStyle.Name = "Simple Style 1";
                }
                break;

            case SimpleShapeType.Line:
                shapeStyle = GetDefaultStyle <LineStyle>(StyleCategories.Line);
                if (shapeStyle == null)
                {
                    shapeStyle      = new LineStyle(new GeoPen(RandomColor(RandomColorType.Bright)));
                    shapeStyle.Name = "Simple Style 1";
                }
                break;

            case SimpleShapeType.Area:
                shapeStyle = GetDefaultStyle <AreaStyle>(StyleCategories.Area);
                if (shapeStyle == null)
                {
                    shapeStyle      = AreaStyles.CreateSimpleAreaStyle(RandomColor(), GeoColor.SimpleColors.Black);
                    shapeStyle.Name = "Simple Style 1";
                }
                break;
            }

            if (shapeStyle != null)
            {
                ZoomLevelSet zoomLevelSet = GisEditor.ActiveMap.ZoomLevelSet;
                ZoomLevel    zoomLevel    = new ZoomLevel(zoomLevelSet.ZoomLevel01.Scale);
                zoomLevel.CustomStyles.Add(shapeStyle);
                zoomLevel.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

                layer.ZoomLevelSet.CustomZoomLevels[0] = zoomLevel;
                layer.DrawingQuality = DrawingQuality.CanvasSettings;
            }
            layer.Close();

            return(layer);
        }
Beispiel #21
0
                static void CreateMainNoteStyle()
                {
                    mMainNote = new Styles.Style( );
                    mMainNote.Initialize();

                    mMainNote.mBackgroundColor = 0x262626FF;
                    mMainNote.mFullWidthHeader = true;
                    mMainNote.mPaddingLeft     = .05f;
                    mMainNote.mPaddingRight    = .05f;
                }
Beispiel #22
0
        private void LoadStyle(Styles.Style s)
        {
            //s.Name = GisEditor.StyleManager.GetStylePluginByStyle(s).Name;
            var styleItem = GisEditor.StyleManager.GetStyleLayerListItem(s);

            if (styleItem != null)
            {
                RootStyleItem.StyleItem.Children.Add(styleItem);
            }
        }
Beispiel #23
0
                static void CreateTextStyle()
                {
                    mText = new Styles.Style( );
                    mText.Initialize();

                    mText.mAlignment   = Styles.Alignment.Left;
                    mText.mFont.mName  = "OpenSans-Regular";
                    mText.mFont.mSize  = 18;
                    mText.mFont.mColor = 0xAFAFAFFF;
                    mText.mTextCase    = Styles.TextCase.Normal;
                }
Beispiel #24
0
 protected override Styles.Style GetBaseStyle()
 {
     Styles.Style style = base.GetBaseStyle();
     style.Font.FontFamily         = (Scryber.Drawing.PDFFontSelector) "Courier";
     style.Text.WrapText           = Scryber.Text.WordWrap.NoWrap;
     style.Text.PreserveWhitespace = true;
     style.Position.PositionMode   = Drawing.PositionMode.Block;
     style.Font.FontSize           = 10;
     //style.Overflow.Split = Drawing.OverflowSplit.Never;
     return(style);
 }
Beispiel #25
0
 private static void AddNewStyleToLayer(FeatureLayer featureLayer, Styles.Style style, int from, int to)
 {
     for (int i = 0; i < GisEditor.ActiveMap.ZoomLevelSet.CustomZoomLevels.Count; i++)
     {
         var tmpZoomLevel = featureLayer.ZoomLevelSet.CustomZoomLevels[i];
         if (i >= from - 1 && i <= to - 1)
         {
             tmpZoomLevel.CustomStyles.Add(style);
         }
     }
 }
Beispiel #26
0
                static void CreateRevealBoxStyle()
                {
                    mRevealBox = new Styles.Style( );
                    mRevealBox.Initialize();

                    // make reveal boxes redish
                    mRevealBox.mAlignment   = Styles.Alignment.Left;
                    mRevealBox.mFont.mName  = "OpenSans-Bold";
                    mRevealBox.mFont.mSize  = 18;
                    mRevealBox.mFont.mColor = 0xC8C8C8FF;
                    mRevealBox.mTextCase    = Styles.TextCase.Normal;
                }
        internal static void AddStyle(Styles.Style style, FeatureLayer layer)
        {
            var styleProvider = GisEditor.StyleManager.GetStylePluginByStyle(style);

            if (styleProvider == null)
            {
                return;
            }
            Styles.Style          csvStyle  = styleProvider.GetDefaultStyle();
            StyleBuilderArguments arguments = new StyleBuilderArguments();

            arguments.AvailableUIElements = StyleBuilderUIElements.ZoomLevelPicker | StyleBuilderUIElements.StyleList;
            arguments.FeatureLayer        = layer;
            var featureLayerPlugin = GisEditor.LayerManager.GetLayerPlugins(layer.GetType()).FirstOrDefault() as FeatureLayerPlugin;

            if (featureLayerPlugin != null)
            {
                switch (featureLayerPlugin.GetFeatureSimpleShapeType(layer))
                {
                case SimpleShapeType.Point:
                    arguments.AvailableStyleCategories = StyleCategories.Point | StyleCategories.Label | StyleCategories.Composite;
                    break;

                case SimpleShapeType.Line:
                    arguments.AvailableStyleCategories = StyleCategories.Line | StyleCategories.Label | StyleCategories.Composite;
                    break;

                case SimpleShapeType.Area:
                    arguments.AvailableStyleCategories = StyleCategories.Area | StyleCategories.Label | StyleCategories.Composite;
                    break;
                }
            }
            arguments.AppliedCallback = args =>
            {
                if (args.CompositeStyle != null)
                {
                    ZoomLevelHelper.ApplyStyle(args.CompositeStyle, layer, args.FromZoomLevelIndex, args.ToZoomLevelIndex);
                }
            };

            arguments.StyleToEdit = new CompositeStyle(new Styles.Style[] { csvStyle })
            {
                Name = styleProvider.Name
            };
            arguments.FillRequiredColumnNames();
            var resultStyle = GisEditor.StyleManager.EditStyle(arguments);

            if (!resultStyle.Canceled)
            {
                ZoomLevelHelper.ApplyStyle(resultStyle.CompositeStyle, layer, resultStyle.FromZoomLevelIndex, resultStyle.ToZoomLevelIndex);
            }
        }
Beispiel #28
0
        public static void Init()
        {
            if (_hasInitialized)
            {
                return;
            }
            _hasInitialized = true;

            // Controls
            Registrar.Handlers.Register <Button, ButtonHandler>();
            Registrar.Handlers.Register <Image, ImageHandler>();
            Registrar.Handlers.Register <TextField, TextFieldHandler>();
            Registrar.Handlers.Register <Text, TextHandler>();
            Registrar.Handlers.Register <SecureField, SecureFieldHandler>();
            Registrar.Handlers.Register <Slider, SliderHandler>();
            Registrar.Handlers.Register <ShapeView, ShapeViewHandler>();
            Registrar.Handlers.Register <Toggle, ToggleHandler>();
            Registrar.Handlers.Register <RadioButton, RadioButtonHandler>();
            Registrar.Handlers.Register <ProgressBar, ProgressBarHandler>();
            //Registrar.Handlers.Register<WebView, WebViewHandler> ();

            // Containers
            Registrar.Handlers.Register <ScrollView, ScrollViewHandler>();
            Registrar.Handlers.Register <View, ViewHandler>();
            Registrar.Handlers.Register <ContentView, ContentViewHandler>();
            Registrar.Handlers.Register <ListView, ListViewHandler>();
            Registrar.Handlers.Register <ViewRepresentable, ViewRepresentableHandler>();
            Registrar.Handlers.Register <RadioGroup, RadioGroupHandler>();

            // Managed Layout
            Registrar.Handlers.Register <HStack, HStackHandler>();
            Registrar.Handlers.Register <VStack, VStackHandler>();
            Registrar.Handlers.Register <ZStack, ZStackHandler>();
            Registrar.Handlers.Register <Spacer, SpacerHandler>();
            Registrar.Handlers.Register <Grid, GridHandler>();

            // Device Features
            ThreadHelper.JoinableTaskContext = new Microsoft.VisualStudio.Threading.JoinableTaskContext();
            ThreadHelper.SetFireOnMainThread(_invoker.BeginInvokeOnMainThread);
            Device.FontService     = new MacFontService();
            Device.GraphicsService = new MacGraphicsService();
            Device.BitmapService   = new MacBitmapService();


            AnimationManger.SetTicker(new MacTicker());

            //Set Default Style
            var style = new Styles.Style();

            style.Apply();
        }
        /// <summary>
        /// Overrides the base implementation to set the explict position mode before
        /// continuing on as normal
        /// </summary>
        /// <param name="comp"></param>
        /// <param name="full"></param>
        protected override void DoLayoutAChild(IPDFComponent comp, Styles.Style full)
        {
            //For each child if there is not an explict Absolute setting then
            //we should treat them as relative
            Styles.PositionStyle pos  = full.Position;
            PositionMode         mode = pos.PositionMode;

            if (mode != PositionMode.Absolute)
            {
                pos.PositionMode = PositionMode.Relative;
            }

            base.DoLayoutAChild(comp, full);
        }
Beispiel #30
0
                // Takes a string and replaces the content of the paragraph with it.
                private void SetText(string text, string activeUrl)
                {
                    foreach (IUIControl control in ChildControls)
                    {
                        control.RemoveFromView(ParentEditingCanvas);
                    }
                    ChildControls.Clear( );

                    // give the text a style that doesn't include things it shouldn't inherit
                    Styles.Style textStyle = mStyle;
                    textStyle.mBorderColor  = null;
                    textStyle.mBorderRadius = null;
                    textStyle.mBorderWidth  = null;

                    // now break it into words so we can do word wrapping
                    string[] words = text.Split(' ');

                    foreach (string word in words)
                    {
                        // create labels out of each one
                        if (string.IsNullOrEmpty(word) == false)
                        {
                            // if the last thing we added was a special control like a reveal box, we
                            // need the first label after that to have a leading space so it doesn't bunch up against
                            // the control
                            string   nextWord  = word;
                            NoteText wordLabel = Parser.CreateNoteText(new CreateParams(this, Frame.Width, Frame.Height, ref textStyle), nextWord + " ");

                            ChildControls.Add(wordLabel);
                        }
                    }

                    if (activeUrl.Trim( ) != EditableConfig.sPlaceholderUrlText && string.IsNullOrWhiteSpace(activeUrl) == false)
                    {
                        // help them out by adding 'https://' if it isn't there.
                        if (activeUrl.StartsWith("https") == false && BibleRenderer.IsBiblePrefix(activeUrl) == false)
                        {
                            activeUrl = activeUrl.Insert(0, "https://");
                        }

                        ActiveUrl = activeUrl;
                    }
                    else
                    {
                        ActiveUrl = null;
                    }

                    TryAddUrlGlyph(Frame.Width, Frame.Height);
                }
Beispiel #31
0
                void ParseHeaderElement( XmlReader reader, float parentWidth, float parentHeight, uint? parentBGColor, out PlatformLabel element, ref RectangleF elementBounds, ref Styles.Style defaultStyle )
                {
                    element = PlatformLabel.Create( );

                    // header elements are weird with styles. We don't want any of our parent's styles,
                    // so we create our own and mix that with our defaults
                    Styles.Style elementStyle = new Styles.Style( );
                    elementStyle.Initialize( );
                    elementStyle.mBackgroundColor = parentBGColor.HasValue ? parentBGColor.Value : 0; //one exception is background color. We do want to inherit that.
                    Styles.Style.ParseStyleAttributesWithDefaults( reader, ref elementStyle, ref defaultStyle );

                    // Note: Margins and padding are not supported by the individual elements of the header.

                    element.SetFont( elementStyle.mFont.mName, elementStyle.mFont.mSize.Value );
                    element.TextColor = elementStyle.mFont.mColor.Value;

                    if( elementStyle.mBackgroundColor.HasValue )
                    {
                        element.BackgroundColor = elementStyle.mBackgroundColor.Value;
                    }

                    element.Bounds = elementBounds;

                    // get text
                    switch( elementStyle.mTextCase )
                    {
                        case Styles.TextCase.Upper:
                        {
                            element.Text = reader.ReadElementContentAsString( ).ToUpper( );
                            break;
                        }

                        case Styles.TextCase.Lower:
                        {
                            element.Text = reader.ReadElementContentAsString( ).ToLower( );
                            break;
                        }

                        case Styles.TextCase.Normal:
                        {
                            element.Text = reader.ReadElementContentAsString( );
                            break;
                        }
                    }
                    element.SizeToFit( );


                    // horizontally position the controls according to their 
                    // requested alignment
                    Styles.Alignment controlAlignment = elementStyle.mAlignment.Value;

                    // adjust by our position
                    float xAdjust = 0;
                    switch( controlAlignment )
                    {
                        case Styles.Alignment.Center:
                        {
                            xAdjust = elementBounds.X + ( ( parentWidth / 2 ) - ( element.Bounds.Width / 2 ) );
                            element.TextAlignment = TextAlignment.Center;
                            break;
                        }
                        case Styles.Alignment.Right:
                        {
                            xAdjust = elementBounds.X + ( parentWidth - element.Bounds.Width );
                            element.TextAlignment = TextAlignment.Right;
                            break;
                        }
                        case Styles.Alignment.Left:
                        {
                            xAdjust = elementBounds.X;
                            element.TextAlignment = TextAlignment.Left;
                            break;
                        }
                    }

                    // adjust position
                    element.Position = new PointF( elementBounds.X + xAdjust, elementBounds.Y );
                }
                static void CreateHeaderStyle()
                {
                    WebRequest = new HttpRequest();

                    // Default the header container to no padding and left alignment.
                    mHeaderContainer = new Styles.Style( );
                    mHeaderContainer.Initialize();
                    mHeaderContainer.mAlignment = Styles.Alignment.Left;

                    // Title should be large, bevan, centered and white
                    // Also, prefer an upper case title.
                    mHeaderTitle = new Styles.Style( );
                    mHeaderTitle.Initialize();
                    mHeaderTitle.mAlignment = Styles.Alignment.Center;
                    mHeaderTitle.mTextCase = Styles.TextCase.Upper;
                    mHeaderTitle.mFont.mName = "Bevan";
                    mHeaderTitle.mFont.mSize = 18;
                    mHeaderTitle.mFont.mColor = 0xFFFFFFFF;

                    // Date should be medium, verdana, left and white
                    mHeaderDate = new Styles.Style( );
                    mHeaderDate.Initialize();
                    mHeaderDate.mAlignment = Styles.Alignment.Left;
                    mHeaderDate.mTextCase = Styles.TextCase.Normal;
                    mHeaderDate.mFont.mName = "Bevan";
                    mHeaderDate.mFont.mSize = 12;
                    mHeaderDate.mFont.mColor = 0xFFFFFFFF;

                    // Speaker should be mediu, verdana, right and white
                    mHeaderSpeaker = new Styles.Style( );
                    mHeaderSpeaker.Initialize();
                    mHeaderSpeaker.mAlignment = Styles.Alignment.Right;
                    mHeaderSpeaker.mTextCase = Styles.TextCase.Normal;
                    mHeaderSpeaker.mFont.mName = "Bevan";
                    mHeaderSpeaker.mFont.mSize = 12;
                    mHeaderSpeaker.mFont.mColor = 0xFFFFFFFF;
                }
                static void CreateUserNoteStyle()
                {
                    mUserNote = new Styles.Style( );
                    mUserNote.Initialize( );

                    mUserNote.mBorderColor = 0x777777FF;
                    mUserNote.mBorderRadius = 5;
                    mUserNote.mBorderWidth = 4;

                    mUserNote.mAlignment = Styles.Alignment.Left;
                    mUserNote.mFont.mName = "Bevan";
                    mUserNote.mFont.mSize = 8;
                    mUserNote.mFont.mColor = 0x777777FF;
                    mUserNote.mTextCase = Styles.TextCase.Normal;
                }
 static void CreateListItemStyle()
 {
     mListItem = new Styles.Style( );
     mListItem.Initialize( );
 }
                static void CreateParagraphStyle()
                {
                    // paragraphs should have a preference for left alignment
                    mParagraph = new Styles.Style( );
                    mParagraph.Initialize();

                    mParagraph.mAlignment = Styles.Alignment.Left;
                }
                static void CreateTextStyle()
                {
                    mText = new Styles.Style( );
                    mText.Initialize();

                    mText.mAlignment = Styles.Alignment.Left;
                    mText.mFont.mName = "Bevan";
                    mText.mFont.mSize = 12;
                    mText.mFont.mColor = 0xFFFFFFFF;
                    mText.mTextCase = Styles.TextCase.Normal;
                }
                static void CreateQuoteStyle()
                {
                    mQuote = new Styles.Style( );
                    mQuote.Initialize();

                    // Make quotes redish
                    mQuote.mAlignment = Styles.Alignment.Left;
                    mQuote.mFont.mName = "Bevan";
                    mQuote.mFont.mSize = 12;
                    mQuote.mFont.mColor = 0x6d1c1cFF;
                    mQuote.mTextCase = Styles.TextCase.Normal;
                }
                static void CreateTextInputStyle()
                {
                    mTextInput = new Styles.Style( );
                    mTextInput.Initialize();

                    // Make text input small by default
                    mTextInput.mAlignment = Styles.Alignment.Left;
                    mTextInput.mFont.mName = "Bevan";
                    mTextInput.mFont.mSize = 8;
                    mTextInput.mFont.mColor = 0xFFFFFFFF;
                    mTextInput.mTextCase = Styles.TextCase.Normal;

                    mTextInput.mBorderColor = 0x777777FF;
                    mTextInput.mBorderRadius = 5;
                    mTextInput.mBorderWidth = 4;
                }
                static void CreateRevealBoxStyle()
                {
                    mRevealBox = new Styles.Style( );
                    mRevealBox.Initialize();

                    // make reveal boxes redish
                    mRevealBox.mAlignment = Styles.Alignment.Left;
                    mRevealBox.mFont.mName = "Bevan";
                    mRevealBox.mFont.mSize = 12;
                    mRevealBox.mFont.mColor = 0x6d1c1cFF;
                    mRevealBox.mTextCase = Styles.TextCase.Normal;
                }
                static void CreateCanvasStyle()
                {
                    // like stacks and paragraphs, canvas shouldn't care about anything
                    // but alignment
                    mCanvas = new Styles.Style( );
                    mCanvas.Initialize( );

                    mCanvas.mAlignment = Styles.Alignment.Left;
                }
                static void CreateStackPanelStyle()
                {
                    // like paragraphs, stack panels shouldn't care about anything but alignment
                    mStackPanel = new Styles.Style( );
                    mStackPanel.Initialize( );

                    mStackPanel.mAlignment = Styles.Alignment.Left;
                }
Beispiel #42
0
 protected VisualItem()
 {
     _style = new Styles.Style();
 }
                static void CreateListStyle()
                {
                    mList = new Styles.Style( );
                    mList.Initialize( );

                    mList.mAlignment = Styles.Alignment.Left;
                    mList.mListBullet = "•"; //we want a nice looking bullet as default
                    mList.mListIndention = 25.0f;
                }
                static void CreateMainNoteStyle()
                {
                    // note should have a black background and no alignment
                    mMainNote = new Styles.Style( );
                    mMainNote.Initialize();

                    mMainNote.mBackgroundColor = 0x000000FF;
                    mMainNote.mFullWidthHeader = false;
                }