Now maintains the state of the undo/redo menu items.
Fixed the size limits when the view is buried a bit deeper in the hierarchy. Tried to disable the slider when it's of no use, but it has no effect... git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6735 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
4886c973ab
commit
d426c2b9ea
@ -352,6 +352,8 @@ PositionSlider::SetSize(off_t size)
|
||||
if (size == fSize)
|
||||
return;
|
||||
|
||||
SetEnabled(fSize > fBlockSize);
|
||||
|
||||
off_t position = Position();
|
||||
if (position >= size)
|
||||
position = size - 1;
|
||||
@ -880,8 +882,10 @@ ProbeView::UpdateSizeLimits()
|
||||
float width, height;
|
||||
fDataView->GetPreferredSize(&width, &height);
|
||||
|
||||
BRect frame = Window()->ConvertFromScreen(ConvertToScreen(fHeaderView->Frame()));
|
||||
|
||||
Window()->SetSizeLimits(200, width + B_V_SCROLL_BAR_WIDTH,
|
||||
200, height + fHeaderView->Frame().bottom + 4 + B_H_SCROLL_BAR_HEIGHT + Frame().top);
|
||||
200, height + frame.bottom + 4 + B_H_SCROLL_BAR_HEIGHT);
|
||||
}
|
||||
|
||||
|
||||
@ -997,8 +1001,12 @@ ProbeView::AttachedToWindow()
|
||||
|
||||
BMenu *menu = new BMenu("Edit");
|
||||
BMenuItem *item;
|
||||
menu->AddItem(new BMenuItem("Undo", NULL, 'Z', B_COMMAND_KEY));
|
||||
menu->AddItem(new BMenuItem("Redo", NULL, 'Z', B_COMMAND_KEY | B_SHIFT_KEY));
|
||||
menu->AddItem(fUndoMenuItem = new BMenuItem("Undo", new BMessage(B_UNDO), 'Z', B_COMMAND_KEY));
|
||||
fUndoMenuItem->SetEnabled(fEditor.CanUndo());
|
||||
fUndoMenuItem->SetTarget(fDataView);
|
||||
menu->AddItem(fRedoMenuItem = new BMenuItem("Redo", new BMessage(B_REDO), 'Z', B_COMMAND_KEY | B_SHIFT_KEY));
|
||||
fRedoMenuItem->SetEnabled(fEditor.CanRedo());
|
||||
fRedoMenuItem->SetTarget(fDataView);
|
||||
menu->AddSeparatorItem();
|
||||
menu->AddItem(item = new BMenuItem("Copy", new BMessage(B_COPY), 'C', B_COMMAND_KEY));
|
||||
item->SetTarget(fDataView);
|
||||
@ -1182,6 +1190,17 @@ ProbeView::MessageReceived(BMessage *message)
|
||||
CheckClipboard();
|
||||
break;
|
||||
|
||||
case kMsgDataEditorStateChange:
|
||||
{
|
||||
bool enabled;
|
||||
if (message->FindBool("can_undo", &enabled) == B_OK)
|
||||
fUndoMenuItem->SetEnabled(enabled);
|
||||
|
||||
if (message->FindBool("can_redo", &enabled) == B_OK)
|
||||
fRedoMenuItem->SetEnabled(enabled);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
BView::MessageReceived(message);
|
||||
}
|
||||
|
@ -37,6 +37,8 @@ class ProbeView : public BView {
|
||||
|
||||
void UpdateSizeLimits();
|
||||
|
||||
DataEditor &Editor() { return fEditor; }
|
||||
|
||||
private:
|
||||
void UpdateAttributesMenu(BMenu *menu);
|
||||
void CheckClipboard();
|
||||
@ -47,6 +49,7 @@ class ProbeView : public BView {
|
||||
DataView *fDataView;
|
||||
BScrollView *fScrollView;
|
||||
BMenuItem *fPasteMenuItem;
|
||||
BMenuItem *fUndoMenuItem, *fRedoMenuItem;
|
||||
};
|
||||
|
||||
#endif /* PROBE_VIEW_H */
|
||||
|
Loading…
Reference in New Issue
Block a user