mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-08-30 23:02:39 -06:00
ide: Highlight column
git-svn-id: svn://ultimatepp.org/upp/trunk@12473 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
f8ba3140d9
commit
b653fbced0
9 changed files with 42 additions and 21 deletions
|
|
@ -157,6 +157,7 @@ void HighlightSetup::DarkTheme()
|
|||
SetHlStyle(PAPER_ERROR, Color(255, 205, 205));
|
||||
SetHlStyle(PAPER_WARNING, Color(255, 255, 205));
|
||||
SetHlStyle(SHOW_LINE, Color(63, 63, 63));
|
||||
SetHlStyle(SHOW_COLUMN, Color(63, 40, 40));
|
||||
SetHlStyle(WHITESPACE, Color(126, 186, 234));
|
||||
SetHlStyle(WARN_WHITESPACE, Color(191, 126, 126));
|
||||
}
|
||||
|
|
@ -223,6 +224,7 @@ void HighlightSetup::WhiteTheme()
|
|||
SetHlStyle(PAPER_WARNING, Blend(White(), Yellow(), 50));
|
||||
|
||||
SetHlStyle(SHOW_LINE, Color(199, 247, 198));
|
||||
SetHlStyle(SHOW_COLUMN, Color(247, 224, 220));
|
||||
|
||||
SetHlStyle(WHITESPACE, Blend(SColorLight, SColorHighlight));
|
||||
SetHlStyle(WARN_WHITESPACE, Blend(SColorLight, SRed));
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ HL_COLOR(PAPER_SELWORD, t_("Found/selected matches"), 0)
|
|||
HL_COLOR(PAPER_ERROR, t_("Error in compiler messages"), 0)
|
||||
HL_COLOR(PAPER_WARNING, t_("Warning in compiler messages"), 0)
|
||||
HL_COLOR(SHOW_LINE, t_("Current line highlight"), 0)
|
||||
HL_COLOR(SHOW_COLUMN, t_("Current column highlight"), 0)
|
||||
|
||||
HL_COLOR(WHITESPACE, t_("Whitespaces"), 1)
|
||||
HL_COLOR(WARN_WHITESPACE, t_("Misplaced tabs and spaces"), 1)
|
||||
|
|
|
|||
|
|
@ -24,7 +24,8 @@ LineEdit::LineEdit() {
|
|||
showlines = false;
|
||||
showreadonly = true;
|
||||
dorectsel = false;
|
||||
hline = Null;
|
||||
hline = vline = Null;
|
||||
vlinex = 0;
|
||||
warnwhitespace = false;
|
||||
}
|
||||
|
||||
|
|
@ -579,23 +580,27 @@ void LineEdit::Paint0(Draw& w) {
|
|||
: (do_highlight ? hl.Top() : ih).paper);
|
||||
if(bordercolumn > 0 && bordercolumn >= gp)
|
||||
rw.DrawRect((bordercolumn - sc.x) * fsz.cx, y, 1, fsz.cy, bordercolor);
|
||||
if((showlines || warn_whitespace)) {
|
||||
int yy = 2 * fsz.cy / 3;
|
||||
int x = (lgp >= 0 ? lgp : gp) * fsz.cx - scx;
|
||||
rw.DrawRect(x, y + yy, fsz.cx / 2, 1, showcolor);
|
||||
if(fsz.cx > 2)
|
||||
rw.DrawRect(x + 1, y + yy - 1, 1, 3, showcolor);
|
||||
if(fsz.cx > 5)
|
||||
rw.DrawRect(x + 2, y + yy - 2, 1, 5, showcolor);
|
||||
rw.DrawRect(x + fsz.cx / 2, y + yy / 2, 1, yy - yy / 2, showcolor);
|
||||
}
|
||||
if(sell == selh) {
|
||||
if(!IsNull(hline) && i == cursorline) {
|
||||
rw.DrawRect(0, y, sz.cx, 1, hline);
|
||||
rw.DrawRect(0, y + fsz.cy - 1, sz.cx, 1, hline);
|
||||
}
|
||||
if(!IsNull(vline))
|
||||
rw.DrawRect(caretpos.x, y, 1, fsz.cy, vline);
|
||||
}
|
||||
if(rectsel && rect.left == rect.right && i >= rect.top && i <= rect.bottom)
|
||||
rw.DrawRect(rect.left * fsz.cx - scx, y, 2, fsz.cy, Blend(color[PAPER_SELECTED], color[PAPER_NORMAL]));
|
||||
}
|
||||
if(pass == 0 && (showlines || warn_whitespace)) {
|
||||
int yy = 2 * fsz.cy / 3;
|
||||
int x = (lgp >= 0 ? lgp : gp) * fsz.cx - scx;
|
||||
rw.DrawRect(x, y + yy, fsz.cx / 2, 1, showcolor);
|
||||
if(fsz.cx > 2)
|
||||
rw.DrawRect(x + 1, y + yy - 1, 1, 3, showcolor);
|
||||
if(fsz.cx > 5)
|
||||
rw.DrawRect(x + 2, y + yy - 2, 1, 5, showcolor);
|
||||
rw.DrawRect(x + fsz.cx / 2, y + yy / 2, 1, yy - yy / 2, showcolor);
|
||||
}
|
||||
if(pass == 0 && !IsNull(hline) && sell == selh && i == cursorline) {
|
||||
rw.DrawRect(0, y, sz.cx, 1, hline);
|
||||
rw.DrawRect(0, y + fsz.cy - 1, sz.cx, 1, hline);
|
||||
}
|
||||
if(pass == 0 && rectsel && rect.left == rect.right && i >= rect.top && i <= rect.bottom)
|
||||
rw.DrawRect(rect.left * fsz.cx - scx, y, 2, fsz.cy, Blend(color[PAPER_SELECTED], color[PAPER_NORMAL]));
|
||||
}
|
||||
}
|
||||
y += fsz.cy;
|
||||
|
|
@ -603,9 +608,9 @@ void LineEdit::Paint0(Draw& w) {
|
|||
selh -= len + 1;
|
||||
pos += len + 1;
|
||||
}
|
||||
|
||||
w.DrawRect(0, y, sz.cx, sz.cy - y, color[IsReadOnly() && showreadonly || !IsShowEnabled() ? PAPER_READONLY : PAPER_NORMAL]);
|
||||
DrawTiles(w, DropCaret(), CtrlImg::checkers());
|
||||
vlinex = caretpos.x;
|
||||
}
|
||||
|
||||
void LineEdit::Paint(Draw& w)
|
||||
|
|
@ -820,6 +825,11 @@ int LineEdit::PlaceCaretNoG(int64 newcursor, bool sel) {
|
|||
WhenSel();
|
||||
if(IsAnySelection())
|
||||
SetSelectionSource(ClipFmtsText());
|
||||
if(!IsNull(hline)) {
|
||||
Size sz = GetSize();
|
||||
Refresh(vlinex, 0, 1, sz.cy);
|
||||
Refresh(caretpos.x, 0, 1, sz.cy);
|
||||
}
|
||||
return p.x;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -339,7 +339,8 @@ protected:
|
|||
int tabsize;
|
||||
int bordercolumn;
|
||||
Color bordercolor;
|
||||
Color hline;
|
||||
Color hline, vline;
|
||||
int vlinex;
|
||||
Scroller scroller;
|
||||
Point caretpos;
|
||||
bool nohbar;
|
||||
|
|
@ -467,6 +468,7 @@ public:
|
|||
LineEdit& NoShowReadOnly() { return ShowReadOnly(false); }
|
||||
bool IsShowReadOnly() { return showreadonly; }
|
||||
LineEdit& ShowCurrentLine(Color color) { hline = color; Refresh(); return *this; }
|
||||
LineEdit& ShowCurrentColumn(Color color) { vline = color; Refresh(); return *this; }
|
||||
|
||||
LineEdit& SetScrollBarStyle(const ScrollBar::Style& s) { sb.SetStyle(s); return *this; }
|
||||
|
||||
|
|
|
|||
|
|
@ -176,7 +176,7 @@ void Sentinel(Stream& s, const char *txt)
|
|||
|
||||
void Ide::Serialize(Stream& s)
|
||||
{
|
||||
int version = 14;
|
||||
int version = 15;
|
||||
Sentinel(s, "before 12341234");
|
||||
s.Magic(0x12341234);
|
||||
Sentinel(s, "after magic");
|
||||
|
|
@ -238,6 +238,8 @@ void Ide::Serialize(Stream& s)
|
|||
s % thousands_separator;
|
||||
if(version >= 5)
|
||||
s % hline;
|
||||
if(version >= 15)
|
||||
s % vline;
|
||||
s % barline;
|
||||
s % qtfsel;
|
||||
s % wrap_console_text;
|
||||
|
|
|
|||
|
|
@ -133,6 +133,7 @@ void Ide::UpdateFormat(CodeEditor& editor)
|
|||
editor.HiliteIfEndif(hilite_if_endif);
|
||||
editor.ThousandsSeparator(thousands_separator);
|
||||
editor.ShowCurrentLine(hline ? HighlightSetup::GetHlStyle(HighlightSetup::SHOW_LINE).color : (Color)Null);
|
||||
editor.ShowCurrentColumn(vline ? HighlightSetup::GetHlStyle(HighlightSetup::SHOW_COLUMN).color : (Color)Null);
|
||||
editor.LineNumbers(line_numbers);
|
||||
editor.AutoEnclose(auto_enclose);
|
||||
editor.MarkLines(mark_lines);
|
||||
|
|
@ -439,6 +440,7 @@ void Ide::SetupFormat() {
|
|||
(hlt.hilite_if_endif, hilite_if_endif)
|
||||
(hlt.thousands_separator, thousands_separator)
|
||||
(hlt.hline, hline)
|
||||
(hlt.vline, vline)
|
||||
|
||||
(edt.indent_spaces, indent_spaces)
|
||||
(edt.no_parenthesis_indent, no_parenthesis_indent)
|
||||
|
|
|
|||
|
|
@ -571,7 +571,7 @@ public:
|
|||
bool no_parenthesis_indent;
|
||||
bool hilite_if_endif;
|
||||
bool thousands_separator;
|
||||
bool hline;
|
||||
bool hline, vline;
|
||||
bool wrap_console_text;
|
||||
bool mute_sounds;
|
||||
bool line_numbers;
|
||||
|
|
|
|||
|
|
@ -515,6 +515,7 @@ LAYOUT(SetupHlLayout, 544, 300)
|
|||
ITEM(Option, hilite_if_endif, SetLabel(t_("#if/#endif tracing")).LeftPosZ(380, 160).TopPosZ(196, 18))
|
||||
ITEM(Option, thousands_separator, SetLabel(t_("Thousands separator")).LeftPosZ(380, 160).TopPosZ(212, 18))
|
||||
ITEM(Option, hline, SetLabel(t_("Current line")).LeftPosZ(380, 160).TopPosZ(228, 18))
|
||||
ITEM(Option, vline, SetLabel(t_("column")).LeftPosZ(464, 84).TopPosZ(228, 18))
|
||||
ITEM(Button, hl_restore, SetLabel(t_("Restore default colors")).LeftPosZ(380, 160).TopPosZ(252, 20))
|
||||
ITEM(Button, hl_restore_dark, SetLabel(t_("Dark theme")).LeftPosZ(460, 80).TopPosZ(276, 20))
|
||||
ITEM(Button, hl_restore_white, SetLabel(t_("White theme")).LeftPosZ(380, 76).TopPosZ(276, 20))
|
||||
|
|
|
|||
|
|
@ -569,6 +569,7 @@ Ide::Ide()
|
|||
hilite_if_endif = false;
|
||||
thousands_separator = true;
|
||||
hline = true;
|
||||
vline = false;
|
||||
wrap_console_text = true;
|
||||
mute_sounds = false;
|
||||
line_numbers = false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue