mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
RichText, Report: RichTextLayoutTracer ability, theide: workspace slash/backslash fix
git-svn-id: svn://ultimatepp.org/upp/trunk@1513 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
c3f5ea97a8
commit
b612e1756c
10 changed files with 113 additions and 83 deletions
|
|
@ -37,11 +37,6 @@ void Report::Clear()
|
|||
SetPageSize(3968, 6074);
|
||||
}
|
||||
|
||||
Draw& Report::Info()
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
Rect Report::GetPageRect()
|
||||
{
|
||||
Rect r = GetSize();
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ NAMESPACE_UPP
|
|||
|
||||
class Report : public DrawingDraw, public PageDraw {
|
||||
public:
|
||||
virtual Draw& Info();
|
||||
virtual Draw& Page(int i);
|
||||
|
||||
private:
|
||||
|
|
@ -49,6 +48,8 @@ public:
|
|||
void Put(const char *qtf);
|
||||
Report& operator<<(const char *qtf) { Put(qtf); return *this; }
|
||||
|
||||
void SetRichTextLayoutTracer(RichTextLayoutTracer& l) { tracer = &l; }
|
||||
|
||||
Point GetMargins() const { return mg; }
|
||||
|
||||
Report& SetPageSize(Size sz);
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ int RichEdit::PtToDot(double pt)
|
|||
|
||||
struct EditPageDraw : public PageDraw {
|
||||
virtual Draw& Page(int _page);
|
||||
virtual Draw& Info() { return w; }
|
||||
|
||||
Draw& w;
|
||||
int page;
|
||||
|
|
|
|||
|
|
@ -155,6 +155,8 @@ void RichPara::Paint(PageDraw& pw, const Rect& page, PageY py, const PaintInfo&
|
|||
{
|
||||
Zoom z = pi.zoom;
|
||||
PageY opy = py;
|
||||
if(pw.tracer)
|
||||
pw.tracer->Paragraph(page, py, *this);
|
||||
Lines pl = Begin(page, py, nbefore, nline);
|
||||
bool highlight = pi.highlightpara >= 0 && pi.highlightpara < pl.len;
|
||||
int hy = py.y - format.before - format.ruler;
|
||||
|
|
@ -370,6 +372,8 @@ void RichPara::Paint(PageDraw& pw, const Rect& page, PageY py, const PaintInfo&
|
|||
pw.Page(py.page).DrawRect(z * page.left, top, z * page.right - z * page.left,
|
||||
z * min(py.y + format.after, page.bottom) - top, InvertColor);
|
||||
}
|
||||
if(pw.tracer)
|
||||
pw.tracer->EndParagraph(py);
|
||||
}
|
||||
|
||||
void RichPara::GetRichPos(RichPos& rp, int pos) const
|
||||
|
|
|
|||
|
|
@ -6,7 +6,10 @@
|
|||
|
||||
NAMESPACE_UPP
|
||||
|
||||
class PasteClip;
|
||||
class PasteClip;
|
||||
struct RichPara;
|
||||
class RichTable;
|
||||
class RichTxt;
|
||||
|
||||
struct Zoom {
|
||||
int m, d;
|
||||
|
|
@ -95,11 +98,23 @@ struct PageRect : public Rect {
|
|||
PageRect() { Clear(); page = 0; }
|
||||
};
|
||||
|
||||
struct PageDraw {
|
||||
virtual Draw& Info() = 0;
|
||||
virtual Draw& Page(int i) = 0;
|
||||
struct RichTextLayoutTracer {
|
||||
virtual void Paragraph(const Rect& page, PageY y, const RichPara& para);
|
||||
virtual void EndParagraph(PageY y);
|
||||
virtual void Table(const Rect& page, PageY y, const RichTable& table);
|
||||
virtual void EndTable(PageY y);
|
||||
virtual void TableRow(const Rect& page, PageY y, int i, const RichTable& table);
|
||||
virtual void EndTableRow(PageY y);
|
||||
virtual void TableCell(const Rect& page, PageY y, int i, int j, const RichTable& table);
|
||||
virtual void EndTableCell(PageY y);
|
||||
};
|
||||
|
||||
operator Draw&() { return Info(); }
|
||||
struct PageDraw {
|
||||
virtual Draw& Page(int i) = 0;
|
||||
|
||||
RichTextLayoutTracer *tracer;
|
||||
|
||||
PageDraw() { tracer = NULL; }
|
||||
|
||||
virtual ~PageDraw() {}
|
||||
};
|
||||
|
|
@ -452,7 +467,6 @@ String EncodeHtml(const RichText& text, Index<String>& css,
|
|||
struct SimplePageDraw : PageDraw {
|
||||
Draw& w;
|
||||
|
||||
virtual Draw& Info();
|
||||
virtual Draw& Page(int);
|
||||
|
||||
SimplePageDraw(Draw& w) : w(w) {}
|
||||
|
|
@ -465,7 +479,6 @@ struct PrintPageDraw : PageDraw {
|
|||
NilDraw nw;
|
||||
|
||||
Draw& Page(int _page) { return page == _page ? w : (Draw&)nw; }
|
||||
Draw& Info() { return w; }
|
||||
void SetPage(int _page) { page = _page; }
|
||||
|
||||
PrintPageDraw(Draw& w) : w(w) {}
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@ bool RichTable::RowPaint(PageDraw& pw, const RichStyles& st, const Layout& tab,
|
|||
const PaintRow& pr = tab[i];
|
||||
rc.py = pr.py;
|
||||
rc.py.page += pd;
|
||||
if(pw.tracer)
|
||||
pw.tracer->TableRow(pg, rc.py, i, *this);
|
||||
int gridln = LineZoom(pi.zoom, format.grid);
|
||||
int ff2ln = gridln - gridln / 2;
|
||||
Color gc = format.gridcolor;
|
||||
|
|
@ -71,10 +73,15 @@ bool RichTable::RowPaint(PageDraw& pw, const RichStyles& st, const Layout& tab,
|
|||
if(paint)
|
||||
pw.Page(rc.py.page).DrawRect(xpg.left, y - gridln, xpg.Width(), gridln, gc);
|
||||
}
|
||||
if(paint)
|
||||
if(paint) {
|
||||
if(pw.tracer)
|
||||
pw.tracer->TableCell(rc.page, rc.py, i, j, *this);
|
||||
row[j].Paint(pw, rc, pyy, xpg, y, ny, pi,
|
||||
sel && j >= pi.cells.left && i >= pi.cells.top &&
|
||||
j + cell.hspan <= pi.cells.right && i + cell.vspan <= pi.cells.bottom);
|
||||
if(pw.tracer)
|
||||
pw.tracer->EndTableCell(pyy);
|
||||
}
|
||||
if(pyy.page == rc.py.page)
|
||||
ExpandFrr(frr, pyy.page, xpg.left, xpg.right, y, ny);
|
||||
else {
|
||||
|
|
@ -90,76 +97,81 @@ bool RichTable::RowPaint(PageDraw& pw, const RichStyles& st, const Layout& tab,
|
|||
}
|
||||
j += cell.hspan + 1;
|
||||
}
|
||||
|
||||
if(pw.tracer)
|
||||
pw.tracer->EndTableRow(rc.py);
|
||||
return rc.py >= pi.bottom;
|
||||
}
|
||||
|
||||
void RichTable::Paint(PageDraw& pw, RichContext rc, const PaintInfo& _pi) const
|
||||
{
|
||||
if(pw.tracer)
|
||||
pw.tracer->Table(rc.page, rc.py, *this);
|
||||
const TabLayout& tab = Realize(rc);
|
||||
if(tab.page.IsEmpty())
|
||||
return;
|
||||
Rect p = tab.page;
|
||||
PaintInfo pi = _pi;
|
||||
int frameln = LineZoom(pi.zoom, format.frame);
|
||||
int gridln = LineZoom(pi.zoom, format.grid);
|
||||
Rect pg = rc.page;
|
||||
pg.left += format.lm;
|
||||
pg.right -= format.rm;
|
||||
pg.left = pi.zoom * pg.left;
|
||||
pg.right = pi.zoom * pg.right;
|
||||
pg.top = pi.zoom * pg.top;
|
||||
pg.bottom = pi.zoom * pg.bottom;
|
||||
pg.Deflate(frameln);
|
||||
int hy = min(format.header, cell.GetCount());
|
||||
Rect hpg = pg;
|
||||
if(tab.hasheader) {
|
||||
hpg.bottom = pi.zoom * tab.header[hy - 1].pyy.y;
|
||||
pg.top = hpg.bottom + gridln;
|
||||
}
|
||||
bool allsel = false;
|
||||
if(pi.sell < 0 && pi.selh >= 0) {
|
||||
pi.sell = pi.selh = 0;
|
||||
allsel = true;
|
||||
}
|
||||
bool sel = pi.tablesel == 0;
|
||||
int ny = cell.GetCount();
|
||||
VectorMap<int, Rect> frr;
|
||||
for(int i = 0; i < ny; i++)
|
||||
if(RowPaint(pw, rc.styles, tab, i, ny, pg, frr, pi, 0, sel))
|
||||
break;
|
||||
|
||||
Color gc = format.gridcolor;
|
||||
Color fc = format.framecolor;
|
||||
int fl = frameln;
|
||||
if(!IsNull(pi.showcodes)) {
|
||||
if(fl == 0 && !IsNull(pi.showcodes)) {
|
||||
fl = 1;
|
||||
fc = pi.showcodes;
|
||||
if(!tab.page.IsEmpty()) {
|
||||
Rect p = tab.page;
|
||||
PaintInfo pi = _pi;
|
||||
int frameln = LineZoom(pi.zoom, format.frame);
|
||||
int gridln = LineZoom(pi.zoom, format.grid);
|
||||
Rect pg = rc.page;
|
||||
pg.left += format.lm;
|
||||
pg.right -= format.rm;
|
||||
pg.left = pi.zoom * pg.left;
|
||||
pg.right = pi.zoom * pg.right;
|
||||
pg.top = pi.zoom * pg.top;
|
||||
pg.bottom = pi.zoom * pg.bottom;
|
||||
pg.Deflate(frameln);
|
||||
int hy = min(format.header, cell.GetCount());
|
||||
Rect hpg = pg;
|
||||
if(tab.hasheader) {
|
||||
hpg.bottom = pi.zoom * tab.header[hy - 1].pyy.y;
|
||||
pg.top = hpg.bottom + gridln;
|
||||
}
|
||||
if(gridln == 0) {
|
||||
gridln = 1;
|
||||
gc = pi.showcodes;
|
||||
bool allsel = false;
|
||||
if(pi.sell < 0 && pi.selh >= 0) {
|
||||
pi.sell = pi.selh = 0;
|
||||
allsel = true;
|
||||
}
|
||||
}
|
||||
for(int i = 0; i < frr.GetCount(); i++) {
|
||||
PaintInfo _pi = pi;
|
||||
pi.tablesel = 0;
|
||||
pi.sell = pi.selh = -1;
|
||||
int pgi = frr.GetKey(i);
|
||||
Draw& w = pw.Page(pgi);
|
||||
if(pgi > tab.page0 && tab.hasheader)
|
||||
for(int i = 0; i < hy; i++) {
|
||||
RowPaint(pw, rc.styles, tab.header, i, hy, hpg, frr, pi, pgi, false);
|
||||
w.DrawRect(pg.left, hpg.bottom, pg.Width(), gridln, format.gridcolor);
|
||||
bool sel = pi.tablesel == 0;
|
||||
int ny = cell.GetCount();
|
||||
VectorMap<int, Rect> frr;
|
||||
for(int i = 0; i < ny; i++)
|
||||
if(RowPaint(pw, rc.styles, tab, i, ny, pg, frr, pi, 0, sel))
|
||||
break;
|
||||
|
||||
Color gc = format.gridcolor;
|
||||
Color fc = format.framecolor;
|
||||
int fl = frameln;
|
||||
if(!IsNull(pi.showcodes)) {
|
||||
if(fl == 0 && !IsNull(pi.showcodes)) {
|
||||
fl = 1;
|
||||
fc = pi.showcodes;
|
||||
}
|
||||
if(gridln == 0) {
|
||||
gridln = 1;
|
||||
gc = pi.showcodes;
|
||||
}
|
||||
}
|
||||
for(int i = 0; i < frr.GetCount(); i++) {
|
||||
PaintInfo _pi = pi;
|
||||
pi.tablesel = 0;
|
||||
pi.sell = pi.selh = -1;
|
||||
int pgi = frr.GetKey(i);
|
||||
Draw& w = pw.Page(pgi);
|
||||
if(pgi > tab.page0 && tab.hasheader)
|
||||
for(int i = 0; i < hy; i++) {
|
||||
RowPaint(pw, rc.styles, tab.header, i, hy, hpg, frr, pi, pgi, false);
|
||||
w.DrawRect(pg.left, hpg.bottom, pg.Width(), gridln, format.gridcolor);
|
||||
}
|
||||
Rect r = frr[i].Inflated(frameln);
|
||||
if(!r.IsEmpty()) {
|
||||
DrawFatFrame(w, r, fc, fl);
|
||||
if(allsel)
|
||||
w.DrawRect(r, InvertColor);
|
||||
}
|
||||
Rect r = frr[i].Inflated(frameln);
|
||||
if(!r.IsEmpty()) {
|
||||
DrawFatFrame(w, r, fc, fl);
|
||||
if(allsel)
|
||||
w.DrawRect(r, InvertColor);
|
||||
}
|
||||
}
|
||||
if(pw.tracer)
|
||||
pw.tracer->EndTable(rc.py);
|
||||
}
|
||||
|
||||
PageY RichTable::GetHeight(RichContext rc) const
|
||||
|
|
|
|||
|
|
@ -338,4 +338,13 @@ RichText::RichText(pick_ RichTxt& x, pick_ RichStyles& st)
|
|||
nolinks = false;
|
||||
}
|
||||
|
||||
void RichTextLayoutTracer::Paragraph(const Rect& page, PageY y, const RichPara& para) {}
|
||||
void RichTextLayoutTracer::EndParagraph(PageY y) {}
|
||||
void RichTextLayoutTracer::Table(const Rect& page, PageY y, const RichTable& table) {}
|
||||
void RichTextLayoutTracer::EndTable(PageY y) {}
|
||||
void RichTextLayoutTracer::TableRow(const Rect& page, PageY y, int i, const RichTable& table) {}
|
||||
void RichTextLayoutTracer::EndTableRow(PageY y) {}
|
||||
void RichTextLayoutTracer::TableCell(const Rect& page, PageY y, int i, int j, const RichTable& table) {}
|
||||
void RichTextLayoutTracer::EndTableCell(PageY y) {}
|
||||
|
||||
END_UPP_NAMESPACE
|
||||
|
|
|
|||
|
|
@ -2,11 +2,6 @@
|
|||
|
||||
NAMESPACE_UPP
|
||||
|
||||
Draw& SimplePageDraw::Info()
|
||||
{
|
||||
return w;
|
||||
}
|
||||
|
||||
Draw& SimplePageDraw::Page(int)
|
||||
{
|
||||
return w;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#define _RichText_icpp_init_stub
|
||||
#include "plugin\png/init"
|
||||
#include "Draw/init"
|
||||
#define BLITZ_INDEX__ FDE63A693846F2AB9FD888AAECF47B819
|
||||
#define BLITZ_INDEX__ F667B6E6D1D19507E8A017DF290EB9418
|
||||
#include "RichImage.icpp"
|
||||
#undef BLITZ_INDEX__
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -401,9 +401,11 @@ void Workspace::AddLoad(const String& name, bool match, const Vector<String>& fl
|
|||
void Workspace::AddUses(Package& p, bool match, const Vector<String>& flag)
|
||||
{
|
||||
int q = package.GetCount();
|
||||
for(int i = 0; i < p.uses.GetCount(); i++)
|
||||
if((!match || MatchWhen(p.uses[i].when, flag)) && package.Find(p.uses[i].text) < 0)
|
||||
AddLoad(p.uses[i].text, match, flag);
|
||||
for(int i = 0; i < p.uses.GetCount(); i++) {
|
||||
String uses = UnixPath(p.uses[i].text);
|
||||
if((!match || MatchWhen(p.uses[i].when, flag)) && package.Find(uses) < 0)
|
||||
AddLoad(uses, match, flag);
|
||||
}
|
||||
for(int i = q; i < package.GetCount(); i++)
|
||||
AddUses(package[i], match, flag);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue