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
+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: