/// <summary> /// Initializes a new instance of the <see cref="acePaletteProviderState"/> class. /// </summary> /// <param name="bg">The bg index</param> /// <param name="fg">The fg index</param> /// <param name="inverse">Inverse (bg/fg) state</param> /// <param name="act">Active palette</param> public acePaletteProviderState(Int32 bg, Int32 fg, Boolean inverse, acePaletteRole act) { bgIndex = bg; fgIndex = fg; inverseState = inverse; active = act; }
/// <summary> /// Sets the specified parameters (if input is not> -1, unknown, none) /// </summary> /// <param name="bg">The bg.</param> /// <param name="fg">The fg.</param> /// <param name="inverse">if set to <c>true</c> [inverse].</param> /// <param name="act">The act.</param> public void set(Int32 bg, Int32 fg, Boolean inverse, acePaletteRole act = acePaletteRole.none) { bgIndex = bg; fgIndex = fg; inverseState = inverse; active = act; }
/// <summary> /// Setups the specified color role. /// </summary> /// <param name="__colorRole">The color role. Unknown for no changes</param> /// <param name="__thickness">The thickness. -1 for no changes</param> /// <param name="__padding">The padding.-1 for no changes</param> /// <param name="__margin">The margin.-1 for no changes</param> /// <param name="__type">The type. Unknown for no changes</param> public void setup(acePaletteRole __colorRole = acePaletteRole.none, Int32 __thickness = -1, Int32 __padding = -1, Int32 __margin = -1, styleBorderType __type = styleBorderType.unknown) { if (__colorRole != acePaletteRole.none) { borderColor = __colorRole; } if (__thickness > -1) { thickness = __thickness; } if (__padding > -1) { padding = __padding; } //padding = __padding; if (__margin > -1) { margin = __margin; } //margin = __margin; if (__type != styleBorderType.unknown) { type = __type; } type = __type; }
public override void construct(object[] resources) { List <object> reslist = resources.getFlatList <object>(typeof(PropertyCollectionList), typeof(PropertyCollection)); PropertyCollectionList dataSet = reslist.Pop <PropertyCollectionList>(); // reslist[0] as PropertyCollectionList; //.getFirstOfType<PropertyCollectionList>(false, null); PropertyCollection dbInfo = reslist.Pop <PropertyCollection>(); // reslist.getFirstOfType<PropertyCollection>(false, null); PropertyCollectionList directAccessDataList = reslist.Pop <PropertyCollectionList>(); //reslist.getFirstOfType<PropertyCollectionList>(false, null); theme = reslist.getFirstOfType <styleTheme>(false, null); documentTitle = "DB Dump report :: " + (dbInfo.getProperString(templateFieldDataTable.data_dbname) + (" @ ") + (dbInfo.getProperString(templateFieldDataTable.data_dbhost))); documentDescription = "Database diagnostic dump -- all tables found at {{{data_dbname}}}"; documentBottomLine = "Tables :: " + (dbInfo.getProperString(templateFieldDataTable.data_tablescount) + " DB User :: " + (dbInfo.getProperString(templateFieldDataTable.data_dbuser))); //dataSet[0].getProperObject<PropertyCollectionList>(templateFieldDataTable.data_accesslist); overview = new pagePresetDataTableReportOverview(documentTitle, documentDescription, documentBottomLine); pages.Add(overview, this); overview.construct(resources); serviceDocumentFolderReadmePage readme = new serviceDocumentFolderReadmePage(name, documentTitle, documentDescription, documentBottomLine); pages.Add(readme, this); readme.construct(resources); foreach (PropertyCollection data in dataSet) { DataTable output = data.getProperObject <DataTable>(templateFieldDataTable.data_table); metaDataTablePage tablePage = new metaDataTablePage(); pages.Add(tablePage, this); tablePage.construct(resources); acePaletteRole rl = theme.palletes.paletteRoleWheel.next(); tablePage.settings.mainColor = rl; //data[templateFieldDataTable.data_accesslist] = directAccessList; //DataTable table = component.settings.dbc.execute("SELECT * FROM " + dba.tableName); //dba.AppendDataFields(data); //table.AppendDataFields(data); //dbDump.addDbTableReportPage(table); } //List<DataTable> dts = reslist.getAllOfType<DataTable>(false); //foreach (Object dt in dts) //{ // metaDataTablePage tmp = new metaDataTablePage(); // pages.Add(tmp, this); // tmp.construct(dt); //} sortChildren(); //throw new NotImplementedException(); }
/// <summary> /// Sets the colors. /// </summary> /// <param name="data">The data.</param> /// <param name="mainColor">Color of the main.</param> /// <param name="layoutColor">Color of the layout.</param> /// <returns></returns> public static PropertyCollection setColors(this PropertyCollection data, acePaletteRole mainColor, acePaletteRole layoutColor) { if (data == null) { data = new PropertyCollection(); } data.addObjectToMultikeys(mainColor, true, templateFieldStyle.style_defaultColorRole, docScriptArguments.dsa_paletteRole); data.addObjectToMultikeys(layoutColor, true, templateFieldStyle.style_layoutColorRole); return(data); }
/// <summary> /// Setups the specified padding. /// </summary> /// <param name="__padding">The padding. -1 to ignore</param> /// <param name="__margin">The margin. -1 to ignore</param> /// <param name="__borderColor">Color of the border. none to ignore</param> /// <param name="__thickness">The thickness. -1 to ignore</param> /// <param name="__type">The type. unknown to ignore</param> /// <param name="directions">The directions.</param> public void setup(Int32 __padding, Int32 __margin, acePaletteRole __borderColor, Int32 __thickness, styleBorderType __type, params styleSideDirection[] directions) { List <styleSideDirection> sides = directions.getFlatList <styleSideDirection>(); if (sides.Count == 0) { sides.AddMultiple(styleSideDirection.top, styleSideDirection.right, styleSideDirection.left, styleSideDirection.bottom); } foreach (styleSideDirection side in sides) { this[side].borderColor = __borderColor; this[side].padding = __padding; this[side].margin = __margin; this[side].thickness = __thickness; this[side].type = __type; } }
//public selectRangeArea getRowArea(Int32 y) //{ // cursorVariatorState currentState = state(area.x, y); // appendRole role = getAppendRole(currentState); // return output; //} #pragma warning disable CS1574 // XML comment has cref attribute 'appendType' that could not be resolved /// <summary> /// Provides complete <see cref="styleShotSet"/> according to x,y coordinates and desired <see cref="aceCommonTypes.enums.appendType"/>. /// </summary> /// <param name="x">X (horizontal) position relative to <c>selectRangeArea</c> 0,0 point.</param> /// <param name="y">Y (vertical) position relative to <c>selectRangeArea</c> 0,0 point.</param> /// <param name="type">If <c>appendType.none</c> it will automatically find the best match</param> /// <returns></returns> public styleShotSet getStyleShot(Int32 x, Int32 y, appendType type = appendType.none) #pragma warning restore CS1574 // XML comment has cref attribute 'appendType' that could not be resolved { cursorVariatorState currentState = state(x, y); appendRole role = getAppendRole(currentState); if (type == appendType.none) { throw new NotSupportedException("appendType is set to none!"); //type = role.convertRoleToType(); } acePaletteRole colorToUse = mainPaletteRole; if (currentState.useLayoutPalette) { colorToUse = layoutPaletteRole; } styleShotSet output = new styleShotSet(role, type, (acePaletteVariationRole)currentState.useColorIndex, colorToUse, currentState.useInvertedForeground, theme); return(output); }
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); }
/// <summary> /// Setting dsa_paletteRole argument /// </summary> /// <param name="paletteRole">Value for dsa_paletteRole</param> /// <returns>Instruction</returns> public docScriptInstruction arg(acePaletteRole paletteRole) { this.add(docScriptArguments.dsa_paletteRole, paletteRole); return(this); }
/// <summary> /// Sets the color role /// </summary> /// <param name="table">The table.</param> /// <param name="color">The color.</param> /// <param name="policy">The policy.</param> /// <returns></returns> public static Boolean SetColor(this DataTable table, acePaletteRole color, existingDataMode policy = existingDataMode.overwriteExisting) { return(table.ExtendedProperties.Append(templateFieldStyling.color_paletteRole, color, policy)); }
public dataProviderForStyler(cursorVariatorHeadFootFlags headFoot, appendTableOptionFlags tableOps, cursorVariatorOddEvenFlags oddEven, styleFourSide container, acePaletteRole mainColor, acePaletteRole layoutColor) { this.setColors(mainColor, layoutColor); this.setVariatorFlags(headFoot, tableOps, oddEven, container); }
/// <summary> /// Runs the style instruction. /// </summary> /// <param name="ins">The ins.</param> /// <returns></returns> /// <remarks>This is for mutliple execution</remarks> /// <exception cref="System.NotImplementedException">No implementation for: " + ins.type.ToString()</exception> protected appendType runStyleInstruction(docScriptInstruction ins) { //if (!hasDocRender) //{ // return ins.type; //} switch (ins.type) { case appendType.s_settings: if (ins.containsKey(d.dsa_background)) { string bgColor = ins.getProperString(Color.White.ColorToHex(), d.dsa_background); string fgColor = ins.getProperString(Color.Black.ColorToHex(), d.dsa_forecolor); docRender.ApplyColor(bgColor, null, false); docRender.ApplyColor(fgColor, null, true); } else if (ins.containsKey(d.dsa_innerAppend)) { appendType ap_type = ins.getProperEnum <appendType>(appendType.regular, d.dsa_innerAppend); appendRole ap_role = ins.getProperEnum <appendRole>(appendRole.paragraph, d.dsa_styleTarget); styleApplicationFlag ap_flag = ins.getProperEnum <styleApplicationFlag>(styleApplicationFlag.allShots, d.dsa_stylerSettings); styleAutoShotSet _shot = new styleAutoShotSet(ap_flag, ap_type, ap_role); List <IStyleInstruction> shots = _shot.resolve(theme); foreach (IStyleInstruction sh in shots) { docRender.ApplyStyle(sh, render.c.getPencil(pencilType.point, 1)); } } else if (ins.containsKey(d.dsa_variationRole)) { aceColorPalette palette = ins.getProperObject <aceColorPalette>(d.dsa_stylerSettings, null); int var = ins.getProperInt32(0, d.dsa_variationRole); acePaletteShotResEnum res = ins.getProperEnum <acePaletteShotResEnum>(acePaletteShotResEnum.background, d.dsa_styleTarget); Color col = palette.bgColors[var]; switch (res) { case acePaletteShotResEnum.foreground: col = palette.fgColors[var]; break; case acePaletteShotResEnum.background: col = palette.bgColors[var]; break; case acePaletteShotResEnum.border: col = palette.tpColors[var]; break; default: throw new ArgumentOutOfRangeException(); } docRender.ApplyColor(col.ColorToHex()); render.c.enter(); } break; case appendType.s_width: int key = ins.getProperInt32(0, d.dsa_key); int val = ins.getProperInt32(0, d.dsa_value); bool isHorizontal = ins.isHorizontal; var corner = ins.getProperEnum <textCursorZoneCorner>(textCursorZoneCorner.none, d.dsa_cursorCorner); bool isAutofit = (bool)ins.get(d.dsa_autostyling, false); if (isHorizontal) { docRender.ApplyColumn(key, val, corner, isAutofit); } else { docRender.ApplyRow(key, val, corner, isAutofit); } break; case appendType.s_variation: throw new NotImplementedException("No implementation for: " + ins.type.ToString()); break; case appendType.s_style: selectRangeArea area = resolveAreaForStyleShot(ins[d.dsa_styleTarget]); //.get(d.dsa_styleTarget)); if (ins.containsAllOfKeys(d.dsa_autostyling, d.dsa_styleTarget)) { styleApplicationFlag flag = ins.getProperEnum <styleApplicationFlag>(styleApplicationFlag.none, d.dsa_autostyling); styleAutoShotSet shot = new styleAutoShotSet(flag); styleStack.Add(shot, area); } else if (ins.containsAllOfKeys(d.dsa_stylerSettings, d.dsa_styleTarget)) { IStyleInstruction shot = ins[d.dsa_stylerSettings] as IStyleInstruction; if (shot == null) { throw new ArgumentNullException("dsa_stylerSettings", "docScript.s_style(null) - no IStyleInstruction for this instruction"); } else { styleStack.Add(shot, area); } } else { } break; case appendType.s_zone: if (ins.containsAnyOfTypes(typeof(textCursorZone))) { render.c.switchToZone(ins.getProperEnum <textCursorZone>(textCursorZone.unknownZone), ins.getProperEnum <textCursorZoneCorner>(textCursorZoneCorner.default_corner)); } else if (ins.containsAnyOfTypes(typeof(cursorSubzoneFrame))) { // prosledjena mu je zona render.c.setTempFrame(ins.getProperEnum <cursorSubzoneFrame>(cursorSubzoneFrame.fullFrame), ins.getProperEnum <textCursorZoneCorner>(textCursorZoneCorner.default_corner)); } else if (ins.containsAnyOfTypes(typeof(cursorZoneRole))) { cursorZoneRole zr = ins.getProperEnum <cursorZoneRole>(cursorZoneRole.master); int szi = ins.getProperInt32(0, docScriptArguments.dsa_value, docScriptArguments.dsa_level, docScriptArguments.dsa_priority); render.c.setToSubFrame(zr, szi); } else { throw new ArgumentNullException(ins.type.ToString(), "Minimum applicable docScriptArguments are missing - can't execute instruction like this"); } break; case appendType.s_alternate: theme.styler.isDisabled = false; break; case appendType.s_normal: theme.styler.isDisabled = true; break; case appendType.s_palette: acePaletteRole newRole = (acePaletteRole)ins.getProperField(d.dsa_paletteRole); if (ins.containsAnyOfKeys(d.dsa_dataTable, d.dsa_dataPairs, d.dsa_zoneFrame, d.dsa_variationRole)) { theme.styler.layoutPaletteRole = newRole; } else { theme.styler.mainPaletteRole = newRole; } break; default: //executionError(String.Format("Instruction ({0}) not supported by runStyleInstruction() method", ins.type.ToString()), ins); //executionError(String.Format("Instruction ({0}) not supported by runSpecialInstruction() method", ins.type.ToString()), ins); return(ins.type); break; } return(appendType.none); }
//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); }