* rearranged header a bit

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26308 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Karsten Heimrich
2008-07-07 20:01:46 +00:00
parent a836d47d56
commit c5ea3d591d
+57 -47
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2001-2006, Haiku. All rights reserved. * Copyright 2001-2008, Haiku. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
@@ -26,6 +26,7 @@ class Printer;
// OpenTracker shared sources // OpenTracker shared sources
#include "ObjectList.h" #include "ObjectList.h"
class SpoolFolder : public Folder { class SpoolFolder : public Folder {
protected: protected:
void Notify(Job* job, int kind); void Notify(Job* job, int kind);
@@ -34,6 +35,7 @@ public:
SpoolFolder(BLocker* locker, BLooper* looper, const BDirectory& spoolDir); SpoolFolder(BLocker* locker, BLooper* looper, const BDirectory& spoolDir);
}; };
/*****************************************************************************/ /*****************************************************************************/
// Printer // Printer
// //
@@ -43,65 +45,73 @@ public:
class Printer : public BHandler, public Object class Printer : public BHandler, public Object
{ {
typedef BHandler Inherited; typedef BHandler Inherited;
public: public:
Printer(const BDirectory* node, Resource* res); Printer(const BDirectory* node, Resource* res);
~Printer(); virtual ~Printer();
// Static helper functions virtual void MessageReceived(BMessage* message);
static Printer* Find(const BString& name); virtual status_t GetSupportedSuites(BMessage* msg);
static Printer* Find(node_ref* node); virtual BHandler* ResolveSpecifier(BMessage* msg, int32 index,
static Printer* At(int32 idx); BMessage* spec, int32 form, const char* prop);
static void Remove(Printer* printer);
static int32 CountPrinters();
status_t Remove(); // Static helper functions
status_t ConfigurePrinter(); static Printer* Find(const BString& name);
status_t ConfigureJob(BMessage& ioSettings); static Printer* Find(node_ref* node);
status_t ConfigurePage(BMessage& ioSettings); static Printer* At(int32 idx);
status_t GetDefaultSettings(BMessage& configuration); static void Remove(Printer* printer);
static int32 CountPrinters();
// Try to start processing of next spooled job status_t Remove();
void HandleSpooledJob(); status_t ConfigurePrinter();
// Abort print_thread without processing spooled job status_t ConfigureJob(BMessage& ioSettings);
void AbortPrintThread(); status_t ConfigurePage(BMessage& ioSettings);
status_t GetDefaultSettings(BMessage& configuration);
void MessageReceived(BMessage* msg); // Try to start processing of next spooled job
void HandleSpooledJob();
// Scripting support, see Printer.Scripting.cpp // Abort print_thread without processing spooled job
status_t GetSupportedSuites(BMessage* msg); void AbortPrintThread();
void HandleScriptingCommand(BMessage* msg);
BHandler* ResolveSpecifier(BMessage* msg, int32 index, BMessage* spec,
int32 form, const char* prop);
void GetName(BString& name); // Scripting support, see Printer.Scripting.cpp
Resource* GetResource() { return fResource; } void HandleScriptingCommand(BMessage* msg);
void GetName(BString& name);
Resource* GetResource() { return fResource; }
private: private:
status_t LoadPrinterAddon(image_id& id); status_t LoadPrinterAddon(image_id& id);
void AddCurrentPrinter(BMessage* m); void AddCurrentPrinter(BMessage* m);
SpoolFolder fPrinter; // the printer spooling directory // Accessor
Resource* fResource; // the resource required for processing a print job BDirectory* SpoolDir() { return fPrinter.GetSpoolDir(); }
bool fSinglePrintThread; // is printer add-on allowed to process multiple print job at once
Job* fJob; // the next job to process
vint32 fProcessing; // the current nmber of processing threads
bool fAbort; // stop processing
static BObjectList<Printer> sPrinters; void ResetJobStatus();
bool HasCurrentPrinter(BString& name);
bool MoveJob(const BString& name);
// Accessor // Get next spooled job if any
BDirectory* SpoolDir() { return fPrinter.GetSpoolDir(); } bool FindSpooledJob();
status_t PrintSpooledJob(BFile* spoolFile);
void PrintThread(Job* job);
void ResetJobStatus(); static status_t print_thread(void* data);
bool HasCurrentPrinter(BString& name); void StartPrintThread();
bool MoveJob(const BString& name);
// Get next spooled job if any private:
bool FindSpooledJob(); // the printer spooling directory
status_t PrintSpooledJob(BFile* spoolFile); SpoolFolder fPrinter;
void PrintThread(Job* job); // the resource required for processing a print job
static status_t print_thread(void* data); Resource* fResource;
void StartPrintThread(); // is printer add-on allowed to process multiple print job at once
bool fSinglePrintThread;
// the next job to process
Job* fJob;
// the current nmber of processing threads
vint32 fProcessing;
// stop processing
bool fAbort;
static BObjectList<Printer> sPrinters;
}; };
#endif #endif