DiskProbe: improved layout scaling.
* Don't use a fixed size font for the header controls, but one that depends on the default plain font size. * Minor cleanup.
This commit is contained in:
@@ -33,7 +33,7 @@ static const uint32 kMsgProbeDevice = 'prFl';
|
|||||||
|
|
||||||
OpenWindow::OpenWindow()
|
OpenWindow::OpenWindow()
|
||||||
:
|
:
|
||||||
BWindow(BRect(0, 0, 35, 10), B_TRANSLATE_SYSTEM_NAME("DiskProbe"),
|
BWindow(BRect(0, 0, 350, 10), B_TRANSLATE_SYSTEM_NAME("DiskProbe"),
|
||||||
B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE
|
B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE
|
||||||
| B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS)
|
| B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS)
|
||||||
{
|
{
|
||||||
@@ -56,18 +56,14 @@ OpenWindow::OpenWindow()
|
|||||||
BButton *cancelButton = new BButton("cancel", B_TRANSLATE("Cancel"),
|
BButton *cancelButton = new BButton("cancel", B_TRANSLATE("Cancel"),
|
||||||
new BMessage(B_QUIT_REQUESTED));
|
new BMessage(B_QUIT_REQUESTED));
|
||||||
|
|
||||||
SetLayout(new BGroupLayout(B_HORIZONTAL));
|
BLayoutBuilder::Group<>(this, B_VERTICAL)
|
||||||
|
.SetInsets(B_USE_DEFAULT_SPACING)
|
||||||
AddChild(BLayoutBuilder::Group<>(B_VERTICAL, B_USE_SMALL_SPACING)
|
|
||||||
.Add(field)
|
.Add(field)
|
||||||
.AddGroup(B_HORIZONTAL)
|
.AddGroup(B_HORIZONTAL)
|
||||||
.Add(cancelButton)
|
.Add(cancelButton)
|
||||||
.Add(probeFileButton)
|
.Add(probeFileButton)
|
||||||
.AddGlue()
|
.AddGlue()
|
||||||
.Add(probeDeviceButton)
|
.Add(probeDeviceButton);
|
||||||
.End()
|
|
||||||
.SetInsets(B_USE_DEFAULT_SPACING)
|
|
||||||
);
|
|
||||||
|
|
||||||
CenterOnScreen();
|
CenterOnScreen();
|
||||||
}
|
}
|
||||||
@@ -82,7 +78,8 @@ void
|
|||||||
OpenWindow::MessageReceived(BMessage *message)
|
OpenWindow::MessageReceived(BMessage *message)
|
||||||
{
|
{
|
||||||
switch (message->what) {
|
switch (message->what) {
|
||||||
case kMsgProbeDevice: {
|
case kMsgProbeDevice:
|
||||||
|
{
|
||||||
BMenuItem *item = fDevicesMenu->FindMarked();
|
BMenuItem *item = fDevicesMenu->FindMarked();
|
||||||
if (item == NULL)
|
if (item == NULL)
|
||||||
break;
|
break;
|
||||||
@@ -97,7 +94,8 @@ OpenWindow::MessageReceived(BMessage *message)
|
|||||||
PostMessage(B_QUIT_REQUESTED);
|
PostMessage(B_QUIT_REQUESTED);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case B_SIMPLE_DATA: {
|
case B_SIMPLE_DATA:
|
||||||
|
{
|
||||||
// if it's a file drop, open it
|
// if it's a file drop, open it
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
if (message->FindRef("refs", 0, &ref) == B_OK) {
|
if (message->FindRef("refs", 0, &ref) == B_OK) {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2004-2009, Axel Dörfler, [email protected].
|
* Copyright 2004-2015, Axel Dörfler, [email protected].
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -490,16 +490,14 @@ HeaderView::HeaderView(const entry_ref *ref, DataEditor &editor)
|
|||||||
GridLayout()->AddView(line, 1, 0);
|
GridLayout()->AddView(line, 1, 0);
|
||||||
|
|
||||||
BFont boldFont = *be_bold_font;
|
BFont boldFont = *be_bold_font;
|
||||||
boldFont.SetSize(10.0);
|
|
||||||
BFont plainFont = *be_plain_font;
|
BFont plainFont = *be_plain_font;
|
||||||
plainFont.SetSize(10.0);
|
boldFont.SetSize(plainFont.Size() * 0.83);
|
||||||
|
plainFont.SetSize(plainFont.Size() * 0.83);
|
||||||
|
|
||||||
BStringView *stringView = new BStringView(
|
BStringView *stringView = new BStringView(
|
||||||
B_EMPTY_STRING, editor.IsAttribute()
|
B_EMPTY_STRING, editor.IsAttribute()
|
||||||
? B_TRANSLATE("Attribute: ")
|
? B_TRANSLATE("Attribute: ") : editor.IsDevice()
|
||||||
: editor.IsDevice()
|
? B_TRANSLATE("Device: ") : B_TRANSLATE("File: "));
|
||||||
? B_TRANSLATE("Device: ")
|
|
||||||
: B_TRANSLATE("File: "));
|
|
||||||
stringView->SetFont(&boldFont);
|
stringView->SetFont(&boldFont);
|
||||||
line->AddChild(stringView);
|
line->AddChild(stringView);
|
||||||
|
|
||||||
@@ -524,7 +522,6 @@ HeaderView::HeaderView(const entry_ref *ref, DataEditor &editor)
|
|||||||
get_type_string(buffer, sizeof(buffer), editor.Type());
|
get_type_string(buffer, sizeof(buffer), editor.Type());
|
||||||
fTypeControl = new BTextControl(B_EMPTY_STRING, NULL, buffer,
|
fTypeControl = new BTextControl(B_EMPTY_STRING, NULL, buffer,
|
||||||
new BMessage(kMsgPositionUpdate));
|
new BMessage(kMsgPositionUpdate));
|
||||||
fTypeControl->SetDivider(0.0);
|
|
||||||
fTypeControl->SetFont(&plainFont);
|
fTypeControl->SetFont(&plainFont);
|
||||||
fTypeControl->TextView()->SetFontAndColor(&plainFont);
|
fTypeControl->TextView()->SetFontAndColor(&plainFont);
|
||||||
fTypeControl->SetEnabled(false);
|
fTypeControl->SetEnabled(false);
|
||||||
@@ -542,7 +539,7 @@ HeaderView::HeaderView(const entry_ref *ref, DataEditor &editor)
|
|||||||
|
|
||||||
BGroupLayoutBuilder(line).AddGlue();
|
BGroupLayoutBuilder(line).AddGlue();
|
||||||
|
|
||||||
line = new BGroupView(B_HORIZONTAL);
|
line = new BGroupView(B_HORIZONTAL, B_USE_SMALL_SPACING);
|
||||||
GridLayout()->AddView(line, 1, 1);
|
GridLayout()->AddView(line, 1, 1);
|
||||||
|
|
||||||
stringView = new BStringView(B_EMPTY_STRING, B_TRANSLATE("Block: "));
|
stringView = new BStringView(B_EMPTY_STRING, B_TRANSLATE("Block: "));
|
||||||
@@ -1078,8 +1075,8 @@ EditorLooper::Find(off_t startAt, const uint8 *data, size_t dataSize,
|
|||||||
// If the user had to wait more than 8 seconds for the result,
|
// If the user had to wait more than 8 seconds for the result,
|
||||||
// we are trying to please him with a requester...
|
// we are trying to please him with a requester...
|
||||||
BAlert* alert = new BAlert(B_TRANSLATE("DiskProbe request"),
|
BAlert* alert = new BAlert(B_TRANSLATE("DiskProbe request"),
|
||||||
B_TRANSLATE("Could not find search string."),
|
B_TRANSLATE("Could not find search string."),
|
||||||
B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL,
|
B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL,
|
||||||
B_WARNING_ALERT);
|
B_WARNING_ALERT);
|
||||||
alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
|
alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
|
||||||
alert->Go(NULL);
|
alert->Go(NULL);
|
||||||
@@ -1254,7 +1251,7 @@ ProbeView::_UpdateAttributesMenu(BMenu *menu)
|
|||||||
if (menu->CountItems() == 0) {
|
if (menu->CountItems() == 0) {
|
||||||
// if there are no attributes, add an item to the menu
|
// if there are no attributes, add an item to the menu
|
||||||
// that says so
|
// that says so
|
||||||
BMenuItem *item = new BMenuItem(B_TRANSLATE_COMMENT("none",
|
BMenuItem *item = new BMenuItem(B_TRANSLATE_COMMENT("none",
|
||||||
"No attributes"), NULL);
|
"No attributes"), NULL);
|
||||||
item->SetEnabled(false);
|
item->SetEnabled(false);
|
||||||
menu->AddItem(item);
|
menu->AddItem(item);
|
||||||
@@ -1448,7 +1445,7 @@ ProbeView::AttachedToWindow()
|
|||||||
|
|
||||||
// "View" menu
|
// "View" menu
|
||||||
|
|
||||||
menu = new BMenu(B_TRANSLATE_COMMENT("View",
|
menu = new BMenu(B_TRANSLATE_COMMENT("View",
|
||||||
"This is the last menubar item 'File Edit Block View'"));
|
"This is the last menubar item 'File Edit Block View'"));
|
||||||
|
|
||||||
// Number Base (hex/decimal)
|
// Number Base (hex/decimal)
|
||||||
@@ -1527,8 +1524,8 @@ ProbeView::AttachedToWindow()
|
|||||||
item->SetMarked(true);
|
item->SetMarked(true);
|
||||||
}
|
}
|
||||||
subMenu->AddSeparatorItem();
|
subMenu->AddSeparatorItem();
|
||||||
subMenu->AddItem(item = new BMenuItem(B_TRANSLATE_COMMENT("Fit",
|
subMenu->AddItem(item = new BMenuItem(B_TRANSLATE_COMMENT("Fit",
|
||||||
"Size of fonts, fits to available room"),
|
"Size of fonts, fits to available room"),
|
||||||
message = new BMessage(kMsgFontSize)));
|
message = new BMessage(kMsgFontSize)));
|
||||||
message->AddFloat("font_size", 0.0f);
|
message->AddFloat("font_size", 0.0f);
|
||||||
if (fontSize == 0)
|
if (fontSize == 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user