]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Mirror 1.1.x changes.
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Sun, 25 May 2003 14:43:34 +0000 (14:43 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Sun, 25 May 2003 14:43:34 +0000 (14:43 +0000)
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/branches/branch-1.2@3749 7a7537e8-13f0-0310-91df-b6672ffda945

CHANGES-1.1.txt
cups/emit.c

index 9430db8b5aa779eaeee1cf93ce5d066ff855cd1f..2f4e4e3ee908188955de44919898b10e9f63ec3e 100644 (file)
@@ -3,6 +3,10 @@ CHANGES-1.1.txt
 
 CHANGES IN CUPS V1.1.19
 
+       - The ppdEmit() functions output "PageSize Custom"
+         instead of "CustomPageSize True" in the DSC comments.
+         Also, the custom page size code did not use the
+         ParamCustomPageSize attributes (STR #127)
        - The cupstestppd command did not list the conflicting
          options (STR #123)
        - The lpq command did not ensure that there was
index a786d235c6e8a5f1ff91a92cf6d99390e809d621..b680c3cb1fc1ec942edd1e96c107002017cb9387 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: emit.c,v 1.23.2.7 2003/02/28 21:07:32 mike Exp $"
+ * "$Id: emit.c,v 1.23.2.8 2003/05/25 14:43:34 mike Exp $"
  *
  *   PPD code emission routines for the Common UNIX Printing System (CUPS).
  *
@@ -196,26 +196,52 @@ ppdEmit(ppd_file_t    *ppd,               /* I - PPD file record */
       * Send DSC comments with option...
       */
 
-      if (fprintf(fp, "%%%%BeginFeature: *%s %s\n",
-                  ((ppd_option_t *)choices[i]->option)->keyword,
-                 choices[i]->choice) < 0)
-      {
-        free(choices);
-        return (-1);
-      }
-
       if ((strcasecmp(((ppd_option_t *)choices[i]->option)->keyword, "PageSize") == 0 ||
            strcasecmp(((ppd_option_t *)choices[i]->option)->keyword, "PageRegion") == 0) &&
           strcasecmp(choices[i]->choice, "Custom") == 0)
       {
        /*
-        * Variable size; write out standard size options (this should
-       * eventually be changed to use the parameter positions defined
-       * in the PPD file...)
+        * Variable size; write out standard size options, using the
+       * parameter positions defined in the PPD file...
        */
 
+        ppd_attr_t     *attr;          /* PPD attribute */
+       int             pos,            /* Position of custom value */
+                       values[5];      /* Values for custom command */
+
+
+        fputs("%%BeginFeature: *CustomPageSize True\n", fp);
+
         size = ppdPageSize(ppd, "Custom");
-        fprintf(fp, "%.0f %.0f 0 0 0\n", size->width, size->length);
+
+        memset(values, 0, sizeof(values));
+
+       if ((attr = ppdFindAttr(ppd, "ParamCustomPageSize", "Width")) != NULL)
+       {
+         pos = atoi(attr->value) - 1;
+
+          if (pos < 0 || pos > 4)
+           pos = 0;
+       }
+       else
+         pos = 0;
+
+       values[pos] = (int)size->width;
+
+       if ((attr = ppdFindAttr(ppd, "ParamCustomPageSize", "Height")) != NULL)
+       {
+         pos = atoi(attr->value) - 1;
+
+          if (pos < 0 || pos > 4)
+           pos = 1;
+       }
+       else
+         pos = 1;
+
+       values[pos] = (int)size->length;
+
+        fprintf(fp, "%d %d %d %d %d\n", values[0], values[1],
+               values[2], values[3], values[4]);
 
        if (choices[i]->code == NULL)
        {
@@ -228,6 +254,13 @@ ppdEmit(ppd_file_t    *ppd,                /* I - PPD file record */
          fputs(ppd_custom_code, fp);
        }
       }
+      else if (fprintf(fp, "%%%%BeginFeature: *%s %s\n",
+                       ((ppd_option_t *)choices[i]->option)->keyword,
+                      choices[i]->choice) < 0)
+      {
+        free(choices);
+        return (-1);
+      }
 
       if (choices[i]->code != NULL && choices[i]->code[0] != '\0')
       {
@@ -274,7 +307,8 @@ ppdEmitFd(ppd_file_t    *ppd,               /* I - PPD file record */
           ppd_section_t section)       /* I - Section to write */
 {
   int          i,                      /* Looping var */
-               count;                  /* Number of choices */
+               count,                  /* Number of choices */
+               custom_size;            /* Non-zero if this option is a custom size */
   ppd_choice_t **choices;              /* Choices */
   ppd_size_t   *size;                  /* Custom page size */
   char         buf[1024];              /* Output buffer for feature */
@@ -311,9 +345,22 @@ ppdEmitFd(ppd_file_t    *ppd,              /* I - PPD file record */
       * Send DSC comments with option...
       */
 
-      snprintf(buf, sizeof(buf), "%%%%BeginFeature: *%s %s\n",
-               ((ppd_option_t *)choices[i]->option)->keyword,
-              choices[i]->choice);
+      if ((strcasecmp(((ppd_option_t *)choices[i]->option)->keyword, "PageSize") == 0 ||
+           strcasecmp(((ppd_option_t *)choices[i]->option)->keyword, "PageRegion") == 0) &&
+          strcasecmp(choices[i]->choice, "Custom") == 0)
+      {
+        custom_size = 1;
+
+       strcpy(buf, "%%BeginFeature: *CustomPageSize True\n");
+      }
+      else
+      {
+        custom_size = 0;
+
+       snprintf(buf, sizeof(buf), "%%%%BeginFeature: *%s %s\n",
+                ((ppd_option_t *)choices[i]->option)->keyword,
+                choices[i]->choice);
+      }
 
       if (write(fd, buf, strlen(buf)) < 1)
       {
@@ -321,19 +368,48 @@ ppdEmitFd(ppd_file_t    *ppd,             /* I - PPD file record */
         return (-1);
       }
 
-      if ((strcasecmp(((ppd_option_t *)choices[i]->option)->keyword, "PageSize") == 0 ||
-           strcasecmp(((ppd_option_t *)choices[i]->option)->keyword, "PageRegion") == 0) &&
-          strcasecmp(choices[i]->choice, "Custom") == 0)
+      if (custom_size)
       {
        /*
-        * Variable size; write out standard size options (this should
-       * eventually be changed to use the parameter positions defined
-       * in the PPD file...)
+        * Variable size; write out standard size options, using the
+       * parameter positions defined in the PPD file...
        */
 
+        ppd_attr_t     *attr;          /* PPD attribute */
+       int             pos,            /* Position of custom value */
+                       values[5];      /* Values for custom command */
+
+
         size = ppdPageSize(ppd, "Custom");
-        snprintf(buf, sizeof(buf), "%.0f %.0f 0 0 0\n", size->width,
-                size->length);
+
+        memset(values, 0, sizeof(values));
+
+       if ((attr = ppdFindAttr(ppd, "ParamCustomPageSize", "Width")) != NULL)
+       {
+         pos = atoi(attr->value) - 1;
+
+          if (pos < 0 || pos > 4)
+           pos = 0;
+       }
+       else
+         pos = 0;
+
+       values[pos] = (int)size->width;
+
+       if ((attr = ppdFindAttr(ppd, "ParamCustomPageSize", "Height")) != NULL)
+       {
+         pos = atoi(attr->value) - 1;
+
+          if (pos < 0 || pos > 4)
+           pos = 1;
+       }
+       else
+         pos = 1;
+
+       values[pos] = (int)size->length;
+
+        snprintf(buf, sizeof(buf), "%d %d %d %d %d\n", values[0], values[1],
+                values[2], values[3], values[4]);
 
        if (write(fd, buf, strlen(buf)) < 1)
        {
@@ -555,5 +631,5 @@ ppd_sort(ppd_choice_t **c1, /* I - First choice */
 
 
 /*
- * End of "$Id: emit.c,v 1.23.2.7 2003/02/28 21:07:32 mike Exp $".
+ * End of "$Id: emit.c,v 1.23.2.8 2003/05/25 14:43:34 mike Exp $".
  */