Ejemplo n.º 1
0
        /// <summary>
        /// Appends the table row.
        /// </summary>
        /// <param name="role">The role.</param>
        /// <param name="columns">The columns.</param>
        public void AppendTableRow(acePaletteVariationRole role, params String[] columns)
        {
            String output = "";

            foreach (String col in columns)
            {
                output = imbSciStringExtensions.add(output, col, "|");
            }

            output = output.newLine();

            switch (role)
            {
            case acePaletteVariationRole.header:
            case acePaletteVariationRole.heading:
                foreach (String col in columns)
                {
                    output = imbSciStringExtensions.add(output, "-".Repeat(col.Length), "|");
                }
                break;

            default:
                break;
            }

            Append(output);
        }
        /// <summary>
        /// Gets the palette shot set - by custom role, inverse and act
        /// </summary>
        /// <param name="role">The role.</param>
        /// <param name="isInverse">if set to <c>true</c> [is inverse].</param>
        /// <param name="act">The act.</param>
        /// <returns>ShotSet with all colors and brushes</returns>
        /// \ingroup_disabled report_ll_highlights
        public acePaletteShot getShotSet(acePaletteVariationRole role, Boolean isInverse, acePaletteRole act)
        {
            String codeName = getColorVariationCodeName(role, isInverse, act);

            if (!shotSets.ContainsKey(codeName))
            {
                shotSets[codeName] = makePalleteShotSet(role, isInverse, act);
            }
            return(getShotSet(codeName));
        }
        /// <summary>
        /// Gets the color[] variation set for [0] background, [1] tp, [2] foreground
        /// </summary>
        /// <param name="_index">The index.</param>
        /// <param name="_isInverse">if set to <c>true</c> [is inverse].</param>
        /// <param name="act">Palette role</param>
        /// <returns>[0] background, [1] tp, [2] foreground</returns>
        internal acePaletteShot makePalleteShotSet(acePaletteVariationRole role, Boolean isInverse, acePaletteRole act = acePaletteRole.none)
        {
            acePaletteShot output = new acePaletteShot();
            Int32          _intex = role.ToInt32();

            if (isInverse)
            {
                _intex = ccount - _intex - 1;
            }

            _intex = _intex.checkRange(acePaletteVariationRole.none.ToInt32() - 1, 0);

            aceColorPalette tmppal = this[act];
            var             bgc    = tmppal.bgColors[_intex];
            var             bgb    = tmppal.bgBrushes[_intex];
            var             bgt    = tmppal.tpColors[_intex];

            output.addAcePaletteShot(acePaletteShotResEnum.background, tmppal.bgColors[_intex], bgb, null, bgt, bgc);
            output.addAcePaletteShot(acePaletteShotResEnum.foreground, tmppal.fgColors[_intex], tmppal.fgBrushes[_intex], null, tmppal.fgColors[_intex], tmppal.fgColors[_intex]);
            output.addAcePaletteShot(acePaletteShotResEnum.border, tmppal.tpColors[_intex], tmppal.tpBrushes[_intex], null, tmppal.tpColors[_intex], tmppal.bgColors[_intex]);
            output.name = getColorVariationCodeName(role, isInverse, act);

            return(output);
        }
Ejemplo n.º 4
0
 public styleShotSet(appendRole role, appendType type, acePaletteVariationRole colorRole, acePaletteRole paletteRole, Boolean isInverse, styleTheme theme)
 {
     palette   = theme.palletes.getShotSet(colorRole, isInverse, paletteRole);
     text      = theme.textShotProvider.getShotSet(role, type);
     container = theme.styleContainerProvider.getShotSet(role, type);
 }
        public static acePaletteVariationRole convertRoleToVariationRole(this appendRole role)
        {
            //appendType type = appendType.heading;

            //acePaletteVariationRole varRole = acePaletteVariationRole.normal;

            acePaletteVariationRole colorRole = acePaletteVariationRole.normal;

            switch (role)
            {
            case appendRole.none:
                break;

            case appendRole.mergedHead:

                colorRole = acePaletteVariationRole.header;
                break;

            case appendRole.mergedContent:

                colorRole = acePaletteVariationRole.normal;
                break;

            case appendRole.mergedFoot:

                colorRole = acePaletteVariationRole.heading;
                break;

            case appendRole.sectionHead:

                colorRole = acePaletteVariationRole.header;
                break;

            case appendRole.sectionContent:

                colorRole = acePaletteVariationRole.normal;

                break;

            case appendRole.sectionFoot:

                colorRole = acePaletteVariationRole.heading;

                break;

            case appendRole.majorHeading:
                colorRole = acePaletteVariationRole.heading;

                break;

            case appendRole.minorHeading:
                colorRole = acePaletteVariationRole.normal;

                break;

            case appendRole.paragraph:
                colorRole = acePaletteVariationRole.normal;

                break;

            case appendRole.remark:
                colorRole = acePaletteVariationRole.heading;

                break;

            case appendRole.tableHead:

                colorRole = acePaletteVariationRole.header;

                break;

            case appendRole.tableColumnHead:

                colorRole = acePaletteVariationRole.heading;

                break;

            case appendRole.tableColumnFoot:
                colorRole = acePaletteVariationRole.heading;

                break;

            case appendRole.tableCellValue:

                colorRole = acePaletteVariationRole.even;

                break;

            case appendRole.tableCellAnnotation:
                colorRole = acePaletteVariationRole.even;

                break;

            case appendRole.tableCellNovalue:
                colorRole = acePaletteVariationRole.even;

                break;

            case appendRole.tableBetween:
                colorRole = acePaletteVariationRole.even;

                break;

            case appendRole.tableFoot:
                colorRole = acePaletteVariationRole.heading;

                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            return(colorRole);
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Setting dsa_variationRole argument
 /// </summary>
 /// <param name="variationRole">Value for dsa_variationRole</param>
 /// <returns>Instruction</returns>
 public docScriptInstruction arg(acePaletteVariationRole variationRole)
 {
     this.add(docScriptArguments.dsa_variationRole, variationRole);
     return(this);
 }
        /// <summary>
        /// Sets the sizing.
        /// </summary>
        /// <param name="data">The data.</param>
        /// <param name="width">The width.</param>
        /// <param name="height">The height.</param>
        /// <param name="doMerge">if set to <c>true</c> [do merge].</param>
        /// <param name="varRole">The variable role.</param>
        /// <param name="role">The role.</param>
        /// <returns></returns>
        public static PropertyCollection setSizing(this PropertyCollection data, int width, int height, bool doMerge, acePaletteVariationRole varRole, appendRole role)
        {
            if (data == null)
            {
                data = new PropertyCollection();
            }

            data.addObjectToMultikeys(width, true, templateFieldStyle.style_width, docScriptArguments.dsa_w);
            data.addObjectToMultikeys(height, true, templateFieldStyle.style_height, docScriptArguments.dsa_h);
            data.addObjectToMultikeys(doMerge, true, docScriptArguments.dsa_doMerge);
            data.addObjectToMultikeys(varRole, true, docScriptArguments.dsa_variationRole);
            data.addObjectToMultikeys(role, true, templateFieldStyle.style_appendRole);

            return(data);
        }
 /// <summary>
 /// Gets the palette shot set - by role and current state of provider
 /// </summary>
 /// <param name="role">The role.</param>
 /// <returns></returns>
 public acePaletteShot getShotSet(acePaletteVariationRole role)
 {
     return(getShotSet(role, state.inverseState, state.active));
 }
 public String getHexCodeBackground(acePaletteVariationRole role)
 {
     return(current.bgColors[role.ToInt32()].ColorToHex());
 }
 /// <summary>
 /// Gets the codename of the color variation.
 /// </summary>
 /// <param name="role">The role.</param>
 /// <param name="isInverse">if set to <c>true</c> [is inverse].</param>
 /// <param name="act">The act.</param>
 /// <returns></returns>
 public static String getColorVariationCodeName(acePaletteVariationRole role, Boolean isInverse, acePaletteRole act)
 {
     return(role.ToString().add(isInverse.ToString(), "_").add(act.ToString(), "_"));
 }
Ejemplo n.º 11
0
        //protected IStyleInstruction resolveInstruction(appendRole role, styleApplicationFlag aFlag)
        //{
        //    IStyleInstruction output = null;
        //    appendType type = role.
        //    styleShotSet shot = new styleShotSet(role)

        //    if (flags.HasFlag(styleApplicationFlag.autoByRole))
        //    {
        //    }
        //}

#pragma warning disable CS1574 // XML comment has cref attribute 'appendType' that could not be resolved
        /// <summary>
        /// Resolves autoshot into a series of instructions
        /// </summary>
        /// <param name="theme">The active teme</param>
        /// <param name="__resources">Resources: set of style related enums and appendType</param>
        /// <seealso cref="aceCommonTypes.enums.appendType"/>
        /// <seealso cref="acePaletteRole"/>
        /// <seealso cref="appendRole"/>
        /// <seealso cref="acePaletteVariationRole"/>
        /// <returns></returns>
        public List <IStyleInstruction> resolve(styleTheme theme, params Object[] __resources)
#pragma warning restore CS1574 // XML comment has cref attribute 'appendType' that could not be resolved
        {
            List <IStyleInstruction> output    = new List <IStyleInstruction>();
            acePaletteVariationRole  colorRole = acePaletteVariationRole.none;

            List <Int32> xy = __resources.getAllOfType <Int32>(false);

            //--------- applying customizations
            appendType     type        = __resources.getFirstOfType <appendType>(false, appendType.none);
            appendRole     role        = __resources.getFirstOfType <appendRole>(false, appendRole.none);
            Boolean        isInverse   = __resources.getFirstOfType <Boolean>(false, false);
            acePaletteRole paletteRole = __resources.getFirstOfType <acePaletteRole>(false, acePaletteRole.none);

            if (role == appendRole.none)
            {
                role = appendRole.paragraph;
            }

            //if ((role != appendRole.none) && (type == appendType.none))
            //{
            //    type = role.convertRoleToType();
            //}

            //if ((role != appendRole.none) && (colorRole == acePaletteVariationRole.none))
            //{
            //    colorRole = role.convertRoleToVariationRole();
            //}

            if (paletteRole == acePaletteRole.none)
            {
                flags &= ~styleApplicationFlag.enableColorShot;
            }

            if (flags.HasFlag(styleApplicationFlag.autoByVariator))
            {
                var tmp = theme.styler.getStyleShot(xy[0], xy[1], type);
                if (flags.HasFlag(styleApplicationFlag.enableColorShot))
                {
                    palette = tmp.palette;                                                      //theme.palletes.getShotSet(colorRole, isInverse, paletteRole);
                }
                if (flags.HasFlag(styleApplicationFlag.enableTextShot))
                {
                    text = tmp.text;                                                     // theme.textShotProvider.getShotSet(role);
                }
                if (flags.HasFlag(styleApplicationFlag.enableContentShot))
                {
                    container = container;                                                        // = theme.styleContainerProvider.getShotSet(role, type);
                }
            }
            else
            {
                if (flags.HasFlag(styleApplicationFlag.enableColorShot))
                {
                    palette = theme.palletes.getShotSet(colorRole, isInverse, paletteRole);
                }
                if (flags.HasFlag(styleApplicationFlag.enableTextShot))
                {
                    text = theme.textShotProvider.getShotSet(role);
                }
                if (flags.HasFlag(styleApplicationFlag.enableContentShot))
                {
                    container = theme.styleContainerProvider.getShotSet(role, type);
                }
            }

            if (flags.HasFlag(styleApplicationFlag.setAsActive))
            {
                theme.activeStyleInstruction = this;
            }

            foreach (IStyleInstruction inst in this)
            {
                if (inst != null)
                {
                    output.Add(inst);
                }
            }

            return(output);
        }