Setting window sizes, NewDir
This commit is contained in:
@@ -254,8 +254,6 @@ void GenerateConfig() {
|
|||||||
colors.add({"TitleBarSelection", "GruvboxLight3"});
|
colors.add({"TitleBarSelection", "GruvboxLight3"});
|
||||||
|
|
||||||
Array<Var> style = {};
|
Array<Var> style = {};
|
||||||
style.add({"ConsoleSizeSmall", "10"});
|
|
||||||
style.add({"ConsoleSizeBig", "30"});
|
|
||||||
style.add({"WaitForEvents", "1"});
|
style.add({"WaitForEvents", "1"});
|
||||||
style.add({"DrawLineNumbers", "1"});
|
style.add({"DrawLineNumbers", "1"});
|
||||||
style.add({"DrawScrollbar", "1"});
|
style.add({"DrawScrollbar", "1"});
|
||||||
@@ -272,8 +270,11 @@ void GenerateConfig() {
|
|||||||
For(gruvbox) sb.add(Fmt("Color %s = %s;", it.name, C(it.value)));
|
For(gruvbox) sb.add(Fmt("Color %s = %s;", it.name, C(it.value)));
|
||||||
For(colors) sb.add(Fmt("Color Color%s = %s;", it.name, C(it.value)));
|
For(colors) sb.add(Fmt("Color Color%s = %s;", it.name, C(it.value)));
|
||||||
For(style) {
|
For(style) {
|
||||||
if (CHAR_IsDigit(it.value[0])) sb.add(Fmt("Int Style%s = %s;", it.name, it.value));
|
if (CHAR_IsDigit(it.value[0])) {
|
||||||
else sb.add(Fmt("String Style%s = \"%s\";", it.name, it.value));
|
sb.add(Fmt("Int Style%s = %s;", it.name, it.value));
|
||||||
|
} else {
|
||||||
|
sb.add(Fmt("String Style%s = \"%s\";", it.name, it.value));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
S8_String string = Merge(scratch, sb, "\n");
|
S8_String string = Merge(scratch, sb, "\n");
|
||||||
|
|||||||
@@ -276,6 +276,31 @@ int64_t GetFileModTime(String file) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum MakeDirResult {
|
||||||
|
MakeDirResult_Success,
|
||||||
|
MakeDirResult_Exists,
|
||||||
|
MakeDirResult_NotFound,
|
||||||
|
MakeDirResult_ErrorOther,
|
||||||
|
};
|
||||||
|
|
||||||
|
MakeDirResult MakeDir(String path) {
|
||||||
|
Scratch scratch;
|
||||||
|
MakeDirResult result = MakeDirResult_Success;
|
||||||
|
String16 string16 = ToString16(scratch, path);
|
||||||
|
BOOL success = CreateDirectoryW((wchar_t *)string16.data, NULL);
|
||||||
|
if (success == 0) {
|
||||||
|
DWORD error = GetLastError();
|
||||||
|
if (error == ERROR_ALREADY_EXISTS) {
|
||||||
|
result = MakeDirResult_Exists;
|
||||||
|
} else if (error == ERROR_PATH_NOT_FOUND) {
|
||||||
|
result = MakeDirResult_NotFound;
|
||||||
|
} else {
|
||||||
|
result = MakeDirResult_ErrorOther;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
struct Win32Process {
|
struct Win32Process {
|
||||||
HANDLE handle;
|
HANDLE handle;
|
||||||
HANDLE child_stdout_read;
|
HANDLE child_stdout_read;
|
||||||
|
|||||||
@@ -944,11 +944,13 @@ void ReopenBuffer(Buffer *buffer) {
|
|||||||
buffer->changed_on_disk = false;
|
buffer->changed_on_disk = false;
|
||||||
buffer->dirty = false;
|
buffer->dirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Command_Reopen() {
|
void Command_Reopen() {
|
||||||
BSet set = GetActiveMainSet();
|
BSet set = GetActiveMainSet();
|
||||||
ReopenBuffer(set.buffer);
|
ReopenBuffer(set.buffer);
|
||||||
ActiveWindow = set.window->id;
|
ActiveWindow = set.window->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Lua_Reopen(lua_State *L) {
|
int Lua_Reopen(lua_State *L) {
|
||||||
Command_Reopen();
|
Command_Reopen();
|
||||||
return 0;
|
return 0;
|
||||||
@@ -977,13 +979,39 @@ void Command_New(String name = "") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int Lua_New(lua_State *L) {
|
int Lua_New(lua_State *L) {
|
||||||
Scratch scratch;
|
|
||||||
String name = lua_tostring(L, 1);
|
String name = lua_tostring(L, 1);
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
Command_New(name);
|
Command_New(name);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NewDir(Window *window, String name = "") {
|
||||||
|
View *view = GetView(window->active_view);
|
||||||
|
Buffer *buffer = GetBuffer(view->active_buffer);
|
||||||
|
|
||||||
|
Scratch scratch;
|
||||||
|
String dir = GetDir(buffer);
|
||||||
|
if (name != "") {
|
||||||
|
if (!IsAbsolute(name)) {
|
||||||
|
name = Format(scratch, "%.*s/%.*s", FmtString(dir), FmtString(name));
|
||||||
|
}
|
||||||
|
name = GetAbsolutePath(scratch, name);
|
||||||
|
} else {
|
||||||
|
name = GetUniqueBufferName(dir, "new");
|
||||||
|
}
|
||||||
|
|
||||||
|
MakeDir(name);
|
||||||
|
Command_Open(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
int Lua_NewDir(lua_State *L) {
|
||||||
|
String name = lua_tostring(L, 1);
|
||||||
|
lua_pop(L, 1);
|
||||||
|
BSet main = GetActiveMainSet();
|
||||||
|
NewDir(main.window, name);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Command_ToggleFullscreen() {
|
void Command_ToggleFullscreen() {
|
||||||
if (IsInFullscreen) {
|
if (IsInFullscreen) {
|
||||||
|
|||||||
@@ -146,7 +146,23 @@ void UpdateScroll(Window *window, bool update_caret_scrolling) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool update_scroll_memes;
|
void ResizerDetectMouse(Event event, WindowSplit *split) {
|
||||||
|
if (split == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Vec2I mouse = MouseVec2I();
|
||||||
|
bool mouse_in_rect = CheckCollisionPointRec(mouse, split->resizer_rect);
|
||||||
|
if (mouse_in_rect) {
|
||||||
|
ResizerHover = split;
|
||||||
|
if (Mouse(LEFT)) {
|
||||||
|
ResizerSelected = split;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ResizerDetectMouse(event, split->left);
|
||||||
|
ResizerDetectMouse(event, split->right);
|
||||||
|
}
|
||||||
|
|
||||||
void OnCommand(Event event) {
|
void OnCommand(Event event) {
|
||||||
ProfileFunction();
|
ProfileFunction();
|
||||||
//
|
//
|
||||||
@@ -154,35 +170,7 @@ void OnCommand(Event event) {
|
|||||||
//
|
//
|
||||||
Scratch scratch;
|
Scratch scratch;
|
||||||
Array<Window *> order = GetWindowZOrder(scratch);
|
Array<Window *> order = GetWindowZOrder(scratch);
|
||||||
{
|
|
||||||
static SDL_Cursor *SDL_MouseCursor;
|
|
||||||
if (SDL_MouseCursor) {
|
|
||||||
SDL_DestroyCursor(SDL_MouseCursor);
|
|
||||||
SDL_MouseCursor = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
Vec2I mouse = MouseVec2I();
|
|
||||||
For(order) {
|
|
||||||
if (!it->visible) continue;
|
|
||||||
bool mouse_in_total = CheckCollisionPointRec(mouse, it->total_rect);
|
|
||||||
bool mouse_in_scrollbar = CheckCollisionPointRec(mouse, it->scrollbar_rect);
|
|
||||||
|
|
||||||
if (!IsDocumentSelectionValid() && (mouse_in_scrollbar || IsScrollbarSelectionValid())) {
|
|
||||||
SDL_MouseCursor = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_DEFAULT);
|
|
||||||
SDL_SetCursor(SDL_MouseCursor);
|
|
||||||
break;
|
|
||||||
} else if (mouse_in_total || IsDocumentSelectionValid()) {
|
|
||||||
SDL_MouseCursor = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_TEXT);
|
|
||||||
SDL_SetCursor(SDL_MouseCursor);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!SDL_MouseCursor) {
|
|
||||||
SDL_MouseCursor = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_DEFAULT);
|
|
||||||
SDL_SetCursor(SDL_MouseCursor);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handle wheel scrolling
|
// Handle wheel scrolling
|
||||||
if (event.xwheel || event.ywheel) {
|
if (event.xwheel || event.ywheel) {
|
||||||
@@ -250,6 +238,24 @@ void OnCommand(Event event) {
|
|||||||
caret = SetFrontWithAnchor(caret, DocumentAnchor, p);
|
caret = SetFrontWithAnchor(caret, DocumentAnchor, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ResizerSelected && Mouse(LEFT_UP)) {
|
||||||
|
Assert(DocumentSelected.id == -1);
|
||||||
|
Assert(ScrollbarSelected.id == -1);
|
||||||
|
ResizerSelected = NULL;
|
||||||
|
} else if (ResizerSelected) {
|
||||||
|
Vec2I mouse = MouseVec2I();
|
||||||
|
mouse -= ResizerSelected->total_rect.min;
|
||||||
|
Vec2I size = GetSize(ResizerSelected->total_rect);
|
||||||
|
Vec2 p = ToVec2(mouse) / ToVec2(size);
|
||||||
|
if (ResizerSelected->kind == WindowSplitKind_Vertical) {
|
||||||
|
ResizerSelected->value = p.x;
|
||||||
|
} else {
|
||||||
|
ResizerSelected->value = p.y;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ResizerDetectMouse(event, &WindowSplits);
|
||||||
|
}
|
||||||
|
|
||||||
// Set active window on click
|
// Set active window on click
|
||||||
if (MousePress()) {
|
if (MousePress()) {
|
||||||
Vec2I mouse = MouseVec2I();
|
Vec2I mouse = MouseVec2I();
|
||||||
@@ -404,12 +410,11 @@ void OnCommand(Event event) {
|
|||||||
if (CtrlPress(SDLK_GRAVE)) {
|
if (CtrlPress(SDLK_GRAVE)) {
|
||||||
if (ActiveWindow != NullWindowID) {
|
if (ActiveWindow != NullWindowID) {
|
||||||
ActiveWindow = NullWindowID;
|
ActiveWindow = NullWindowID;
|
||||||
WindowSplits.value = (double)StyleConsoleSizeBig;
|
|
||||||
} else {
|
} else {
|
||||||
if (WindowSplits.value - 0.1 > StyleConsoleSizeSmall) {
|
if (WindowSplits.value + 0.01 < 0.9) {
|
||||||
WindowSplits.value = (double)StyleConsoleSizeSmall;
|
WindowSplits.value = (double)0.9;
|
||||||
} else {
|
} else {
|
||||||
WindowSplits.value = (double)StyleConsoleSizeBig;
|
WindowSplits.value = (double)0.6;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,8 +58,6 @@ Color.TitleBarBackground = GruvboxLight1
|
|||||||
Color.TitleBarActiveBackground = 0xfefefefe
|
Color.TitleBarActiveBackground = 0xfefefefe
|
||||||
Color.TitleBarSelection = GruvboxLight3
|
Color.TitleBarSelection = GruvboxLight3
|
||||||
Style = {}
|
Style = {}
|
||||||
Style.ConsoleSizeSmall = 10
|
|
||||||
Style.ConsoleSizeBig = 30
|
|
||||||
Style.WaitForEvents = 1
|
Style.WaitForEvents = 1
|
||||||
Style.DrawLineNumbers = 1
|
Style.DrawLineNumbers = 1
|
||||||
Style.DrawScrollbar = 1
|
Style.DrawScrollbar = 1
|
||||||
@@ -393,8 +391,6 @@ void ReloadStyle() {
|
|||||||
ColorTitleBarBackground = GetColor("TitleBarBackground", ColorTitleBarBackground);
|
ColorTitleBarBackground = GetColor("TitleBarBackground", ColorTitleBarBackground);
|
||||||
ColorTitleBarActiveBackground = GetColor("TitleBarActiveBackground", ColorTitleBarActiveBackground);
|
ColorTitleBarActiveBackground = GetColor("TitleBarActiveBackground", ColorTitleBarActiveBackground);
|
||||||
ColorTitleBarSelection = GetColor("TitleBarSelection", ColorTitleBarSelection);
|
ColorTitleBarSelection = GetColor("TitleBarSelection", ColorTitleBarSelection);
|
||||||
StyleConsoleSizeSmall = GetStyleInt("ConsoleSizeSmall", StyleConsoleSizeSmall);
|
|
||||||
StyleConsoleSizeBig = GetStyleInt("ConsoleSizeBig", StyleConsoleSizeBig);
|
|
||||||
StyleWaitForEvents = GetStyleInt("WaitForEvents", StyleWaitForEvents);
|
StyleWaitForEvents = GetStyleInt("WaitForEvents", StyleWaitForEvents);
|
||||||
StyleDrawLineNumbers = GetStyleInt("DrawLineNumbers", StyleDrawLineNumbers);
|
StyleDrawLineNumbers = GetStyleInt("DrawLineNumbers", StyleDrawLineNumbers);
|
||||||
StyleDrawScrollbar = GetStyleInt("DrawScrollbar", StyleDrawScrollbar);
|
StyleDrawScrollbar = GetStyleInt("DrawScrollbar", StyleDrawScrollbar);
|
||||||
|
|||||||
@@ -55,8 +55,6 @@ Color ColorTitleBarText = GruvboxDark2;
|
|||||||
Color ColorTitleBarBackground = GruvboxLight1;
|
Color ColorTitleBarBackground = GruvboxLight1;
|
||||||
Color ColorTitleBarActiveBackground = {0xfe, 0xfe, 0xfe, 0xfe};
|
Color ColorTitleBarActiveBackground = {0xfe, 0xfe, 0xfe, 0xfe};
|
||||||
Color ColorTitleBarSelection = GruvboxLight3;
|
Color ColorTitleBarSelection = GruvboxLight3;
|
||||||
Int StyleConsoleSizeSmall = 10;
|
|
||||||
Int StyleConsoleSizeBig = 30;
|
|
||||||
Int StyleWaitForEvents = 1;
|
Int StyleWaitForEvents = 1;
|
||||||
Int StyleDrawLineNumbers = 1;
|
Int StyleDrawLineNumbers = 1;
|
||||||
Int StyleDrawScrollbar = 1;
|
Int StyleDrawScrollbar = 1;
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ luaL_Reg LuaFunctions[] = {
|
|||||||
{"Save", Lua_Save},
|
{"Save", Lua_Save},
|
||||||
{"Reopen", Lua_Reopen},
|
{"Reopen", Lua_Reopen},
|
||||||
{"New", Lua_New},
|
{"New", Lua_New},
|
||||||
|
{"NewDir", Lua_NewDir},
|
||||||
{"ToggleFullscreen", Lua_ToggleFullscreen},
|
{"ToggleFullscreen", Lua_ToggleFullscreen},
|
||||||
{"GetCFiles", Lua_GetCFiles},
|
{"GetCFiles", Lua_GetCFiles},
|
||||||
{"C", Lua_C},
|
{"C", Lua_C},
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ BufferID DebugBufferID;
|
|||||||
WindowSplit WindowSplits;
|
WindowSplit WindowSplits;
|
||||||
WindowID ActiveWindow;
|
WindowID ActiveWindow;
|
||||||
|
|
||||||
|
WindowSplit *ResizerSelected = NULL;
|
||||||
|
WindowSplit *ResizerHover = NULL;
|
||||||
WindowID ScrollbarSelected = {-1};
|
WindowID ScrollbarSelected = {-1};
|
||||||
WindowID DocumentSelected = {-1};
|
WindowID DocumentSelected = {-1};
|
||||||
Caret DocumentAnchor;
|
Caret DocumentAnchor;
|
||||||
|
|||||||
@@ -163,6 +163,63 @@ Event TranslateSDLEvent(SDL_Event *input_event) {
|
|||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetMouseCursor(Event event) {
|
||||||
|
Scratch scratch;
|
||||||
|
Array<Window *> order = GetWindowZOrder(scratch);
|
||||||
|
Vec2I mouse = MouseVec2I();
|
||||||
|
|
||||||
|
static SDL_Cursor *SDL_MouseCursor;
|
||||||
|
if (SDL_MouseCursor) {
|
||||||
|
SDL_DestroyCursor(SDL_MouseCursor);
|
||||||
|
SDL_MouseCursor = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ResizerSelected) {
|
||||||
|
WindowSplit *split = ResizerSelected;
|
||||||
|
if (split->kind == WindowSplitKind_Vertical) {
|
||||||
|
SDL_MouseCursor = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_EW_RESIZE);
|
||||||
|
SDL_SetCursor(SDL_MouseCursor);
|
||||||
|
} else {
|
||||||
|
Assert(split->kind == WindowSplitKind_Horizontal);
|
||||||
|
SDL_MouseCursor = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_NS_RESIZE);
|
||||||
|
SDL_SetCursor(SDL_MouseCursor);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
For(order) {
|
||||||
|
if (!it->visible) continue;
|
||||||
|
bool mouse_in_total = CheckCollisionPointRec(mouse, it->total_rect);
|
||||||
|
bool mouse_in_scrollbar = CheckCollisionPointRec(mouse, it->scrollbar_rect);
|
||||||
|
|
||||||
|
if (!IsDocumentSelectionValid() && (mouse_in_scrollbar || IsScrollbarSelectionValid())) {
|
||||||
|
SDL_MouseCursor = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_DEFAULT);
|
||||||
|
SDL_SetCursor(SDL_MouseCursor);
|
||||||
|
return;
|
||||||
|
} else if (mouse_in_total || IsDocumentSelectionValid()) {
|
||||||
|
SDL_MouseCursor = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_TEXT);
|
||||||
|
SDL_SetCursor(SDL_MouseCursor);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ResizerHover) {
|
||||||
|
WindowSplit *split = ResizerHover;
|
||||||
|
if (split->kind == WindowSplitKind_Vertical) {
|
||||||
|
SDL_MouseCursor = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_EW_RESIZE);
|
||||||
|
SDL_SetCursor(SDL_MouseCursor);
|
||||||
|
} else {
|
||||||
|
Assert(split->kind == WindowSplitKind_Horizontal);
|
||||||
|
SDL_MouseCursor = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_NS_RESIZE);
|
||||||
|
SDL_SetCursor(SDL_MouseCursor);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_MouseCursor = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_DEFAULT);
|
||||||
|
SDL_SetCursor(SDL_MouseCursor);
|
||||||
|
}
|
||||||
|
|
||||||
void Update(Event event) {
|
void Update(Event event) {
|
||||||
LayoutWindows(event.xwindow, event.ywindow);
|
LayoutWindows(event.xwindow, event.ywindow);
|
||||||
|
|
||||||
@@ -186,6 +243,8 @@ void Update(Event event) {
|
|||||||
UpdateDebugBuffer();
|
UpdateDebugBuffer();
|
||||||
GarbageCollect();
|
GarbageCollect();
|
||||||
|
|
||||||
|
|
||||||
|
SetMouseCursor(event);
|
||||||
For(IterateInReverse(&order)) {
|
For(IterateInReverse(&order)) {
|
||||||
if (!it->visible) continue;
|
if (!it->visible) continue;
|
||||||
|
|
||||||
|
|||||||
@@ -37,9 +37,9 @@ struct Window {
|
|||||||
WindowID search_bar_window;
|
WindowID search_bar_window;
|
||||||
|
|
||||||
Rect2I total_rect;
|
Rect2I total_rect;
|
||||||
|
Rect2I document_rect;
|
||||||
Rect2I scrollbar_rect;
|
Rect2I scrollbar_rect;
|
||||||
Rect2I line_numbers_rect;
|
Rect2I line_numbers_rect;
|
||||||
Rect2I document_rect;
|
|
||||||
|
|
||||||
Array<GotoCrumb> goto_history;
|
Array<GotoCrumb> goto_history;
|
||||||
Array<GotoCrumb> goto_redo;
|
Array<GotoCrumb> goto_redo;
|
||||||
@@ -68,20 +68,15 @@ enum WindowSplitKind {
|
|||||||
WindowSplitKind_Horizontal,
|
WindowSplitKind_Horizontal,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ValueKind {
|
|
||||||
ValueKind_Proportion,
|
|
||||||
ValueKind_CharSize,
|
|
||||||
ValueKind_CharSizeOtherWindow,
|
|
||||||
};
|
|
||||||
|
|
||||||
struct WindowSplit {
|
struct WindowSplit {
|
||||||
WindowSplitKind kind;
|
WindowSplitKind kind;
|
||||||
WindowSplit *left;
|
WindowSplit *left;
|
||||||
WindowSplit *right;
|
WindowSplit *right;
|
||||||
WindowSplit *parent;
|
WindowSplit *parent;
|
||||||
|
Rect2I total_rect;
|
||||||
|
Rect2I resizer_rect;
|
||||||
|
|
||||||
Window *window;
|
Window *window;
|
||||||
ValueKind value_kind;
|
|
||||||
double value;
|
double value;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -98,6 +93,15 @@ struct BSet {
|
|||||||
Buffer *buffer;
|
Buffer *buffer;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum MakeDirResult {
|
||||||
|
MakeDirResult_Success,
|
||||||
|
MakeDirResult_Exists,
|
||||||
|
MakeDirResult_NotFound,
|
||||||
|
MakeDirResult_ErrorOther,
|
||||||
|
};
|
||||||
|
|
||||||
|
MakeDirResult MakeDir(String path);
|
||||||
|
|
||||||
// @WARNING: be careful about using this, should only be used for debugging
|
// @WARNING: be careful about using this, should only be used for debugging
|
||||||
// the problem with this is that we want events to be reproducible.
|
// the problem with this is that we want events to be reproducible.
|
||||||
// We eat as many events as we can in a frame, we abstract the frame and so on.
|
// We eat as many events as we can in a frame, we abstract the frame and so on.
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
- Add metadata to Lua bindings so that we would get a better listing (function args?, what else?)
|
- Add metadata to Lua bindings so that we would get a better listing (function args?, what else?)
|
||||||
- Kill buffer command (it should be marked for deletion and deleted at the end of frame!)
|
- Kill buffer command (it should be marked for deletion and deleted at the end of frame!)
|
||||||
- Delete directory/file on disk command
|
- Delete directory/file on disk command
|
||||||
- Create directory command (probably should enter it automatically
|
|
||||||
- Check. Convert more commands to taking buffer instead of view
|
- Check. Convert more commands to taking buffer instead of view
|
||||||
- Check. Rewrite more commands to use already implemented commands?
|
- Check. Rewrite more commands to use already implemented commands?
|
||||||
|
|
||||||
@@ -16,7 +15,6 @@
|
|||||||
- dump text editor state to file, restore state
|
- dump text editor state to file, restore state
|
||||||
- help menu popup when for example in process buffer, on tile bar buffer and stuff like that
|
- help menu popup when for example in process buffer, on tile bar buffer and stuff like that
|
||||||
- proper lister
|
- proper lister
|
||||||
- Setting size of splits
|
|
||||||
|
|
||||||
- adding items to directory should create files on save - it should ask the user (syntax: dir/ | file)
|
- adding items to directory should create files on save - it should ask the user (syntax: dir/ | file)
|
||||||
- ask user if he really wants to quit even though he has an unsaved buffer - popup window | we could just show ForceClose() in the titlebar
|
- ask user if he really wants to quit even though he has an unsaved buffer - popup window | we could just show ForceClose() in the titlebar
|
||||||
@@ -49,6 +47,7 @@ backlog
|
|||||||
- redo tree
|
- redo tree
|
||||||
- gap buffer
|
- gap buffer
|
||||||
- optimize rendering - command buffer, and vertice buffer instead of vertice buffer with scissor
|
- optimize rendering - command buffer, and vertice buffer instead of vertice buffer with scissor
|
||||||
|
- fix mouse cursor code, visual artifacts, fast cursor changing stuff
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
buffer = make_buffer()
|
buffer = make_buffer()
|
||||||
|
|||||||
@@ -82,7 +82,6 @@ void SplitWindowEx(WindowSplit **node, WindowSplit *split, Window *target, Windo
|
|||||||
WindowSplit *hori = AllocType(Perm, WindowSplit);
|
WindowSplit *hori = AllocType(Perm, WindowSplit);
|
||||||
hori->parent = node[0]->parent;
|
hori->parent = node[0]->parent;
|
||||||
hori->kind = kind;
|
hori->kind = kind;
|
||||||
hori->value_kind = ValueKind_Proportion;
|
|
||||||
hori->value = 0.5;
|
hori->value = 0.5;
|
||||||
hori->left = *node;
|
hori->left = *node;
|
||||||
hori->right = CreateSplitForWindow(hori, new_window);
|
hori->right = CreateSplitForWindow(hori, new_window);
|
||||||
@@ -174,8 +173,7 @@ void InitWindows() {
|
|||||||
|
|
||||||
WindowSplit *split = &WindowSplits;
|
WindowSplit *split = &WindowSplits;
|
||||||
split->kind = WindowSplitKind_Horizontal;
|
split->kind = WindowSplitKind_Horizontal;
|
||||||
split->value_kind = ValueKind_CharSizeOtherWindow;
|
split->value = (double)1.0 - 0.1;
|
||||||
split->value = (double)StyleConsoleSizeSmall;
|
|
||||||
|
|
||||||
{
|
{
|
||||||
Window *window = CreateWindow();
|
Window *window = CreateWindow();
|
||||||
@@ -199,7 +197,6 @@ void InitWindows() {
|
|||||||
split->right = CreateSplitForWindow(split, window);
|
split->right = CreateSplitForWindow(split, window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
Window *window = CreateWindow();
|
Window *window = CreateWindow();
|
||||||
DebugWindowID = window->id;
|
DebugWindowID = window->id;
|
||||||
@@ -225,8 +222,9 @@ void InitWindows() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void LayoutWindowSplit(WindowSplit *split, Rect2I rect) {
|
void LayoutWindowSplit(WindowSplit *split, Rect2I rect) {
|
||||||
float scrollbar_size = (10.f * DPIScale);
|
float scrollbar_size = (10.f * DPIScale);
|
||||||
float line_numbers_size = (float)FontCharSpacing * 10;
|
float line_numbers_size = (float)FontCharSpacing * 10;
|
||||||
|
float resizer_size = (float)FontCharSpacing*0.5f;
|
||||||
|
|
||||||
if (split->kind == WindowSplitKind_Window) {
|
if (split->kind == WindowSplitKind_Window) {
|
||||||
Window *it = split->window;
|
Window *it = split->window;
|
||||||
@@ -248,30 +246,20 @@ void LayoutWindowSplit(WindowSplit *split, Rect2I rect) {
|
|||||||
if (it->draw_line_numbers) it->line_numbers_rect = CutLeft(&it->document_rect, (Int)line_numbers_size);
|
if (it->draw_line_numbers) it->line_numbers_rect = CutLeft(&it->document_rect, (Int)line_numbers_size);
|
||||||
} else if (split->kind == WindowSplitKind_Vertical) {
|
} else if (split->kind == WindowSplitKind_Vertical) {
|
||||||
Rect2I rect2 = {0};
|
Rect2I rect2 = {0};
|
||||||
if (split->value_kind == ValueKind_Proportion) {
|
split->total_rect = rect;
|
||||||
rect2 = CutLeft(&rect, (Int)round((double)GetSize(rect).x * split->value));
|
rect2 = CutLeft(&rect, (Int)round((double)GetSize(rect).x * split->value));
|
||||||
} else if (split->value_kind == ValueKind_CharSize) {
|
split->resizer_rect = CutRight(&rect2, (Int)resizer_size);
|
||||||
rect2 = CutLeft(&rect, (Int)round((double)FontCharSpacing * split->value));
|
|
||||||
} else {
|
|
||||||
Assert(split->value_kind == ValueKind_CharSizeOtherWindow);
|
|
||||||
rect2 = CutRight(&rect, (Int)round((double)FontCharSpacing * split->value));
|
|
||||||
}
|
|
||||||
|
|
||||||
LayoutWindowSplit(split->left, rect2);
|
LayoutWindowSplit(split->left, rect2);
|
||||||
LayoutWindowSplit(split->right, rect);
|
LayoutWindowSplit(split->right, rect);
|
||||||
} else if (split->kind == WindowSplitKind_Horizontal) {
|
} else if (split->kind == WindowSplitKind_Horizontal) {
|
||||||
Rect2I rect2 = {0};
|
Rect2I rect2 = {0};
|
||||||
if (split->value_kind == ValueKind_Proportion) {
|
split->total_rect = rect;
|
||||||
rect2 = CutTop(&rect, (Int)round((double)GetSize(rect).y * split->value));
|
rect2 = CutTop(&rect, (Int)round((double)GetSize(rect).y * split->value));
|
||||||
} else if (split->value_kind == ValueKind_CharSize) {
|
split->resizer_rect = CutTop(&rect, (Int)resizer_size);
|
||||||
rect2 = CutTop(&rect, (Int)round((double)FontLineSpacing * split->value));
|
|
||||||
} else {
|
|
||||||
Assert(split->value_kind == ValueKind_CharSizeOtherWindow);
|
|
||||||
rect2 = CutBottom(&rect, (Int)round((double)FontLineSpacing * split->value));
|
|
||||||
}
|
|
||||||
|
|
||||||
LayoutWindowSplit(split->left, rect2);
|
LayoutWindowSplit(split->left, rect);
|
||||||
LayoutWindowSplit(split->right, rect);
|
LayoutWindowSplit(split->right, rect2);
|
||||||
} else {
|
} else {
|
||||||
Assert(!"Invalid codepath");
|
Assert(!"Invalid codepath");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user