Use class PrinterDriver of libprint.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6578 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Pfeiffer 2004-02-13 23:46:35 +00:00
parent 69512fac34
commit 53045bc61b
5 changed files with 187 additions and 345 deletions

View File

@ -3,77 +3,48 @@
* Copyright 1999-2000 Y.Takagi. All Rights Reserved.
*/
#include <File.h>
#include <Message.h>
#include <Node.h>
#include "Exports.h"
#include "Lips3.h"
#include "PrinterData.h"
#include "Lips3Cap.h"
#include "UIDriver.h"
#include "AboutBox.h"
#include "DbgMsg.h"
#include "PrinterDriver.h"
char *add_printer(char *printer_name)
class Lips3PrinterDriver : public PrinterDriver
{
DBGMSG((">LIPS3: add_printer\n"));
DBGMSG(("\tprinter_name: %s\n", printer_name));
DBGMSG(("<LIPS3: add_printer\n"));
return printer_name;
public:
Lips3PrinterDriver(BNode* printerFolder) : PrinterDriver(printerFolder) {}
const char* GetSignature() const
{
return "application/x-vnd.lips3-compatible";
}
const char* GetDriverName() const
{
return "Canon LIPS3 Compatible";
}
const char* GetVersion() const
{
return "0.9.4";
}
const char* GetCopyright() const
{
return "Copyright © 1999-2000 Y.Takagi.\n";
}
PrinterCap* InstantiatePrinterCap(PrinterData* printerData)
{
return new Lips3Cap(printerData);
}
GraphicsDriver* InstantiateGraphicsDriver(BMessage* settings, PrinterData* printerData, PrinterCap* printerCap)
{
return new LIPS3Driver(settings, printerData, printerCap);
}
};
PrinterDriver* instantiate_printer_driver(BNode* printerFolder)
{
return new Lips3PrinterDriver(printerFolder);
}
BMessage *config_page(BNode *node, BMessage *msg)
{
DBGMSG((">LIPS3: config_page\n"));
DUMP_BMESSAGE(msg);
DUMP_BNODE(node);
PrinterData printer_data(node);
Lips3Cap printer_cap(&printer_data);
UIDriver drv(msg, &printer_data, &printer_cap);
BMessage *result = drv.configPage();
DUMP_BMESSAGE(result);
DBGMSG(("<LIPS3: config_page\n"));
return result;
}
BMessage *config_job(BNode *node, BMessage *msg)
{
DBGMSG((">LIPS3: config_job\n"));
DUMP_BMESSAGE(msg);
DUMP_BNODE(node);
PrinterData printer_data(node);
Lips3Cap printer_cap(&printer_data);
UIDriver drv(msg, &printer_data, &printer_cap);
BMessage *result = drv.configJob();
DUMP_BMESSAGE(result);
DBGMSG(("<LIPS3: config_job\n"));
return result;
}
BMessage *take_job(BFile *spool, BNode *node, BMessage *msg)
{
DBGMSG((">LIPS3: take_job\n"));
DUMP_BMESSAGE(msg);
DUMP_BNODE(node);
PrinterData printer_data(node);
Lips3Cap printer_cap(&printer_data);
LIPS3Driver drv(msg, &printer_data, &printer_cap);
BMessage *result = drv.takeJob(spool);
// DUMP_BMESSAGE(result);
DBGMSG(("<LIPS3: take_job\n"));
return result;
}
int main()
{
AboutBox app("application/x-vnd.lips3-compatible", "Canon LIPS3 Compatible", "0.9.4", "Copyright © 1999-2000 Y.Takagi. All Rights Reserved.");
app.Run();
return 0;
}

View File

@ -3,77 +3,47 @@
* Copyright 1999-2000 Y.Takagi. All Rights Reserved.
*/
#include <File.h>
#include <Message.h>
#include <Node.h>
#include "Exports.h"
#include "Lips4.h"
#include "PrinterData.h"
#include "Lips4Cap.h"
#include "UIDriver.h"
#include "AboutBox.h"
#include "DbgMsg.h"
#include "PrinterDriver.h"
char *add_printer(char *printer_name)
class Lips4PrinterDriver : public PrinterDriver
{
DBGMSG((">LIPS4: add_printer\n"));
DBGMSG(("\tprinter_name: %s\n", printer_name));
DBGMSG(("<LIPS4: add_printer\n"));
return printer_name;
}
public:
Lips4PrinterDriver(BNode* printerFolder) : PrinterDriver(printerFolder) {}
const char* GetSignature() const
{
return "application/x-vnd.lips4-compatible";
}
const char* GetDriverName() const
{
return "Canon LIPS4 Compatible";
}
const char* GetVersion() const
{
return "0.9.4";
}
const char* GetCopyright() const
{
return "Copyright © 1999-2000 Y.Takagi.\n";
}
BMessage *config_page(BNode *node, BMessage *msg)
PrinterCap* InstantiatePrinterCap(PrinterData* printerData)
{
return new Lips4Cap(printerData);
}
GraphicsDriver* InstantiateGraphicsDriver(BMessage* settings, PrinterData* printerData, PrinterCap* printerCap)
{
return new LIPS4Driver(settings, printerData, printerCap);
}
};
PrinterDriver* instantiate_printer_driver(BNode* printerFolder)
{
DBGMSG((">LIPS4: config_page\n"));
DUMP_BMESSAGE(msg);
DUMP_BNODE(node);
PrinterData printer_data(node);
Lips4Cap printer_cap(&printer_data);
UIDriver drv(msg, &printer_data, &printer_cap);
BMessage *result = drv.configPage();
DUMP_BMESSAGE(result);
DBGMSG(("<LIPS4: config_page\n"));
return result;
}
BMessage *config_job(BNode *node, BMessage *msg)
{
DBGMSG((">LIPS4: config_job\n"));
DUMP_BMESSAGE(msg);
DUMP_BNODE(node);
PrinterData printer_data(node);
Lips4Cap printer_cap(&printer_data);
UIDriver drv(msg, &printer_data, &printer_cap);
BMessage *result = drv.configJob();
DUMP_BMESSAGE(result);
DBGMSG(("<LIPS4: config_job\n"));
return result;
}
BMessage *take_job(BFile *spool, BNode *node, BMessage *msg)
{
DBGMSG((">LIPS4: take_job\n"));
DUMP_BMESSAGE(msg);
DUMP_BNODE(node);
PrinterData printer_data(node);
Lips4Cap printer_cap(&printer_data);
LIPS4Driver drv(msg, &printer_data, &printer_cap);
BMessage *result = drv.takeJob(spool);
// DUMP_BMESSAGE(result);
DBGMSG(("<LIPS4: take_job\n"));
return result;
}
int main()
{
AboutBox app("application/x-vnd.lips4-compatible", "Canon LIPS4 Compatible", "0.9.4", "Copyright © 1999-2000 Y.Takagi. All Rights Reserved.");
app.Run();
return 0;
return new Lips4PrinterDriver(printerFolder);
}

View File

@ -4,80 +4,47 @@
* Copyright 2003 Michael Pfeiffer.
*/
#include <File.h>
#include <Message.h>
#include <Node.h>
#include "Exports.h"
#include "PCL5.h"
#include "PrinterData.h"
#include "PCL5Cap.h"
#include "UIDriver.h"
#include "AboutBox.h"
#include "DbgMsg.h"
#include "PrinterDriver.h"
char *add_printer(char *printer_name)
class PCL5PrinterDriver : public PrinterDriver
{
DBGMSG((">PCL5: add_printer\n"));
DBGMSG(("\tprinter_name: %s\n", printer_name));
DBGMSG(("<PCL5: add_printer\n"));
return printer_name;
}
public:
PCL5PrinterDriver(BNode* printerFolder) : PrinterDriver(printerFolder) {}
const char* GetSignature() const
{
return "application/x-vnd.PCL5-compatible";
}
const char* GetDriverName() const
{
return "PCL5 Compatible";
}
const char* GetVersion() const
{
return "1.0";
}
const char* GetCopyright() const
{
return "PCL5 driver Copyright © 2003,04 Michael Pfeiffer.\n";
}
BMessage *config_page(BNode *node, BMessage *msg)
PrinterCap* InstantiatePrinterCap(PrinterData* printerData)
{
return new PCL5Cap(printerData);
}
GraphicsDriver* InstantiateGraphicsDriver(BMessage* settings, PrinterData* printerData, PrinterCap* printerCap)
{
return new PCL5Driver(settings, printerData, printerCap);
}
};
PrinterDriver* instantiate_printer_driver(BNode* printerFolder)
{
DBGMSG((">PCL5: config_page\n"));
DUMP_BMESSAGE(msg);
DUMP_BNODE(node);
PrinterData printer_data(node);
PCL5Cap printer_cap(&printer_data);
UIDriver drv(msg, &printer_data, &printer_cap);
BMessage *result = drv.configPage();
DUMP_BMESSAGE(result);
DBGMSG(("<PCL5: config_page\n"));
return result;
}
BMessage *config_job(BNode *node, BMessage *msg)
{
DBGMSG((">PCL5: config_job\n"));
DUMP_BMESSAGE(msg);
DUMP_BNODE(node);
PrinterData printer_data(node);
PCL5Cap printer_cap(&printer_data);
UIDriver drv(msg, &printer_data, &printer_cap);
BMessage *result = drv.configJob();
DUMP_BMESSAGE(result);
DBGMSG(("<PCL5: config_job\n"));
return result;
}
BMessage *take_job(BFile *spool, BNode *node, BMessage *msg)
{
DBGMSG((">PCL5: take_job\n"));
DUMP_BMESSAGE(msg);
DUMP_BNODE(node);
PrinterData printer_data(node);
PCL5Cap printer_cap(&printer_data);
PCL5Driver drv(msg, &printer_data, &printer_cap);
BMessage *result = drv.takeJob(spool);
// DUMP_BMESSAGE(result);
DBGMSG(("<PCL5: take_job\n"));
return result;
}
int main()
{
AboutBox app("application/x-vnd.PCL5-compatible", "PCL5 Compatible", "0.1",
"libprint Copyright © 1999-2000 Y.Takagi\n"
"PCL5 driver Copyright © 2003 Michael Pfeiffer.\n"
"All Rights Reserved.");
app.Run();
return 0;
return new PCL5PrinterDriver(printerFolder);
}

View File

@ -4,80 +4,47 @@
* Copyright 2003 Michael Pfeiffer.
*/
#include <File.h>
#include <Message.h>
#include <Node.h>
#include "Exports.h"
#include "PCL6.h"
#include "PrinterData.h"
#include "PCL6Cap.h"
#include "UIDriver.h"
#include "AboutBox.h"
#include "DbgMsg.h"
#include "PrinterDriver.h"
char *add_printer(char *printer_name)
class PCL6PrinterDriver : public PrinterDriver
{
DBGMSG((">PCL6: add_printer\n"));
DBGMSG(("\tprinter_name: %s\n", printer_name));
DBGMSG(("<PCL6: add_printer\n"));
return printer_name;
}
public:
PCL6PrinterDriver(BNode* printerFolder) : PrinterDriver(printerFolder) {}
const char* GetSignature() const
{
return "application/x-vnd.PCL6-compatible";
}
const char* GetDriverName() const
{
return "PCL6 Compatible";
}
const char* GetVersion() const
{
return "0.2";
}
const char* GetCopyright() const
{
return "PCL6 driver Copyright © 2003,04 Michael Pfeiffer.\n";
}
BMessage *config_page(BNode *node, BMessage *msg)
PrinterCap* InstantiatePrinterCap(PrinterData* printerData)
{
return new PCL6Cap(printerData);
}
GraphicsDriver* InstantiateGraphicsDriver(BMessage* settings, PrinterData* printerData, PrinterCap* printerCap)
{
return new PCL6Driver(settings, printerData, printerCap);
}
};
PrinterDriver* instantiate_printer_driver(BNode* printerFolder)
{
DBGMSG((">PCL6: config_page\n"));
DUMP_BMESSAGE(msg);
DUMP_BNODE(node);
PrinterData printer_data(node);
PCL6Cap printer_cap(&printer_data);
UIDriver drv(msg, &printer_data, &printer_cap);
BMessage *result = drv.configPage();
DUMP_BMESSAGE(result);
DBGMSG(("<PCL6: config_page\n"));
return result;
}
BMessage *config_job(BNode *node, BMessage *msg)
{
DBGMSG((">PCL6: config_job\n"));
DUMP_BMESSAGE(msg);
DUMP_BNODE(node);
PrinterData printer_data(node);
PCL6Cap printer_cap(&printer_data);
UIDriver drv(msg, &printer_data, &printer_cap);
BMessage *result = drv.configJob();
DUMP_BMESSAGE(result);
DBGMSG(("<PCL6: config_job\n"));
return result;
}
BMessage *take_job(BFile *spool, BNode *node, BMessage *msg)
{
DBGMSG((">PCL6: take_job\n"));
DUMP_BMESSAGE(msg);
DUMP_BNODE(node);
PrinterData printer_data(node);
PCL6Cap printer_cap(&printer_data);
PCL6Driver drv(msg, &printer_data, &printer_cap);
BMessage *result = drv.takeJob(spool);
// DUMP_BMESSAGE(result);
DBGMSG(("<PCL6: take_job\n"));
return result;
}
int main()
{
AboutBox app("application/x-vnd.PCL6-compatible", "PCL6 Compatible", "0.1",
"libprint Copyright © 1999-2000 Y.Takagi\n"
"PCL6 driver Copyright © 2003 Michael Pfeiffer.\n"
"All Rights Reserved.");
app.Run();
return 0;
return new PCL6PrinterDriver(printerFolder);
}

View File

@ -4,80 +4,47 @@
* Copyright 2003 Michael Pfeiffer.
*/
#include <File.h>
#include <Message.h>
#include <Node.h>
#include "Exports.h"
#include "PS.h"
#include "PrinterData.h"
#include "PSCap.h"
#include "UIDriver.h"
#include "AboutBox.h"
#include "DbgMsg.h"
#include "PrinterDriver.h"
char *add_printer(char *printer_name)
class PSPrinterDriver : public PrinterDriver
{
DBGMSG((">PS: add_printer\n"));
DBGMSG(("\tprinter_name: %s\n", printer_name));
DBGMSG(("<PS: add_printer\n"));
return printer_name;
}
public:
PSPrinterDriver(BNode* printerFolder) : PrinterDriver(printerFolder) {}
const char* GetSignature() const
{
return "application/x-vnd.PS-compatible";
}
const char* GetDriverName() const
{
return "PS Compatible";
}
const char* GetVersion() const
{
return "0.1";
}
const char* GetCopyright() const
{
return "PS driver Copyright © 2003,04 Michael Pfeiffer.\n";
}
BMessage *config_page(BNode *node, BMessage *msg)
PrinterCap* InstantiatePrinterCap(PrinterData* printerData)
{
return new PSCap(printerData);
}
GraphicsDriver* InstantiateGraphicsDriver(BMessage* settings, PrinterData* printerData, PrinterCap* printerCap)
{
return new PSDriver(settings, printerData, printerCap);
}
};
PrinterDriver* instantiate_printer_driver(BNode* printerFolder)
{
DBGMSG((">PS: config_page\n"));
DUMP_BMESSAGE(msg);
DUMP_BNODE(node);
PrinterData printer_data(node);
PSCap printer_cap(&printer_data);
UIDriver drv(msg, &printer_data, &printer_cap);
BMessage *result = drv.configPage();
DUMP_BMESSAGE(result);
DBGMSG(("<PS: config_page\n"));
return result;
}
BMessage *config_job(BNode *node, BMessage *msg)
{
DBGMSG((">PS: config_job\n"));
DUMP_BMESSAGE(msg);
DUMP_BNODE(node);
PrinterData printer_data(node);
PSCap printer_cap(&printer_data);
UIDriver drv(msg, &printer_data, &printer_cap);
BMessage *result = drv.configJob();
DUMP_BMESSAGE(result);
DBGMSG(("<PS: config_job\n"));
return result;
}
BMessage *take_job(BFile *spool, BNode *node, BMessage *msg)
{
DBGMSG((">PS: take_job\n"));
DUMP_BMESSAGE(msg);
DUMP_BNODE(node);
PrinterData printer_data(node);
PSCap printer_cap(&printer_data);
PSDriver drv(msg, &printer_data, &printer_cap);
BMessage *result = drv.takeJob(spool);
// DUMP_BMESSAGE(result);
DBGMSG(("<PS: take_job\n"));
return result;
}
int main()
{
AboutBox app("application/x-vnd.PS-compatible", "PS Compatible", "0.1",
"libprint Copyright © 1999-2000 Y.Takagi\n"
"PostScript driver Copyright © 2003 Michael Pfeiffer.\n"
"All Rights Reserved.");
app.Run();
return 0;
return new PSPrinterDriver(printerFolder);
}