mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-21 23:09:40 +00:00
cosmetics
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24370 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
a125dab7fd
commit
c206a3953e
@ -12,66 +12,37 @@
|
|||||||
|
|
||||||
#include "PrinterParams.h"
|
#include "PrinterParams.h"
|
||||||
|
|
||||||
#include "support/lstrings.h"
|
#include "LyXRC.h"
|
||||||
|
|
||||||
#include "support/assert.h"
|
#include "support/assert.h"
|
||||||
|
#include "support/lstrings.h"
|
||||||
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
namespace lyx {
|
namespace lyx {
|
||||||
|
|
||||||
|
PrinterParams::PrinterParams()
|
||||||
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)
|
|
||||||
{
|
{
|
||||||
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();
|
testInvariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PrinterParams::testInvariant() const
|
void PrinterParams::testInvariant() const
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_ASSERTIONS
|
|
||||||
switch (target) {
|
switch (target) {
|
||||||
case PRINTER:
|
case PRINTER:
|
||||||
//LASSERT(!printer_name.empty(), /**/);
|
LASSERT(!printer_name.empty(), /**/);
|
||||||
break;
|
break;
|
||||||
case FILE:
|
case FILE:
|
||||||
LASSERT(!file_name.empty(), /**/);
|
LASSERT(!file_name.empty(), /**/);
|
||||||
@ -80,7 +51,6 @@ void PrinterParams::testInvariant() const
|
|||||||
LASSERT(false, /**/);
|
LASSERT(false, /**/);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
#ifndef PRINTERPARAMS_H
|
#ifndef PRINTERPARAMS_H
|
||||||
#define PRINTERPARAMS_H
|
#define PRINTERPARAMS_H
|
||||||
|
|
||||||
#include "LyXRC.h"
|
#include <string>
|
||||||
|
|
||||||
|
|
||||||
namespace lyx {
|
namespace lyx {
|
||||||
@ -25,8 +25,12 @@ namespace lyx {
|
|||||||
document with different orientation, papersize or single/duplex state
|
document with different orientation, papersize or single/duplex state
|
||||||
than the document's settings. ARRae 20000423
|
than the document's settings. ARRae 20000423
|
||||||
*/
|
*/
|
||||||
class PrinterParams {
|
class PrinterParams
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
|
///
|
||||||
|
PrinterParams();
|
||||||
|
|
||||||
///
|
///
|
||||||
enum Target {
|
enum Target {
|
||||||
///
|
///
|
||||||
@ -34,6 +38,14 @@ public:
|
|||||||
///
|
///
|
||||||
FILE
|
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;
|
Target target;
|
||||||
///
|
///
|
||||||
@ -72,25 +84,6 @@ public:
|
|||||||
// Override document settings for duplex.
|
// Override document settings for duplex.
|
||||||
// bool 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);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,11 +20,12 @@
|
|||||||
#include "Buffer.h"
|
#include "Buffer.h"
|
||||||
#include "BufferParams.h"
|
#include "BufferParams.h"
|
||||||
#include "FuncRequest.h"
|
#include "FuncRequest.h"
|
||||||
#include "support/gettext.h"
|
#include "LyXRC.h"
|
||||||
|
|
||||||
#include "support/convert.h"
|
#include "support/convert.h"
|
||||||
#include "support/FileFilterList.h"
|
#include "support/FileFilterList.h"
|
||||||
#include "support/filetools.h"
|
#include "support/filetools.h"
|
||||||
|
#include "support/gettext.h"
|
||||||
#include "support/os.h"
|
#include "support/os.h"
|
||||||
|
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
@ -157,22 +158,18 @@ void GuiPrint::updateContents()
|
|||||||
|
|
||||||
void GuiPrint::applyView()
|
void GuiPrint::applyView()
|
||||||
{
|
{
|
||||||
PrinterParams::Target t = PrinterParams::PRINTER;
|
params_.target = fileRB->isChecked()
|
||||||
if (fileRB->isChecked())
|
? PrinterParams::FILE : PrinterParams::PRINTER;
|
||||||
t = PrinterParams::FILE;
|
params_.printer_name = fromqstr(printerED->text());
|
||||||
|
params_.file_name = os::internal_path(fromqstr(fileED->text()));
|
||||||
params_ = PrinterParams(t,
|
params_.all_pages = allRB->isChecked();
|
||||||
fromqstr(printerED->text()),
|
params_.from_page = fromED->text().toUInt();
|
||||||
os::internal_path(fromqstr(fileED->text())),
|
params_.to_page = toED->text().toUInt();
|
||||||
allRB->isChecked(),
|
params_.odd_pages = oddCB->isChecked();
|
||||||
fromED->text().toUInt(),
|
params_.even_pages = evenCB->isChecked();
|
||||||
toED->text().toUInt(),
|
params_.count_copies = copiesSB->text().toUInt();
|
||||||
oddCB->isChecked(),
|
params_.sorted_copies = collateCB->isChecked();
|
||||||
evenCB->isChecked(),
|
params_.reverse_order = reverseCB->isChecked();
|
||||||
copiesSB->text().toUInt(),
|
|
||||||
collateCB->isChecked(),
|
|
||||||
reverseCB->isChecked()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -181,7 +178,8 @@ bool GuiPrint::initialiseParams(string const &)
|
|||||||
/// get global printer parameters
|
/// get global printer parameters
|
||||||
string const name = support::changeExtension(buffer().absFileName(),
|
string const name = support::changeExtension(buffer().absFileName(),
|
||||||
lyxrc.print_file_extension);
|
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
|
setButtonsValid(true); // so that the user can press Ok
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user