This commit is contained in:
Mirek Fidler 2024-11-18 14:14:26 +01:00
parent e0b8f38db0
commit b2bb5f244b
15 changed files with 39 additions and 19 deletions

View file

@ -49,8 +49,9 @@ bool Ctrl::DispatchKey(dword keycode, int count)
<< ", " << GetKeyDesc(keycode) << "), count:" << count
<< " focusCtrl:" << UPP::Name(focusCtrl) << " focusCtrlWnd:" << UPP::Name(focusCtrlWnd));
#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;
DLOG("---- reskin");
ReSkin();
}
#endif

View file

@ -18,7 +18,7 @@ void ColorPusher::Paint(Draw& w)
voidtext, StdFont(), SColorText());
else {
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);
w.DrawRect(x, y, cx / 2, cy, c);
w.DrawRect(x + cx / 2, y, cx - cx / 2, cy, DarkTheme(c));

View file

@ -1449,6 +1449,11 @@ void FileSel::Activate()
TopWindow::Activate();
}
void FileSel::Skin()
{
Reload();
}
bool FileSel::Key(dword key, int count) {
switch(key) {
case K_F9:

View file

@ -175,6 +175,7 @@ class FileSel : public WithFileSelectorLayout<TopWindow> {
public:
virtual bool Key(dword key, int count);
virtual void Activate();
virtual void Skin();
private:
SizeGrip sizegrip;

View file

@ -4,6 +4,7 @@ namespace Upp {
CH_STYLE(TabCtrl, Style, StyleDefault)
{
DLOG("TabCtrl style");
font = StdFont();
tabheight = font.Info().GetHeight() + 8;
margin = 2;

View file

@ -417,6 +417,7 @@ void ChReset()
void ChFinish()
{
DLOG("-- chFinish");
sChInvalid = false;
for(int i = 0; i < sChStyle().GetCount(); i++)
sChStyle()[i].init();

View file

@ -65,7 +65,7 @@ void COMBINE5(klass, __, type, __, style)::InitIt() { \
\
const klass::type& klass::style() \
{ \
static COMBINE5(klass, __, type, __, style) b, standard; \
static COMBINE5(klass, __, type, __, style) b; \
if(b.status == 0) { \
ChRegisterStyle__(b.status, b.registered, COMBINE5(klass, __, type, __, style)::InitIt); \
b.Init(); \
@ -76,10 +76,6 @@ const klass::type& klass::style() \
\
void COMBINE5(klass, __, type, __, style)::Init()
// standard = b; \
// standard.standard = b.standard = &standard; \
// CH_VAR0 allows inserting action into _Write (missing ending '}')
#define CH_VAR0(chtype, type, name, init) \
chtype& COMBINE(ch_var__, name)(); \

View file

@ -12,6 +12,7 @@ struct scImageMaker : ValueMaker {
StringBuffer s;
s.Cat(typeid(*m).name());
RawCat(s, paintonly);
RawCat(s, IsDarkTheme());
s.Cat(m->Key());
return String(s);
}

View file

@ -175,10 +175,10 @@ FileTabs& FileTabs::operator<<(const FileTabs &src)
FileTabs::FileTabs() :
stackedicons(false),
greyedicons(true),
filecolor(SColorLabel),
extcolor(IsDark(SColorFace()) ? Blend(White, LtBlue) : LtBlue)
filecolor(SColorLabel)
{
static SColor se([] { return IsDark(SColorFace()) ? Blend(White, LtBlue) : LtBlue; });
extcolor = se;
}
}

View file

@ -187,7 +187,7 @@ void Sentinel(Stream& s, const char *txt)
void Ide::Serialize(Stream& s)
{
int version = 30;
int version = 31;
Sentinel(s, "before 12341234");
s.Magic(0x12341234);
Sentinel(s, "after magic");
@ -254,6 +254,8 @@ void Ide::Serialize(Stream& s)
s % hilite_if_endif;
s % hilite_bracket;
s % hilite_ifdef;
if(version >= 31)
s % hl_custom;
if(version >= 3)
s % thousands_separator;
if(version >= 5)

View file

@ -381,6 +381,7 @@ void Ide::SetupFormat() {
(hlt.thousands_separator, thousands_separator)
(hlt.hline, hline)
(hlt.vline, vline)
(hlt.hl_custom, hl_custom)
(edt.indent_spaces, indent_spaces)
(edt.no_parenthesis_indent, no_parenthesis_indent)
@ -457,6 +458,7 @@ void Ide::SetupFormat() {
edt.tabsize.WhenAction = rtvr <<=
hlt.hlstyle.WhenCtrlsAction = ed.WhenAction = tf.WhenAction =
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);
hlt.hl_restore <<= dlg.Breaker(333);
hlt.hl_restore_white <<= dlg.Breaker(334);
@ -532,18 +534,21 @@ void Ide::SetupFormat() {
SetupEditor();
ReadHlStyles(hlt.hlstyle);
hlstyle_is_default = true;
hlt.hl_custom <<= true;
}
if(c == 334 && PromptYesNo("Set white theme?")) {
editor.WhiteTheme(false);
SetupEditor();
ReadHlStyles(hlt.hlstyle);
hlstyle_is_default = false;
hlt.hl_custom <<= true;
}
if(c == 335 && PromptYesNo("Set dark theme?")) {
editor.DarkTheme(false);
SetupEditor();
ReadHlStyles(hlt.hlstyle);
hlstyle_is_default = false;
hlt.hl_custom <<= true;
}
if(c == 336) {
auto v = GetAllChSkins();

View file

@ -673,6 +673,7 @@ public:
byte hilite_scope;
int hilite_bracket;
int hilite_ifdef;
bool hl_custom = false;
bool barline;
bool qtfsel;

View file

@ -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::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::Option, hilite_if_endif, SetLabel(t_("#if/#endif tracing")).LeftPosZ(372, 160).TopPosZ(184, 18))
ITEM(Upp::Option, thousands_separator, SetLabel(t_("Thousands separator")).LeftPosZ(372, 160).TopPosZ(204, 18))
ITEM(Upp::Option, hline, SetLabel(t_("Line")).LeftPosZ(432, 160).TopPosZ(228, 18))
ITEM(Upp::Option, vline, SetLabel(t_("Column")).LeftPosZ(472, 84).TopPosZ(228, 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(200, 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(224, 18))
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_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
LAYOUT(SetupEditorLayout, 544, 344)

View file

@ -7,6 +7,11 @@
void Ide::Skin()
{
SetToolBar();
ScanWorkspace();
if(!hl_custom) {
editor.DefaultHlStyles();
SetupEditor();
}
}
void Ide::ToggleVerboseBuild() {