Drawing split, fix split left right behaviour
This commit is contained in:
@@ -57,6 +57,8 @@ Color.TitleBarText = GruvboxDark2
|
||||
Color.TitleBarBackground = GruvboxLight1
|
||||
Color.TitleBarActiveBackground = 0xfefefefe
|
||||
Color.TitleBarSelection = GruvboxLight3
|
||||
Color.ResizerBackground = GruvboxLight0Soft
|
||||
Color.ResizerOutline = GruvboxLight3
|
||||
Style = {}
|
||||
Style.WaitForEvents = 1
|
||||
Style.DrawLineNumbers = 1
|
||||
@@ -391,6 +393,8 @@ void ReloadStyle() {
|
||||
ColorTitleBarBackground = GetColor("TitleBarBackground", ColorTitleBarBackground);
|
||||
ColorTitleBarActiveBackground = GetColor("TitleBarActiveBackground", ColorTitleBarActiveBackground);
|
||||
ColorTitleBarSelection = GetColor("TitleBarSelection", ColorTitleBarSelection);
|
||||
ColorResizerBackground = GetColor("ResizerBackground", ColorResizerBackground);
|
||||
ColorResizerOutline = GetColor("ResizerOutline", ColorResizerOutline);
|
||||
StyleWaitForEvents = GetStyleInt("WaitForEvents", StyleWaitForEvents);
|
||||
StyleDrawLineNumbers = GetStyleInt("DrawLineNumbers", StyleDrawLineNumbers);
|
||||
StyleDrawScrollbar = GetStyleInt("DrawScrollbar", StyleDrawScrollbar);
|
||||
|
||||
@@ -55,6 +55,8 @@ Color ColorTitleBarText = GruvboxDark2;
|
||||
Color ColorTitleBarBackground = GruvboxLight1;
|
||||
Color ColorTitleBarActiveBackground = {0xfe, 0xfe, 0xfe, 0xfe};
|
||||
Color ColorTitleBarSelection = GruvboxLight3;
|
||||
Color ColorResizerBackground = GruvboxLight0Soft;
|
||||
Color ColorResizerOutline = GruvboxLight3;
|
||||
Int StyleWaitForEvents = 1;
|
||||
Int StyleDrawLineNumbers = 1;
|
||||
Int StyleDrawScrollbar = 1;
|
||||
|
||||
@@ -243,8 +243,6 @@ void Update(Event event) {
|
||||
UpdateDebugBuffer();
|
||||
GarbageCollect();
|
||||
|
||||
|
||||
SetMouseCursor(event);
|
||||
For(IterateInReverse(&order)) {
|
||||
if (!it->visible) continue;
|
||||
|
||||
@@ -467,8 +465,11 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
Event *event = GetLast(frame_events);
|
||||
SetMouseCursor(*event);
|
||||
LayoutWindows(event->xwindow, event->ywindow); // This is here to render changes in title bar size without a frame of delay
|
||||
BeginFrameRender(event->xwindow, event->ywindow);
|
||||
DrawSplits(&WindowSplits);
|
||||
|
||||
Array<Window *> order = GetWindowZOrder(scratch);
|
||||
For(IterateInReverse(&order)) {
|
||||
if (!it->visible) continue;
|
||||
|
||||
@@ -173,7 +173,7 @@ void InitWindows() {
|
||||
|
||||
WindowSplit *split = &WindowSplits;
|
||||
split->kind = WindowSplitKind_Horizontal;
|
||||
split->value = (double)1.0 - 0.1;
|
||||
split->value = (double)0.9;
|
||||
|
||||
{
|
||||
Window *window = CreateWindow();
|
||||
@@ -182,7 +182,7 @@ void InitWindows() {
|
||||
CreateTitlebar(window->id);
|
||||
CreateSearchBar(window->id);
|
||||
|
||||
split->left = CreateSplitForWindow(split, window);
|
||||
split->right = CreateSplitForWindow(split, window);
|
||||
}
|
||||
|
||||
{
|
||||
@@ -194,7 +194,7 @@ void InitWindows() {
|
||||
CreateSearchBar(window->id);
|
||||
ActiveWindow = window->id;
|
||||
|
||||
split->right = CreateSplitForWindow(split, window);
|
||||
split->left = CreateSplitForWindow(split, window);
|
||||
}
|
||||
|
||||
{
|
||||
@@ -258,8 +258,8 @@ void LayoutWindowSplit(WindowSplit *split, Rect2I rect) {
|
||||
rect2 = CutTop(&rect, (Int)round((double)GetSize(rect).y * split->value));
|
||||
split->resizer_rect = CutTop(&rect, (Int)resizer_size);
|
||||
|
||||
LayoutWindowSplit(split->left, rect);
|
||||
LayoutWindowSplit(split->right, rect2);
|
||||
LayoutWindowSplit(split->left, rect2);
|
||||
LayoutWindowSplit(split->right, rect);
|
||||
} else {
|
||||
Assert(!"Invalid codepath");
|
||||
}
|
||||
|
||||
@@ -274,3 +274,21 @@ void DrawWindow(Window *window, Event &event) {
|
||||
DrawRect(window->total_rect, ColorInactiveWindow);
|
||||
}
|
||||
}
|
||||
|
||||
void DrawSplits(WindowSplit *split) {
|
||||
if (split == NULL) {
|
||||
return;
|
||||
}
|
||||
Rect2I rect = split->resizer_rect;
|
||||
DrawRect(split->resizer_rect, ColorResizerBackground);
|
||||
if (split->kind == WindowSplitKind_Vertical) {
|
||||
Rect2I s = CutRight(&rect, 1);
|
||||
DrawRect(s, ColorResizerOutline);
|
||||
} else if (split->kind == WindowSplitKind_Horizontal) {
|
||||
Rect2I s = CutBottom(&rect, 1);
|
||||
DrawRect(s, ColorResizerOutline);
|
||||
}
|
||||
|
||||
DrawSplits(split->left);
|
||||
DrawSplits(split->right);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user