Color of title bar when active and window size
This commit is contained in:
@@ -250,6 +250,7 @@ void GenerateConfig() {
|
|||||||
|
|
||||||
colors.add({"TitleBarText", "GruvboxDark2"});
|
colors.add({"TitleBarText", "GruvboxDark2"});
|
||||||
colors.add({"TitleBarBackground", "GruvboxLight1"});
|
colors.add({"TitleBarBackground", "GruvboxLight1"});
|
||||||
|
colors.add({"TitleBarActiveBackground", "0xfefefefe"});
|
||||||
colors.add({"TitleBarSelection", "GruvboxLight3"});
|
colors.add({"TitleBarSelection", "GruvboxLight3"});
|
||||||
|
|
||||||
Array<Var> style = {};
|
Array<Var> style = {};
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ Color.ScrollbarScroller = GruvboxLight1
|
|||||||
Color.ScrollbarScrollerSelected = GruvboxLight0Hard
|
Color.ScrollbarScrollerSelected = GruvboxLight0Hard
|
||||||
Color.TitleBarText = GruvboxDark2
|
Color.TitleBarText = GruvboxDark2
|
||||||
Color.TitleBarBackground = GruvboxLight1
|
Color.TitleBarBackground = GruvboxLight1
|
||||||
|
Color.TitleBarActiveBackground = 0xfefefefe
|
||||||
Color.TitleBarSelection = GruvboxLight3
|
Color.TitleBarSelection = GruvboxLight3
|
||||||
Style = {}
|
Style = {}
|
||||||
Style.ConsoleSizeSmall = 10
|
Style.ConsoleSizeSmall = 10
|
||||||
@@ -347,6 +348,7 @@ void ReloadStyle() {
|
|||||||
ColorScrollbarScrollerSelected = GetColor("ScrollbarScrollerSelected", ColorScrollbarScrollerSelected);
|
ColorScrollbarScrollerSelected = GetColor("ScrollbarScrollerSelected", ColorScrollbarScrollerSelected);
|
||||||
ColorTitleBarText = GetColor("TitleBarText", ColorTitleBarText);
|
ColorTitleBarText = GetColor("TitleBarText", ColorTitleBarText);
|
||||||
ColorTitleBarBackground = GetColor("TitleBarBackground", ColorTitleBarBackground);
|
ColorTitleBarBackground = GetColor("TitleBarBackground", ColorTitleBarBackground);
|
||||||
|
ColorTitleBarActiveBackground = GetColor("TitleBarActiveBackground", ColorTitleBarActiveBackground);
|
||||||
ColorTitleBarSelection = GetColor("TitleBarSelection", ColorTitleBarSelection);
|
ColorTitleBarSelection = GetColor("TitleBarSelection", ColorTitleBarSelection);
|
||||||
StyleConsoleSizeSmall = GetStyleInt("ConsoleSizeSmall", StyleConsoleSizeSmall);
|
StyleConsoleSizeSmall = GetStyleInt("ConsoleSizeSmall", StyleConsoleSizeSmall);
|
||||||
StyleConsoleSizeBig = GetStyleInt("ConsoleSizeBig", StyleConsoleSizeBig);
|
StyleConsoleSizeBig = GetStyleInt("ConsoleSizeBig", StyleConsoleSizeBig);
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ Color ColorScrollbarScroller = GruvboxLight1;
|
|||||||
Color ColorScrollbarScrollerSelected = GruvboxLight0Hard;
|
Color ColorScrollbarScrollerSelected = GruvboxLight0Hard;
|
||||||
Color ColorTitleBarText = GruvboxDark2;
|
Color ColorTitleBarText = GruvboxDark2;
|
||||||
Color ColorTitleBarBackground = GruvboxLight1;
|
Color ColorTitleBarBackground = GruvboxLight1;
|
||||||
|
Color ColorTitleBarActiveBackground = {0xfe, 0xfe, 0xfe, 0xfe};
|
||||||
Color ColorTitleBarSelection = GruvboxLight3;
|
Color ColorTitleBarSelection = GruvboxLight3;
|
||||||
Int StyleConsoleSizeSmall = 10;
|
Int StyleConsoleSizeSmall = 10;
|
||||||
Int StyleConsoleSizeBig = 30;
|
Int StyleConsoleSizeBig = 30;
|
||||||
|
|||||||
@@ -352,7 +352,8 @@ Buffer *BufferOpenFile(String path) {
|
|||||||
if (!FileExists(path)) {
|
if (!FileExists(path)) {
|
||||||
buffer = CreateBuffer(sys_allocator, path);
|
buffer = CreateBuffer(sys_allocator, path);
|
||||||
} else if (IsDir(path)) {
|
} else if (IsDir(path)) {
|
||||||
Assert(!"Invalid codepath");
|
ReportWarningf("failed to open, it's a directory: %.*s", FmtString(path));
|
||||||
|
return GetBuffer(NullBufferID);
|
||||||
} else {
|
} else {
|
||||||
String string = ReadFile(scratch, path);
|
String string = ReadFile(scratch, path);
|
||||||
buffer = CreateBuffer(sys_allocator, path, string.len * 4 + 4096);
|
buffer = CreateBuffer(sys_allocator, path, string.len * 4 + 4096);
|
||||||
|
|||||||
@@ -295,8 +295,11 @@ int main(int argc, char **argv)
|
|||||||
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
|
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
|
||||||
SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8);
|
SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8);
|
||||||
|
|
||||||
|
SDL_DisplayID primary_display_id = SDL_GetPrimaryDisplay();
|
||||||
|
const SDL_DisplayMode *display_mode = SDL_GetCurrentDisplayMode(primary_display_id);
|
||||||
|
|
||||||
Uint32 window_flags = SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE | SDL_WINDOW_HIDDEN | SDL_WINDOW_HIGH_PIXEL_DENSITY;
|
Uint32 window_flags = SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE | SDL_WINDOW_HIDDEN | SDL_WINDOW_HIGH_PIXEL_DENSITY;
|
||||||
SDLWindow = SDL_CreateWindow("Text editor", 1280, 720, window_flags);
|
SDLWindow = SDL_CreateWindow("Text editor", (int)(display_mode->w * 0.8), (int)(display_mode->h * 0.8), window_flags);
|
||||||
if (SDLWindow == NULL) {
|
if (SDLWindow == NULL) {
|
||||||
ReportErrorf("Couldn't create window! %s", SDL_GetError());
|
ReportErrorf("Couldn't create window! %s", SDL_GetError());
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@@ -123,7 +123,11 @@ void DrawWindow(Window *window, Event &event) {
|
|||||||
Color color_text_line_numbers = ColorTextLineNumbers;
|
Color color_text_line_numbers = ColorTextLineNumbers;
|
||||||
Color color_text = ColorText;
|
Color color_text = ColorText;
|
||||||
if (window->is_title_bar) {
|
if (window->is_title_bar) {
|
||||||
color_background = ColorTitleBarBackground;
|
if (is_active) {
|
||||||
|
color_background = ColorTitleBarActiveBackground;
|
||||||
|
} else {
|
||||||
|
color_background = ColorTitleBarBackground;
|
||||||
|
}
|
||||||
color_selection = ColorTitleBarSelection;
|
color_selection = ColorTitleBarSelection;
|
||||||
color_text = ColorTitleBarText;
|
color_text = ColorTitleBarText;
|
||||||
color_line_highlight = ColorTitleBarBackground;
|
color_line_highlight = ColorTitleBarBackground;
|
||||||
@@ -170,7 +174,7 @@ void DrawWindow(Window *window, Event &event) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else if (!window->is_title_bar) {
|
||||||
//
|
//
|
||||||
// Draw highlight
|
// Draw highlight
|
||||||
Int front = GetFront(it);
|
Int front = GetFront(it);
|
||||||
@@ -267,6 +271,10 @@ void DrawWindow(Window *window, Event &event) {
|
|||||||
|
|
||||||
if (!is_active) {
|
if (!is_active) {
|
||||||
SetScissor(screen_rect);
|
SetScissor(screen_rect);
|
||||||
DrawRect(window->total_rect, ColorInactiveWindow);
|
if (window->is_title_bar) {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
DrawRect(window->total_rect, ColorInactiveWindow);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user