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