mirror of
https://review.haiku-os.org/haiku
synced 2024-11-23 07:18:40 +01:00
libprint: whitespace cleanup only
Change-Id: I5a3da12e8f61ff404a50b24b0962f9c92511b182 Reviewed-on: https://review.haiku-os.org/c/haiku/+/7791 Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org> Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This commit is contained in:
parent
922624afa6
commit
26db1794f9
@ -69,7 +69,7 @@ void AboutBoxView::AttachedToWindow()
|
||||
|
||||
class AboutBoxWindow : public BWindow {
|
||||
public:
|
||||
AboutBoxWindow(BRect frame, const char *driver_name, const char *version, const char *copyright);
|
||||
AboutBoxWindow(BRect frame, const char *driver_name, const char *version, const char *copyright);
|
||||
virtual void MessageReceived(BMessage *msg);
|
||||
virtual bool QuitRequested();
|
||||
};
|
||||
|
@ -86,7 +86,7 @@ void
|
||||
HWindow::Init(uint32 escape_msg)
|
||||
{
|
||||
AddShortcut('i', 0, new BMessage(B_ABOUT_REQUESTED));
|
||||
AddCommonFilter(new EscapeMessageFilter(this, escape_msg));
|
||||
AddCommonFilter(new EscapeMessageFilter(this, escape_msg));
|
||||
}
|
||||
|
||||
|
||||
@ -124,7 +124,7 @@ HWindow::AboutRequested()
|
||||
v->SetFontAndColor(i+1, i+2, NULL, 0, &red);
|
||||
s += 2;
|
||||
}
|
||||
// first text line
|
||||
// first text line
|
||||
s = strchr(text, '\n');
|
||||
BFont font;
|
||||
v->GetFontAndColor(0, &font);
|
||||
@ -155,14 +155,14 @@ BlockingWindow::BlockingWindow(BRect frame, const char *title, window_look look,
|
||||
}
|
||||
|
||||
|
||||
BlockingWindow::~BlockingWindow()
|
||||
BlockingWindow::~BlockingWindow()
|
||||
{
|
||||
delete_sem(fExitSem);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BlockingWindow::Init(const char* title)
|
||||
BlockingWindow::Init(const char* title)
|
||||
{
|
||||
fUserQuitResult = B_OK;
|
||||
fResult = NULL;
|
||||
|
@ -55,7 +55,7 @@ void DUMP_BMESSAGE(BMessage *msg)
|
||||
DBGMSG(("\t************ START - DUMP BMessage ***********\n"));
|
||||
DBGMSG(("\taddress: %p\n", msg));
|
||||
if (!msg)
|
||||
return;
|
||||
return;
|
||||
|
||||
// DBGMSG(("\tmsg->what: 0x%x\n", msg->what));
|
||||
DBGMSG(("\tmsg->what: %c%c%c%c\n",
|
||||
|
@ -2,13 +2,15 @@
|
||||
* DialogWindow.h
|
||||
* Copyright 2004 Michael Pfeiffer. All Rights Reserved.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "DialogWindow.h"
|
||||
|
||||
#include <Messenger.h>
|
||||
|
||||
|
||||
DialogWindow::DialogWindow(BRect frame,
|
||||
const char *title,
|
||||
const char *title,
|
||||
window_type type,
|
||||
uint32 flags,
|
||||
uint32 workspace)
|
||||
@ -20,7 +22,7 @@ DialogWindow::DialogWindow(BRect frame,
|
||||
}
|
||||
|
||||
DialogWindow::DialogWindow(BRect frame,
|
||||
const char *title,
|
||||
const char *title,
|
||||
window_look look,
|
||||
window_feel feel,
|
||||
uint32 flags,
|
||||
@ -42,7 +44,7 @@ void DialogWindow::MessageReceived(BMessage *msg)
|
||||
}
|
||||
BWindow::MessageReceived(msg);
|
||||
}
|
||||
|
||||
|
||||
status_t DialogWindow::Go()
|
||||
{
|
||||
BMessenger messenger(this, this);
|
||||
@ -51,7 +53,7 @@ status_t DialogWindow::Go()
|
||||
volatile status_t result = fPreviousResult;
|
||||
// new results are stored on the stack
|
||||
fResult = &result;
|
||||
|
||||
|
||||
// show the window
|
||||
Show();
|
||||
// at this point we must not access member variables,
|
||||
@ -66,17 +68,17 @@ status_t DialogWindow::Go()
|
||||
if (reply.FindInt32("thread_id", &windowThread) != B_OK) {
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
// wait for window thread to die
|
||||
// The window thread will crash if the image holding the
|
||||
// code used by the window thread is unloaded while the thread is
|
||||
// code used by the window thread is unloaded while the thread is
|
||||
// still running!!!
|
||||
status_t status = B_ERROR;
|
||||
wait_for_thread(windowThread, &status);
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void DialogWindow::SetResult(status_t result)
|
||||
{
|
||||
if (fResult != NULL) {
|
||||
|
@ -77,7 +77,7 @@ RotateRect(BRect rect)
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
bool
|
||||
GraphicsDriver::_SetupData(BFile* spoolFile)
|
||||
{
|
||||
if (fOrgJobData != NULL) {
|
||||
@ -134,13 +134,13 @@ GraphicsDriver::_SetupData(BFile* spoolFile)
|
||||
} else {
|
||||
fInternalCopies = 1;
|
||||
}
|
||||
|
||||
|
||||
fSpoolMetaData = new SpoolMetaData(spoolFile);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
void
|
||||
GraphicsDriver::_CleanupData()
|
||||
{
|
||||
delete fRealJobData;
|
||||
@ -152,7 +152,7 @@ GraphicsDriver::_CleanupData()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
void
|
||||
GraphicsDriver::_SetupBitmap()
|
||||
{
|
||||
fPixelDepth = color_space2pixel_depth(fOrgJobData->GetSurfaceType());
|
||||
@ -223,7 +223,7 @@ GraphicsDriver::_SetupBitmap()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
void
|
||||
GraphicsDriver::_CleanupBitmap()
|
||||
{
|
||||
delete fBitmap;
|
||||
@ -235,7 +235,7 @@ GraphicsDriver::_CleanupBitmap()
|
||||
}
|
||||
|
||||
|
||||
BPoint
|
||||
BPoint
|
||||
GraphicsDriver::GetScale(int32 nup, BRect physicalRect, float scaling)
|
||||
{
|
||||
float width;
|
||||
@ -320,7 +320,7 @@ GraphicsDriver::GetScale(int32 nup, BRect physicalRect, float scaling)
|
||||
}
|
||||
|
||||
|
||||
BPoint
|
||||
BPoint
|
||||
GraphicsDriver::GetOffset(int32 nup, int index,
|
||||
JobData::Orientation orientation, const BPoint* scale,
|
||||
BRect scaledPhysicalRect, BRect scaledPrintableRect,
|
||||
@ -420,7 +420,7 @@ GraphicsDriver::GetOffset(int32 nup, int index,
|
||||
|
||||
|
||||
// print the specified pages on a physical page
|
||||
bool
|
||||
bool
|
||||
GraphicsDriver::_PrintPage(PageDataList* pages)
|
||||
{
|
||||
BPoint offset;
|
||||
@ -483,7 +483,7 @@ GraphicsDriver::_PrintPage(PageDataList* pages)
|
||||
return false;
|
||||
|
||||
} while (offset.x >= 0.0f && offset.y >= 0.0f);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -539,7 +539,7 @@ GraphicsDriver::_RotateInto(BBitmap* target, const BBitmap* source)
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
bool
|
||||
GraphicsDriver::_CollectPages(SpoolData* spoolData, PageDataList* pages)
|
||||
{
|
||||
// collect the pages to be printed on the physical page
|
||||
@ -551,19 +551,19 @@ GraphicsDriver::_CollectPages(SpoolData* spoolData, PageDataList* pages)
|
||||
if (pages != NULL)
|
||||
pages->push_back(page_data);
|
||||
} while (more && --nup);
|
||||
|
||||
|
||||
return more;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
bool
|
||||
GraphicsDriver::_SkipPages(SpoolData* spoolData)
|
||||
{
|
||||
return _CollectPages(spoolData, NULL);
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
bool
|
||||
GraphicsDriver::_PrintDocument(SpoolData* spoolData)
|
||||
{
|
||||
bool more;
|
||||
@ -575,7 +575,7 @@ GraphicsDriver::_PrintDocument(SpoolData* spoolData)
|
||||
more = true;
|
||||
success = true;
|
||||
page_index = 0;
|
||||
|
||||
|
||||
if (fPrinterCap->Supports(PrinterCap::kCopyCommand))
|
||||
// let the printer perform the copy operation
|
||||
copies = 1;
|
||||
@ -585,10 +585,10 @@ GraphicsDriver::_PrintDocument(SpoolData* spoolData)
|
||||
|
||||
fStatusWindow -> SetPageCopies(copies);
|
||||
// inform fStatusWindow about number of copies
|
||||
|
||||
|
||||
// printing of even/odd numbered pages only is valid in simplex mode
|
||||
bool simplex = fRealJobData->GetPrintStyle() == JobData::kSimplex;
|
||||
|
||||
|
||||
if (spoolData->startEnum()) {
|
||||
do {
|
||||
DBGMSG(("page index = %d\n", page_index));
|
||||
@ -602,10 +602,10 @@ GraphicsDriver::_PrintDocument(SpoolData* spoolData)
|
||||
if (!more)
|
||||
// end reached
|
||||
break;
|
||||
|
||||
|
||||
PageDataList pages;
|
||||
more = _CollectPages(spoolData, &pages);
|
||||
|
||||
|
||||
if (more && simplex
|
||||
&& fRealJobData->GetPageSelection()
|
||||
== JobData::kOddNumberedPages)
|
||||
@ -616,13 +616,13 @@ GraphicsDriver::_PrintDocument(SpoolData* spoolData)
|
||||
for (copy = 0; success && copy < copies; copy ++) {
|
||||
|
||||
// Update the status / cancel job
|
||||
if (fStatusWindow->UpdateStatusBar(page_index, copy))
|
||||
return false;
|
||||
if (fStatusWindow->UpdateStatusBar(page_index, copy))
|
||||
return false;
|
||||
|
||||
success = StartPage(page_index);
|
||||
if (!success)
|
||||
break;
|
||||
|
||||
|
||||
// print the pages on the physical page
|
||||
fView->Window()->Lock();
|
||||
success = _PrintPage(&pages);
|
||||
@ -632,7 +632,7 @@ GraphicsDriver::_PrintDocument(SpoolData* spoolData)
|
||||
success = EndPage(page_index);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
page_index++;
|
||||
} while (success && more);
|
||||
}
|
||||
@ -645,7 +645,7 @@ GraphicsDriver::_PrintDocument(SpoolData* spoolData)
|
||||
% 2)) {
|
||||
// append an empty page on the back side of the page in duplex or
|
||||
// booklet mode
|
||||
success =
|
||||
success =
|
||||
StartPage(page_index) &&
|
||||
_PrintPage(NULL) &&
|
||||
EndPage(page_index);
|
||||
@ -664,7 +664,7 @@ GraphicsDriver::GetJobData(BFile* spoolFile)
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
bool
|
||||
GraphicsDriver::_PrintJob(BFile* spoolFile)
|
||||
{
|
||||
bool success = true;
|
||||
@ -688,9 +688,9 @@ GraphicsDriver::_PrintJob(BFile* spoolFile)
|
||||
fRealJobData->GetPageSelection() == JobData::kOddNumberedPages,
|
||||
fRealJobData->GetPageSelection() == JobData::kEvenNumberedPages,
|
||||
fRealJobData->GetFirstPage(),
|
||||
fPageCount,
|
||||
fPageCount,
|
||||
fInternalCopies,fRealJobData->GetNup());
|
||||
|
||||
|
||||
while (fInternalCopies--) {
|
||||
success = _PrintDocument(&spoolData);
|
||||
if (success == false) {
|
||||
@ -698,7 +698,7 @@ GraphicsDriver::_PrintJob(BFile* spoolFile)
|
||||
}
|
||||
}
|
||||
EndDocument(success);
|
||||
|
||||
|
||||
fStatusWindow->Lock();
|
||||
fStatusWindow->Quit();
|
||||
}
|
||||
@ -735,35 +735,35 @@ GraphicsDriver::TakeJob(BFile* spoolFile)
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
bool
|
||||
GraphicsDriver::StartDocument()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
bool
|
||||
GraphicsDriver::StartPage(int)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
bool
|
||||
GraphicsDriver::NextBand(BBitmap*, BPoint*)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
bool
|
||||
GraphicsDriver::EndPage(int)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
bool
|
||||
GraphicsDriver::EndDocument(bool)
|
||||
{
|
||||
return true;
|
||||
@ -833,7 +833,7 @@ GraphicsDriver::_NeedRotateBitmapBand() const
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
void
|
||||
GraphicsDriver::_ConvertRGB32ToRGB24(const void* src, void* dst, int width) {
|
||||
uint8* d = (uint8*)dst;
|
||||
const rgb_color* s = static_cast<const rgb_color*>(src);
|
||||
@ -846,7 +846,7 @@ GraphicsDriver::_ConvertRGB32ToRGB24(const void* src, void* dst, int width) {
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
void
|
||||
GraphicsDriver::_ConvertCMAP8ToRGB24(const void* src, void* dst, int width) {
|
||||
uint8* d = (uint8*)dst;
|
||||
const uint8* s = static_cast<const uint8*>(src);
|
||||
@ -856,12 +856,12 @@ GraphicsDriver::_ConvertCMAP8ToRGB24(const void* src, void* dst, int width) {
|
||||
*d ++ = rgb->red;
|
||||
*d ++ = rgb->green;
|
||||
*d ++ = rgb->blue;
|
||||
s ++;
|
||||
s ++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
void
|
||||
GraphicsDriver::ConvertToRGB24(const void* src, void* dst, int width,
|
||||
color_space cs) {
|
||||
if (cs == B_RGB32)
|
||||
@ -874,7 +874,7 @@ GraphicsDriver::ConvertToRGB24(const void* src, void* dst, int width,
|
||||
}
|
||||
|
||||
|
||||
uint8
|
||||
uint8
|
||||
GraphicsDriver::_ConvertToGray(uint8 r, uint8 g, uint8 b) {
|
||||
if (r == g && g == b)
|
||||
return r;
|
||||
@ -883,7 +883,7 @@ GraphicsDriver::_ConvertToGray(uint8 r, uint8 g, uint8 b) {
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
void
|
||||
GraphicsDriver::_ConvertRGB32ToGray(const void* src, void* dst, int width) {
|
||||
uint8* d = (uint8*)dst;
|
||||
const rgb_color* s = static_cast<const rgb_color*>(src);
|
||||
@ -892,7 +892,7 @@ GraphicsDriver::_ConvertRGB32ToGray(const void* src, void* dst, int width) {
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
void
|
||||
GraphicsDriver::_ConvertCMAP8ToGray(const void* src, void* dst, int width) {
|
||||
uint8* d = (uint8*)dst;
|
||||
const uint8* s = static_cast<const uint8*>(src);
|
||||
@ -904,7 +904,7 @@ GraphicsDriver::_ConvertCMAP8ToGray(const void* src, void* dst, int width) {
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
void
|
||||
GraphicsDriver::ConvertToGray(const void* src, void* dst, int width,
|
||||
color_space cs) {
|
||||
if (cs == B_RGB32)
|
||||
|
@ -156,7 +156,7 @@ Halftone::Dither(uchar* destination, const uchar* source, int x, int y,
|
||||
{
|
||||
if (fPlanes == kPlaneRGB1) {
|
||||
switch (fCurrentPlane) {
|
||||
case 0:
|
||||
case 0:
|
||||
SetGrayFunction(kRedChannel);
|
||||
break;
|
||||
case 1:
|
||||
@ -295,15 +295,15 @@ void
|
||||
Halftone::SetupErrorBuffer(int x, int y, int width)
|
||||
{
|
||||
DeleteErrorTables();
|
||||
fX = x;
|
||||
fY = y;
|
||||
fX = x;
|
||||
fY = y;
|
||||
fWidth = width;
|
||||
for (int i = 0; i < fNumberOfPlanes; i ++) {
|
||||
// reserve also space for sentinals at both ends of error table
|
||||
const int size = width + 2;
|
||||
fErrorTables[i] = new int[size];
|
||||
memset(fErrorTables[i], 0, sizeof(int) * size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -327,16 +327,16 @@ Halftone::DitherFloydSteinberg(uchar *destination, const uchar* source0,
|
||||
const ColorRGB32 *source = reinterpret_cast<const ColorRGB32 *>(source0);
|
||||
uchar cur = 0; // cleared bit means white, set bit means black
|
||||
for (int x = 0; x < width; x ++, source ++) {
|
||||
const int bit = 7 - x % 8;
|
||||
const int bit = 7 - x % 8;
|
||||
const int density = GetDensity(*source) + current_error / 16;
|
||||
|
||||
|
||||
if (density < 128) {
|
||||
error = density;
|
||||
cur |= (1 << bit);
|
||||
} else {
|
||||
error = density - 255;
|
||||
}
|
||||
|
||||
|
||||
// distribute error using this pattern:
|
||||
// 0 X 7 (current_error)
|
||||
// (left) 3 5 1 (right)
|
||||
@ -344,13 +344,13 @@ Halftone::DitherFloydSteinberg(uchar *destination, const uchar* source0,
|
||||
int* right = &errorTable[x+1];
|
||||
current_error = (*right) + 7 * error;
|
||||
*right = 1 * error;
|
||||
|
||||
|
||||
int* middle = right - 1;
|
||||
*middle += 5 * error;
|
||||
|
||||
|
||||
int* left = middle - 1;
|
||||
*left += 3 * error;
|
||||
|
||||
|
||||
if (bit == 0) {
|
||||
*destination = ConvertUsingBlackValue(cur);
|
||||
// advance to next byte
|
||||
@ -358,7 +358,7 @@ Halftone::DitherFloydSteinberg(uchar *destination, const uchar* source0,
|
||||
cur = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const bool hasRest = (width % 8) != 0;
|
||||
if (hasRest) {
|
||||
*destination = ConvertUsingBlackValue(cur);
|
||||
|
@ -20,15 +20,15 @@ HalftonePreviewView::Preview(float gamma, float min,
|
||||
const float right = Bounds().Width();
|
||||
const float bottom = Bounds().Height();
|
||||
BRect rect(0, 0, right, bottom);
|
||||
|
||||
|
||||
BBitmap testImage(rect, kColorSpace, true);
|
||||
BBitmap preview(rect, kColorSpace);
|
||||
BView view(rect, "", B_FOLLOW_ALL, B_WILL_DRAW);
|
||||
|
||||
|
||||
// create test image
|
||||
testImage.Lock();
|
||||
testImage.AddChild(&view);
|
||||
|
||||
|
||||
// color bars
|
||||
const int height = Bounds().IntegerHeight()+1;
|
||||
const int width = Bounds().IntegerWidth()+1;
|
||||
@ -37,10 +37,10 @@ HalftonePreviewView::Preview(float gamma, float min,
|
||||
const float green_bottom = red_bottom + delta;
|
||||
const float blue_bottom = green_bottom + delta;
|
||||
const float gray_bottom = height - 1;
|
||||
|
||||
|
||||
for (int x = 0; x <= right; x ++) {
|
||||
uchar value = x * 255 / width;
|
||||
|
||||
|
||||
BPoint from(x, 0);
|
||||
BPoint to(x, red_bottom);
|
||||
// red
|
||||
@ -66,17 +66,17 @@ HalftonePreviewView::Preview(float gamma, float min,
|
||||
view.Sync();
|
||||
testImage.RemoveChild(&view);
|
||||
testImage.Unlock();
|
||||
|
||||
// create preview image
|
||||
|
||||
// create preview image
|
||||
Halftone halftone(kColorSpace, gamma, min, ditherType);
|
||||
halftone.SetBlackValue(Halftone::kLowValueMeansBlack);
|
||||
|
||||
const int widthBytes = (width + 7) / 8; // byte boundary
|
||||
uchar* buffer = new uchar[widthBytes];
|
||||
|
||||
|
||||
const uchar* src = (uchar*)testImage.Bits();
|
||||
uchar* dstRow = (uchar*)preview.Bits();
|
||||
|
||||
|
||||
const int numPlanes = color ? 3 : 1;
|
||||
if (color) {
|
||||
halftone.SetPlanes(Halftone::kPlaneRGB1);
|
||||
@ -86,7 +86,7 @@ HalftonePreviewView::Preview(float gamma, float min,
|
||||
for (int plane = 0; plane < numPlanes; plane ++) {
|
||||
// halftone the preview image
|
||||
halftone.Dither(buffer, src, 0, y, width);
|
||||
|
||||
|
||||
// convert the plane(s) to RGB32
|
||||
ColorRGB32Little* dst = (ColorRGB32Little*)dstRow;
|
||||
const uchar* bitmap = buffer;
|
||||
@ -94,7 +94,7 @@ HalftonePreviewView::Preview(float gamma, float min,
|
||||
const int bit = 7 - (x % 8);
|
||||
const bool isSet = (*bitmap & (1 << bit)) != 0;
|
||||
uchar value = isSet ? 255 : 0;
|
||||
|
||||
|
||||
if (color) {
|
||||
switch (plane) {
|
||||
case 0: dst->red = value;
|
||||
@ -107,20 +107,20 @@ HalftonePreviewView::Preview(float gamma, float min,
|
||||
} else {
|
||||
dst->red = dst->green = dst->blue = value;
|
||||
}
|
||||
|
||||
|
||||
if (bit == 0) {
|
||||
bitmap ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// next row
|
||||
src += testImage.BytesPerRow();
|
||||
dstRow += preview.BytesPerRow();
|
||||
}
|
||||
|
||||
delete[] buffer;
|
||||
|
||||
|
||||
SetViewBitmap(&preview);
|
||||
Invalidate();
|
||||
}
|
||||
@ -135,7 +135,7 @@ HalftoneView::HalftoneView(BRect frame, const char* name, uint32 resizeMask,
|
||||
|
||||
BRect r(frame);
|
||||
float size, max;
|
||||
|
||||
|
||||
r.OffsetTo(0, 0);
|
||||
const int height = r.IntegerHeight()+1;
|
||||
const int delta = height / 4;
|
||||
@ -143,12 +143,11 @@ HalftoneView::HalftoneView(BRect frame, const char* name, uint32 resizeMask,
|
||||
const float green_top = delta;
|
||||
const float blue_top = green_top + delta;
|
||||
const float gray_top = r.bottom - delta;
|
||||
|
||||
|
||||
const char* kRedLabel = "Red: ";
|
||||
const char* kGreenLabel = "Green: ";
|
||||
const char* kBlueLabel = "Blue: ";
|
||||
const char* kGrayLabel = "Black: ";
|
||||
|
||||
|
||||
BFont font(be_plain_font);
|
||||
font_height fh;
|
||||
|
@ -22,8 +22,8 @@ JSDSlider::JSDSlider(const char* name, const char* label,
|
||||
|
||||
|
||||
JSDSlider::~JSDSlider()
|
||||
{
|
||||
}
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
const char*
|
||||
|
@ -258,12 +258,12 @@ JobData::Load(BMessage* message, const PrinterCap* printerCap,
|
||||
fSettingType = settingType;
|
||||
|
||||
const PaperCap *paperCap = NULL;
|
||||
|
||||
if (message->HasBool(kJDShowPreview))
|
||||
fShowPreview = message->FindBool(kJDShowPreview);
|
||||
else
|
||||
fShowPreview = false;
|
||||
|
||||
|
||||
if (message->HasBool(kJDShowPreview))
|
||||
fShowPreview = message->FindBool(kJDShowPreview);
|
||||
else
|
||||
fShowPreview = false;
|
||||
|
||||
if (message->HasInt32(kJDPaper))
|
||||
fPaper = (Paper)message->FindInt32(kJDPaper);
|
||||
else if (printerCap->Supports(PrinterCap::kPaper)) {
|
||||
@ -284,14 +284,14 @@ JobData::Load(BMessage* message, const PrinterCap* printerCap,
|
||||
}
|
||||
|
||||
if (message->HasInt64(kJDXRes)) {
|
||||
int64 xres64;
|
||||
int64 xres64;
|
||||
message->FindInt64(kJDXRes, &xres64);
|
||||
fXRes = xres64;
|
||||
fXRes = xres64;
|
||||
} else if (printerCap->Supports(PrinterCap::kResolution)) {
|
||||
fXRes = ((const ResolutionCap *)printerCap->GetDefaultCap(
|
||||
PrinterCap::kResolution))->fXResolution;
|
||||
} else {
|
||||
fXRes = 300;
|
||||
fXRes = 300;
|
||||
}
|
||||
|
||||
if (message->HasInt64(kJDYRes)) {
|
||||
@ -431,12 +431,12 @@ JobData::Load(BMessage* message, const PrinterCap* printerCap,
|
||||
PrinterCap::kColor))->fColor;
|
||||
else
|
||||
fColor = kMonochrome;
|
||||
|
||||
|
||||
if (message->HasInt32(kJDDitherType))
|
||||
fDitherType = (Halftone::DitherType)message->FindInt32(kJDDitherType);
|
||||
else
|
||||
fDitherType = Halftone::kTypeFloydSteinberg;
|
||||
|
||||
|
||||
if (message->HasInt32(kJDPageSelection))
|
||||
fPageSelection = (PageSelection)message->FindInt32(kJDPageSelection);
|
||||
else
|
||||
@ -469,7 +469,7 @@ JobData::Save(BMessage* message)
|
||||
|
||||
message->RemoveName(kJDXRes);
|
||||
message->AddInt64(kJDXRes, fXRes);
|
||||
|
||||
|
||||
message->RemoveName(kJDYRes);
|
||||
message->AddInt64(kJDYRes, fYRes);
|
||||
|
||||
@ -501,14 +501,14 @@ JobData::Save(BMessage* message)
|
||||
message->AddInt32(kJDMarginUnit, fMarginUnit);
|
||||
|
||||
// page settings end here
|
||||
|
||||
|
||||
// job settings
|
||||
|
||||
// make sure job settings are not present in page settings
|
||||
message->RemoveName(kJDShowPreview);
|
||||
if (fSettingType == kJobSettings)
|
||||
message->AddBool(kJDShowPreview, fShowPreview);
|
||||
|
||||
|
||||
message->RemoveName(kJDNup);
|
||||
if (fSettingType == kJobSettings)
|
||||
message->AddInt32(kJDNup, fNup);
|
||||
@ -564,7 +564,7 @@ JobData::Save(BMessage* message)
|
||||
message->RemoveName(kJDDitherType);
|
||||
if (fSettingType == kJobSettings)
|
||||
message->AddInt32(kJDDitherType, fDitherType);
|
||||
|
||||
|
||||
message->RemoveName(kJDPageSelection);
|
||||
if (fSettingType == kJobSettings)
|
||||
message->AddInt32(kJDPageSelection, fPageSelection);
|
||||
|
@ -53,12 +53,12 @@ public:
|
||||
unsigned char thisbyte;
|
||||
unsigned char runbyte;
|
||||
STATUS status;
|
||||
|
||||
|
||||
i = 0;
|
||||
status = INITIAL;
|
||||
control = runbuf = destination;
|
||||
runbyte = *source++;
|
||||
|
||||
|
||||
while (--n) {
|
||||
thisbyte = *source++;
|
||||
switch (status) {
|
||||
@ -73,7 +73,7 @@ public:
|
||||
}
|
||||
i = 1;
|
||||
break;
|
||||
|
||||
|
||||
case UNDECIDED:
|
||||
if (i == MAXINBYTES) {
|
||||
WRITE_CONTROL(CONTROL2(i));
|
||||
@ -94,7 +94,7 @@ public:
|
||||
i++;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case UNMATCHED:
|
||||
if (i == MAXINBYTES) {
|
||||
WRITE_CONTROL(CONTROL2(i));
|
||||
@ -108,7 +108,7 @@ public:
|
||||
WRITE_TO_RUN_BUF(runbyte);
|
||||
runbyte = thisbyte;
|
||||
break;
|
||||
|
||||
|
||||
case MATCHED:
|
||||
if ((thisbyte != runbyte) || (i == MAXINBYTES)) {
|
||||
runbuf = control;
|
||||
@ -122,7 +122,7 @@ public:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
switch (status) {
|
||||
case INITIAL:
|
||||
WRITE_TO_RUN_BUF(CONTROL2(1));
|
||||
@ -137,7 +137,7 @@ public:
|
||||
break;
|
||||
}
|
||||
WRITE_TO_RUN_BUF(runbyte);
|
||||
|
||||
|
||||
return runbuf - destination;
|
||||
}
|
||||
};
|
||||
|
@ -16,7 +16,7 @@ PagesView::PagesView(BRect frame, const char* name, uint32 resizeMask, uint32 fl
|
||||
{
|
||||
SetViewColor(B_TRANSPARENT_COLOR);
|
||||
}
|
||||
|
||||
|
||||
void PagesView::GetPreferredSize(float *width, float *height)
|
||||
{
|
||||
*width = kWidth;
|
||||
@ -32,11 +32,11 @@ void PagesView::Draw(BRect rect)
|
||||
}
|
||||
SetHighColor(backgroundColor);
|
||||
FillRect(rect);
|
||||
|
||||
|
||||
BFont font(be_plain_font);
|
||||
font.SetSize(8);
|
||||
SetFont(&font);
|
||||
|
||||
|
||||
BPoint position(3, 3);
|
||||
if (fCollate) {
|
||||
BPoint next(kPageWidth + kPageHorizontalIndent * 2 + 10, 0);
|
||||
@ -81,7 +81,7 @@ void PagesView::_DrawPage(BPoint position, int number)
|
||||
const rgb_color pageBackgroundColor = {255, 255, 255};
|
||||
const rgb_color pageBorderColor = {0, 0, 0};
|
||||
const rgb_color pageNumberColor = {0, 0, 0};
|
||||
|
||||
|
||||
BPoint page[5];
|
||||
page[0].x = position.x + 3;
|
||||
page[0].y = position.y;
|
||||
@ -93,22 +93,22 @@ void PagesView::_DrawPage(BPoint position, int number)
|
||||
page[2].y = position.y + kPageHeight - 1;
|
||||
page[3].x = position.x;
|
||||
page[3].y = position.y + kPageHeight - 1;
|
||||
|
||||
|
||||
SetHighColor(pageBackgroundColor);
|
||||
FillPolygon(page, 5);
|
||||
|
||||
|
||||
SetHighColor(pageBorderColor);
|
||||
StrokePolygon(page, 5);
|
||||
StrokePolygon(page, 5);
|
||||
StrokeLine(position + BPoint(3, 1), position + BPoint(3, 3));
|
||||
StrokeLine(position + BPoint(3, 3), position + BPoint(1, 3));
|
||||
|
||||
|
||||
SetHighColor(pageNumberColor);
|
||||
SetLowColor(pageBackgroundColor);
|
||||
DrawChar('0' + number,
|
||||
position +
|
||||
DrawChar('0' + number,
|
||||
position +
|
||||
BPoint(kPageWidth - kPageHorizontalIndent + 1, kPageHeight - 2));
|
||||
}
|
||||
|
||||
|
||||
void PagesView::SetCollate(bool collate)
|
||||
{
|
||||
fCollate = collate;
|
||||
|
@ -27,7 +27,7 @@ PictureData::PictureData(BFile *file)
|
||||
DBGMSG(("2: current seek position = 0x%x\n", (int)file->Position()));
|
||||
|
||||
picture->Unflatten(file);
|
||||
|
||||
|
||||
DBGMSG(("3: current seek position = 0x%x\n", (int)file->Position()));
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ void
|
||||
PrinterData::Load()
|
||||
{
|
||||
if (fNode == NULL) return;
|
||||
|
||||
|
||||
char buffer[512];
|
||||
|
||||
fNode->ReadAttr(PD_DRIVER_NAME, B_STRING_TYPE, 0, buffer, sizeof(buffer));
|
||||
@ -46,7 +46,7 @@ PrinterData::Load()
|
||||
fComments = buffer;
|
||||
fNode->ReadAttr(PD_TRANSPORT, B_STRING_TYPE, 0, buffer, sizeof(buffer));
|
||||
fTransport = buffer;
|
||||
|
||||
|
||||
int32 valueI32;
|
||||
fNode->ReadAttr(PD_PROTOCOL_CLASS, B_INT32_TYPE, 0, &valueI32, sizeof(valueI32));
|
||||
fProtocolClass = (int)valueI32;
|
||||
@ -70,7 +70,7 @@ PrinterData::GetPath(string &path) const
|
||||
{
|
||||
if (fNode == NULL)
|
||||
return false;
|
||||
|
||||
|
||||
node_ref nref;
|
||||
if (fNode->GetNodeRef(&nref) != B_OK)
|
||||
return false;
|
||||
@ -78,11 +78,11 @@ PrinterData::GetPath(string &path) const
|
||||
BDirectory dir(&nref);
|
||||
if (dir.InitCheck() != B_OK)
|
||||
return false;
|
||||
|
||||
|
||||
BPath path0(&dir, ".");
|
||||
if (path0.InitCheck() != B_OK)
|
||||
return false;
|
||||
|
||||
|
||||
path = path0.Path();
|
||||
return true;
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ PrinterDriver::~PrinterDriver()
|
||||
{
|
||||
delete fGraphicsDriver;
|
||||
fGraphicsDriver = NULL;
|
||||
|
||||
|
||||
delete fPrinterCap;
|
||||
fPrinterCap = NULL;
|
||||
|
||||
@ -75,7 +75,7 @@ PrinterDriver::About()
|
||||
copyright = "libprint Copyright © 1999-2000 Y.Takagi\n";
|
||||
copyright << GetCopyright();
|
||||
copyright << "All Rights Reserved.";
|
||||
|
||||
|
||||
AboutBox app(GetSignature(), GetDriverName(), GetVersion(), copyright.String());
|
||||
app.Run();
|
||||
}
|
||||
@ -89,7 +89,7 @@ PrinterDriver::AddPrinter(char* printerName)
|
||||
DBGMSG((">%s: add_printer\n", GetDriverName()));
|
||||
DBGMSG(("\tprinter_name: %s\n", printerName));
|
||||
DBGMSG(("<%s: add_printer\n", GetDriverName()));
|
||||
|
||||
|
||||
if (fPrinterCap->Supports(PrinterCap::kProtocolClass)) {
|
||||
if (fPrinterCap->CountCap(PrinterCap::kProtocolClass) > 1) {
|
||||
AddPrinterDlg *dialog;
|
||||
@ -117,7 +117,7 @@ PrinterDriver::ConfigPage(BMessage* settings)
|
||||
DBGMSG((">%s: config_page\n", GetDriverName()));
|
||||
DUMP_BMESSAGE(settings);
|
||||
DUMP_BNODE(fSpoolFolder);
|
||||
|
||||
|
||||
BMessage pageSettings(*settings);
|
||||
_MergeWithPreviousSettings(kAttrPageSettings, &pageSettings);
|
||||
UIDriver uiDriver(&pageSettings, fPrinterData, fPrinterCap);
|
||||
@ -135,13 +135,13 @@ PrinterDriver::ConfigJob(BMessage* settings)
|
||||
DBGMSG((">%s: config_job\n", GetDriverName()));
|
||||
DUMP_BMESSAGE(settings);
|
||||
DUMP_BNODE(fSpoolFolder);
|
||||
|
||||
|
||||
BMessage jobSettings(*settings);
|
||||
_MergeWithPreviousSettings(kAttrJobSettings, &jobSettings);
|
||||
UIDriver uiDriver(&jobSettings, fPrinterData, fPrinterCap);
|
||||
BMessage *result = uiDriver.ConfigJob();
|
||||
_WriteSettings(kAttrJobSettings, result);
|
||||
|
||||
|
||||
DUMP_BMESSAGE(result);
|
||||
DBGMSG(("<%s: config_job\n", GetDriverName()));
|
||||
return result;
|
||||
@ -163,7 +163,7 @@ PrinterDriver::TakeJob(BFile* printJob, BMessage* settings)
|
||||
return new BMessage('okok');
|
||||
}
|
||||
printJob->Seek(offset, SEEK_SET);
|
||||
}
|
||||
}
|
||||
BMessage *result = fGraphicsDriver->TakeJob(printJob);
|
||||
|
||||
DUMP_BMESSAGE(result);
|
||||
@ -179,7 +179,7 @@ PrinterDriver::_ReadSettings(const char* attrName, BMessage* settings)
|
||||
ssize_t size;
|
||||
|
||||
settings->MakeEmpty();
|
||||
|
||||
|
||||
if (fSpoolFolder->GetAttrInfo(attrName, &info) == B_OK && info.size > 0) {
|
||||
BStackOrHeapArray<char, 0> data(info.size);
|
||||
if (!data.IsValid())
|
||||
@ -197,11 +197,11 @@ void
|
||||
PrinterDriver::_WriteSettings(const char* attrName, BMessage* settings)
|
||||
{
|
||||
if (settings == NULL || settings->what != 'okok') return;
|
||||
|
||||
|
||||
status_t status;
|
||||
BMallocIO data;
|
||||
status = settings->Flatten(&data);
|
||||
|
||||
|
||||
if (status == B_OK) {
|
||||
fSpoolFolder->WriteAttr(attrName, B_MESSAGE_TYPE, 0, data.Buffer(),
|
||||
data.BufferLength());
|
||||
@ -213,7 +213,7 @@ void
|
||||
PrinterDriver::_MergeWithPreviousSettings(const char* attrName, BMessage* settings)
|
||||
{
|
||||
if (settings == NULL) return;
|
||||
|
||||
|
||||
BMessage stored;
|
||||
if (_ReadSettings(attrName, &stored)) {
|
||||
AddFields(&stored, settings);
|
||||
|
@ -10,7 +10,7 @@ const char *kSDDescription = "_spool/Description";
|
||||
const char* kSDMimeType = "_spool/MimeType";
|
||||
|
||||
|
||||
SpoolMetaData::SpoolMetaData(BFile* spool_file)
|
||||
SpoolMetaData::SpoolMetaData(BFile* spool_file)
|
||||
{
|
||||
BString string;
|
||||
time_t time;
|
||||
|
Loading…
Reference in New Issue
Block a user