DiskProbe: rewrite to use layout code.
The main goal is to use a layout aware tab view in the attribute editor window, removing some hacks that caused #10480.
This commit is contained in:
@@ -14,6 +14,9 @@
|
|||||||
#include <Alert.h>
|
#include <Alert.h>
|
||||||
#include <Catalog.h>
|
#include <Catalog.h>
|
||||||
#include <Directory.h>
|
#include <Directory.h>
|
||||||
|
#include <GroupLayout.h>
|
||||||
|
#include <GroupLayoutBuilder.h>
|
||||||
|
#include <GroupView.h>
|
||||||
#include <Locale.h>
|
#include <Locale.h>
|
||||||
#include <MenuBar.h>
|
#include <MenuBar.h>
|
||||||
#include <MenuItem.h>
|
#include <MenuItem.h>
|
||||||
@@ -31,169 +34,67 @@ static const uint32 kMsgRemoveAttribute = 'rmat';
|
|||||||
|
|
||||||
class EditorTabView : public BTabView {
|
class EditorTabView : public BTabView {
|
||||||
public:
|
public:
|
||||||
EditorTabView(BRect frame, const char *name,
|
EditorTabView(const char *name,
|
||||||
button_width width = B_WIDTH_AS_USUAL,
|
button_width width = B_WIDTH_FROM_WIDEST,
|
||||||
uint32 resizingMode = B_FOLLOW_ALL,
|
|
||||||
uint32 flags = B_WILL_DRAW | B_FRAME_EVENTS);
|
uint32 flags = B_WILL_DRAW | B_FRAME_EVENTS);
|
||||||
|
|
||||||
virtual void FrameResized(float width, float height);
|
|
||||||
virtual void Select(int32 tab);
|
|
||||||
|
|
||||||
void AddRawEditorTab(BView *view);
|
void AddRawEditorTab(BView *view);
|
||||||
void SetTypeEditorTab(BView *view);
|
void SetTypeEditorTab(BView *view);
|
||||||
|
|
||||||
private:
|
|
||||||
BView *fRawEditorView;
|
|
||||||
BView *fTypeEditorView;
|
|
||||||
BStringView *fNoEditorView;
|
|
||||||
int32 fRawTab;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//-----------------
|
// -----------------
|
||||||
|
|
||||||
|
|
||||||
EditorTabView::EditorTabView(BRect frame, const char *name, button_width width,
|
EditorTabView::EditorTabView(const char *name, button_width width, uint32 flags)
|
||||||
uint32 resizingMode, uint32 flags)
|
: BTabView(name, width, flags)
|
||||||
: BTabView(frame, name, width, resizingMode, flags),
|
|
||||||
fRawEditorView(NULL),
|
|
||||||
fRawTab(-1)
|
|
||||||
{
|
{
|
||||||
ContainerView()->MoveBy(-ContainerView()->Frame().left,
|
SetBorder(B_NO_BORDER);
|
||||||
TabHeight() + 1 - ContainerView()->Frame().top);
|
|
||||||
fNoEditorView = new BStringView(ContainerView()->Bounds(),
|
|
||||||
B_TRANSLATE("Type editor"), B_TRANSLATE("No type editor available"),
|
|
||||||
B_FOLLOW_NONE);
|
|
||||||
fNoEditorView->ResizeToPreferred();
|
|
||||||
fNoEditorView->SetAlignment(B_ALIGN_CENTER);
|
|
||||||
fTypeEditorView = fNoEditorView;
|
|
||||||
|
|
||||||
FrameResized(0, 0);
|
|
||||||
|
|
||||||
SetTypeEditorTab(NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
EditorTabView::FrameResized(float width, float height)
|
|
||||||
{
|
|
||||||
BRect rect = Bounds();
|
|
||||||
rect.top = ContainerView()->Frame().top;
|
|
||||||
|
|
||||||
ContainerView()->ResizeTo(rect.Width(), rect.Height());
|
|
||||||
|
|
||||||
BView *view = fTypeEditorView;
|
|
||||||
if (view == NULL)
|
|
||||||
view = fNoEditorView;
|
|
||||||
|
|
||||||
BPoint point = view->Frame().LeftTop();
|
|
||||||
if ((view->ResizingMode() & B_FOLLOW_RIGHT) == 0)
|
|
||||||
point.x = (rect.Width() - view->Bounds().Width()) / 2;
|
|
||||||
if ((view->ResizingMode() & B_FOLLOW_BOTTOM) == 0)
|
|
||||||
point.y = (rect.Height() - view->Bounds().Height()) / 2;
|
|
||||||
|
|
||||||
view->MoveTo(point);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
EditorTabView::Select(int32 tab)
|
|
||||||
{
|
|
||||||
if (tab != fRawTab && fRawEditorView != NULL && !fRawEditorView->IsHidden(fRawEditorView))
|
|
||||||
fRawEditorView->Hide();
|
|
||||||
|
|
||||||
BTabView::Select(tab);
|
|
||||||
|
|
||||||
BView *view;
|
|
||||||
if (tab == fRawTab && fRawEditorView != NULL) {
|
|
||||||
if (fRawEditorView->IsHidden(fRawEditorView))
|
|
||||||
fRawEditorView->Show();
|
|
||||||
view = fRawEditorView;
|
|
||||||
} else
|
|
||||||
view = ViewForTab(Selection());
|
|
||||||
|
|
||||||
if (view != NULL && (view->ResizingMode() & (B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM)) != 0) {
|
|
||||||
BRect rect = ContainerView()->Bounds();
|
|
||||||
|
|
||||||
BRect frame = view->Frame();
|
|
||||||
rect.left = frame.left;
|
|
||||||
rect.top = frame.top;
|
|
||||||
if ((view->ResizingMode() & B_FOLLOW_RIGHT) == 0)
|
|
||||||
rect.right = frame.right;
|
|
||||||
if ((view->ResizingMode() & B_FOLLOW_BOTTOM) == 0)
|
|
||||||
rect.bottom = frame.bottom;
|
|
||||||
|
|
||||||
view->ResizeTo(rect.Width(), rect.Height());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
EditorTabView::AddRawEditorTab(BView *view)
|
EditorTabView::AddRawEditorTab(BView *view)
|
||||||
{
|
{
|
||||||
fRawEditorView = view;
|
BTab* tab = new BTab(view);
|
||||||
if (view != NULL)
|
tab->SetLabel(B_TRANSLATE("Raw editor"));
|
||||||
ContainerView()->AddChild(view);
|
AddTab(view, tab);
|
||||||
|
|
||||||
fRawTab = CountTabs();
|
|
||||||
|
|
||||||
view = new BView(BRect(0, 0, 5, 5), B_TRANSLATE("Raw editor"), B_FOLLOW_NONE, 0);
|
|
||||||
view->SetViewColor(ViewColor());
|
|
||||||
AddTab(view);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
EditorTabView::SetTypeEditorTab(BView *view)
|
EditorTabView::SetTypeEditorTab(BView *view)
|
||||||
{
|
{
|
||||||
if (fTypeEditorView == view)
|
if (view == NULL) {
|
||||||
return;
|
view = new BStringView(B_TRANSLATE("Type editor"),
|
||||||
|
B_TRANSLATE("No type editor available"));
|
||||||
BTab *tab = TabAt(0);
|
((BStringView*)view)->SetAlignment(B_ALIGN_CENTER);
|
||||||
if (tab != NULL)
|
|
||||||
tab->SetView(NULL);
|
|
||||||
|
|
||||||
fTypeEditorView = view;
|
|
||||||
|
|
||||||
if (view == NULL)
|
|
||||||
view = fNoEditorView;
|
|
||||||
|
|
||||||
if (CountTabs() == 0)
|
|
||||||
AddTab(view);
|
|
||||||
else
|
|
||||||
tab->SetView(view);
|
|
||||||
|
|
||||||
FrameResized(0, 0);
|
|
||||||
|
|
||||||
#ifdef HAIKU_TARGET_PLATFORM_BEOS
|
|
||||||
if (Window() != NULL) {
|
|
||||||
// With R5's BTabView, calling select without being
|
|
||||||
// attached to a window crashes...
|
|
||||||
Select(0);
|
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
|
BGroupView* group = new BGroupView(B_VERTICAL);
|
||||||
|
BGroupLayoutBuilder(group)
|
||||||
|
.AddGlue()
|
||||||
|
.Add(view, 0)
|
||||||
|
.AddGlue();
|
||||||
|
|
||||||
|
group->SetName(view->Name());
|
||||||
|
|
||||||
|
AddTab(group);
|
||||||
Select(0);
|
Select(0);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
AttributeWindow::AttributeWindow(BRect _rect, entry_ref *ref, const char *attribute,
|
AttributeWindow::AttributeWindow(BRect _rect, entry_ref *ref,
|
||||||
const BMessage *settings)
|
const char *attribute, const BMessage *settings)
|
||||||
: ProbeWindow(_rect, ref),
|
: ProbeWindow(_rect, ref),
|
||||||
fAttribute(strdup(attribute))
|
fAttribute(strdup(attribute))
|
||||||
{
|
{
|
||||||
// Set alternative window title for devices
|
// Set alternative window title for devices
|
||||||
|
|
||||||
char name[B_FILE_NAME_LENGTH];
|
char name[B_FILE_NAME_LENGTH];
|
||||||
#ifdef HAIKU_TARGET_PLATFORM_BEOS
|
|
||||||
strncpy(name, ref->name, sizeof(name));
|
|
||||||
name[sizeof(name) - 1] = '\0';
|
|
||||||
#else
|
|
||||||
strlcpy(name, ref->name, sizeof(name));
|
strlcpy(name, ref->name, sizeof(name));
|
||||||
#endif
|
|
||||||
|
|
||||||
BEntry entry(ref);
|
BEntry entry(ref);
|
||||||
if (entry.IsDirectory()) {
|
if (entry.IsDirectory()) {
|
||||||
@@ -209,59 +110,50 @@ AttributeWindow::AttributeWindow(BRect _rect, entry_ref *ref, const char *attrib
|
|||||||
snprintf(buffer, sizeof(buffer), "%s: %s", name, attribute);
|
snprintf(buffer, sizeof(buffer), "%s: %s", name, attribute);
|
||||||
SetTitle(buffer);
|
SetTitle(buffer);
|
||||||
|
|
||||||
|
BGroupLayout* layout = new BGroupLayout(B_VERTICAL, 0);
|
||||||
|
SetLayout(layout);
|
||||||
|
|
||||||
// add the menu
|
// add the menu
|
||||||
|
|
||||||
BMenuBar *menuBar = new BMenuBar(BRect(0, 0, 0, 0), NULL);
|
BMenuBar *menuBar = new BMenuBar("");
|
||||||
AddChild(menuBar);
|
layout->AddView(menuBar, 0);
|
||||||
|
|
||||||
BMenu *menu = new BMenu(B_TRANSLATE("Attribute"));
|
BMenu *menu = new BMenu(B_TRANSLATE("Attribute"));
|
||||||
|
|
||||||
// the ProbeView save menu items will be inserted here
|
// the ProbeView save menu items will be inserted here
|
||||||
menu->AddItem(new BMenuItem(B_TRANSLATE("Remove from file"),
|
menu->AddItem(new BMenuItem(B_TRANSLATE("Remove from file"),
|
||||||
new BMessage(kMsgRemoveAttribute)));
|
new BMessage(kMsgRemoveAttribute)));
|
||||||
menu->AddSeparatorItem();
|
menu->AddSeparatorItem();
|
||||||
|
|
||||||
// the ProbeView print menu items will be inserted here
|
// the ProbeView print menu items will be inserted here
|
||||||
menu->AddSeparatorItem();
|
menu->AddSeparatorItem();
|
||||||
|
|
||||||
menu->AddItem(new BMenuItem(B_TRANSLATE("Close"), new BMessage(B_CLOSE_REQUESTED),
|
menu->AddItem(new BMenuItem(B_TRANSLATE("Close"),
|
||||||
'W', B_COMMAND_KEY));
|
new BMessage(B_CLOSE_REQUESTED), 'W', B_COMMAND_KEY));
|
||||||
menu->SetTargetForItems(this);
|
menu->SetTargetForItems(this);
|
||||||
menuBar->AddItem(menu);
|
menuBar->AddItem(menu);
|
||||||
|
|
||||||
// add our interface widgets
|
// add our interface widgets
|
||||||
|
|
||||||
BRect rect = Bounds();
|
EditorTabView *tabView = new EditorTabView("tabView");
|
||||||
rect.top = menuBar->Bounds().Height() + 1;
|
layout->AddView(tabView, 999);
|
||||||
|
|
||||||
BView *view = new BView(rect, "main", B_FOLLOW_ALL, 0);
|
BRect rect = tabView->ContainerView()->Bounds();
|
||||||
view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
|
||||||
AddChild(view);
|
|
||||||
|
|
||||||
rect = view->Bounds();
|
|
||||||
rect.top += 3;
|
rect.top += 3;
|
||||||
|
|
||||||
EditorTabView *tabView = new EditorTabView(rect, "tabView");
|
fProbeView = new ProbeView(ref, attribute, settings);
|
||||||
|
|
||||||
rect = tabView->ContainerView()->Bounds();
|
|
||||||
rect.top += 3;
|
|
||||||
fProbeView = new ProbeView(rect, ref, attribute, settings);
|
|
||||||
tabView->AddRawEditorTab(fProbeView);
|
|
||||||
|
|
||||||
view->AddChild(tabView);
|
|
||||||
|
|
||||||
fTypeEditorView = GetTypeEditorFor(rect, fProbeView->Editor());
|
|
||||||
if (fTypeEditorView != NULL)
|
|
||||||
tabView->SetTypeEditorTab(fTypeEditorView);
|
|
||||||
else {
|
|
||||||
// show the raw editor if we don't have a specialised type editor
|
|
||||||
tabView->Select(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
fProbeView->AddSaveMenuItems(menu, 0);
|
fProbeView->AddSaveMenuItems(menu, 0);
|
||||||
fProbeView->AddPrintMenuItems(menu, menu->CountItems() - 2);
|
fProbeView->AddPrintMenuItems(menu, menu->CountItems() - 2);
|
||||||
|
|
||||||
fProbeView->UpdateSizeLimits();
|
fTypeEditorView = GetTypeEditorFor(rect, fProbeView->Editor());
|
||||||
|
|
||||||
|
tabView->SetTypeEditorTab(fTypeEditorView);
|
||||||
|
tabView->AddRawEditorTab(fProbeView);
|
||||||
|
|
||||||
|
if (fTypeEditorView == NULL) {
|
||||||
|
// show the raw editor if we don't have a specialised type editor
|
||||||
|
tabView->Select(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -280,8 +172,8 @@ AttributeWindow::MessageReceived(BMessage *message)
|
|||||||
char buffer[1024];
|
char buffer[1024];
|
||||||
|
|
||||||
snprintf(buffer, sizeof(buffer),
|
snprintf(buffer, sizeof(buffer),
|
||||||
B_TRANSLATE("Do you really want to remove the attribute \"%s\" from "
|
B_TRANSLATE("Do you really want to remove the attribute \"%s\" "
|
||||||
"the file \"%s\"?\n\nYou cannot undo this action."),
|
"from the file \"%s\"?\n\nYou cannot undo this action."),
|
||||||
fAttribute, Ref().name);
|
fAttribute, Ref().name);
|
||||||
|
|
||||||
BAlert* alert = new BAlert(B_TRANSLATE("DiskProbe request"),
|
BAlert* alert = new BAlert(B_TRANSLATE("DiskProbe request"),
|
||||||
|
|||||||
@@ -94,8 +94,8 @@ is_valid_utf8(uint8 *data, size_t size)
|
|||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
DataView::DataView(BRect rect, DataEditor &editor)
|
DataView::DataView(DataEditor &editor)
|
||||||
: BView(rect, "dataView", B_FOLLOW_ALL, B_WILL_DRAW | B_NAVIGABLE | B_FRAME_EVENTS),
|
: BView("dataView", B_WILL_DRAW | B_NAVIGABLE | B_FRAME_EVENTS),
|
||||||
fEditor(editor),
|
fEditor(editor),
|
||||||
fFocus(kHexFocus),
|
fFocus(kHexFocus),
|
||||||
fBase(kHexBase),
|
fBase(kHexBase),
|
||||||
@@ -910,6 +910,9 @@ DataView::UpdateScroller()
|
|||||||
float width, height;
|
float width, height;
|
||||||
GetPreferredSize(&width, &height);
|
GetPreferredSize(&width, &height);
|
||||||
|
|
||||||
|
SetExplicitMinSize(BSize(250, 200));
|
||||||
|
SetExplicitMaxSize(BSize(width, height));
|
||||||
|
|
||||||
BScrollBar *bar;
|
BScrollBar *bar;
|
||||||
if ((bar = ScrollBar(B_HORIZONTAL)) != NULL) {
|
if ((bar = ScrollBar(B_HORIZONTAL)) != NULL) {
|
||||||
float delta = width - Bounds().Width();
|
float delta = width - Bounds().Width();
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ enum view_focus {
|
|||||||
|
|
||||||
class DataView : public BView {
|
class DataView : public BView {
|
||||||
public:
|
public:
|
||||||
DataView(BRect rect, DataEditor& editor);
|
DataView(DataEditor& editor);
|
||||||
virtual ~DataView();
|
virtual ~DataView();
|
||||||
|
|
||||||
virtual void DetachedFromWindow();
|
virtual void DetachedFromWindow();
|
||||||
|
|||||||
@@ -11,11 +11,12 @@
|
|||||||
|
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
#include <Catalog.h>
|
#include <Catalog.h>
|
||||||
|
#include <Directory.h>
|
||||||
|
#include <GroupLayout.h>
|
||||||
#include <Locale.h>
|
#include <Locale.h>
|
||||||
#include <MenuBar.h>
|
#include <MenuBar.h>
|
||||||
#include <MenuItem.h>
|
#include <MenuItem.h>
|
||||||
#include <Path.h>
|
#include <Path.h>
|
||||||
#include <Directory.h>
|
|
||||||
#include <Volume.h>
|
#include <Volume.h>
|
||||||
#include <be_apps/Tracker/RecentItems.h>
|
#include <be_apps/Tracker/RecentItems.h>
|
||||||
|
|
||||||
@@ -27,6 +28,7 @@
|
|||||||
FileWindow::FileWindow(BRect rect, entry_ref *ref, const BMessage *settings)
|
FileWindow::FileWindow(BRect rect, entry_ref *ref, const BMessage *settings)
|
||||||
: ProbeWindow(rect, ref)
|
: ProbeWindow(rect, ref)
|
||||||
{
|
{
|
||||||
|
SetLayout(new BGroupLayout(B_VERTICAL, 0));
|
||||||
// Set alternative window title for devices
|
// Set alternative window title for devices
|
||||||
|
|
||||||
BEntry entry(ref);
|
BEntry entry(ref);
|
||||||
@@ -50,8 +52,7 @@ FileWindow::FileWindow(BRect rect, entry_ref *ref, const BMessage *settings)
|
|||||||
|
|
||||||
// add the menu
|
// add the menu
|
||||||
|
|
||||||
BMenuBar *menuBar = new BMenuBar(BRect(0, 0, Bounds().Width(), 8),
|
BMenuBar *menuBar = new BMenuBar("menu bar");
|
||||||
"menu bar");
|
|
||||||
AddChild(menuBar);
|
AddChild(menuBar);
|
||||||
|
|
||||||
BMenu *menu = new BMenu(B_TRANSLATE("File"));
|
BMenu *menu = new BMenu(B_TRANSLATE("File"));
|
||||||
@@ -88,16 +89,12 @@ FileWindow::FileWindow(BRect rect, entry_ref *ref, const BMessage *settings)
|
|||||||
|
|
||||||
// add our interface widgets
|
// add our interface widgets
|
||||||
|
|
||||||
rect = Bounds();
|
fProbeView = new ProbeView(ref, NULL, settings);
|
||||||
rect.top = menuBar->Bounds().Height() + 1;
|
|
||||||
fProbeView = new ProbeView(rect, ref, NULL, settings);
|
|
||||||
AddChild(fProbeView);
|
AddChild(fProbeView);
|
||||||
|
|
||||||
fProbeView->AddSaveMenuItems(menu, 4);
|
fProbeView->AddSaveMenuItems(menu, 4);
|
||||||
fProbeView->AddPrintMenuItems(menu, menu->CountItems() - 4);
|
fProbeView->AddPrintMenuItems(menu, menu->CountItems() - 4);
|
||||||
fProbeView->AddViewAsMenuItems();
|
fProbeView->AddViewAsMenuItems();
|
||||||
|
|
||||||
fProbeView->UpdateSizeLimits();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,10 @@
|
|||||||
#include <Entry.h>
|
#include <Entry.h>
|
||||||
#include <ExpressionParser.h>
|
#include <ExpressionParser.h>
|
||||||
#include <fs_attr.h>
|
#include <fs_attr.h>
|
||||||
|
#include <GridView.h>
|
||||||
|
#include <GroupLayout.h>
|
||||||
|
#include <GroupLayoutBuilder.h>
|
||||||
|
#include <GroupView.h>
|
||||||
#include <Locale.h>
|
#include <Locale.h>
|
||||||
#include <MenuBar.h>
|
#include <MenuBar.h>
|
||||||
#include <MenuItem.h>
|
#include <MenuItem.h>
|
||||||
@@ -70,7 +74,7 @@ static const uint32 kMsgStopFind = 'sfnd';
|
|||||||
|
|
||||||
class IconView : public BView {
|
class IconView : public BView {
|
||||||
public:
|
public:
|
||||||
IconView(BRect frame, const entry_ref *ref, bool isDevice);
|
IconView(const entry_ref *ref, bool isDevice);
|
||||||
virtual ~IconView();
|
virtual ~IconView();
|
||||||
|
|
||||||
virtual void AttachedToWindow();
|
virtual void AttachedToWindow();
|
||||||
@@ -87,8 +91,8 @@ class IconView : public BView {
|
|||||||
|
|
||||||
class PositionSlider : public BSlider {
|
class PositionSlider : public BSlider {
|
||||||
public:
|
public:
|
||||||
PositionSlider(BRect rect, const char *name, BMessage *message,
|
PositionSlider(const char *name, BMessage *message, off_t size,
|
||||||
off_t size, uint32 blockSize);
|
uint32 blockSize);
|
||||||
virtual ~PositionSlider();
|
virtual ~PositionSlider();
|
||||||
|
|
||||||
#ifdef DRAW_SLIDER_BAR
|
#ifdef DRAW_SLIDER_BAR
|
||||||
@@ -115,15 +119,13 @@ class PositionSlider : public BSlider {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class HeaderView : public BView, public BInvoker {
|
class HeaderView : public BGridView, public BInvoker {
|
||||||
public:
|
public:
|
||||||
HeaderView(BRect frame, const entry_ref *ref, DataEditor &editor);
|
HeaderView(const entry_ref *ref, DataEditor &editor);
|
||||||
virtual ~HeaderView();
|
virtual ~HeaderView();
|
||||||
|
|
||||||
virtual void AttachedToWindow();
|
virtual void AttachedToWindow();
|
||||||
virtual void DetachedFromWindow();
|
virtual void DetachedFromWindow();
|
||||||
virtual void Draw(BRect updateRect);
|
|
||||||
virtual void GetPreferredSize(float *_width, float *_height);
|
|
||||||
virtual void MessageReceived(BMessage *message);
|
virtual void MessageReceived(BMessage *message);
|
||||||
|
|
||||||
base_type Base() const { return fBase; }
|
base_type Base() const { return fBase; }
|
||||||
@@ -227,13 +229,14 @@ get_type_string(char *buffer, size_t bufferSize, type_code type)
|
|||||||
// #pragma mark - IconView
|
// #pragma mark - IconView
|
||||||
|
|
||||||
|
|
||||||
IconView::IconView(BRect rect, const entry_ref *ref, bool isDevice)
|
IconView::IconView(const entry_ref *ref, bool isDevice)
|
||||||
: BView(rect, NULL, B_FOLLOW_NONE, B_WILL_DRAW),
|
: BView(NULL, B_WILL_DRAW),
|
||||||
fRef(*ref),
|
fRef(*ref),
|
||||||
fIsDevice(isDevice),
|
fIsDevice(isDevice),
|
||||||
fBitmap(NULL)
|
fBitmap(NULL)
|
||||||
{
|
{
|
||||||
UpdateIcon();
|
UpdateIcon();
|
||||||
|
SetExplicitSize(BSize(32, 32));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -307,10 +310,10 @@ IconView::UpdateIcon()
|
|||||||
// #pragma mark - PositionSlider
|
// #pragma mark - PositionSlider
|
||||||
|
|
||||||
|
|
||||||
PositionSlider::PositionSlider(BRect rect, const char *name, BMessage *message,
|
PositionSlider::PositionSlider(const char *name, BMessage *message,
|
||||||
off_t size, uint32 blockSize)
|
off_t size, uint32 blockSize)
|
||||||
: BSlider(rect, name, NULL, message, 0, kMaxSliderLimit, B_HORIZONTAL,
|
: BSlider(name, NULL, message, 0, kMaxSliderLimit, B_HORIZONTAL,
|
||||||
B_TRIANGLE_THUMB, B_FOLLOW_LEFT_RIGHT),
|
B_TRIANGLE_THUMB),
|
||||||
fSize(size),
|
fSize(size),
|
||||||
fBlockSize(blockSize)
|
fBlockSize(blockSize)
|
||||||
{
|
{
|
||||||
@@ -469,8 +472,8 @@ PositionSlider::SetBlockSize(uint32 blockSize)
|
|||||||
// #pragma mark - HeaderView
|
// #pragma mark - HeaderView
|
||||||
|
|
||||||
|
|
||||||
HeaderView::HeaderView(BRect frame, const entry_ref *ref, DataEditor &editor)
|
HeaderView::HeaderView(const entry_ref *ref, DataEditor &editor)
|
||||||
: BView(frame, "probeHeader", B_FOLLOW_LEFT_RIGHT, B_WILL_DRAW),
|
: BGridView("probeHeader", B_USE_SMALL_SPACING, B_USE_SMALL_SPACING),
|
||||||
fAttribute(editor.Attribute()),
|
fAttribute(editor.Attribute()),
|
||||||
fFileSize(editor.FileSize()),
|
fFileSize(editor.FileSize()),
|
||||||
fBlockSize(editor.BlockSize()),
|
fBlockSize(editor.BlockSize()),
|
||||||
@@ -480,34 +483,27 @@ HeaderView::HeaderView(BRect frame, const entry_ref *ref, DataEditor &editor)
|
|||||||
fLastPosition(0)
|
fLastPosition(0)
|
||||||
{
|
{
|
||||||
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
|
GridLayout()->SetInsets(B_USE_SMALL_SPACING);
|
||||||
|
|
||||||
fIconView = new IconView(BRect(10, 10, 41, 41), ref, editor.IsDevice());
|
fIconView = new IconView(ref, editor.IsDevice());
|
||||||
AddChild(fIconView);
|
GridLayout()->AddView(fIconView, 0, 0, 1, 2);
|
||||||
|
|
||||||
|
BGroupView* line = new BGroupView(B_HORIZONTAL);
|
||||||
|
GridLayout()->AddView(line, 1, 0);
|
||||||
|
|
||||||
BFont boldFont = *be_bold_font;
|
BFont boldFont = *be_bold_font;
|
||||||
boldFont.SetSize(10.0);
|
boldFont.SetSize(10.0);
|
||||||
BFont plainFont = *be_plain_font;
|
BFont plainFont = *be_plain_font;
|
||||||
plainFont.SetSize(10.0);
|
plainFont.SetSize(10.0);
|
||||||
|
|
||||||
BRect rect = Bounds();
|
BStringView *stringView = new BStringView(
|
||||||
fStopButton = new BButton(BRect(0, 0, 20, 20), B_EMPTY_STRING,
|
|
||||||
B_TRANSLATE("Stop"), new BMessage(kMsgStopFind),
|
|
||||||
B_FOLLOW_TOP | B_FOLLOW_RIGHT);
|
|
||||||
fStopButton->SetFont(&plainFont);
|
|
||||||
fStopButton->ResizeToPreferred();
|
|
||||||
fStopButton->MoveTo(rect.right - 4 - fStopButton->Bounds().Width(), 4);
|
|
||||||
fStopButton->Hide();
|
|
||||||
AddChild(fStopButton);
|
|
||||||
|
|
||||||
BStringView *stringView = new BStringView(BRect(50, 6, rect.right, 20),
|
|
||||||
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("Device: ")
|
||||||
: B_TRANSLATE("File: "));
|
: B_TRANSLATE("File: "));
|
||||||
stringView->SetFont(&boldFont);
|
stringView->SetFont(&boldFont);
|
||||||
stringView->ResizeToPreferred();
|
line->AddChild(stringView);
|
||||||
AddChild(stringView);
|
|
||||||
|
|
||||||
BPath path(ref);
|
BPath path(ref);
|
||||||
BString string = path.Path();
|
BString string = path.Path();
|
||||||
@@ -516,115 +512,88 @@ HeaderView::HeaderView(BRect frame, const entry_ref *ref, DataEditor &editor)
|
|||||||
string.Prepend(fAttribute);
|
string.Prepend(fAttribute);
|
||||||
string.Append(")");
|
string.Append(")");
|
||||||
}
|
}
|
||||||
rect = stringView->Frame();
|
fPathView = new BStringView(B_EMPTY_STRING, string.String());
|
||||||
rect.left = rect.right;
|
|
||||||
rect.right = fStopButton->Frame().right - 1;
|
|
||||||
fPathView = new BStringView(rect, B_EMPTY_STRING, string.String(),
|
|
||||||
B_FOLLOW_TOP | B_FOLLOW_LEFT_RIGHT);
|
|
||||||
fPathView->SetFont(&plainFont);
|
fPathView->SetFont(&plainFont);
|
||||||
AddChild(fPathView);
|
line->AddChild(fPathView);
|
||||||
|
|
||||||
float top = 28;
|
|
||||||
if (editor.IsAttribute()) {
|
if (editor.IsAttribute()) {
|
||||||
top += 3;
|
stringView = new BStringView(B_EMPTY_STRING,
|
||||||
stringView = new BStringView(BRect(50, top, frame.right, top + 15),
|
B_TRANSLATE("Attribute type: "));
|
||||||
B_EMPTY_STRING, B_TRANSLATE("Attribute type: "));
|
|
||||||
stringView->SetFont(&boldFont);
|
stringView->SetFont(&boldFont);
|
||||||
stringView->ResizeToPreferred();
|
line->AddChild(stringView);
|
||||||
AddChild(stringView);
|
|
||||||
|
|
||||||
rect = stringView->Frame();
|
|
||||||
rect.left = rect.right;
|
|
||||||
rect.right += 100;
|
|
||||||
rect.OffsetBy(0, -2);
|
|
||||||
// BTextControl oddities
|
|
||||||
|
|
||||||
char buffer[16];
|
char buffer[16];
|
||||||
get_type_string(buffer, sizeof(buffer), editor.Type());
|
get_type_string(buffer, sizeof(buffer), editor.Type());
|
||||||
fTypeControl = new BTextControl(rect, B_EMPTY_STRING, NULL, buffer,
|
fTypeControl = new BTextControl(B_EMPTY_STRING, NULL, buffer,
|
||||||
new BMessage(kMsgPositionUpdate));
|
new BMessage(kMsgPositionUpdate));
|
||||||
fTypeControl->SetDivider(0.0);
|
fTypeControl->SetDivider(0.0);
|
||||||
fTypeControl->SetFont(&plainFont);
|
fTypeControl->SetFont(&plainFont);
|
||||||
fTypeControl->TextView()->SetFontAndColor(&plainFont);
|
fTypeControl->TextView()->SetFontAndColor(&plainFont);
|
||||||
fTypeControl->SetEnabled(false);
|
fTypeControl->SetEnabled(false);
|
||||||
// ToDo: for now
|
// ToDo: for now
|
||||||
AddChild(fTypeControl);
|
line->AddChild(fTypeControl);
|
||||||
|
|
||||||
top += 25;
|
|
||||||
} else
|
} else
|
||||||
fTypeControl = NULL;
|
fTypeControl = NULL;
|
||||||
|
|
||||||
stringView = new BStringView(BRect(50, top, frame.right, top + 15),
|
fStopButton = new BButton(B_EMPTY_STRING,
|
||||||
B_EMPTY_STRING, B_TRANSLATE("Block: "));
|
B_TRANSLATE("Stop"), new BMessage(kMsgStopFind));
|
||||||
stringView->SetFont(&boldFont);
|
fStopButton->SetFont(&plainFont);
|
||||||
stringView->ResizeToPreferred();
|
fStopButton->Hide();
|
||||||
AddChild(stringView);
|
line->AddChild(fStopButton);
|
||||||
|
|
||||||
|
BGroupLayoutBuilder(line).AddGlue();
|
||||||
|
|
||||||
|
line = new BGroupView(B_HORIZONTAL);
|
||||||
|
GridLayout()->AddView(line, 1, 1);
|
||||||
|
|
||||||
|
stringView = new BStringView(B_EMPTY_STRING, B_TRANSLATE("Block: "));
|
||||||
|
stringView->SetFont(&boldFont);
|
||||||
|
line->AddChild(stringView);
|
||||||
|
|
||||||
rect = stringView->Frame();
|
|
||||||
rect.left = rect.right;
|
|
||||||
rect.right += 75;
|
|
||||||
rect.OffsetBy(0, -2);
|
|
||||||
// BTextControl oddities
|
// BTextControl oddities
|
||||||
fPositionControl = new BTextControl(rect, B_EMPTY_STRING, NULL, "0x0",
|
fPositionControl = new BTextControl(B_EMPTY_STRING, NULL, "0x0",
|
||||||
new BMessage(kMsgPositionUpdate));
|
new BMessage(kMsgPositionUpdate));
|
||||||
fPositionControl->SetDivider(0.0);
|
fPositionControl->SetDivider(0.0);
|
||||||
fPositionControl->SetFont(&plainFont);
|
fPositionControl->SetFont(&plainFont);
|
||||||
fPositionControl->TextView()->SetFontAndColor(&plainFont);
|
fPositionControl->TextView()->SetFontAndColor(&plainFont);
|
||||||
fPositionControl->SetAlignment(B_ALIGN_LEFT, B_ALIGN_RIGHT);
|
fPositionControl->SetAlignment(B_ALIGN_LEFT, B_ALIGN_RIGHT);
|
||||||
AddChild(fPositionControl);
|
line->AddChild(fPositionControl);
|
||||||
|
|
||||||
rect.left = rect.right + 4;
|
fSizeView = new BStringView(B_EMPTY_STRING, B_TRANSLATE_COMMENT("of "
|
||||||
rect.right = rect.left + 75;
|
|
||||||
rect.OffsetBy(0, 2);
|
|
||||||
fSizeView = new BStringView(rect, B_EMPTY_STRING, B_TRANSLATE_COMMENT("of "
|
|
||||||
"0x0", "This is a part of 'Block 0xXXXX of 0x0026' message. In "
|
"0x0", "This is a part of 'Block 0xXXXX of 0x0026' message. In "
|
||||||
"languages without 'of' structure it can be replaced simply "
|
"languages without 'of' structure it can be replaced simply "
|
||||||
"with '/'."));
|
"with '/'."));
|
||||||
fSizeView->SetFont(&plainFont);
|
fSizeView->SetFont(&plainFont);
|
||||||
AddChild(fSizeView);
|
line->AddChild(fSizeView);
|
||||||
UpdateFileSizeView();
|
UpdateFileSizeView();
|
||||||
|
|
||||||
rect.left = rect.right + 4;
|
stringView = new BStringView(B_EMPTY_STRING, B_TRANSLATE("Offset: "));
|
||||||
rect.right = frame.right;
|
|
||||||
stringView = new BStringView(rect, B_EMPTY_STRING, B_TRANSLATE("Offset: "));
|
|
||||||
stringView->SetFont(&boldFont);
|
stringView->SetFont(&boldFont);
|
||||||
stringView->ResizeToPreferred();
|
line->AddChild(stringView);
|
||||||
AddChild(stringView);
|
|
||||||
|
|
||||||
rect = stringView->Frame();
|
fOffsetView = new BStringView(B_EMPTY_STRING, "0x0");
|
||||||
rect.left = rect.right;
|
|
||||||
rect.right = rect.left + 40;
|
|
||||||
fOffsetView = new BStringView(rect, B_EMPTY_STRING, "0x0");
|
|
||||||
fOffsetView->SetFont(&plainFont);
|
fOffsetView->SetFont(&plainFont);
|
||||||
AddChild(fOffsetView);
|
line->AddChild(fOffsetView);
|
||||||
UpdateOffsetViews(false);
|
UpdateOffsetViews(false);
|
||||||
|
|
||||||
rect.left = rect.right + 4;
|
stringView = new BStringView(B_EMPTY_STRING, editor.IsAttribute()
|
||||||
rect.right = frame.right;
|
|
||||||
stringView = new BStringView(rect, B_EMPTY_STRING, editor.IsAttribute()
|
|
||||||
? B_TRANSLATE("Attribute offset: ") : editor.IsDevice()
|
? B_TRANSLATE("Attribute offset: ") : editor.IsDevice()
|
||||||
? B_TRANSLATE("Device offset: ") : B_TRANSLATE("File offset: "));
|
? B_TRANSLATE("Device offset: ") : B_TRANSLATE("File offset: "));
|
||||||
stringView->SetFont(&boldFont);
|
stringView->SetFont(&boldFont);
|
||||||
stringView->ResizeToPreferred();
|
line->AddChild(stringView);
|
||||||
AddChild(stringView);
|
|
||||||
|
|
||||||
rect = stringView->Frame();
|
fFileOffsetView = new BStringView(B_EMPTY_STRING, "0x0");
|
||||||
rect.left = rect.right;
|
|
||||||
rect.right = rect.left + 70;
|
|
||||||
fFileOffsetView = new BStringView(rect, B_EMPTY_STRING, "0x0");
|
|
||||||
fFileOffsetView->SetFont(&plainFont);
|
fFileOffsetView->SetFont(&plainFont);
|
||||||
AddChild(fFileOffsetView);
|
line->AddChild(fFileOffsetView);
|
||||||
|
|
||||||
rect = Bounds();
|
BGroupLayoutBuilder(line).AddGlue();
|
||||||
rect.InsetBy(3, 0);
|
|
||||||
rect.top = top + 21;
|
fPositionSlider = new PositionSlider("slider",
|
||||||
rect.bottom = rect.top + 12;
|
|
||||||
fPositionSlider = new PositionSlider(rect, "slider",
|
|
||||||
new BMessage(kMsgSliderUpdate), editor.FileSize(), editor.BlockSize());
|
new BMessage(kMsgSliderUpdate), editor.FileSize(), editor.BlockSize());
|
||||||
fPositionSlider->SetModificationMessage(new BMessage(kMsgSliderUpdate));
|
fPositionSlider->SetModificationMessage(new BMessage(kMsgSliderUpdate));
|
||||||
fPositionSlider->SetBarThickness(8);
|
fPositionSlider->SetBarThickness(8);
|
||||||
fPositionSlider->ResizeToPreferred();
|
GridLayout()->AddView(fPositionSlider, 0, 2, 2, 1);
|
||||||
AddChild(fPositionSlider);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -668,33 +637,6 @@ HeaderView::DetachedFromWindow()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
HeaderView::Draw(BRect updateRect)
|
|
||||||
{
|
|
||||||
BRect rect = Bounds();
|
|
||||||
|
|
||||||
#ifdef HAIKU_TARGET_PLATFORM_BEOS
|
|
||||||
SetHighColor(255, 255, 255);
|
|
||||||
#else
|
|
||||||
SetHighColor(ui_color(B_SHINE_COLOR));
|
|
||||||
#endif
|
|
||||||
StrokeLine(rect.LeftTop(), rect.LeftBottom());
|
|
||||||
StrokeLine(rect.LeftTop(), rect.RightTop());
|
|
||||||
|
|
||||||
// the gradient at the bottom is drawn by the BScrollView
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
HeaderView::GetPreferredSize(float *_width, float *_height)
|
|
||||||
{
|
|
||||||
if (_width)
|
|
||||||
*_width = Bounds().Width();
|
|
||||||
if (_height)
|
|
||||||
*_height = fPositionSlider->Frame().bottom + 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
HeaderView::UpdateIcon()
|
HeaderView::UpdateIcon()
|
||||||
{
|
{
|
||||||
@@ -843,11 +785,9 @@ HeaderView::MessageReceived(BMessage *message)
|
|||||||
&& fFileSize > fBlockSize) {
|
&& fFileSize > fBlockSize) {
|
||||||
fPositionSlider->SetEnabled(!state);
|
fPositionSlider->SetEnabled(!state);
|
||||||
if (state) {
|
if (state) {
|
||||||
fPathView->ResizeBy(-fStopButton->Bounds().Width(), 0);
|
|
||||||
fStopButton->Show();
|
fStopButton->Show();
|
||||||
} else {
|
} else {
|
||||||
fStopButton->Hide();
|
fStopButton->Hide();
|
||||||
fPathView->ResizeBy(fStopButton->Bounds().Width(), 0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1182,13 +1122,14 @@ TypeView::FrameResized(float width, float height)
|
|||||||
// #pragma mark - ProbeView
|
// #pragma mark - ProbeView
|
||||||
|
|
||||||
|
|
||||||
ProbeView::ProbeView(BRect rect, entry_ref *ref, const char *attribute,
|
ProbeView::ProbeView(entry_ref *ref, const char *attribute,
|
||||||
const BMessage *settings)
|
const BMessage *settings)
|
||||||
: BView(rect, "probeView", B_FOLLOW_ALL, B_WILL_DRAW),
|
: BView("probeView", B_WILL_DRAW),
|
||||||
fPrintSettings(NULL),
|
fPrintSettings(NULL),
|
||||||
fTypeView(NULL),
|
fTypeView(NULL),
|
||||||
fLastSearch(NULL)
|
fLastSearch(NULL)
|
||||||
{
|
{
|
||||||
|
SetLayout(new BGroupLayout(B_VERTICAL, 0));
|
||||||
fEditor.SetTo(*ref, attribute);
|
fEditor.SetTo(*ref, attribute);
|
||||||
|
|
||||||
int32 baseType = kHexBase;
|
int32 baseType = kHexBase;
|
||||||
@@ -1198,22 +1139,16 @@ ProbeView::ProbeView(BRect rect, entry_ref *ref, const char *attribute,
|
|||||||
settings->FindFloat("font_size", &fontSize);
|
settings->FindFloat("font_size", &fontSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
rect = Bounds();
|
fHeaderView = new HeaderView(&fEditor.Ref(), fEditor);
|
||||||
fHeaderView = new HeaderView(rect, &fEditor.Ref(), fEditor);
|
|
||||||
fHeaderView->ResizeToPreferred();
|
|
||||||
fHeaderView->SetBase((base_type)baseType);
|
fHeaderView->SetBase((base_type)baseType);
|
||||||
AddChild(fHeaderView);
|
AddChild(fHeaderView);
|
||||||
|
|
||||||
rect = fHeaderView->Frame();
|
fDataView = new DataView(fEditor);
|
||||||
rect.top = rect.bottom + 3;
|
|
||||||
rect.bottom = Bounds().bottom - B_H_SCROLL_BAR_HEIGHT;
|
|
||||||
rect.right -= B_V_SCROLL_BAR_WIDTH;
|
|
||||||
fDataView = new DataView(rect, fEditor);
|
|
||||||
fDataView->SetBase((base_type)baseType);
|
fDataView->SetBase((base_type)baseType);
|
||||||
fDataView->SetFontSize(fontSize);
|
fDataView->SetFontSize(fontSize);
|
||||||
|
|
||||||
fScrollView = new BScrollView("scroller", fDataView, B_FOLLOW_ALL,
|
fScrollView = new BScrollView("scroller", fDataView, B_WILL_DRAW, true,
|
||||||
B_WILL_DRAW, true, true);
|
true);
|
||||||
AddChild(fScrollView);
|
AddChild(fScrollView);
|
||||||
|
|
||||||
fDataView->UpdateScroller();
|
fDataView->UpdateScroller();
|
||||||
@@ -1225,37 +1160,6 @@ ProbeView::~ProbeView()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
ProbeView::UpdateSizeLimits()
|
|
||||||
{
|
|
||||||
if (Window() == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!fDataView->FontSizeFitsBounds()) {
|
|
||||||
float width, height;
|
|
||||||
fDataView->GetPreferredSize(&width, &height);
|
|
||||||
|
|
||||||
BRect frame = Window()->ConvertFromScreen(ConvertToScreen(
|
|
||||||
fHeaderView->Frame()));
|
|
||||||
|
|
||||||
Window()->SetSizeLimits(250, width + B_V_SCROLL_BAR_WIDTH,
|
|
||||||
200, height + frame.bottom + 4 + B_H_SCROLL_BAR_HEIGHT);
|
|
||||||
} else
|
|
||||||
Window()->SetSizeLimits(250, 32768, 200, 32768);
|
|
||||||
|
|
||||||
#ifdef HAIKU_TARGET_PLATFORM_BEOS
|
|
||||||
// In Haiku and Dano, the window is resized automatically
|
|
||||||
BRect bounds = Window()->Bounds();
|
|
||||||
float minWidth, maxWidth, minHeight, maxHeight;
|
|
||||||
Window()->GetSizeLimits(&minWidth, &maxWidth, &minHeight, &maxHeight);
|
|
||||||
if (maxWidth < bounds.Width() || maxHeight < bounds.Height()) {
|
|
||||||
Window()->ResizeTo(MIN(maxWidth, bounds.Width()), MIN(maxHeight,
|
|
||||||
bounds.Height()));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ProbeView::DetachedFromWindow()
|
ProbeView::DetachedFromWindow()
|
||||||
{
|
{
|
||||||
@@ -1394,6 +1298,8 @@ ProbeView::AddViewAsMenuItems()
|
|||||||
void
|
void
|
||||||
ProbeView::AttachedToWindow()
|
ProbeView::AttachedToWindow()
|
||||||
{
|
{
|
||||||
|
BView::AttachedToWindow();
|
||||||
|
|
||||||
fEditorLooper = new EditorLooper(fEditor.Ref().name, fEditor,
|
fEditorLooper = new EditorLooper(fEditor.Ref().name, fEditor,
|
||||||
BMessenger(fDataView));
|
BMessenger(fDataView));
|
||||||
fEditorLooper->Run();
|
fEditorLooper->Run();
|
||||||
@@ -1409,12 +1315,9 @@ ProbeView::AttachedToWindow()
|
|||||||
BMenuBar *bar = Window()->KeyMenuBar();
|
BMenuBar *bar = Window()->KeyMenuBar();
|
||||||
if (bar == NULL) {
|
if (bar == NULL) {
|
||||||
// there is none? Well, but we really want to have one
|
// there is none? Well, but we really want to have one
|
||||||
bar = new BMenuBar(BRect(0, 0, 0, 0), NULL);
|
bar = new BMenuBar("");
|
||||||
Window()->AddChild(bar);
|
Window()->AddChild(bar);
|
||||||
|
|
||||||
MoveBy(0, bar->Bounds().Height());
|
|
||||||
ResizeBy(0, -bar->Bounds().Height());
|
|
||||||
|
|
||||||
BMenu *menu = new BMenu(fEditor.IsAttribute()
|
BMenu *menu = new BMenu(fEditor.IsAttribute()
|
||||||
? B_TRANSLATE("Attribute") : fEditor.IsDevice() ? B_TRANSLATE("Device") : B_TRANSLATE("File"));
|
? B_TRANSLATE("Attribute") : fEditor.IsDevice() ? B_TRANSLATE("Device") : B_TRANSLATE("File"));
|
||||||
AddSaveMenuItems(menu, 0);
|
AddSaveMenuItems(menu, 0);
|
||||||
@@ -1935,9 +1838,6 @@ ProbeView::MessageReceived(BMessage *message)
|
|||||||
_UpdateSelectionMenuItems(start, end);
|
_UpdateSelectionMenuItems(start, end);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case kDataViewPreferredSize:
|
|
||||||
UpdateSizeLimits();
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class EditorLooper;
|
|||||||
|
|
||||||
class ProbeView : public BView {
|
class ProbeView : public BView {
|
||||||
public:
|
public:
|
||||||
ProbeView(BRect rect, entry_ref* ref, const char* attribute = NULL,
|
ProbeView(entry_ref* ref, const char* attribute = NULL,
|
||||||
const BMessage* settings = NULL);
|
const BMessage* settings = NULL);
|
||||||
virtual ~ProbeView();
|
virtual ~ProbeView();
|
||||||
|
|
||||||
@@ -38,7 +38,6 @@ class ProbeView : public BView {
|
|||||||
void AddPrintMenuItems(BMenu* menu, int32 index);
|
void AddPrintMenuItems(BMenu* menu, int32 index);
|
||||||
void AddViewAsMenuItems();
|
void AddViewAsMenuItems();
|
||||||
|
|
||||||
void UpdateSizeLimits();
|
|
||||||
bool QuitRequested();
|
bool QuitRequested();
|
||||||
|
|
||||||
DataEditor& Editor() { return fEditor; }
|
DataEditor& Editor() { return fEditor; }
|
||||||
|
|||||||
@@ -12,7 +12,8 @@
|
|||||||
|
|
||||||
|
|
||||||
ProbeWindow::ProbeWindow(BRect rect, entry_ref *ref)
|
ProbeWindow::ProbeWindow(BRect rect, entry_ref *ref)
|
||||||
: BWindow(rect, ref->name, B_DOCUMENT_WINDOW, B_ASYNCHRONOUS_CONTROLS),
|
: BWindow(rect, ref->name, B_DOCUMENT_WINDOW,
|
||||||
|
B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS),
|
||||||
fRef(*ref)
|
fRef(*ref)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user