Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
magicseteditor
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
magicseteditor
Commits
111264d7
Commit
111264d7
authored
Feb 02, 2011
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added option to disable spacing between printed cards
parent
59c6ab4c
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
138 additions
and
159 deletions
+138
-159
src/data/settings.cpp
src/data/settings.cpp
+9
-0
src/data/settings.hpp
src/data/settings.hpp
+12
-0
src/gui/print_window.cpp
src/gui/print_window.cpp
+77
-144
src/gui/print_window.hpp
src/gui/print_window.hpp
+40
-15
No files found.
src/data/settings.cpp
View file @
111264d7
...
...
@@ -152,6 +152,13 @@ IMPLEMENT_REFLECTION_NO_SCRIPT(StyleSheetSettings) {
REFLECT
(
card_spellcheck_enabled
);
}
// ----------------------------------------------------------------------------- : Printing
IMPLEMENT_REFLECTION_ENUM
(
PageLayoutType
)
{
VALUE_N
(
"no space"
,
LAYOUT_NO_SPACE
);
VALUE_N
(
"equal space"
,
LAYOUT_EQUAL_SPACE
);
}
// ----------------------------------------------------------------------------- : Settings
Settings
settings
;
...
...
@@ -166,6 +173,7 @@ Settings::Settings()
,
symbol_grid_size
(
30
)
,
symbol_grid
(
true
)
,
symbol_grid_snap
(
false
)
,
print_layout
(
LAYOUT_NO_SPACE
)
#if USE_OLD_STYLE_UPDATE_CHECKER
,
updates_url
(
_
(
"http://magicseteditor.sourceforge.net/updates"
))
#endif
...
...
@@ -253,6 +261,7 @@ IMPLEMENT_REFLECTION_NO_SCRIPT(Settings) {
REFLECT
(
symbol_grid
);
REFLECT
(
symbol_grid_snap
);
REFLECT
(
default_game
);
REFLECT
(
print_layout
);
REFLECT
(
apprentice_location
);
#if USE_OLD_STYLE_UPDATE_CHECKER
REFLECT
(
updates_url
);
...
...
src/data/settings.hpp
View file @
111264d7
...
...
@@ -112,6 +112,14 @@ class StyleSheetSettings : public IntrusivePtrBase<StyleSheetSettings> {
DECLARE_REFLECTION
();
};
// ----------------------------------------------------------------------------- : Printing settings
enum
PageLayoutType
{
LAYOUT_NO_SPACE
,
LAYOUT_EQUAL_SPACE
//, LAYOUT_CUSTOM
};
// ----------------------------------------------------------------------------- : Settings
/// Class that holds MSE settings.
...
...
@@ -178,6 +186,10 @@ class Settings {
/// Get the options for an export template
IndexMap
<
FieldP
,
ValueP
>&
exportOptionsFor
(
const
ExportTemplate
&
export_template
);
// --------------------------------------------------- : Printing
PageLayoutType
print_layout
;
// --------------------------------------------------- : Special game stuff
String
apprentice_location
;
...
...
src/gui/print_window.cpp
View file @
111264d7
This diff is collapsed.
Click to expand it.
src/gui/print_window.hpp
View file @
111264d7
...
...
@@ -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?
PageLayout
();
void
init
(
const
StyleSheet
&
stylesheet
,
PageLayoutType
layout_type
,
const
RealSize
&
page_size
);
/// Is this layout uninitialized?
inline
bool
empty
()
const
{
return
cards_per_page
()
==
0
;
}
/// The number of cards per page
inline
int
cardsPerPage
()
const
{
return
rows
*
cols
;
}
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
;
private:
DECLARE_REFLECTION
();
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment