Now made the kSignature constant accessible in an appropriate way.
Implemented the print view stuff (as borrowed from ShowImage). Not yet tested because the print_server is funny today over here... git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6770 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -26,6 +26,8 @@
|
||||
#include <string.h>
|
||||
|
||||
|
||||
const char *kSignature = "application/x-vnd.OpenBeOS-DiskProbe";
|
||||
|
||||
static const uint32 kMsgDiskProbeSettings = 'DPst';
|
||||
static const uint32 kCascadeOffset = 20;
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include <SupportDefs.h>
|
||||
|
||||
|
||||
static const char *kSignature = "application/x-vnd.OpenBeOS-DiskProbe";
|
||||
extern const char *kSignature;
|
||||
|
||||
static const uint32 kMsgOpenFilePanel = 'opFp';
|
||||
static const uint32 kMsgOpenOpenWindow = 'opOw';
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include <NodeMonitor.h>
|
||||
#include <Volume.h>
|
||||
#include <fs_attr.h>
|
||||
#include <PrintJob.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@@ -857,7 +858,8 @@ UpdateLooper::MessageReceived(BMessage *message)
|
||||
|
||||
|
||||
ProbeView::ProbeView(BRect rect, entry_ref *ref, const char *attribute, const BMessage *settings)
|
||||
: BView(rect, "probeView", B_FOLLOW_ALL, B_WILL_DRAW)
|
||||
: BView(rect, "probeView", B_FOLLOW_ALL, B_WILL_DRAW),
|
||||
fPrintSettings(NULL)
|
||||
{
|
||||
fEditor.SetTo(*ref, attribute);
|
||||
|
||||
@@ -1240,6 +1242,51 @@ ProbeView::CheckClipboard()
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
ProbeView::PageSetup()
|
||||
{
|
||||
BPrintJob printJob(Window()->Title());
|
||||
if (fPrintSettings != NULL)
|
||||
printJob.SetSettings(new BMessage(*fPrintSettings));
|
||||
|
||||
status_t status = printJob.ConfigPage();
|
||||
if (status == B_OK) {
|
||||
// replace the print settings on success
|
||||
delete fPrintSettings;
|
||||
fPrintSettings = printJob.Settings();
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ProbeView::Print()
|
||||
{
|
||||
if (fPrintSettings == NULL && PageSetup() != B_OK)
|
||||
return;
|
||||
|
||||
BPrintJob printJob(Window()->Title());
|
||||
printJob.SetSettings(new BMessage(*fPrintSettings));
|
||||
|
||||
if (printJob.ConfigJob() == B_OK) {
|
||||
BRect rect = printJob.PrintableRect();
|
||||
|
||||
float width, height;
|
||||
fDataView->GetPreferredSize(&width, &height);
|
||||
|
||||
printJob.BeginJob();
|
||||
|
||||
fDataView->SetScale(rect.Width() / width);
|
||||
printJob.DrawView(fDataView, rect, rect.LeftTop());
|
||||
fDataView->SetScale(1.0);
|
||||
printJob.SpoolPage();
|
||||
|
||||
printJob.CommitJob();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
ProbeView::Save()
|
||||
{
|
||||
@@ -1342,11 +1389,11 @@ ProbeView::MessageReceived(BMessage *message)
|
||||
}
|
||||
|
||||
case kMsgPrint:
|
||||
puts("print...");
|
||||
Print();
|
||||
break;
|
||||
|
||||
case kMsgPageSetup:
|
||||
puts("page setup...");
|
||||
PageSetup();
|
||||
break;
|
||||
|
||||
case B_NODE_MONITOR:
|
||||
|
||||
@@ -45,6 +45,8 @@ class ProbeView : public BView {
|
||||
void UpdateAttributesMenu(BMenu *menu);
|
||||
void UpdateSelectionMenuItems(int64 start, int64 end);
|
||||
void CheckClipboard();
|
||||
status_t PageSetup();
|
||||
void Print();
|
||||
status_t Save();
|
||||
|
||||
DataEditor fEditor;
|
||||
@@ -56,6 +58,7 @@ class ProbeView : public BView {
|
||||
BMenuItem *fUndoMenuItem, *fRedoMenuItem;
|
||||
BMenuItem *fNativeMenuItem, *fSwappedMenuItem;
|
||||
BMenuItem *fSaveMenuItem;
|
||||
BMessage *fPrintSettings;
|
||||
};
|
||||
|
||||
#endif /* PROBE_VIEW_H */
|
||||
|
||||
Reference in New Issue
Block a user