]> mj.ucw.cz Git - paperjam.git/blobdiff - cmds.cc
Manual: Fix grammar errors found by LanguageTool
[paperjam.git] / cmds.cc
diff --git a/cmds.cc b/cmds.cc
index f16cd991138ec45ee042331bf12bd50303e11cd1..7fad3028cccd0d462b3ba2d7cd72c7d258319c1a 100644 (file)
--- a/cmds.cc
+++ b/cmds.cc
@@ -32,6 +32,11 @@ class xform_page : public page {
   pdf_matrix xform;
 public:
   void render(out_context *out, pdf_matrix xform) override;
+  void debug_dump() override
+    {
+      debug("Transform [%s]", xform.to_string().c_str());
+      orig_page->debug_dump();
+    }
   xform_page(page *p, pdf_matrix xf);
 };
 
@@ -199,8 +204,8 @@ public:
     {
       bb->x_min += l;
       bb->x_max -= r;
-      bb->y_min += b;
-      bb->y_max -= t;
+      bb->y_min += t;
+      bb->y_max -= b;
       if (bb->x_min >= bb->x_max || bb->y_min >= bb->y_max)
        err("Margins cannot be larger than the whole page");
     }
@@ -208,8 +213,8 @@ public:
     {
       bb->x_min -= l;
       bb->x_max += r;
-      bb->y_min -= b;
-      bb->y_max += t;
+      bb->y_min -= t;
+      bb->y_max += b;
     }
 };
 
@@ -575,7 +580,7 @@ vector<page *> select_cmd::process(vector<page *> &pages)
          int f = validate_page_index(pages, ps.from);
          int t = validate_page_index(pages, ps.to);
          int step = (f <= t) ? 1 : -1;
-         for (int i=f; i<=t; i += step)
+         for (int i=f; i != t + step; i += step)
            selected.push_back(pages[i]);
        }
       auto processed = run_command_list(pb->commands, selected);
@@ -718,6 +723,11 @@ public:
       out->contents += page_cm->pdf_stream(out, page_bbox, xform);
       out->contents += image_cm->pdf_stream(out, image_box, xform);
     }
+  void debug_dump() override
+    {
+      debug("Draw debugging boxes");
+      orig_page->debug_dump();
+    }
 };
 
 class debug_cmd : public cmd_exec_simple {
@@ -778,6 +788,14 @@ public:
       for (auto p: orig_pages)
        p->render(out, xform);
     }
+  void debug_dump() override
+    {
+      debug("Merge pages");
+      debug_indent += 4;
+      for (auto p: orig_pages)
+       p->debug_dump();
+      debug_indent -= 4;
+    }
 };
 
 vector<page *> merge_cmd::process(vector<page *> &pages)
@@ -1263,6 +1281,14 @@ public:
   cropmark_spec *cmarks;
   void render(out_context *out, pdf_matrix xform) override;
   nup_page(nup_state &st) : page(st.paper_w, st.paper_h) { }
+  void debug_dump() override
+    {
+      debug("N-up printing");
+      debug_indent += 4;
+      for (auto p: orig_pages)
+       p->debug_dump();
+      debug_indent -= 4;
+    }
 };
 
 void nup_page::render(out_context *out, pdf_matrix parent_xform)
@@ -1360,6 +1386,11 @@ public:
       orig_page->render(out, xform);
       out->contents += cm->pdf_stream(out, image_box, xform);
     }
+  void debug_dump() override
+    {
+      debug("Add cropmarks");
+      orig_page->debug_dump();
+    }
   cropmarks_page(page *p, cropmark_spec *cms) : page(p), orig_page(p), cm(cms) { }
 };
 
@@ -1390,6 +1421,11 @@ public:
       orig_page->render(out, xform);
       out->contents += "Q ";
     }
+  void debug_dump() override
+    {
+      debug("Clip [%.3f %.3f %.3f %.3f]", clip_to.x_min, clip_to.y_min, clip_to.x_max, clip_to.y_max);
+      orig_page->debug_dump();
+    }
   clip_page(page *p, BBox &to) : page(p), orig_page(p), clip_to(to) { }
 };