mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-12 13:37:00 -04:00
Added option to disable spacing between printed cards
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1646 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
+41
-16
@@ -12,27 +12,19 @@
|
||||
#include <util/prec.hpp>
|
||||
#include <util/reflect.hpp>
|
||||
#include <util/real_point.hpp>
|
||||
#include <data/settings.hpp>
|
||||
#include <gui/card_select_window.hpp>
|
||||
|
||||
DECLARE_POINTER_TYPE(Set);
|
||||
DECLARE_POINTER_TYPE(PrintJob);
|
||||
class StyleSheet;
|
||||
|
||||
// ----------------------------------------------------------------------------- : Printing
|
||||
|
||||
/// Show a print preview for the given set
|
||||
void print_preview(Window* parent, const SetP& set, const ExportCardSelectionChoices& choices);
|
||||
|
||||
/// Print the given set
|
||||
void print_set(Window* parent, const SetP& set, const ExportCardSelectionChoices& choices);
|
||||
|
||||
// ----------------------------------------------------------------------------- : Layout
|
||||
|
||||
/// Layout of a page of cards
|
||||
class PageLayout : public IntrusivePtrBase<PageLayout> {
|
||||
class PageLayout {
|
||||
public:
|
||||
PageLayout();
|
||||
PageLayout(const StyleSheet& stylesheet, const RealSize& page_size);
|
||||
|
||||
// layout
|
||||
RealSize page_size; ///< Size of a page (in millimetres)
|
||||
RealSize card_size; ///< Size of a card (in millimetres)
|
||||
RealSize card_spacing; ///< Spacing between cards (in millimetres)
|
||||
@@ -40,12 +32,45 @@ class PageLayout : public IntrusivePtrBase<PageLayout> {
|
||||
int rows, cols; ///< Number of rows/columns of cards
|
||||
bool card_landscape; ///< Are cards rotated to landscape orientation?
|
||||
|
||||
/// The number of cards per page
|
||||
inline int cardsPerPage() const { return rows * cols; }
|
||||
PageLayout();
|
||||
void init(const StyleSheet& stylesheet, PageLayoutType layout_type, const RealSize& page_size);
|
||||
|
||||
private:
|
||||
DECLARE_REFLECTION();
|
||||
/// Is this layout uninitialized?
|
||||
inline bool empty() const { return cards_per_page() == 0; }
|
||||
/// The number of cards per page
|
||||
inline int cards_per_page() const { return rows * cols; }
|
||||
};
|
||||
|
||||
class PrintJob : public IntrusivePtrBase<PrintJob> {
|
||||
public:
|
||||
PrintJob(SetP const& set) : set(set) {}
|
||||
|
||||
// set and cards to print
|
||||
SetP set;
|
||||
vector<CardP> cards;
|
||||
|
||||
// printing options
|
||||
PageLayoutType layout_type;
|
||||
PageLayout layout;
|
||||
|
||||
inline int num_pages() const {
|
||||
int cards_per_page = max(1,layout.cards_per_page());
|
||||
return (cards.size() + cards_per_page - 1) / cards_per_page;
|
||||
}
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------- : Printing
|
||||
|
||||
/// Make a print job, by asking the user for options, and card selection
|
||||
PrintJobP make_print_job(Window* parent, const SetP& set, const ExportCardSelectionChoices& choices);
|
||||
|
||||
/// Show a print preview for the given set
|
||||
void print_preview(Window* parent, const PrintJobP& job);
|
||||
void print_preview(Window* parent, const SetP& set, const ExportCardSelectionChoices& choices);
|
||||
|
||||
/// Print the given set
|
||||
void print_set(Window* parent, const PrintJobP& job);
|
||||
void print_set(Window* parent, const SetP& set, const ExportCardSelectionChoices& choices);
|
||||
|
||||
// ----------------------------------------------------------------------------- : EOF
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user