From 6781cbdc9b74b5fa54d623c023c62c4650924e65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Thu, 26 Feb 2004 12:54:51 +0000 Subject: [PATCH] Removed the "Block/Write" menu item, and introduced new "Save" menu items; they are not yet working, though. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6756 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/diskprobe/AttributeWindow.cpp | 7 ++++--- src/apps/diskprobe/FileWindow.cpp | 11 +++++++++-- src/apps/diskprobe/ProbeView.cpp | 22 +++++++++++++++++----- src/apps/diskprobe/ProbeView.h | 3 ++- 4 files changed, 32 insertions(+), 11 deletions(-) diff --git a/src/apps/diskprobe/AttributeWindow.cpp b/src/apps/diskprobe/AttributeWindow.cpp index eea48e1d17..118f93ff58 100644 --- a/src/apps/diskprobe/AttributeWindow.cpp +++ b/src/apps/diskprobe/AttributeWindow.cpp @@ -173,11 +173,11 @@ AttributeWindow::AttributeWindow(BRect rect, entry_ref *ref, const char *attribu BMenu *menu = new BMenu("Attribute"); - menu->AddItem(new BMenuItem("Save", NULL, 'S', B_COMMAND_KEY)); + // the ProbeView save menu items will be inserted here menu->AddItem(new BMenuItem("Remove from File", new BMessage(kMsgRemoveAttribute))); menu->AddSeparatorItem(); - // the ProbeView file menu items will be inserted here + // the ProbeView print menu items will be inserted here menu->AddSeparatorItem(); menu->AddItem(new BMenuItem("Close", new BMessage(B_CLOSE_REQUESTED), 'W', B_COMMAND_KEY)); @@ -201,7 +201,8 @@ AttributeWindow::AttributeWindow(BRect rect, entry_ref *ref, const char *attribu rect = tabView->ContainerView()->Bounds(); rect.top += 3; fProbeView = new ProbeView(rect, ref, attribute, settings); - fProbeView->AddFileMenuItems(menu, menu->CountItems() - 2); + fProbeView->AddSaveMenuItems(menu, 0); + fProbeView->AddPrintMenuItems(menu, menu->CountItems() - 2); tabView->AddRawEditorTab(fProbeView); view->AddChild(tabView); diff --git a/src/apps/diskprobe/FileWindow.cpp b/src/apps/diskprobe/FileWindow.cpp index 93e8511364..481a26ed3a 100644 --- a/src/apps/diskprobe/FileWindow.cpp +++ b/src/apps/diskprobe/FileWindow.cpp @@ -45,7 +45,12 @@ FileWindow::FileWindow(BRect rect, entry_ref *ref, const BMessage *settings) new BMessage(kMsgOpenFilePanel), 'O', B_COMMAND_KEY)); menu->AddSeparatorItem(); - // the ProbeView file menu items will be inserted here + // the ProbeView save menu items will be inserted here + BMenuItem *item = new BMenuItem("Close", new BMessage(B_CLOSE_REQUESTED), 'W', B_COMMAND_KEY); + menu->AddItem(item); + menu->AddSeparatorItem(); + + // the ProbeView print menu items will be inserted here menu->AddSeparatorItem(); menu->AddItem(new BMenuItem("About DiskProbe" B_UTF8_ELLIPSIS, new BMessage(B_ABOUT_REQUESTED))); @@ -53,6 +58,7 @@ FileWindow::FileWindow(BRect rect, entry_ref *ref, const BMessage *settings) menu->AddItem(new BMenuItem("Quit", new BMessage(B_QUIT_REQUESTED), 'Q', B_COMMAND_KEY)); menu->SetTargetForItems(be_app); + item->SetTarget(this); menuBar->AddItem(menu); // add our interface widgets @@ -60,7 +66,8 @@ FileWindow::FileWindow(BRect rect, entry_ref *ref, const BMessage *settings) BRect rect = Bounds(); rect.top = menuBar->Bounds().Height() + 1; ProbeView *probeView = new ProbeView(rect, ref, NULL, settings); - probeView->AddFileMenuItems(menu, menu->CountItems() - 4); + probeView->AddSaveMenuItems(menu, 4); + probeView->AddPrintMenuItems(menu, menu->CountItems() - 4); AddChild(probeView); probeView->UpdateSizeLimits(); diff --git a/src/apps/diskprobe/ProbeView.cpp b/src/apps/diskprobe/ProbeView.cpp index 758a81da5f..727be4194a 100644 --- a/src/apps/diskprobe/ProbeView.cpp +++ b/src/apps/diskprobe/ProbeView.cpp @@ -969,12 +969,25 @@ ProbeView::UpdateAttributesMenu(BMenu *menu) void -ProbeView::AddFileMenuItems(BMenu *menu, int32 index) +ProbeView::AddSaveMenuItems(BMenu *menu, int32 index) +{ + BMenuItem *item; + menu->AddItem(item = new BMenuItem("Save", new BMessage(B_SAVE_REQUESTED)), index++); + item->SetTarget(this); + item->SetEnabled(false); + //menu->AddItem(new BMenuItem("Save As" B_UTF8_ELLIPSIS, NULL)); +} + + +void +ProbeView::AddPrintMenuItems(BMenu *menu, int32 index) { BMenuItem *item; menu->AddItem(item = new BMenuItem("Page Setup" B_UTF8_ELLIPSIS, NULL), index++); + item->SetTarget(this); item->SetEnabled(false); menu->AddItem(item = new BMenuItem("Print" B_UTF8_ELLIPSIS, NULL, 'P', B_COMMAND_KEY), index++); + item->SetTarget(this); item->SetEnabled(false); } @@ -1002,7 +1015,9 @@ ProbeView::AttachedToWindow() ResizeBy(0, -bar->Bounds().Height()); BMenu *menu = new BMenu(fEditor.IsAttribute() ? "Attribute" : fEditor.IsDevice() ? "Device" : "File"); - AddFileMenuItems(menu, 0); + AddSaveMenuItems(menu, 0); + menu->AddSeparatorItem(); + AddPrintMenuItems(menu, menu->CountItems()); menu->AddSeparatorItem(); menu->AddItem(new BMenuItem("Close", new BMessage(B_CLOSE_REQUESTED), 'W', B_COMMAND_KEY)); @@ -1058,9 +1073,6 @@ ProbeView::AttachedToWindow() UpdateSelectionMenuItems(0, 0); menu->AddSeparatorItem(); - menu->AddItem(new BMenuItem("Write", NULL, 'S', B_COMMAND_KEY)); - menu->AddSeparatorItem(); - subMenu = new BMenu("Bookmarks"); subMenu->AddItem(new BMenuItem("Add", NULL, 'B', B_COMMAND_KEY)); menu->AddItem(new BMenuItem(subMenu)); diff --git a/src/apps/diskprobe/ProbeView.h b/src/apps/diskprobe/ProbeView.h index 13b5d399d1..140cac1e56 100644 --- a/src/apps/diskprobe/ProbeView.h +++ b/src/apps/diskprobe/ProbeView.h @@ -33,7 +33,8 @@ class ProbeView : public BView { virtual void WindowActivated(bool active); virtual void MessageReceived(BMessage *message); - void AddFileMenuItems(BMenu *menu, int32 index); + void AddSaveMenuItems(BMenu *menu, int32 index); + void AddPrintMenuItems(BMenu *menu, int32 index); void UpdateSizeLimits();