mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-21 06:45:39 -06:00
ide skin
This commit is contained in:
parent
e0b8f38db0
commit
b2bb5f244b
15 changed files with 39 additions and 19 deletions
|
|
@ -49,8 +49,9 @@ bool Ctrl::DispatchKey(dword keycode, int count)
|
||||||
<< ", " << GetKeyDesc(keycode) << "), count:" << count
|
<< ", " << GetKeyDesc(keycode) << "), count:" << count
|
||||||
<< " focusCtrl:" << UPP::Name(focusCtrl) << " focusCtrlWnd:" << UPP::Name(focusCtrlWnd));
|
<< " focusCtrl:" << UPP::Name(focusCtrl) << " focusCtrlWnd:" << UPP::Name(focusCtrlWnd));
|
||||||
#if defined(_DEBUG) || defined(flagDEBUGCODE)
|
#if defined(_DEBUG) || defined(flagDEBUGCODE)
|
||||||
if(keycode == (K_SHIFT|K_CTRL|K_SUBTRACT)) {
|
if(keycode == (K_SHIFT|K_ALT|K_SUBTRACT)) {
|
||||||
skini = skini ? 0 : IsDarkTheme() ? 1 : 2;
|
skini = skini ? 0 : IsDarkTheme() ? 1 : 2;
|
||||||
|
DLOG("---- reskin");
|
||||||
ReSkin();
|
ReSkin();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ void ColorPusher::Paint(Draw& w)
|
||||||
voidtext, StdFont(), SColorText());
|
voidtext, StdFont(), SColorText());
|
||||||
else {
|
else {
|
||||||
auto DrawColor = [&](int x, int y, int cx, int cy) {
|
auto DrawColor = [&](int x, int y, int cx, int cy) {
|
||||||
if(color.GetSpecial() >= 0) {
|
if(color.GetSpecial() >= 0 && color.GetSpecial() < 18) {
|
||||||
Color c = RealizeColor(color);
|
Color c = RealizeColor(color);
|
||||||
w.DrawRect(x, y, cx / 2, cy, c);
|
w.DrawRect(x, y, cx / 2, cy, c);
|
||||||
w.DrawRect(x + cx / 2, y, cx - cx / 2, cy, DarkTheme(c));
|
w.DrawRect(x + cx / 2, y, cx - cx / 2, cy, DarkTheme(c));
|
||||||
|
|
|
||||||
|
|
@ -1449,6 +1449,11 @@ void FileSel::Activate()
|
||||||
TopWindow::Activate();
|
TopWindow::Activate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FileSel::Skin()
|
||||||
|
{
|
||||||
|
Reload();
|
||||||
|
}
|
||||||
|
|
||||||
bool FileSel::Key(dword key, int count) {
|
bool FileSel::Key(dword key, int count) {
|
||||||
switch(key) {
|
switch(key) {
|
||||||
case K_F9:
|
case K_F9:
|
||||||
|
|
|
||||||
|
|
@ -175,6 +175,7 @@ class FileSel : public WithFileSelectorLayout<TopWindow> {
|
||||||
public:
|
public:
|
||||||
virtual bool Key(dword key, int count);
|
virtual bool Key(dword key, int count);
|
||||||
virtual void Activate();
|
virtual void Activate();
|
||||||
|
virtual void Skin();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SizeGrip sizegrip;
|
SizeGrip sizegrip;
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ namespace Upp {
|
||||||
|
|
||||||
CH_STYLE(TabCtrl, Style, StyleDefault)
|
CH_STYLE(TabCtrl, Style, StyleDefault)
|
||||||
{
|
{
|
||||||
|
DLOG("TabCtrl style");
|
||||||
font = StdFont();
|
font = StdFont();
|
||||||
tabheight = font.Info().GetHeight() + 8;
|
tabheight = font.Info().GetHeight() + 8;
|
||||||
margin = 2;
|
margin = 2;
|
||||||
|
|
|
||||||
|
|
@ -417,6 +417,7 @@ void ChReset()
|
||||||
|
|
||||||
void ChFinish()
|
void ChFinish()
|
||||||
{
|
{
|
||||||
|
DLOG("-- chFinish");
|
||||||
sChInvalid = false;
|
sChInvalid = false;
|
||||||
for(int i = 0; i < sChStyle().GetCount(); i++)
|
for(int i = 0; i < sChStyle().GetCount(); i++)
|
||||||
sChStyle()[i].init();
|
sChStyle()[i].init();
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ void COMBINE5(klass, __, type, __, style)::InitIt() { \
|
||||||
\
|
\
|
||||||
const klass::type& klass::style() \
|
const klass::type& klass::style() \
|
||||||
{ \
|
{ \
|
||||||
static COMBINE5(klass, __, type, __, style) b, standard; \
|
static COMBINE5(klass, __, type, __, style) b; \
|
||||||
if(b.status == 0) { \
|
if(b.status == 0) { \
|
||||||
ChRegisterStyle__(b.status, b.registered, COMBINE5(klass, __, type, __, style)::InitIt); \
|
ChRegisterStyle__(b.status, b.registered, COMBINE5(klass, __, type, __, style)::InitIt); \
|
||||||
b.Init(); \
|
b.Init(); \
|
||||||
|
|
@ -76,10 +76,6 @@ const klass::type& klass::style() \
|
||||||
\
|
\
|
||||||
void COMBINE5(klass, __, type, __, style)::Init()
|
void COMBINE5(klass, __, type, __, style)::Init()
|
||||||
|
|
||||||
// standard = b; \
|
|
||||||
// standard.standard = b.standard = &standard; \
|
|
||||||
|
|
||||||
|
|
||||||
// CH_VAR0 allows inserting action into _Write (missing ending '}')
|
// CH_VAR0 allows inserting action into _Write (missing ending '}')
|
||||||
#define CH_VAR0(chtype, type, name, init) \
|
#define CH_VAR0(chtype, type, name, init) \
|
||||||
chtype& COMBINE(ch_var__, name)(); \
|
chtype& COMBINE(ch_var__, name)(); \
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ struct scImageMaker : ValueMaker {
|
||||||
StringBuffer s;
|
StringBuffer s;
|
||||||
s.Cat(typeid(*m).name());
|
s.Cat(typeid(*m).name());
|
||||||
RawCat(s, paintonly);
|
RawCat(s, paintonly);
|
||||||
|
RawCat(s, IsDarkTheme());
|
||||||
s.Cat(m->Key());
|
s.Cat(m->Key());
|
||||||
return String(s);
|
return String(s);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -175,10 +175,10 @@ FileTabs& FileTabs::operator<<(const FileTabs &src)
|
||||||
FileTabs::FileTabs() :
|
FileTabs::FileTabs() :
|
||||||
stackedicons(false),
|
stackedicons(false),
|
||||||
greyedicons(true),
|
greyedicons(true),
|
||||||
filecolor(SColorLabel),
|
filecolor(SColorLabel)
|
||||||
extcolor(IsDark(SColorFace()) ? Blend(White, LtBlue) : LtBlue)
|
|
||||||
{
|
{
|
||||||
|
static SColor se([] { return IsDark(SColorFace()) ? Blend(White, LtBlue) : LtBlue; });
|
||||||
|
extcolor = se;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1151,7 +1151,7 @@ void TabBar::PaintTab(Draw &w, const Size &sz, int n, bool enable, bool dragsamp
|
||||||
bool ac = (n == active && enable);
|
bool ac = (n == active && enable);
|
||||||
bool hl = (n == highlight && enable) || (stacking && highlight >= 0 && tabs[highlight].stack == t.stack);
|
bool hl = (n == highlight && enable) || (stacking && highlight >= 0 && tabs[highlight].stack == t.stack);
|
||||||
|
|
||||||
int c = align == LEFT ? cnt - n : n;
|
int c = align == LEFT ? cnt - n : n;
|
||||||
int lx = n > 0 ? s.extendleft : 0;
|
int lx = n > 0 ? s.extendleft : 0;
|
||||||
int x = t.pos.x - sc.GetPos() - lx + s.margin;
|
int x = t.pos.x - sc.GetPos() - lx + s.margin;
|
||||||
|
|
||||||
|
|
@ -2696,7 +2696,7 @@ TabBar::Style& TabBar::Style::GroupSeparators(Value horz, Value vert)
|
||||||
|
|
||||||
TabBar::Style& TabBar::Style::DefaultGroupSeparators()
|
TabBar::Style& TabBar::Style::DefaultGroupSeparators()
|
||||||
{
|
{
|
||||||
return GroupSeparators(TabBarImg::SEP(), TabBarImg::SEPV());
|
return GroupSeparators(TabBarImg::SEP(), TabBarImg::SEPV());
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<Value> TabBar::GetKeys() const
|
Vector<Value> TabBar::GetKeys() const
|
||||||
|
|
@ -2723,7 +2723,7 @@ TabBar& TabBar::CopyBaseSettings(const TabBar& src)
|
||||||
crosses_side = src.crosses_side;
|
crosses_side = src.crosses_side;
|
||||||
grouping = src.grouping;
|
grouping = src.grouping;
|
||||||
contextmenu = src.contextmenu;
|
contextmenu = src.contextmenu;
|
||||||
autoscrollhide = src.autoscrollhide;
|
autoscrollhide = src.autoscrollhide;
|
||||||
nosel = src.nosel;
|
nosel = src.nosel;
|
||||||
nohl = src.nohl;
|
nohl = src.nohl;
|
||||||
inactivedisabled = src.inactivedisabled;
|
inactivedisabled = src.inactivedisabled;
|
||||||
|
|
|
||||||
|
|
@ -187,7 +187,7 @@ void Sentinel(Stream& s, const char *txt)
|
||||||
|
|
||||||
void Ide::Serialize(Stream& s)
|
void Ide::Serialize(Stream& s)
|
||||||
{
|
{
|
||||||
int version = 30;
|
int version = 31;
|
||||||
Sentinel(s, "before 12341234");
|
Sentinel(s, "before 12341234");
|
||||||
s.Magic(0x12341234);
|
s.Magic(0x12341234);
|
||||||
Sentinel(s, "after magic");
|
Sentinel(s, "after magic");
|
||||||
|
|
@ -254,6 +254,8 @@ void Ide::Serialize(Stream& s)
|
||||||
s % hilite_if_endif;
|
s % hilite_if_endif;
|
||||||
s % hilite_bracket;
|
s % hilite_bracket;
|
||||||
s % hilite_ifdef;
|
s % hilite_ifdef;
|
||||||
|
if(version >= 31)
|
||||||
|
s % hl_custom;
|
||||||
if(version >= 3)
|
if(version >= 3)
|
||||||
s % thousands_separator;
|
s % thousands_separator;
|
||||||
if(version >= 5)
|
if(version >= 5)
|
||||||
|
|
|
||||||
|
|
@ -381,6 +381,7 @@ void Ide::SetupFormat() {
|
||||||
(hlt.thousands_separator, thousands_separator)
|
(hlt.thousands_separator, thousands_separator)
|
||||||
(hlt.hline, hline)
|
(hlt.hline, hline)
|
||||||
(hlt.vline, vline)
|
(hlt.vline, vline)
|
||||||
|
(hlt.hl_custom, hl_custom)
|
||||||
|
|
||||||
(edt.indent_spaces, indent_spaces)
|
(edt.indent_spaces, indent_spaces)
|
||||||
(edt.no_parenthesis_indent, no_parenthesis_indent)
|
(edt.no_parenthesis_indent, no_parenthesis_indent)
|
||||||
|
|
@ -457,6 +458,7 @@ void Ide::SetupFormat() {
|
||||||
edt.tabsize.WhenAction = rtvr <<=
|
edt.tabsize.WhenAction = rtvr <<=
|
||||||
hlt.hlstyle.WhenCtrlsAction = ed.WhenAction = tf.WhenAction =
|
hlt.hlstyle.WhenCtrlsAction = ed.WhenAction = tf.WhenAction =
|
||||||
con.WhenAction = f1.WhenAction = f2.WhenAction = dlg.Breaker(222);
|
con.WhenAction = f1.WhenAction = f2.WhenAction = dlg.Breaker(222);
|
||||||
|
hlt.hlstyle.WhenCtrlsAction << [&] { hlt.hl_custom <<= true; };
|
||||||
ide.showtimeafter <<= Nvl((Date)FileGetTime(ConfigFile("version")), GetSysDate() - 1);
|
ide.showtimeafter <<= Nvl((Date)FileGetTime(ConfigFile("version")), GetSysDate() - 1);
|
||||||
hlt.hl_restore <<= dlg.Breaker(333);
|
hlt.hl_restore <<= dlg.Breaker(333);
|
||||||
hlt.hl_restore_white <<= dlg.Breaker(334);
|
hlt.hl_restore_white <<= dlg.Breaker(334);
|
||||||
|
|
@ -532,18 +534,21 @@ void Ide::SetupFormat() {
|
||||||
SetupEditor();
|
SetupEditor();
|
||||||
ReadHlStyles(hlt.hlstyle);
|
ReadHlStyles(hlt.hlstyle);
|
||||||
hlstyle_is_default = true;
|
hlstyle_is_default = true;
|
||||||
|
hlt.hl_custom <<= true;
|
||||||
}
|
}
|
||||||
if(c == 334 && PromptYesNo("Set white theme?")) {
|
if(c == 334 && PromptYesNo("Set white theme?")) {
|
||||||
editor.WhiteTheme(false);
|
editor.WhiteTheme(false);
|
||||||
SetupEditor();
|
SetupEditor();
|
||||||
ReadHlStyles(hlt.hlstyle);
|
ReadHlStyles(hlt.hlstyle);
|
||||||
hlstyle_is_default = false;
|
hlstyle_is_default = false;
|
||||||
|
hlt.hl_custom <<= true;
|
||||||
}
|
}
|
||||||
if(c == 335 && PromptYesNo("Set dark theme?")) {
|
if(c == 335 && PromptYesNo("Set dark theme?")) {
|
||||||
editor.DarkTheme(false);
|
editor.DarkTheme(false);
|
||||||
SetupEditor();
|
SetupEditor();
|
||||||
ReadHlStyles(hlt.hlstyle);
|
ReadHlStyles(hlt.hlstyle);
|
||||||
hlstyle_is_default = false;
|
hlstyle_is_default = false;
|
||||||
|
hlt.hl_custom <<= true;
|
||||||
}
|
}
|
||||||
if(c == 336) {
|
if(c == 336) {
|
||||||
auto v = GetAllChSkins();
|
auto v = GetAllChSkins();
|
||||||
|
|
|
||||||
|
|
@ -673,6 +673,7 @@ public:
|
||||||
byte hilite_scope;
|
byte hilite_scope;
|
||||||
int hilite_bracket;
|
int hilite_bracket;
|
||||||
int hilite_ifdef;
|
int hilite_ifdef;
|
||||||
|
bool hl_custom = false;
|
||||||
bool barline;
|
bool barline;
|
||||||
bool qtfsel;
|
bool qtfsel;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -538,14 +538,15 @@ LAYOUT(SetupHlLayout, 544, 344)
|
||||||
ITEM(Upp::Switch, hilite_bracket, SetLabel(t_("None\nNormal\nFlashing")).LeftPosZ(372, 180).TopPosZ(68, 20))
|
ITEM(Upp::Switch, hilite_bracket, SetLabel(t_("None\nNormal\nFlashing")).LeftPosZ(372, 180).TopPosZ(68, 20))
|
||||||
ITEM(Upp::Label, dv___5, SetLabel(t_("#else/#elif/#endif info")).LeftPosZ(372, 160).TopPosZ(100, 16))
|
ITEM(Upp::Label, dv___5, SetLabel(t_("#else/#elif/#endif info")).LeftPosZ(372, 160).TopPosZ(100, 16))
|
||||||
ITEM(Upp::Switch, hilite_ifdef, SetLabel(t_("None\nNormal\nWith line number")).LeftPosZ(372, 196).TopPosZ(120, 60))
|
ITEM(Upp::Switch, hilite_ifdef, SetLabel(t_("None\nNormal\nWith line number")).LeftPosZ(372, 196).TopPosZ(120, 60))
|
||||||
ITEM(Upp::Option, hilite_if_endif, SetLabel(t_("#if/#endif tracing")).LeftPosZ(372, 160).TopPosZ(184, 18))
|
ITEM(Upp::Option, hilite_if_endif, SetLabel(t_("#if/#endif tracing")).LeftPosZ(372, 160).TopPosZ(180, 18))
|
||||||
ITEM(Upp::Option, thousands_separator, SetLabel(t_("Thousands separator")).LeftPosZ(372, 160).TopPosZ(204, 18))
|
ITEM(Upp::Option, thousands_separator, SetLabel(t_("Thousands separator")).LeftPosZ(372, 160).TopPosZ(200, 18))
|
||||||
ITEM(Upp::Option, hline, SetLabel(t_("Line")).LeftPosZ(432, 160).TopPosZ(228, 18))
|
ITEM(Upp::Option, hline, SetLabel(t_("Line")).LeftPosZ(432, 160).TopPosZ(224, 18))
|
||||||
ITEM(Upp::Option, vline, SetLabel(t_("Column")).LeftPosZ(472, 84).TopPosZ(228, 18))
|
ITEM(Upp::Option, vline, SetLabel(t_("Column")).LeftPosZ(472, 84).TopPosZ(224, 18))
|
||||||
ITEM(Upp::Button, hl_restore, SetLabel(t_("Restore default colors")).HSizePosZ(368, 4).BottomPosZ(56, 20))
|
ITEM(Upp::Button, hl_restore, SetLabel(t_("Restore default colors")).HSizePosZ(368, 4).BottomPosZ(56, 20))
|
||||||
ITEM(Upp::Button, hl_restore_dark, SetLabel(t_("Dark theme")).HSizePosZ(368, 4).BottomPosZ(8, 20))
|
ITEM(Upp::Button, hl_restore_dark, SetLabel(t_("Dark theme")).HSizePosZ(368, 4).BottomPosZ(8, 20))
|
||||||
ITEM(Upp::Button, hl_restore_white, SetLabel(t_("White theme")).HSizePosZ(368, 4).BottomPosZ(32, 20))
|
ITEM(Upp::Button, hl_restore_white, SetLabel(t_("White theme")).HSizePosZ(368, 4).BottomPosZ(32, 20))
|
||||||
ITEM(Upp::Label, dv___14, SetLabel(t_("Current")).LeftPosZ(372, 40).TopPosZ(228, 18))
|
ITEM(Upp::Label, dv___14, SetLabel(t_("Current")).LeftPosZ(372, 40).TopPosZ(224, 18))
|
||||||
|
ITEM(Upp::Option, hl_custom, SetLabel(t_("Custom colors")).LeftPosZ(372, 172).TopPosZ(248, 16))
|
||||||
END_LAYOUT
|
END_LAYOUT
|
||||||
|
|
||||||
LAYOUT(SetupEditorLayout, 544, 344)
|
LAYOUT(SetupEditorLayout, 544, 344)
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,11 @@
|
||||||
void Ide::Skin()
|
void Ide::Skin()
|
||||||
{
|
{
|
||||||
SetToolBar();
|
SetToolBar();
|
||||||
|
ScanWorkspace();
|
||||||
|
if(!hl_custom) {
|
||||||
|
editor.DefaultHlStyles();
|
||||||
|
SetupEditor();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ide::ToggleVerboseBuild() {
|
void Ide::ToggleVerboseBuild() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue