]> git.lyx.org Git - features.git/commitdiff
cosmetics
authorAndré Pönitz <poenitz@gmx.net>
Sat, 19 Apr 2008 20:39:48 +0000 (20:39 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Sat, 19 Apr 2008 20:39:48 +0000 (20:39 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24370 a592a061-630c-0410-9148-cb99ea01b6c8

src/PrinterParams.cpp
src/PrinterParams.h
src/frontends/qt4/GuiPrint.cpp

index 0518d27850d5eb8d7dbfef16a6352eb265f2bf30..0a6620f6c6d27f1d839f3828e6a284607ad482ad 100644 (file)
 
 #include "PrinterParams.h"
 
-#include "support/lstrings.h"
+#include "LyXRC.h"
 
 #include "support/assert.h"
+#include "support/lstrings.h"
 
 
-using namespace std;
-
 namespace lyx {
 
-
-PrinterParams::PrinterParams(Target t,
-                            string const & pname,
-                            string const & fname,
-                            bool all,
-                            unsigned int from,
-                            unsigned int to,
-                            bool odd,
-                            bool even,
-                            unsigned int copies,
-                            bool sorted,
-                            bool reverse)
-       : target(t),
-         printer_name(pname),
-         file_name(fname),
-         all_pages(all),
-         from_page(from),
-         to_page(to),
-         odd_pages(odd),
-         even_pages(even),
-         count_copies(copies),
-         sorted_copies(sorted),
-         reverse_order(reverse)
+PrinterParams::PrinterParams() 
 {
-       testInvariant();
-}
+       target = PRINTER;
+       printer_name = lyxrc.printer;
+       file_name = std::string();
+       all_pages = true;
+       from_page = 1;
+       to_page = 0;
+       odd_pages = true;
+       even_pages = true;
+       count_copies = 1;
+       sorted_copies = false;
+       reverse_order = false;
 
-
-PrinterParams::PrinterParams(PrinterParams const & pp)
-       : target(pp.target),
-         printer_name(pp.printer_name),
-         file_name(pp.file_name),
-         all_pages(pp.all_pages),
-         from_page(pp.from_page),
-         to_page(pp.to_page),
-         odd_pages(pp.odd_pages),
-         even_pages(pp.even_pages),
-         count_copies(pp.count_copies),
-         sorted_copies(pp.sorted_copies),
-         reverse_order(pp.reverse_order)
-{
        testInvariant();
 }
 
 
 void PrinterParams::testInvariant() const
 {
-#ifdef ENABLE_ASSERTIONS
        switch (target) {
        case PRINTER:
-               //LASSERT(!printer_name.empty(), /**/);
+               LASSERT(!printer_name.empty(), /**/);
                break;
        case FILE:
                LASSERT(!file_name.empty(), /**/);
@@ -80,7 +51,6 @@ void PrinterParams::testInvariant() const
                LASSERT(false, /**/);
                break;
        }
-#endif
 }
 
 
index 6ae9aa9be8678900ce32a3c3d904d52a9a72efc8..73b10c368ccb50ff178a7120f8148f3b83af7592 100644 (file)
@@ -12,7 +12,7 @@
 #ifndef PRINTERPARAMS_H
 #define PRINTERPARAMS_H
 
-#include "LyXRC.h"
+#include <string>
 
 
 namespace lyx {
@@ -25,8 +25,12 @@ namespace lyx {
   document with different orientation, papersize or single/duplex state
   than the document's settings. ARRae 20000423
 */
-class PrinterParams {
+class PrinterParams
+{
 public:
+       ///
+       PrinterParams();
+
        ///
        enum Target {
                ///
@@ -34,6 +38,14 @@ public:
                ///
                FILE
        };
+
+       /** Test that all the fields contain valid entries.  It's unlikely
+           that the internal code will get this wrong however new ports
+           and external scripts might drive the wrong values in.
+        */
+       void testInvariant() const;
+
+public:
        ///
        Target target;
        ///
@@ -72,25 +84,6 @@ public:
        // Override document settings for duplex.
        // bool duplex;
 
-       /** Test that all the fields contain valid entries.  It's unlikely
-           that the internal code will get this wrong however new ports
-           and external scripts might drive the wrong values in.
-        */
-       void testInvariant() const;
-       ///
-       PrinterParams(Target t = PRINTER,
-                     std::string const & pname = lyxrc.printer,
-                     std::string const & fname = std::string(),
-                     bool all = true,
-                     unsigned int from = 1,
-                     unsigned int to = 0,
-                     bool odd = true,
-                     bool even = true,
-                     unsigned int copies = 1,
-                     bool sorted = false,
-                     bool reverse = false);
-       ///
-       PrinterParams(PrinterParams const & pp);
 };
 
 
index aedba1b8859c59736bd920502b09e546abdf9452..20003e48ac5376f816bc34fc716369cd5d16c9fb 100644 (file)
 #include "Buffer.h"
 #include "BufferParams.h"
 #include "FuncRequest.h"
-#include "support/gettext.h"
+#include "LyXRC.h"
 
 #include "support/convert.h"
 #include "support/FileFilterList.h"
 #include "support/filetools.h"
+#include "support/gettext.h"
 #include "support/os.h"
 
 #include <QLineEdit>
@@ -157,22 +158,18 @@ void GuiPrint::updateContents()
 
 void GuiPrint::applyView()
 {
-       PrinterParams::Target t = PrinterParams::PRINTER;
-       if (fileRB->isChecked())
-               t = PrinterParams::FILE;
-
-       params_ = PrinterParams(t,
-               fromqstr(printerED->text()),
-               os::internal_path(fromqstr(fileED->text())),
-               allRB->isChecked(),
-               fromED->text().toUInt(),
-               toED->text().toUInt(),
-               oddCB->isChecked(),
-               evenCB->isChecked(),
-               copiesSB->text().toUInt(),
-               collateCB->isChecked(),
-               reverseCB->isChecked()
-       );
+       params_.target        = fileRB->isChecked()
+               ?  PrinterParams::FILE : PrinterParams::PRINTER;
+       params_.printer_name  = fromqstr(printerED->text());
+       params_.file_name     = os::internal_path(fromqstr(fileED->text()));
+       params_.all_pages     = allRB->isChecked();
+       params_.from_page     = fromED->text().toUInt();
+       params_.to_page       = toED->text().toUInt();
+       params_.odd_pages     = oddCB->isChecked();
+       params_.even_pages    = evenCB->isChecked();
+       params_.count_copies  = copiesSB->text().toUInt();
+       params_.sorted_copies = collateCB->isChecked();
+       params_.reverse_order = reverseCB->isChecked();
 }
 
 
@@ -181,7 +178,8 @@ bool GuiPrint::initialiseParams(string const &)
        /// get global printer parameters
        string const name = support::changeExtension(buffer().absFileName(),
                                        lyxrc.print_file_extension);
-       params_ = PrinterParams(PrinterParams::PRINTER, lyxrc.printer, name);
+       params_ = PrinterParams();
+       params_.file_name = name;
 
        setButtonsValid(true); // so that the user can press Ok
        return true;