Remove tabs
This commit is contained in:
@@ -360,10 +360,10 @@ void GenerateConfig() {
|
|||||||
colors.add({"Text" , "GruvboxDark0Hard"});
|
colors.add({"Text" , "GruvboxDark0Hard"});
|
||||||
colors.add({"Background" , "GruvboxLight0Hard"});
|
colors.add({"Background" , "GruvboxLight0Hard"});
|
||||||
colors.add({"InactiveWindow" , "_InactiveWindowColor"});
|
colors.add({"InactiveWindow" , "_InactiveWindowColor"});
|
||||||
colors.add({"TabText" , "GruvboxDark0Hard"});
|
// colors.add({"TabText" , "GruvboxDark0Hard"});
|
||||||
colors.add({"TabBackground" , "GruvboxLight0Hard"});
|
// colors.add({"TabBackground" , "GruvboxLight0Hard"});
|
||||||
colors.add({"TabBackgroundInactive" , "GruvboxLight2"});
|
// colors.add({"TabBackgroundInactive" , "GruvboxLight2"});
|
||||||
colors.add({"TabSeparator" , "GruvboxLight2"});
|
// colors.add({"TabSeparator" , "GruvboxLight2"});
|
||||||
colors.add({"TextLineNumbers" , "GruvboxDark4"});
|
colors.add({"TextLineNumbers" , "GruvboxDark4"});
|
||||||
colors.add({"ScrollbarBackground" , "GruvboxLight2"});
|
colors.add({"ScrollbarBackground" , "GruvboxLight2"});
|
||||||
colors.add({"ScrollbarScroller" , "GruvboxLight1"});
|
colors.add({"ScrollbarScroller" , "GruvboxLight1"});
|
||||||
|
|||||||
@@ -39,10 +39,6 @@ Color _InactiveWindowColor = {0x00, 0x00, 0x00, 0x0F};
|
|||||||
Color ColorText = GruvboxDark0Hard;
|
Color ColorText = GruvboxDark0Hard;
|
||||||
Color ColorBackground = GruvboxLight0Hard;
|
Color ColorBackground = GruvboxLight0Hard;
|
||||||
Color ColorInactiveWindow = _InactiveWindowColor;
|
Color ColorInactiveWindow = _InactiveWindowColor;
|
||||||
Color ColorTabText = GruvboxDark0Hard;
|
|
||||||
Color ColorTabBackground = GruvboxLight0Hard;
|
|
||||||
Color ColorTabBackgroundInactive = GruvboxLight2;
|
|
||||||
Color ColorTabSeparator = GruvboxLight2;
|
|
||||||
Color ColorTextLineNumbers = GruvboxDark4;
|
Color ColorTextLineNumbers = GruvboxDark4;
|
||||||
Color ColorScrollbarBackground = GruvboxLight2;
|
Color ColorScrollbarBackground = GruvboxLight2;
|
||||||
Color ColorScrollbarScroller = GruvboxLight1;
|
Color ColorScrollbarScroller = GruvboxLight1;
|
||||||
@@ -95,10 +91,6 @@ Color = {}
|
|||||||
Color.Text = GruvboxDark0Hard
|
Color.Text = GruvboxDark0Hard
|
||||||
Color.Background = GruvboxLight0Hard
|
Color.Background = GruvboxLight0Hard
|
||||||
Color.InactiveWindow = _InactiveWindowColor
|
Color.InactiveWindow = _InactiveWindowColor
|
||||||
Color.TabText = GruvboxDark0Hard
|
|
||||||
Color.TabBackground = GruvboxLight0Hard
|
|
||||||
Color.TabBackgroundInactive = GruvboxLight2
|
|
||||||
Color.TabSeparator = GruvboxLight2
|
|
||||||
Color.TextLineNumbers = GruvboxDark4
|
Color.TextLineNumbers = GruvboxDark4
|
||||||
Color.ScrollbarBackground = GruvboxLight2
|
Color.ScrollbarBackground = GruvboxLight2
|
||||||
Color.ScrollbarScroller = GruvboxLight1
|
Color.ScrollbarScroller = GruvboxLight1
|
||||||
@@ -235,10 +227,6 @@ void ReloadColors() {
|
|||||||
ColorText = GetColor("Text", ColorText);
|
ColorText = GetColor("Text", ColorText);
|
||||||
ColorBackground = GetColor("Background", ColorBackground);
|
ColorBackground = GetColor("Background", ColorBackground);
|
||||||
ColorInactiveWindow = GetColor("InactiveWindow", ColorInactiveWindow);
|
ColorInactiveWindow = GetColor("InactiveWindow", ColorInactiveWindow);
|
||||||
ColorTabText = GetColor("TabText", ColorTabText);
|
|
||||||
ColorTabBackground = GetColor("TabBackground", ColorTabBackground);
|
|
||||||
ColorTabBackgroundInactive = GetColor("TabBackgroundInactive", ColorTabBackgroundInactive);
|
|
||||||
ColorTabSeparator = GetColor("TabSeparator", ColorTabSeparator);
|
|
||||||
ColorTextLineNumbers = GetColor("TextLineNumbers", ColorTextLineNumbers);
|
ColorTextLineNumbers = GetColor("TextLineNumbers", ColorTextLineNumbers);
|
||||||
ColorScrollbarBackground = GetColor("ScrollbarBackground", ColorScrollbarBackground);
|
ColorScrollbarBackground = GetColor("ScrollbarBackground", ColorScrollbarBackground);
|
||||||
ColorScrollbarScroller = GetColor("ScrollbarScroller", ColorScrollbarScroller);
|
ColorScrollbarScroller = GetColor("ScrollbarScroller", ColorScrollbarScroller);
|
||||||
|
|||||||
@@ -58,7 +58,6 @@ struct Window {
|
|||||||
Array<ViewID> views;
|
Array<ViewID> views;
|
||||||
|
|
||||||
Rect2I total_rect;
|
Rect2I total_rect;
|
||||||
Rect2I tabs_rect;
|
|
||||||
Rect2I scrollbar_rect;
|
Rect2I scrollbar_rect;
|
||||||
Rect2I line_numbers_rect;
|
Rect2I line_numbers_rect;
|
||||||
Rect2I document_rect;
|
Rect2I document_rect;
|
||||||
@@ -73,7 +72,6 @@ struct Window {
|
|||||||
|
|
||||||
bool draw_scrollbar : 1;
|
bool draw_scrollbar : 1;
|
||||||
bool draw_line_numbers : 1;
|
bool draw_line_numbers : 1;
|
||||||
bool draw_tabs : 1;
|
|
||||||
bool visible : 1;
|
bool visible : 1;
|
||||||
|
|
||||||
bool fuzzy_search : 1; // @todo: consider moving this to view and introducing view commands
|
bool fuzzy_search : 1; // @todo: consider moving this to view and introducing view commands
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
- Save file (utf16->utf8)
|
- Save file (utf16->utf8)
|
||||||
- make sure we only save file buffers
|
- make sure we only save file buffers
|
||||||
|
- Move open fully to config so that user can easily modify the plumbing
|
||||||
- resize windows
|
- resize windows
|
||||||
- color the line number with line highlight
|
- color the line number with line highlight
|
||||||
- page up and down should also scroll and leave you in exactly same scroll
|
- page up and down should also scroll and leave you in exactly same scroll
|
||||||
|
|||||||
@@ -10,10 +10,9 @@ void InitWindows(View *null_view) {
|
|||||||
Allocator sys_allocator = GetSystemAllocator();
|
Allocator sys_allocator = GetSystemAllocator();
|
||||||
|
|
||||||
{
|
{
|
||||||
Window *w = CreateWindow();
|
Window *w = CreateWindow();
|
||||||
w->draw_tabs = true;
|
Buffer *b = CreateBuffer(sys_allocator, "*load_text_a*");
|
||||||
Buffer *b = CreateBuffer(sys_allocator, "*load_text_a*");
|
View *v = CreateView(b->id);
|
||||||
View *v = CreateView(b->id);
|
|
||||||
LoadTextA(b);
|
LoadTextA(b);
|
||||||
LoadUnicode(b);
|
LoadUnicode(b);
|
||||||
AddView(w, null_view->id);
|
AddView(w, null_view->id);
|
||||||
@@ -22,7 +21,6 @@ void InitWindows(View *null_view) {
|
|||||||
|
|
||||||
{
|
{
|
||||||
Window *w = CreateWindow();
|
Window *w = CreateWindow();
|
||||||
w->draw_tabs = true;
|
|
||||||
Buffer *b = CreateBuffer(sys_allocator, "*console*");
|
Buffer *b = CreateBuffer(sys_allocator, "*console*");
|
||||||
b->no_history = true;
|
b->no_history = true;
|
||||||
View *v = CreateView(b->id);
|
View *v = CreateView(b->id);
|
||||||
@@ -122,7 +120,6 @@ void LayoutWindows() {
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
Windows[i].total_rect = CutLeft(&screen_rect, (Int)((double)sizex * 0.5));
|
Windows[i].total_rect = CutLeft(&screen_rect, (Int)((double)sizex * 0.5));
|
||||||
Windows[i].document_rect = Windows[i].total_rect;
|
Windows[i].document_rect = Windows[i].total_rect;
|
||||||
if (Windows[i].draw_tabs) Windows[i].tabs_rect = CutTop(&Windows[i].document_rect, (Int)FontLineSpacing);
|
|
||||||
if (Windows[i].draw_scrollbar) Windows[i].scrollbar_rect = CutRight(&Windows[i].document_rect, 10);
|
if (Windows[i].draw_scrollbar) Windows[i].scrollbar_rect = CutRight(&Windows[i].document_rect, 10);
|
||||||
if (Windows[i].draw_line_numbers) Windows[i].line_numbers_rect = CutLeft(&Windows[i].document_rect, (Int)line_numbers_size);
|
if (Windows[i].draw_line_numbers) Windows[i].line_numbers_rect = CutLeft(&Windows[i].document_rect, (Int)line_numbers_size);
|
||||||
}
|
}
|
||||||
@@ -130,7 +127,6 @@ void LayoutWindows() {
|
|||||||
int i = 1;
|
int i = 1;
|
||||||
Windows[i].total_rect = CutLeft(&screen_rect, (Int)((double)sizex));
|
Windows[i].total_rect = CutLeft(&screen_rect, (Int)((double)sizex));
|
||||||
Windows[i].document_rect = Windows[i].total_rect;
|
Windows[i].document_rect = Windows[i].total_rect;
|
||||||
if (Windows[i].draw_tabs) Windows[i].tabs_rect = CutTop(&Windows[i].document_rect, (Int)FontLineSpacing);
|
|
||||||
if (Windows[i].draw_scrollbar) Windows[i].scrollbar_rect = CutRight(&Windows[i].document_rect, 10);
|
if (Windows[i].draw_scrollbar) Windows[i].scrollbar_rect = CutRight(&Windows[i].document_rect, 10);
|
||||||
if (Windows[i].draw_line_numbers) Windows[i].line_numbers_rect = CutLeft(&Windows[i].document_rect, (Int)line_numbers_size);
|
if (Windows[i].draw_line_numbers) Windows[i].line_numbers_rect = CutLeft(&Windows[i].document_rect, (Int)line_numbers_size);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -198,53 +198,6 @@ void DrawWindow(Window *window) {
|
|||||||
DrawRect(rect, color);
|
DrawRect(rect, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window->draw_tabs) {
|
|
||||||
Rect2 rect = ToRect2(window->tabs_rect);
|
|
||||||
SetScissor(rect);
|
|
||||||
DrawRect(rect, ColorTabBackgroundInactive);
|
|
||||||
|
|
||||||
Int open_views = window->views.len;
|
|
||||||
Vec2 entire_tab_size = GetSize(rect);
|
|
||||||
|
|
||||||
Vec2 tab_size = {200 * DPIScale, entire_tab_size.y};
|
|
||||||
// Vec2 tab_size = {entire_tab_size.x / (float)open_views, };
|
|
||||||
|
|
||||||
// float total = entire_tab_size.x / tab_size.x;
|
|
||||||
float offset = entire_tab_size.x / (float)window->views.len;
|
|
||||||
offset = ClampTop(tab_size.x, offset);
|
|
||||||
|
|
||||||
float i = (float)window->views.len - 1;
|
|
||||||
For(window->views) {
|
|
||||||
Rect2 tab_rect = Rect2FromSize({rect.min.x + offset * i, rect.min.y}, tab_size);
|
|
||||||
i -= 1.f;
|
|
||||||
|
|
||||||
Scratch scratch;
|
|
||||||
View *view = GetView(it);
|
|
||||||
Buffer *buffer = GetBuffer(view->active_buffer);
|
|
||||||
|
|
||||||
String16 string16 = ToString16(scratch, buffer->name);
|
|
||||||
string16 = SkipToLastSlash(string16);
|
|
||||||
Vec2 string_size = GetStringSize(&MainFont, string16);
|
|
||||||
Vec2 pos = {tab_rect.min.x + (tab_size.x - string_size.x) / 2};
|
|
||||||
pos.y = tab_rect.min.y;
|
|
||||||
|
|
||||||
if (window->active_view.id == it.id) {
|
|
||||||
DrawRect(tab_rect, ColorTabBackground);
|
|
||||||
} else {
|
|
||||||
DrawRect(tab_rect, ColorTabBackgroundInactive);
|
|
||||||
}
|
|
||||||
DrawString(&MainFont, string16, pos, ColorTabText);
|
|
||||||
|
|
||||||
Rect2 sep = CutRight(&tab_rect, 1);
|
|
||||||
DrawRect(sep, ColorTabSeparator);
|
|
||||||
sep = CutLeft(&tab_rect, 1);
|
|
||||||
DrawRect(sep, ColorTabSeparator);
|
|
||||||
}
|
|
||||||
|
|
||||||
Rect2 sep = CutRight(&rect, 1);
|
|
||||||
DrawRect(sep, ColorTabSeparator);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!is_active) {
|
if (!is_active) {
|
||||||
SetScissor(GetScreenRectF());
|
SetScissor(GetScreenRectF());
|
||||||
DrawRect(window->total_rect, ColorInactiveWindow);
|
DrawRect(window->total_rect, ColorInactiveWindow);
|
||||||
|
|||||||
Reference in New Issue
Block a user