/// <summary> /// Dodaje novi layer u layout. Ako je __target objekat vec zakacen za neki layer odustaje i vraca FALSE /// </summary> /// <param name="__target">Objekat koji pruza sadrzaj</param> /// <param name="__blending">Nacin kopiranja sadrzaja</param> /// <param name="onTop">Ako je TRUE layer ce biti na vrhu (poslednji se renderuje), ako je FALSE layer ce biti prvi na dnu (prvi se renderuje)</param> /// <returns></returns> public virtual Boolean addLayer(ITextLayoutContentProvider __target, layerBlending __blending = layerBlending.notset, Int32 __ZOrder = -1) { if (__target == null) { return(false); } if (__blending != layerBlending.notset) { __target.blending = __blending; } if (__ZOrder > -1) { __target.ZLayerOrder = __ZOrder; } if (layers.Contains(__target)) { return(false); } layers.Add(__target); return(true); }
public textPageManager(ITextLayoutContentProvider host) { Int32 __top = host.getAttachmentHeight(false); Int32 __bottom = host.getAttachmentHeight(true); //height = host.height - (__bottom + __top+2); height = host.height - host.margin.top; }
/// <summary> /// Pakuje sadržaj po lejerima u IHasCursor target objekat koristeći njegov kursor /// </summary> /// <param name="target">Objekat čijim kursorom pakuje sadržaj</param> private void render(ITextLayoutContentProvider source, IHasCursor target) { textCursor cursor; cursor = target.cursor; cursor.switchToZone(textCursorZone.innerZone); if (source != null) { List <String> lns = source.getContent().ToList(); switch (source.blending) { case layerBlending.background: cursor.switchToZone(textCursorZone.outterZone); cursor.moveToCorner(textCursorZoneCorner.UpLeft); foreach (String ln in lns) { target.write(cursor, ln, -1, true); //target.write(ln, cursor.x, true, layer.target.width, true); } break; case layerBlending.semitransparent: lns = lns.GetRange(source.innerBoxedTopPosition, source.innerBoxedHeight); cursor.switchToZone(textCursorZone.innerBoxedZone); cursor.moveToCorner(textCursorZoneCorner.UpLeft); foreach (String ln in lns) { target.write(cursor, ln, -1, true); // target.write(cursor, ln, -1, true); //ln, 0, true, source.width, true); } break; case layerBlending.transparent: // lns = lns.GetRange(source.innerBoxedTopPosition, source.innerBoxedHeight); cursor.switchToZone(textCursorZone.innerBoxedZone); cursor.moveToCorner(textCursorZoneCorner.UpLeft); for (Int32 i = source.innerBoxedTopPosition; i < source.innerBoxedBottomPosition; i++) { String cur = source.select(cursor, target.innerWidth, false); target.write(cursor, cur); } break; case layerBlending.hidden: break; } } cursor.switchToMainZone(); }
public aceMenuItem getMenuItemBySection(ITextLayoutContentProvider section) { aceMenuItem output = null; foreach (var ir in this) { if (ir.section == section) { return(ir.result as aceMenuItem); } } return(output); }
public void paint(ITextLayoutContentProvider parent, String deco = "") { Clear(); if (!String.IsNullOrEmpty(deco)) { deco = parent.marginDecoration; } String ln = deco.Repeat(parent.width); for (int i = 0; i < parent.height; i++) { Add(ln); } }
public textContentLines(ITextLayoutContentProvider parent) { String deco = " "; if (!String.IsNullOrEmpty(parent.marginDecoration)) { deco = parent.marginDecoration; } String ln = deco.Repeat(parent.width); for (int i = 0; i < parent.height; i++) { Add(ln); } }
/// <summary> /// Kaci prosledjeni section na ovaj - zajedno ce biti renderovani /// </summary> /// <param name="__sectionToAttach">Sekcija koja se kaci na ovu</param> /// <param name="isBottomAttachment">Ako je TRUE onda ga dodaje sa donje strane</param> /// <returns>Vraca sekciju koja je bila ranije attachovana, ako je NULL onda je prvi put da se nesto attachuje</returns> public ITextLayoutContentProvider setAttachment(ITextLayoutContentProvider __sectionToAttach, Boolean isBottomAttachment = true) { ITextLayoutContentProvider popout = null; if (isBottomAttachment) { popout = bottom_attachment; bottom_attachment = __sectionToAttach; __sectionToAttach.setAttachment(this, false); refreshAttachmentPosition(isBottomAttachment); //__sectionToAttach.margin.top = outerBottomPosition; //__sectionToAttach.ZLayerOrder = ZLayerOrder + 5; return(popout); } else { top_attachment = __sectionToAttach; // refreshAttachmentPosition(isBottomAttachment); //if (margin.top > __sectionToAttach.innerBoxedHeight) //{ // popout = top_attachment; // //__sectionToAttach.margin.top = margin.top - __sectionToAttach.innerBoxedHeight; // // __sectionToAttach.setAttachment(this, false); // //__sectionToAttach.ZLayerOrder = ZLayerOrder - 5; // refreshAttachmentPosition(isBottomAttachment); //} else //{ // Exception ex = new aceGeneralException("Top attachment refused> no free space in section margin"); // throw ex; //} //refreshAttachmentPosition(isBottomAttachment); return(popout); } return(popout); }
public textInputResult getBySection(ITextLayoutContentProvider section) { textInputResult output = null; if (section != null) { foreach (var ir in this) { if (ir.section == section) { resultInFocus = ir; return(ir); } } } output = new textInputResult(platform, inputReadMode.unknown, new selectZone(0, 0, 0, 0)); output.section = section; Add(output); return(output); }
private static int compareZ(ITextLayoutContentProvider x, ITextLayoutContentProvider y) { return(x.ZLayerOrder.CompareTo(y.ZLayerOrder)); }
/// <summary> /// #1 Generise sadrzaj /// </summary> private void render(ITextLayoutContentProvider source, IPlatform platform) { platform.setColors(source.foreColor, source.backColor, source.doInverseColors); List <String> lns = source.getContent().ToList(); textCursor cursor = new textCursor(platform, textCursorMode.fixedZone, textCursorZone.outterZone); if (source is smartInfoLineSection) { string[] cnt = source.getContent(); platform.render(cnt[0], 0, source.margin.top); return; } switch (source.blending) { case layerBlending.background: cursor.switchToZone(textCursorZone.outterZone); cursor.moveToCorner(textCursorZoneCorner.UpLeft); foreach (String ln in lns) { platform.render(ln, 0, cursor.y); cursor.nextLine(); //target.write(cursor, ln, -1, true); //target.write(ln, cursor.x, true, layer.target.width, true); } break; case layerBlending.semitransparent: cursor = new textCursor(source, textCursorMode.fixedZone, textCursorZone.outterZone); cursor.switchToZone(textCursorZone.innerBoxedZone); cursor.moveToCorner(textCursorZoneCorner.UpLeft); for (Int32 i = 0; i < source.innerBoxedHeight; i++) { cursor.moveLineTo(i); String cur = source.select(cursor, source.innerBoxedHeight, true); platform.render(cur, 0, cursor.y); } //lns = lns.GetRange(source.innerBoxedTopPosition, source.innerBoxedHeight); //cursor.moveLineTo(source.innerBoxedTopPosition); //cursor.switchToZone(enums.textCursorZone.innerBoxedZone); //cursor.moveToCorner(textCursorZoneCorner.UpLeft); foreach (String ln in lns) { platform.render(ln, 0, cursor.y); //target.write(cursor, ln, -1, true); // target.write(cursor, ln, -1, true); //ln, 0, true, source.width, true); } break; case layerBlending.transparent: // lns = lns.GetRange(source.innerBoxedTopPosition, source.innerBoxedHeight); cursor = new textCursor(source, textCursorMode.fixedZone, textCursorZone.innerBoxedZone); cursor.switchToZone(textCursorZone.innerBoxedZone); cursor.moveToCorner(textCursorZoneCorner.UpLeft); for (Int32 i = source.innerBoxedTopPosition; i < source.innerBoxedBottomPosition; i++) { cursor.y = i; //cursor.x = String cur = source.select(cursor, source.innerBoxedWidth, false); platform.render(cur, cursor.x, cursor.y); } break; case layerBlending.hidden: break; } platform.setColorsBack(); //platform.setColors(platformColorName.none); }
public override Boolean addLayer(ITextLayoutContentProvider __target, layerBlending __blending = layerBlending.notset, Int32 __ZOrder = -1) { // __target.margin.top = __target.margin.top + this.margin.top; return(base.addLayer(__target, __blending, __ZOrder)); }