RichText: Fixed table selection issues

git-svn-id: svn://ultimatepp.org/upp/trunk@6592 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2013-11-21 06:51:44 +00:00
parent 4f65f39eed
commit 0ac2ebf109
8 changed files with 139 additions and 12 deletions

View file

@ -2,7 +2,7 @@
NAMESPACE_UPP
#define LLOG(x) DLOG(x)
#define LLOG(x) // DLOG(x)
Report::Report()
{
@ -66,10 +66,12 @@ void Report::StartPage(int i)
{
DrawingDraw dw(GetSize());
page.At(i) = dw;
LLOG("Creating page " << i);
LLOG("Start page " << i);
Create(GetSize());
WhenPage();
LLOG("Paint header");
PaintHF(*this, 0, header, i);
LLOG("Paint footer");
PaintHF(*this, GetSize().cy - footercy, footer, i);
y = GetPageRect().top;
}
@ -154,6 +156,7 @@ Report& Report::Landscape()
void Report::Put(const RichText& txt, void *context)
{
PageY py(pagei, y);
LLOG("Put RichText, py: " << py << ", pagerect: " << GetPageRect());
PaintInfo paintinfo;
paintinfo.top = PageY(0, 0);
paintinfo.bottom = PageY(INT_MAX, INT_MAX);
@ -162,6 +165,7 @@ void Report::Put(const RichText& txt, void *context)
paintinfo.context = context;
txt.Paint(*this, py, GetPageRect(), paintinfo);
py = txt.GetHeight(py, GetPageRect());
LLOG("Final pos: " << py);
Page(py.page);
y = py.y;
}

View file

@ -16,7 +16,7 @@ void RichEdit::FinishNF()
}
else
if(p.table != anchorp.table) {
if(text.GetRichPos(anchor, 1).table == 1 && anchor < cursor) {
if(anchor == 0 && anchorp.level == 1 && text.GetRichPos(anchor, 1).table == 1 && anchor < cursor) {
begtabsel = true;
anchor = 0;
}

View file

@ -150,8 +150,8 @@ void RichEdit::MouseMove(Point p, dword flags)
for(int i = 0; i < tabmove.column; i++)
nl += fmt.column[i];
int xn = fmt.column[tabmove.column] + fmt.column[tabmove.column + 1];
int xl = tabmove.left + tabmove.cx * nl / sum + 120;
int xh = tabmove.left + tabmove.cx * (nl + xn) / sum - 120;
int xl = tabmove.left + tabmove.cx * nl / sum + 12;
int xh = tabmove.left + tabmove.cx * (nl + xn) / sum - 12;
if(xl >= xh)
return;
int xx = minmax(GetSnapX(p.x) - tabmove.delta, xl, xh) - tabmove.left;

View file

@ -1224,6 +1224,26 @@ trTR("H\303\274cre \303\266zellikleri")
zhCN("\345\215\225\345\205\203\346\240\274\345\261\236\346\200\247")
zhTW("\345\226\256\346\240\274\345\261\254\346\200\247")
T_("(no change)")
caES("")
csCZ("(ponechat)")
deDE("")
esES("")
fiFI("")
frFR("")
huHU("")
itIT("")
nlNL("")
plPL("")
ptBR("")
roRO("")
ruRU("")
skSK("")
srSP("")
trTR("")
zhCN("")
zhTW("")
// Find.cpp
@ -1979,6 +1999,69 @@ trTR("")
zhCN("\346\240\267\345\274\217\351\224\256\346\240\207...")
zhTW("\346\250\243\345\274\217\351\215\265..")
T_("Header/Footer..")
caES("")
csCZ("")
deDE("")
esES("")
fiFI("")
frFR("")
huHU("")
itIT("")
nlNL("")
plPL("")
ptBR("")
roRO("")
ruRU("")
skSK("")
srSP("")
trTR("")
zhCN("")
zhTW("")
// HeaderFooter.cpp
T_("Insert page number")
caES("")
csCZ("")
deDE("")
esES("")
fiFI("")
frFR("")
huHU("")
itIT("")
nlNL("")
plPL("")
ptBR("")
roRO("")
ruRU("")
skSK("")
srSP("")
trTR("")
zhCN("")
zhTW("")
T_("Insert page count")
caES("")
csCZ("")
deDE("")
esES("")
fiFI("")
frFR("")
huHU("")
itIT("")
nlNL("")
plPL("")
ptBR("")
roRO("")
ruRU("")
skSK("")
srSP("")
trTR("")
zhCN("")
zhTW("")
// RichEdit.lay
@ -3382,6 +3465,46 @@ trTR("Sonraki ile birlikte")
zhCN("\344\270\216\344\270\213\344\270\200\350\241\214\344\277\235\346\214\201\344\270\200\350\207\264")
zhTW("\350\210\207\344\270\213\344\270\200\350\241\214\344\277\235\346\214\201\344\270\200\350\207\264")
T_("Use header")
caES("")
csCZ("")
deDE("")
esES("")
fiFI("")
frFR("")
huHU("")
itIT("")
nlNL("")
plPL("")
ptBR("")
roRO("")
ruRU("")
skSK("")
srSP("")
trTR("")
zhCN("")
zhTW("")
T_("Use footer")
caES("")
csCZ("")
deDE("")
esES("")
fiFI("")
frFR("")
huHU("")
itIT("")
nlNL("")
plPL("")
ptBR("")
roRO("")
ruRU("")
skSK("")
srSP("")
trTR("")
zhCN("")
zhTW("")
// Obsolete

View file

@ -316,8 +316,8 @@ void RichEdit::CellProperties()
dlg.align.Set(0, ALIGN_TOP);
dlg.align.Set(1, ALIGN_CENTER);
dlg.align.Set(2, ALIGN_BOTTOM);
dlg.color.WithVoid().VoidText("(no change)");
dlg.border.WithVoid().VoidText("(no change)");
dlg.color.WithVoid().VoidText(t_("(no change)"));
dlg.border.WithVoid().VoidText(t_("(no change)"));
if(dlg.Run() != IDOK)
return;
r.Retrieve();

View file

@ -38,7 +38,7 @@ Rect RichText::GetPageMinusHeaderFooter(const Rect& page) const
}
void RichText::PaintHeaderFooter(PageDraw& pw, const Rect& page, const PaintInfo& pi_,
int from_page, int to_page, int page_count) const
int from_page, int to_page) const
{
Rect rpage = GetPageMinusHeaderFooter(page);
if(rpage == page)
@ -46,7 +46,7 @@ void RichText::PaintHeaderFooter(PageDraw& pw, const Rect& page, const PaintInfo
PaintInfo pi = pi_;
pi.sell = pi.selh = 0;
VectorMap<String, Value> vars;
vars.Add("PAGECOUNT", GetHeight(rpage).page);
vars.Add("PAGECOUNT", GetHeight(page).page + 1);
for(int i = from_page; i <= to_page; i++) {
vars.GetAdd("PAGENUMBER") = i + 1;
if(header) {

View file

@ -10,7 +10,7 @@ class RichText : public RichTxt, public DeepCopyOption<RichText> {
Rect GetPageMinusHeaderFooter(const Rect& page) const;
void PaintHeaderFooter(PageDraw& pw, const Rect& page, const PaintInfo& pi,
int from_page, int to_page, int page_count) const;
int from_page, int to_page) const;
struct StyleChangeOp;
struct SetStylesOp;

View file

@ -35,7 +35,7 @@ void RichText::Paint(PageDraw& w, PageY py, const Rect& page, const PaintInfo& p
py.y = ctx.page.top;
ctx.py = py;
RichTxt::Paint(w, ctx, pi);
PaintHeaderFooter(w, page, pi, from_page, ctx.py.page, 9999);
PaintHeaderFooter(w, page, pi, from_page, ctx.py.page);
}
void RichText::Paint(PageDraw& w, const Rect& page, const PaintInfo& pi) const
@ -43,7 +43,7 @@ void RichText::Paint(PageDraw& w, const Rect& page, const PaintInfo& pi) const
RichContext ctx = Context(page);
int from_page = ctx.py.page;
RichTxt::Paint(w, ctx, pi);
PaintHeaderFooter(w, page, pi, from_page, ctx.py.page, 9999);
PaintHeaderFooter(w, page, pi, from_page, ctx.py.page);
}
RichCaret RichText::GetCaret(int pos, const Rect& page) const