summaryrefslogtreecommitdiff
path: root/src/main/print-escp2-data.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/print-escp2-data.c')
-rw-r--r--src/main/print-escp2-data.c72
1 files changed, 21 insertions, 51 deletions
diff --git a/src/main/print-escp2-data.c b/src/main/print-escp2-data.c
index ec2230d..1537adf 100644
--- a/src/main/print-escp2-data.c
+++ b/src/main/print-escp2-data.c
@@ -1,5 +1,5 @@
/*
- * "$Id: print-escp2-data.c,v 1.271 2008/11/22 20:28:04 rlk Exp $"
+ * "$Id: print-escp2-data.c,v 1.273 2010/08/04 00:33:56 rlk Exp $"
*
* Print plug-in EPSON ESC/P2 driver for the GIMP.
*
@@ -40,15 +40,15 @@ typedef struct
static const escp2_printer_attr_t escp2_printer_attrs[] =
{
{ "command_mode", 0, 4 },
- { "zero_margin", 4, 2 },
- { "variable_mode", 6, 1 },
- { "graymode", 7, 1 },
- { "fast_360", 8, 1 },
- { "send_zero_advance", 9, 1 },
- { "supports_ink_change", 10, 1 },
- { "packet_mode", 11, 1 },
- { "interchangeable_ink", 12, 1 },
- { "envelope_landscape", 13, 1 },
+ { "zero_margin", 4, 3 },
+ { "variable_mode", 7, 1 },
+ { "graymode", 8, 1 },
+ { "fast_360", 9, 1 },
+ { "send_zero_advance", 10, 1 },
+ { "supports_ink_change", 11, 1 },
+ { "packet_mode", 12, 1 },
+ { "interchangeable_ink", 13, 1 },
+ { "envelope_landscape", 14, 1 },
};
static stpi_escp2_printer_t *escp2_model_capabilities;
@@ -98,38 +98,22 @@ load_model_from_file(const stp_vars_t *v, stp_mxml_node_t *xmod, int model)
const char *val = child->value.text.string;
if (!strcmp(name, "verticalBorderlessSequence"))
{
- if (p->vertical_borderless_sequence)
- {
- stp_erprintf("Reassigning vertical borderless sequence for model %d\n", model);
- stp_abort();
- }
+ STPI_ASSERT(!p->vertical_borderless_sequence, NULL);
p->vertical_borderless_sequence = stp_xmlstrtoraw(val);
}
else if (!strcmp(name, "preinitSequence"))
{
- if (p->preinit_sequence)
- {
- stp_erprintf("Reassigning pre-init sequence for model %d\n", model);
- stp_abort();
- }
+ STPI_ASSERT(!p->preinit_sequence, NULL);
p->preinit_sequence = stp_xmlstrtoraw(val);
}
else if (!strcmp(name, "preinitRemoteSequence"))
{
- if (p->preinit_remote_sequence)
- {
- stp_erprintf("Reassigning pre-init remote sequence for model %d\n", model);
- stp_abort();
- }
+ STPI_ASSERT(!p->preinit_remote_sequence, NULL);
p->preinit_remote_sequence = stp_xmlstrtoraw(val);
}
else if (!strcmp(name, "postinitRemoteSequence"))
{
- if (p->postinit_remote_sequence)
- {
- stp_erprintf("Reassigning post-init remote sequence for model %d\n", model);
- stp_abort();
- }
+ STPI_ASSERT(!p->postinit_remote_sequence, NULL);
p->postinit_remote_sequence = stp_xmlstrtoraw(val);
}
else if (!strcmp(name, "commandSet"))
@@ -151,6 +135,8 @@ load_model_from_file(const stp_vars_t *v, stp_mxml_node_t *xmod, int model)
p->flags |= MODEL_ZEROMARGIN_YES;
else if (!strcmp(val, "Full"))
p->flags |= MODEL_ZEROMARGIN_FULL;
+ else if (!strcmp(val, "VerticalRestricted"))
+ p->flags |= MODEL_ZEROMARGIN_RESTR;
else if (!strcmp(val, "HorizontalOnly"))
p->flags |= MODEL_ZEROMARGIN_H_ONLY;
}
@@ -424,17 +410,9 @@ stp_escp2_load_model(const stp_vars_t *v, int model)
if (node)
{
const char *stmp = stp_mxmlElementGetAttr(node, "id");
- if (stmp && stp_xmlstrtol(stmp) == model)
- {
- load_model_from_file(v, node, model);
- found = 1;
- }
- else
- {
- stp_erprintf("Model id %d does not match definition %s!\n",
- model, stmp);
- stp_abort();
- }
+ STPI_ASSERT(stmp && stp_xmlstrtol(stmp) == model, v);
+ load_model_from_file(v, node, model);
+ found = 1;
}
stp_mxmlDelete(doc);
if (found)
@@ -444,22 +422,14 @@ stp_escp2_load_model(const stp_vars_t *v, int model)
}
stp_xml_exit();
stp_list_destroy(dirlist);
- if (! found)
- {
- stp_erprintf("Unable to find printer definition for model %d!\n", model);
- stp_abort();
- }
+ STPI_ASSERT(found, v);
}
stpi_escp2_printer_t *
stp_escp2_get_printer(const stp_vars_t *v)
{
int model = stp_get_model_id(v);
- if (model < 0)
- {
- stp_erprintf("Unable to find printer definition for model %d!\n", model);
- stp_abort();
- }
+ STPI_ASSERT(model >= 0, v);
if (!escp2_model_capabilities)
{
escp2_model_capabilities =