mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 14:16:07 -06:00
ide: More lines in package selection Recents, single-line mode in RichText removed
This commit is contained in:
parent
1553ad42e6
commit
eb0fcfeca3
6 changed files with 34 additions and 39 deletions
|
|
@ -34,7 +34,6 @@ private:
|
|||
bool shrink_oversized_objects;
|
||||
bool icursor = true;
|
||||
bool copy_with_tabs = false;
|
||||
bool single_line = false;
|
||||
|
||||
void EndSizeTracking();
|
||||
void SetSb();
|
||||
|
|
@ -121,7 +120,6 @@ public:
|
|||
RichTextView& ICursor(bool b = true) { icursor = b; return *this; }
|
||||
RichTextView& NoICursor() { return ICursor(false); }
|
||||
RichTextView& CopyWithTabs(bool b = true) { copy_with_tabs = b; return *this; }
|
||||
RichTextView& SingleLine(bool b = true) { single_line = b; return *this; }
|
||||
|
||||
void operator=(const char *qtf) { SetQTF(qtf); }
|
||||
|
||||
|
|
|
|||
|
|
@ -66,7 +66,6 @@ void RichTextView::Paint(Draw& w)
|
|||
pi.sizetracking = sizetracking;
|
||||
pi.shrink_oversized_objects = shrink_oversized_objects;
|
||||
pi.darktheme = IsDarkTheme();
|
||||
pi.single_line = single_line;
|
||||
Rect pg = GetPage();
|
||||
pg.top = TopY();
|
||||
text.Paint(pw, pg, pi);
|
||||
|
|
@ -82,8 +81,6 @@ void RichTextView::SetSb()
|
|||
|
||||
bool RichTextView::Key(dword key, int count)
|
||||
{
|
||||
if(single_line)
|
||||
return false;
|
||||
if(key == K_CTRL_C || key == K_SHIFT_INSERT) {
|
||||
Copy();
|
||||
return true;
|
||||
|
|
@ -93,8 +90,6 @@ bool RichTextView::Key(dword key, int count)
|
|||
|
||||
void RichTextView::MouseWheel(Point p, int zdelta, dword keyflags)
|
||||
{
|
||||
if(single_line)
|
||||
return;
|
||||
if(!WhenMouseWheel(zdelta, keyflags))
|
||||
sb.Wheel(zdelta);
|
||||
}
|
||||
|
|
@ -138,8 +133,6 @@ String RichTextView::GetSelectionData(const String& fmt) const
|
|||
|
||||
void RichTextView::RightDown(Point p, dword keyflags)
|
||||
{
|
||||
if(single_line)
|
||||
return;
|
||||
MenuBar b;
|
||||
b.Add(cursor != anchor, t_("Copy"), CtrlImg::copy(), THISBACK(Copy)).Key(K_CTRL_C);
|
||||
b.Execute();
|
||||
|
|
@ -159,10 +152,7 @@ int RichTextView::GetPointPos(Point p) const
|
|||
sz.cx -= margin.left + margin.right;
|
||||
sz.cy -= margin.top + margin.bottom;
|
||||
p = GetTextPoint(p);
|
||||
Rect pg = GetPage();
|
||||
if(single_line)
|
||||
pg.right = INT_MAX / 2;
|
||||
return text.GetPos(p.x, PageY(0, p.y), pg);
|
||||
return text.GetPos(p.x, PageY(0, p.y), GetPage());
|
||||
}
|
||||
|
||||
String RichTextView::GetLink(int pos, Point p) const
|
||||
|
|
@ -251,8 +241,6 @@ void RichTextView::LeftDown(Point p, dword keyflags)
|
|||
|
||||
void RichTextView::LeftDouble(Point p, dword keyflags)
|
||||
{
|
||||
if(single_line)
|
||||
return;
|
||||
int pos = GetPointPos(p);
|
||||
if(IsLeNum(text[pos])) {
|
||||
anchor = pos;
|
||||
|
|
@ -270,8 +258,6 @@ void RichTextView::LeftDouble(Point p, dword keyflags)
|
|||
|
||||
void RichTextView::LeftTriple(Point p, dword keyflags)
|
||||
{
|
||||
if(single_line)
|
||||
return;
|
||||
int pos = GetPointPos(p);
|
||||
RichPos rp = text.GetRichPos(pos);
|
||||
anchor = pos - rp.posinpara;
|
||||
|
|
@ -285,8 +271,6 @@ void RichTextView::MouseMove(Point p, dword keyflags)
|
|||
int pos = GetPointPos(p);
|
||||
WhenMouseMove(pos);
|
||||
if(HasCapture()) {
|
||||
if(single_line)
|
||||
return;
|
||||
if(pos < 0)
|
||||
return;
|
||||
cursor = pos;
|
||||
|
|
|
|||
|
|
@ -414,8 +414,6 @@ void RichPara::Paint(PageDraw& pw, RichContext rc, const PaintInfo& pi,
|
|||
hg++;
|
||||
}
|
||||
rc.py.y += linecy;
|
||||
if(pi.single_line)
|
||||
break;
|
||||
}
|
||||
Size sz = RichTextImg::EndParaChar().GetSize();
|
||||
if(sz.cy < z * lineascent && !IsNull(pi.showcodes))
|
||||
|
|
|
|||
|
|
@ -290,7 +290,6 @@ struct PaintInfo {
|
|||
void *context;
|
||||
bool showlabels;
|
||||
bool shrink_oversized_objects;
|
||||
bool single_line = false; // draw just one line (special usecase)
|
||||
void (*DrawSelection)(Draw& w, int x, int y, int cx, int cy);
|
||||
|
||||
Color ResolveInk(Color ink) const;
|
||||
|
|
|
|||
|
|
@ -207,16 +207,29 @@ SelectPackageDlg::SelectPackageDlg(const char *title, bool selectvars_, bool mai
|
|||
parent.Add(list.SizePos());
|
||||
parent.AddFrame(splitter.Left(base, Zx(170)));
|
||||
|
||||
recent.NoSb().NoHyperlinkDecoration().SingleLine();
|
||||
recent.NoSb().NoHyperlinkDecoration();
|
||||
LoadLRU();
|
||||
if(main && selectvars && lru.GetCount()) {
|
||||
String text;
|
||||
for(int i = 0; i < lru.GetCount(); i++) {
|
||||
const auto& m = lru[i];
|
||||
MergeWith(text, ", ", "[$W^A" + AsString(i) + "^ \1" + m.a + "\1]" +
|
||||
MergeWith(text, ", ", "[@b^A" + AsString(i) + "^ \1" + m.a + "\1]" +
|
||||
":_[*^ "+ AsString(i) + "^ \1" + m.b + "\1]");
|
||||
}
|
||||
recent <<= "[g [@K/ Recent:] " + text;
|
||||
if(text.GetCount())
|
||||
recent <<= "[gpw [@K/ Recent:] " + text;
|
||||
Rect r = recent.GetRect();
|
||||
Rect pg = recent.GetPage();
|
||||
RichText txt = ParseQTF(recent.GetQTF());
|
||||
int cy = 0;
|
||||
for(int i = 0; i < txt.GetLength(); i++) { // Find the height of text that completely fits
|
||||
Rect cr = txt.GetCaret(i, pg);
|
||||
if(cr.bottom > r.GetHeight()) // does not fit
|
||||
break;
|
||||
cy = cr.bottom;
|
||||
}
|
||||
r.bottom = r.top + cy;
|
||||
recent.SetRect(r);
|
||||
recent.WhenLink = [=](const String& s) {
|
||||
if(*s == 'A') {
|
||||
int i = Atoi(~s + 1);
|
||||
|
|
@ -233,6 +246,9 @@ SelectPackageDlg::SelectPackageDlg(const char *title, bool selectvars_, bool mai
|
|||
}
|
||||
}
|
||||
};
|
||||
LogPos p = parent.GetPos();
|
||||
p.y.SetA(r.bottom + DPI(3));
|
||||
parent.SetPos(p);
|
||||
}
|
||||
else {
|
||||
LogPos p = parent.GetPos();
|
||||
|
|
@ -297,8 +313,8 @@ void SelectPackageDlg::StoreLRU(const String& p)
|
|||
if(i >= 0)
|
||||
lru.Remove(i);
|
||||
lru.Insert(0, q);
|
||||
if(lru.GetCount() > 10)
|
||||
lru.Trim(10);
|
||||
if(lru.GetCount() > 100)
|
||||
lru.Trim(100);
|
||||
StoreToFile(lru, LRUFilePath());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
LAYOUT(SelectPackageLayout, 816, 468)
|
||||
ITEM(Upp::RichTextCtrl, recent, LeftPosZ(4, 804).TopPosZ(4, 19))
|
||||
ITEM(Upp::ParentCtrl, parent, HSizePosZ(4, 8).VSizePosZ(24, 32))
|
||||
ITEM(Upp::DropList, kind, Tip(t_("Select which packages should be displayed")).LeftPosZ(4, 124).BottomPosZ(7, 19))
|
||||
ITEM(Upp::DropList, nest, Tip(t_("Select which packages should be displayed")).LeftPosZ(132, 112).BottomPosZ(7, 19))
|
||||
ITEM(Upp::EditString, search, Tip(t_("Search for the concrete package")).HSizePosZ(248, 412).BottomPosZ(6, 20))
|
||||
ITEM(Upp::Option, brief, SetLabel(t_("Brief list")).RightPosZ(332, 72).BottomPosZ(6, 20))
|
||||
ITEM(Upp::Button, help, SetLabel(t_("?")).RightPosZ(308, 20).BottomPosZ(4, 24))
|
||||
ITEM(Upp::Button, upphub, SetLabel(t_("UppHub")).RightPosZ(236, 68).BottomPosZ(4, 24))
|
||||
ITEM(Upp::Button, newu, SetLabel(t_("&New package")).RightPosZ(144, 88).BottomPosZ(4, 24))
|
||||
ITEM(Upp::Button, ok, SetLabel(t_("OK")).RightPosZ(76, 64).BottomPosZ(4, 24))
|
||||
ITEM(Upp::Button, cancel, SetLabel(t_("Cancel")).RightPosZ(8, 64).BottomPosZ(4, 24))
|
||||
LAYOUT(SelectPackageLayout, 816, 588)
|
||||
ITEM(Upp::RichTextCtrl, recent, LeftPosZ(4, 804).TopPosZ(4, 56))
|
||||
ITEM(Upp::ParentCtrl, parent, HSizePosZ(4, 8).VSizePosZ(64, 36))
|
||||
ITEM(Upp::DropList, kind, Tip(t_("Select which packages should be displayed")).LeftPosZ(4, 124).BottomPosZ(9, 19))
|
||||
ITEM(Upp::DropList, nest, Tip(t_("Select which packages should be displayed")).LeftPosZ(132, 112).BottomPosZ(9, 19))
|
||||
ITEM(Upp::EditString, search, Tip(t_("Search for the concrete package")).HSizePosZ(248, 412).BottomPosZ(8, 20))
|
||||
ITEM(Upp::Option, brief, SetLabel(t_("Brief list")).RightPosZ(332, 72).BottomPosZ(8, 20))
|
||||
ITEM(Upp::Button, help, SetLabel(t_("?")).RightPosZ(308, 20).BottomPosZ(6, 24))
|
||||
ITEM(Upp::Button, upphub, SetLabel(t_("UppHub")).RightPosZ(236, 68).BottomPosZ(6, 24))
|
||||
ITEM(Upp::Button, newu, SetLabel(t_("&New package")).RightPosZ(144, 88).BottomPosZ(6, 24))
|
||||
ITEM(Upp::Button, ok, SetLabel(t_("OK")).RightPosZ(76, 64).BottomPosZ(6, 24))
|
||||
ITEM(Upp::Button, cancel, SetLabel(t_("Cancel")).RightPosZ(8, 64).BottomPosZ(6, 24))
|
||||
END_LAYOUT
|
||||
|
||||
LAYOUT(ConfigLayout, 724, 216)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue