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:
Axel Dörfler
2004-02-26 20:09:11 +00:00
parent aa60f34665
commit 124640857d
4 changed files with 56 additions and 4 deletions
+2
View File
@@ -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;
+1 -1
View File
@@ -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';
+50 -3
View File
@@ -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:
+3
View File
@@ -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 */