New splitting
This commit is contained in:
@@ -378,6 +378,16 @@ int Lua_GetDir(lua_State *L) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
int Lua_SplitSize(lua_State *L) {
|
||||
lua_Number num = lua_tonumber(L, 1);
|
||||
lua_pop(L, 1);
|
||||
|
||||
BSet set = GetActiveMainSet();
|
||||
WindowSplit *split = set.window->split_ref;
|
||||
split->parent->value = num;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void HookLuaForceExit(lua_State *L, lua_Debug *debug) {
|
||||
SDL_PumpEvents();
|
||||
int numkeys = 0;
|
||||
|
||||
@@ -25,6 +25,7 @@ luaL_Reg LuaFunctions[] = {
|
||||
{"FileExists", Lua_FileExists},
|
||||
{"GetWorkingDir", Lua_GetWorkingDir},
|
||||
{"GetDir", Lua_GetDir},
|
||||
{"SplitSize", Lua_SplitSize},
|
||||
{"Play", Lua_Play},
|
||||
{NULL, NULL},
|
||||
};
|
||||
|
||||
@@ -60,10 +60,11 @@ Int GetTitleBarSize(Window *window) {
|
||||
return (Int)result;
|
||||
}
|
||||
|
||||
WindowSplit *CreateSplitForWindow(Window *window) {
|
||||
WindowSplit *CreateSplitForWindow(WindowSplit *parent, Window *window) {
|
||||
WindowSplit *split = AllocType(Perm, WindowSplit);
|
||||
split->kind = WindowSplitKind_Window;
|
||||
split->window = window;
|
||||
split->parent = parent;
|
||||
window->split_ref = split;
|
||||
return split;
|
||||
}
|
||||
@@ -79,11 +80,12 @@ void SplitWindowEx(WindowSplit **node, WindowSplit *split, Window *target, Windo
|
||||
}
|
||||
|
||||
WindowSplit *hori = AllocType(Perm, WindowSplit);
|
||||
hori->parent = node[0]->parent;
|
||||
hori->kind = kind;
|
||||
hori->value_kind = ValueKind_Proportion;
|
||||
hori->value = 0.5;
|
||||
hori->left = *node;
|
||||
hori->right = CreateSplitForWindow(new_window);
|
||||
hori->right = CreateSplitForWindow(hori, new_window);
|
||||
*node = hori;
|
||||
}
|
||||
}
|
||||
@@ -182,7 +184,7 @@ void InitWindows() {
|
||||
CreateTitlebar(window->id);
|
||||
CreateSearchBar(window->id);
|
||||
|
||||
split->left = CreateSplitForWindow(window);
|
||||
split->left = CreateSplitForWindow(split, window);
|
||||
}
|
||||
|
||||
{
|
||||
@@ -195,7 +197,7 @@ void InitWindows() {
|
||||
CreateSearchBar(window->id);
|
||||
ActiveWindow = window->id;
|
||||
|
||||
split->right = CreateSplitForWindow(window);
|
||||
split->right = CreateSplitForWindow(split, window);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user