summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/app.c4
-rw-r--r--src/ui/root.c16
-rw-r--r--src/ui/util.c4
-rw-r--r--src/ui/window.c21
4 files changed, 31 insertions, 14 deletions
diff --git a/src/app.c b/src/app.c
index 29d8cac4..29a97c8f 100644
--- a/src/app.c
+++ b/src/app.c
@@ -1660,7 +1660,7 @@ iBool handleCommand_App(const char *cmd) {
1660 d->prefs.langTo = argLabel_Command(cmd, "to"); 1660 d->prefs.langTo = argLabel_Command(cmd, "to");
1661 return iTrue; 1661 return iTrue;
1662 } 1662 }
1663 else if (equal_Command(cmd, "ui.frames")) { 1663 else if (equal_Command(cmd, "ui.split")) {
1664 d->window->pendingSplitMode = 1664 d->window->pendingSplitMode =
1665 (argLabel_Command(cmd, "axis") ? vertical_WindowSplit : 0) | (arg_Command(cmd) << 1); 1665 (argLabel_Command(cmd, "axis") ? vertical_WindowSplit : 0) | (arg_Command(cmd) << 1);
1666 return iTrue; 1666 return iTrue;
@@ -2033,7 +2033,7 @@ iBool handleCommand_App(const char *cmd) {
2033 } 2033 }
2034 if (tabCount_Widget(tabs) == 0) { 2034 if (tabCount_Widget(tabs) == 0) {
2035 iAssert(isSplit); 2035 iAssert(isSplit);
2036 postCommand_App("ui.frames arg:0"); 2036 postCommand_App("ui.split arg:0");
2037 } 2037 }
2038 else { 2038 else {
2039 arrange_Widget(tabs); 2039 arrange_Widget(tabs);
diff --git a/src/ui/root.c b/src/ui/root.c
index 2eca982c..a97c8d49 100644
--- a/src/ui/root.c
+++ b/src/ui/root.c
@@ -885,7 +885,7 @@ void updateMetrics_Root(iRoot *d) {
885} 885}
886 886
887void createUserInterface_Root(iRoot *d) { 887void createUserInterface_Root(iRoot *d) {
888 iWidget *root = d->widget = new_Widget(); 888 iWidget *root = d->widget = new_Widget();
889 iAssert(root->root == d); 889 iAssert(root->root == d);
890 setId_Widget(root, "root"); 890 setId_Widget(root, "root");
891 /* Children of root cover the entire window. */ 891 /* Children of root cover the entire window. */
@@ -1238,15 +1238,15 @@ void createUserInterface_Root(iRoot *d) {
1238 }, 1238 },
1239 4); 1239 4);
1240 iWidget *splitMenu = makeMenu_Widget(root, (iMenuItem[]){ 1240 iWidget *splitMenu = makeMenu_Widget(root, (iMenuItem[]){
1241 { "Single Frame", '1', 0, "ui.frames arg:0" }, 1241 { "Single Frame", '1', 0, "ui.split arg:0" },
1242 { "---", 0, 0, NULL }, 1242 { "---", 0, 0, NULL },
1243 { "Horizontal", '2', 0, "ui.frames arg:3 axis:0" }, 1243 { "Horizontal", '2', 0, "ui.split arg:3 axis:0" },
1244 { "Horizontal 1:2", SDLK_d, 0, "ui.frames arg:1 axis:0" }, 1244 { "Horizontal 1:2", SDLK_d, 0, "ui.split arg:1 axis:0" },
1245 { "Horizontal 2:1", SDLK_e, 0, "ui.frames arg:2 axis:0" }, 1245 { "Horizontal 2:1", SDLK_e, 0, "ui.split arg:2 axis:0" },
1246 { "---", 0, 0, NULL }, 1246 { "---", 0, 0, NULL },
1247 { "Vertical", '3', 0, "ui.frames arg:3 axis:1" }, 1247 { "Vertical", '3', 0, "ui.split arg:3 axis:1" },
1248 { "Vertical 1:2", SDLK_f, 0, "ui.frames arg:1 axis:1" }, 1248 { "Vertical 1:2", SDLK_f, 0, "ui.split arg:1 axis:1" },
1249 { "Vertical 2:1", SDLK_r, 0, "ui.frames arg:2 axis:1" }, 1249 { "Vertical 2:1", SDLK_r, 0, "ui.split arg:2 axis:1" },
1250 }, 9); 1250 }, 9);
1251 setFlags_Widget(splitMenu, disabledWhenHidden_WidgetFlag, iTrue); /* enabled when open */ 1251 setFlags_Widget(splitMenu, disabledWhenHidden_WidgetFlag, iTrue); /* enabled when open */
1252 setId_Widget(tabsMenu, "doctabs.menu"); 1252 setId_Widget(tabsMenu, "doctabs.menu");
diff --git a/src/ui/util.c b/src/ui/util.c
index fd8740b4..0a0c37a9 100644
--- a/src/ui/util.c
+++ b/src/ui/util.c
@@ -968,11 +968,13 @@ static void addTabPage_Widget_(iWidget *tabs, enum iWidgetAddPos addPos, iWidget
968 buttons, 968 buttons,
969 iClob(newKeyMods_LabelWidget(label, key, kmods, format_CStr("tabs.switch page:%p", page))), 969 iClob(newKeyMods_LabelWidget(label, key, kmods, format_CStr("tabs.switch page:%p", page))),
970 addPos); 970 addPos);
971 setFlags_Widget(buttons, hidden_WidgetFlag, iFalse);
972 setFlags_Widget(button, selected_WidgetFlag, isSel); 971 setFlags_Widget(button, selected_WidgetFlag, isSel);
973 setFlags_Widget( 972 setFlags_Widget(
974 button, noTopFrame_WidgetFlag | commandOnClick_WidgetFlag | expand_WidgetFlag, iTrue); 973 button, noTopFrame_WidgetFlag | commandOnClick_WidgetFlag | expand_WidgetFlag, iTrue);
975 addChildPos_Widget(pages, page, addPos); 974 addChildPos_Widget(pages, page, addPos);
975 if (tabCount_Widget(tabs) > 1) {
976 setFlags_Widget(buttons, hidden_WidgetFlag, iFalse);
977 }
976 setFlags_Widget(page, hidden_WidgetFlag | disabled_WidgetFlag, !isSel); 978 setFlags_Widget(page, hidden_WidgetFlag | disabled_WidgetFlag, !isSel);
977} 979}
978 980
diff --git a/src/ui/window.c b/src/ui/window.c
index da1db514..9ac9b918 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -29,6 +29,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
29#include "embedded.h" 29#include "embedded.h"
30#include "keys.h" 30#include "keys.h"
31#include "labelwidget.h" 31#include "labelwidget.h"
32#include "documentwidget.h"
32#include "paint.h" 33#include "paint.h"
33#include "root.h" 34#include "root.h"
34#include "touch.h" 35#include "touch.h"
@@ -1170,13 +1171,27 @@ void setSplitMode_Window(iWindow *d, int splitMode) {
1170 } 1171 }
1171 else if ((splitMode & mask_WindowSplit) && oldCount == 1) { 1172 else if ((splitMode & mask_WindowSplit) && oldCount == 1) {
1172 /* Add a second root. */ 1173 /* Add a second root. */
1174 iDocumentWidget *moved = document_Root(d->roots[0]);
1173 iAssert(d->roots[1] == NULL); 1175 iAssert(d->roots[1] == NULL);
1174 d->roots[1] = new_Root(); 1176 d->roots[1] = new_Root();
1175 setCurrent_Root(d->roots[1]); 1177 setCurrent_Root(d->roots[1]);
1176 createUserInterface_Root(d->roots[1]); 1178 createUserInterface_Root(d->roots[1]);
1177 /* If the old root has multiple tabs, move the current one to the new split. */ 1179 /* If the old root has multiple tabs, move the current one to the new split. */ {
1178 1180 iWidget *docTabs0 = findChild_Widget(d->roots[0]->widget, "doctabs");
1179 postCommand_Root(d->roots[1], "navigate.home"); 1181 iWidget *docTabs1 = findChild_Widget(d->roots[1]->widget, "doctabs");
1182 if (tabCount_Widget(docTabs0) >= 2) {
1183 int movedIndex = tabPageIndex_Widget(docTabs0, moved);
1184 removeTabPage_Widget(docTabs0, movedIndex);
1185 showTabPage_Widget(docTabs0, tabPage_Widget(docTabs0, iMax(movedIndex - 1, 0)));
1186 iRelease(removeTabPage_Widget(docTabs1, 0)); /* delete the default tab */
1187 setRoot_Widget(as_Widget(moved), d->roots[1]);
1188 prependTabPage_Widget(docTabs1, iClob(moved), "", 0, 0);
1189 showTabPage_Widget(docTabs1, as_Widget(moved));
1190 }
1191 else {
1192 postCommand_Root(d->roots[1], "navigate.home");
1193 }
1194 }
1180 setCurrent_Root(NULL); 1195 setCurrent_Root(NULL);
1181 } 1196 }
1182 d->splitMode = splitMode; 1197 d->splitMode = splitMode;