In PoorMan: use templatized layout builders.
Also clean up layout a bit.
This commit is contained in:
parent
a1ae802279
commit
c5a09a88e9
@ -7,7 +7,7 @@
|
||||
|
||||
#include <Box.h>
|
||||
#include <Catalog.h>
|
||||
#include <GroupLayoutBuilder.h>
|
||||
#include <LayoutBuilder.h>
|
||||
#include <Locale.h>
|
||||
|
||||
#include "constants.h"
|
||||
@ -27,8 +27,6 @@ PoorManAdvancedView::PoorManAdvancedView(const char* name)
|
||||
PoorManWindow* win;
|
||||
win = ((PoorManApplication*)be_app)->GetPoorManWindow();
|
||||
|
||||
SetLayout(new BGroupLayout(B_VERTICAL));
|
||||
|
||||
BBox* connectionOptions = new BBox(B_TRANSLATE("Connections"));
|
||||
connectionOptions->SetLabel(STR_BBX_CONNECTION);
|
||||
|
||||
@ -40,14 +38,18 @@ PoorManAdvancedView::PoorManAdvancedView(const char* name)
|
||||
fMaxConnections->SetLimitLabels("1", "200");
|
||||
SetMaxSimutaneousConnections(win->MaxConnections());
|
||||
|
||||
connectionOptions->AddChild(BGroupLayoutBuilder(B_VERTICAL, 10)
|
||||
.Add(fMaxConnections)
|
||||
.SetInsets(5, 5, 5, 5));
|
||||
|
||||
AddChild(BGroupLayoutBuilder(B_VERTICAL, 10)
|
||||
.Add(connectionOptions)
|
||||
|
||||
BGroupLayout* connectionOptionsLayout = new BGroupLayout(B_VERTICAL, 0);
|
||||
connectionOptions->SetLayout(connectionOptionsLayout);
|
||||
|
||||
BLayoutBuilder::Group<>(this, B_VERTICAL)
|
||||
.AddGroup(connectionOptionsLayout)
|
||||
.SetInsets(B_USE_ITEM_INSETS)
|
||||
.AddStrut(B_USE_ITEM_SPACING)
|
||||
.Add(fMaxConnections)
|
||||
.End()
|
||||
.AddGlue()
|
||||
.SetInsets(5, 5, 5, 5));
|
||||
.SetInsets(B_USE_ITEM_INSETS);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
#include <Box.h>
|
||||
#include <Catalog.h>
|
||||
#include <GroupLayoutBuilder.h>
|
||||
#include <LayoutBuilder.h>
|
||||
#include <Locale.h>
|
||||
|
||||
#include "constants.h"
|
||||
@ -27,8 +27,6 @@ PoorManLoggingView::PoorManLoggingView(const char* name)
|
||||
PoorManWindow* win;
|
||||
win = ((PoorManApplication*)be_app)->GetPoorManWindow();
|
||||
|
||||
SetLayout(new BGroupLayout(B_VERTICAL));
|
||||
|
||||
BBox* consoleLogging = new BBox(B_TRANSLATE("Console Logging"));
|
||||
consoleLogging->SetLabel(STR_BBX_CONSOLE_LOGGING);
|
||||
|
||||
@ -57,24 +55,28 @@ PoorManLoggingView::PoorManLoggingView(const char* name)
|
||||
fCreateLogFile = new BButton(B_TRANSLATE("Create Log File"),
|
||||
STR_BTN_CREATE_LOG_FILE, new BMessage(MSG_PREF_LOG_BTN_CREATE_FILE));
|
||||
|
||||
consoleLogging->AddChild(BGroupLayoutBuilder(B_VERTICAL, 10)
|
||||
.Add(BGroupLayoutBuilder(B_HORIZONTAL, 10)
|
||||
.Add(fLogConsole)
|
||||
.AddGlue())
|
||||
.SetInsets(5, 5, 5, 5));
|
||||
|
||||
fileLogging->AddChild(BGroupLayoutBuilder(B_VERTICAL, 10)
|
||||
.Add(BGroupLayoutBuilder(B_HORIZONTAL, 10)
|
||||
.Add(fLogFile)
|
||||
.AddGlue())
|
||||
.Add(fLogFileName)
|
||||
.Add(BGroupLayoutBuilder(B_HORIZONTAL, 10)
|
||||
.AddGlue()
|
||||
.Add(fCreateLogFile))
|
||||
.SetInsets(5, 5, 5, 5));
|
||||
BGroupLayout* consoleLoggingLayout = new BGroupLayout(B_VERTICAL, 0);
|
||||
consoleLogging->SetLayout(consoleLoggingLayout);
|
||||
|
||||
AddChild(BGroupLayoutBuilder(B_VERTICAL, 10)
|
||||
.Add(consoleLogging)
|
||||
.Add(fileLogging)
|
||||
.SetInsets(5, 5, 5, 5));
|
||||
BGroupLayout* fileLoggingLayout = new BGroupLayout(B_VERTICAL,
|
||||
B_USE_SMALL_SPACING);
|
||||
fileLogging->SetLayout(fileLoggingLayout);
|
||||
|
||||
BLayoutBuilder::Group<>(this, B_VERTICAL)
|
||||
.SetInsets(B_USE_ITEM_INSETS)
|
||||
.AddGroup(consoleLoggingLayout)
|
||||
.SetInsets(B_USE_ITEM_INSETS)
|
||||
.AddGroup(B_HORIZONTAL)
|
||||
.SetInsets(0, B_USE_ITEM_INSETS, 0, 0)
|
||||
.Add(fLogConsole)
|
||||
.AddGlue()
|
||||
.End()
|
||||
.End()
|
||||
.AddGroup(fileLoggingLayout)
|
||||
.SetInsets(B_USE_ITEM_INSETS)
|
||||
.AddGrid(B_USE_SMALL_SPACING, B_USE_SMALL_SPACING)
|
||||
.SetInsets(0, B_USE_ITEM_INSETS, 0, 0)
|
||||
.Add(fLogFile, 0, 0)
|
||||
.AddTextControl(fLogFileName, 0, 1, B_ALIGN_LEFT, 1, 2)
|
||||
.Add(fCreateLogFile, 2, 2);
|
||||
}
|
||||
|
@ -9,10 +9,8 @@
|
||||
#include <Catalog.h>
|
||||
#include <Debug.h>
|
||||
#include <Directory.h>
|
||||
#include <GroupLayoutBuilder.h>
|
||||
#include <GroupView.h>
|
||||
#include <LayoutBuilder.h>
|
||||
#include <Locale.h>
|
||||
#include <SpaceLayoutItem.h>
|
||||
#include <Window.h>
|
||||
|
||||
#include "constants.h"
|
||||
@ -32,8 +30,6 @@ PoorManPreferencesWindow::PoorManPreferencesWindow(BRect frame, char * name)
|
||||
fWebDirFilePanel(NULL),
|
||||
fLogFilePanel(NULL)
|
||||
{
|
||||
SetLayout(new BGroupLayout(B_VERTICAL));
|
||||
|
||||
fCancelButton = new BButton("Cancel Button", B_TRANSLATE("Cancel"),
|
||||
new BMessage(MSG_PREF_BTN_CANCEL));
|
||||
fDoneButton = new BButton("Done Button", B_TRANSLATE("Done"),
|
||||
@ -80,13 +76,14 @@ PoorManPreferencesWindow::PoorManPreferencesWindow(BRect frame, char * name)
|
||||
change_title = fLogFilePanel->Window();
|
||||
change_title->SetTitle(STR_FILEPANEL_CREATE_LOG_FILE);
|
||||
|
||||
AddChild(BGroupLayoutBuilder(B_VERTICAL, 10)
|
||||
|
||||
BLayoutBuilder::Group<>(this, B_VERTICAL)
|
||||
.SetInsets(B_USE_WINDOW_INSETS)
|
||||
.Add(fPrefTabView)
|
||||
.Add(BGroupLayoutBuilder(B_HORIZONTAL)
|
||||
.AddGroup(B_HORIZONTAL)
|
||||
.AddGlue()
|
||||
.Add(fCancelButton)
|
||||
.Add(fDoneButton))
|
||||
.SetInsets(5, 5, 5, 5));
|
||||
.Add(fDoneButton);
|
||||
}
|
||||
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*/
|
||||
|
||||
#include <Box.h>
|
||||
#include <GroupLayoutBuilder.h>
|
||||
#include <LayoutBuilder.h>
|
||||
|
||||
#include "constants.h"
|
||||
#include "PoorManSiteView.h"
|
||||
@ -24,7 +24,7 @@ PoorManSiteView::PoorManSiteView(const char* name)
|
||||
// Web Site Location BBox
|
||||
BBox* webSiteLocation = new BBox("Web Location");
|
||||
webSiteLocation->SetLabel(STR_BBX_LOCATION);
|
||||
|
||||
|
||||
// Web Site Options BBox
|
||||
BBox* webSiteOptions = new BBox("Web Options");
|
||||
webSiteOptions->SetLabel(STR_BBX_OPTIONS);
|
||||
@ -47,22 +47,32 @@ PoorManSiteView::PoorManSiteView(const char* name)
|
||||
fIndexFileName = new BTextControl("Index File Name", STR_TXT_INDEX, NULL);
|
||||
SetIndexFileName(win->IndexFileName());
|
||||
|
||||
webSiteOptions->AddChild(BGroupLayoutBuilder(B_VERTICAL, 10)
|
||||
.Add(BGroupLayoutBuilder(B_HORIZONTAL, 10)
|
||||
.Add(fSendDir)
|
||||
.AddGlue())
|
||||
.SetInsets(5, 5, 5, 5));
|
||||
|
||||
webSiteLocation->AddChild(BGroupLayoutBuilder(B_VERTICAL, 10)
|
||||
.Add(fWebDir)
|
||||
.Add(BGroupLayoutBuilder(B_HORIZONTAL, 10)
|
||||
.AddGlue()
|
||||
.Add(fSelectWebDir))
|
||||
.Add(fIndexFileName)
|
||||
.SetInsets(5, 5, 5, 5));
|
||||
BGroupLayout* webSiteLocationLayout = new BGroupLayout(B_VERTICAL, 0);
|
||||
webSiteLocation->SetLayout(webSiteLocationLayout);
|
||||
|
||||
AddChild(BGroupLayoutBuilder(B_VERTICAL, 10)
|
||||
.Add(webSiteLocation)
|
||||
.Add(webSiteOptions)
|
||||
.SetInsets(5, 5, 5, 5));
|
||||
BGroupLayout* webSiteOptionsLayout = new BGroupLayout(B_VERTICAL, 0);
|
||||
webSiteOptions->SetLayout(webSiteOptionsLayout);
|
||||
|
||||
BLayoutBuilder::Group<>(this, B_VERTICAL)
|
||||
.SetInsets(B_USE_ITEM_INSETS)
|
||||
.AddGroup(webSiteLocationLayout)
|
||||
.SetInsets(B_USE_ITEM_INSETS)
|
||||
.AddGrid(B_USE_SMALL_SPACING, B_USE_SMALL_SPACING)
|
||||
.SetInsets(0, B_USE_ITEM_INSETS, 0, 0)
|
||||
.AddTextControl(fWebDir, 0, 0, B_ALIGN_LEFT, 1, 2)
|
||||
.Add(fSelectWebDir, 2, 1)
|
||||
.AddTextControl(fIndexFileName, 0, 2, B_ALIGN_LEFT, 1, 2)
|
||||
.SetColumnWeight(1, 10.f)
|
||||
.End()
|
||||
.End()
|
||||
.AddGroup(webSiteOptionsLayout)
|
||||
.SetInsets(B_USE_ITEM_INSETS)
|
||||
.AddStrut(B_USE_ITEM_SPACING)
|
||||
.AddGroup(B_HORIZONTAL)
|
||||
.SetInsets(0)
|
||||
.Add(fSendDir)
|
||||
.AddGlue()
|
||||
.End()
|
||||
.AddGlue();
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include <Directory.h>
|
||||
#include <File.h>
|
||||
#include <FindDirectory.h>
|
||||
#include <GroupLayoutBuilder.h>
|
||||
#include <LayoutBuilder.h>
|
||||
#include <Locale.h>
|
||||
#include <Menu.h>
|
||||
#include <MenuBar.h>
|
||||
@ -73,8 +73,6 @@ PoorManWindow::PoorManWindow(BRect frame)
|
||||
SetSizeLimits(318, 1600, 53, 1200);
|
||||
// limit the size of the size of the window
|
||||
|
||||
SetLayout(new BGroupLayout(B_VERTICAL));
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
// Three Labels
|
||||
|
||||
@ -137,18 +135,21 @@ PoorManWindow::PoorManWindow(BRect frame)
|
||||
change_title = fSaveConsoleSelectionFilePanel->Window();
|
||||
change_title->SetTitle(STR_FILEPANEL_SAVE_CONSOLE_SELECTION);
|
||||
|
||||
AddChild(BGroupLayoutBuilder(B_VERTICAL)
|
||||
BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
|
||||
.SetInsets(0)
|
||||
.Add(fFileMenuBar)
|
||||
.Add(BGroupLayoutBuilder(B_VERTICAL, 5)
|
||||
.Add(BGroupLayoutBuilder(B_HORIZONTAL)
|
||||
.AddGroup(B_VERTICAL, B_USE_SMALL_SPACING)
|
||||
.SetInsets(B_USE_WINDOW_INSETS)
|
||||
.AddGroup(B_HORIZONTAL)
|
||||
.Add(fStatusView)
|
||||
.AddGlue()
|
||||
.Add(fHitsView))
|
||||
.Add(BGroupLayoutBuilder(B_HORIZONTAL)
|
||||
.Add(fHitsView)
|
||||
.End()
|
||||
.AddGroup(B_HORIZONTAL)
|
||||
.Add(fDirView)
|
||||
.AddGlue())
|
||||
.Add(fScrollView)
|
||||
.SetInsets(10, 10, 10, 10)));
|
||||
.AddGlue()
|
||||
.End()
|
||||
.Add(fScrollView);
|
||||
|
||||
pthread_rwlock_init(&fLogFileLock, NULL);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user