1
0
mirror of https://github.com/pdewacht/brlaser synced 2025-07-19 15:29:44 +02:00

Merge remote-tracking branch 'xc-racer99/master'

This commit is contained in:
Peter De Wachter
2017-10-14 21:40:58 +02:00
4 changed files with 17 additions and 7 deletions

View File

@ -73,10 +73,16 @@ void job::write_page_header() {
fprintf(out_, "@PJL SET PAGEPROTECT = AUTO\n");
fprintf(out_, "@PJL SET ORIENTATION = PORTRAIT\n");
fprintf(out_, "@PJL ENTER LANGUAGE = PCL\n");
fputs("\033E", out_);
fprintf(out_, "\033&l%dX", std::max(1, page_params_.num_copies));
if (page_params_.duplex) {
fputs("\033&l2S", out_);
}
}
void job::encode_page(const page_params &page_params,
int num_copies,
int lines,
int linesize,
nextline_fn nextline) {
@ -95,8 +101,6 @@ void job::encode_page(const page_params &page_params,
block.add_line(encode_line(line));
std::swap(line, reference);
fputs("\033E", out_);
fprintf(out_, "\033&l%dX", std::max(1, num_copies));
fputs("\033*b1030m", out_);
for (int i = 1; i < lines && nextline(line.data()); ++i) {

View File

@ -23,14 +23,18 @@
#include <string>
struct page_params {
int num_copies;
int resolution;
bool duplex;
bool economode;
std::string sourcetray;
std::string mediatype;
std::string papersize;
bool operator==(const page_params &o) const {
return resolution == o.resolution
return num_copies == o.num_copies
&& resolution == o.resolution
&& duplex == o.duplex
&& economode == o.economode
&& sourcetray == o.sourcetray
&& mediatype == o.mediatype
@ -46,7 +50,6 @@ class job {
~job();
void encode_page(const page_params &params,
int num_copies,
int lines,
int linesize,
nextline_fn nextline);

View File

@ -107,9 +107,11 @@ page_params build_page_params() {
};
page_params p = { };
p.num_copies = header.NumCopies;
p.resolution = header.HWResolution[0];
p.economode = header.cupsInteger[10];
p.mediatype = header.MediaType;
p.duplex = header.Duplex;
if (header.MediaPosition < sources.size())
p.sourcetray = sources[header.MediaPosition];
@ -182,7 +184,6 @@ int main(int argc, char *argv[]) {
dump_page_header(header);
}
job.encode_page(build_page_params(),
header.NumCopies,
header.cupsHeight,
header.cupsBytesPerLine,
next_line);