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
7b570b21
Commit
7b570b21
authored
Dec 22, 2006
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rotation and style changing works
parent
11181f53
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
82 additions
and
52 deletions
+82
-52
src/data/action/set.cpp
src/data/action/set.cpp
+9
-0
src/data/action/set.hpp
src/data/action/set.hpp
+9
-2
src/data/format/image.cpp
src/data/format/image.cpp
+1
-1
src/gui/control/card_viewer.cpp
src/gui/control/card_viewer.cpp
+1
-4
src/gui/control/native_look_editor.cpp
src/gui/control/native_look_editor.cpp
+2
-2
src/gui/control/text_ctrl.cpp
src/gui/control/text_ctrl.cpp
+1
-1
src/gui/set/cards_panel.cpp
src/gui/set/cards_panel.cpp
+9
-3
src/gui/set/style_panel.cpp
src/gui/set/style_panel.cpp
+2
-0
src/gui/set/window.cpp
src/gui/set/window.cpp
+10
-12
src/render/card/viewer.cpp
src/render/card/viewer.cpp
+16
-11
src/render/card/viewer.hpp
src/render/card/viewer.hpp
+4
-5
src/render/value/choice.cpp
src/render/value/choice.cpp
+3
-3
src/util/rotation.cpp
src/util/rotation.cpp
+7
-4
src/util/rotation.hpp
src/util/rotation.hpp
+8
-4
No files found.
src/data/action/set.cpp
View file @
7b570b21
...
@@ -80,6 +80,14 @@ void ReorderCardsAction::perform(bool to_undo) {
...
@@ -80,6 +80,14 @@ void ReorderCardsAction::perform(bool to_undo) {
// ----------------------------------------------------------------------------- : Change stylesheet
// ----------------------------------------------------------------------------- : Change stylesheet
String
DisplayChangeAction
::
getName
(
bool
to_undo
)
const
{
assert
(
false
);
return
_
(
""
);
}
void
DisplayChangeAction
::
perform
(
bool
to_undo
)
{
assert
(
false
);
}
String
ChangeCardStyleAction
::
getName
(
bool
to_undo
)
const
{
String
ChangeCardStyleAction
::
getName
(
bool
to_undo
)
const
{
return
_
(
"Change style"
);
return
_
(
"Change style"
);
...
@@ -88,6 +96,7 @@ void ChangeCardStyleAction::perform(bool to_undo) {
...
@@ -88,6 +96,7 @@ void ChangeCardStyleAction::perform(bool to_undo) {
swap
(
card
->
stylesheet
,
stylesheet
);
swap
(
card
->
stylesheet
,
stylesheet
);
}
}
String
ChangeSetStyleAction
::
getName
(
bool
to_undo
)
const
{
String
ChangeSetStyleAction
::
getName
(
bool
to_undo
)
const
{
return
_
(
"Change style (all cards)"
);
return
_
(
"Change style (all cards)"
);
}
}
...
...
src/data/action/set.hpp
View file @
7b570b21
...
@@ -76,8 +76,15 @@ class ReorderCardsAction : public CardListAction {
...
@@ -76,8 +76,15 @@ class ReorderCardsAction : public CardListAction {
// ----------------------------------------------------------------------------- : Change stylesheet
// ----------------------------------------------------------------------------- : Change stylesheet
/// An action that affects the rendering/display/look of a set or cards in the set
class
DisplayChangeAction
:
public
Action
{
public:
virtual
String
getName
(
bool
to_undo
)
const
;
virtual
void
perform
(
bool
to_undo
);
};
/// Changing the style of a a card
/// Changing the style of a a card
class
ChangeCardStyleAction
:
public
Action
{
class
ChangeCardStyleAction
:
public
DisplayChange
Action
{
public:
public:
ChangeCardStyleAction
(
const
CardP
&
card
,
const
StyleSheetP
&
stylesheet
)
ChangeCardStyleAction
(
const
CardP
&
card
,
const
StyleSheetP
&
stylesheet
)
:
card
(
card
),
stylesheet
(
stylesheet
)
{}
:
card
(
card
),
stylesheet
(
stylesheet
)
{}
...
@@ -91,7 +98,7 @@ class ChangeCardStyleAction : public Action {
...
@@ -91,7 +98,7 @@ class ChangeCardStyleAction : public Action {
};
};
/// Changing the style of a set to that of a card
/// Changing the style of a set to that of a card
class
ChangeSetStyleAction
:
public
Action
{
class
ChangeSetStyleAction
:
public
DisplayChange
Action
{
public:
public:
ChangeSetStyleAction
(
Set
&
set
,
const
CardP
&
card
)
ChangeSetStyleAction
(
Set
&
set
,
const
CardP
&
card
)
:
set
(
set
),
card
(
card
)
{}
:
set
(
set
),
card
(
card
)
{}
...
...
src/data/format/image.cpp
View file @
7b570b21
...
@@ -32,7 +32,7 @@ Bitmap export_bitmap(const SetP& set, const CardP& card) {
...
@@ -32,7 +32,7 @@ Bitmap export_bitmap(const SetP& set, const CardP& card) {
// viewer.rotation.angle = 0;
// viewer.rotation.angle = 0;
// viewer.rotation.zoom = 1.0;
// viewer.rotation.zoom = 1.0;
}
}
RealSize
size
=
viewer
.
getRotation
().
getExternal
Rect
().
s
ize
();
RealSize
size
=
viewer
.
getRotation
().
getExternal
S
ize
();
// create bitmap & dc
// create bitmap & dc
Bitmap
bitmap
(
size
.
width
,
size
.
height
);
Bitmap
bitmap
(
size
.
width
,
size
.
height
);
if
(
!
bitmap
.
Ok
())
throw
InternalError
(
_
(
"Unable to create bitmap"
));
if
(
!
bitmap
.
Ok
())
throw
InternalError
(
_
(
"Unable to create bitmap"
));
...
...
src/gui/control/card_viewer.cpp
View file @
7b570b21
...
@@ -20,10 +20,7 @@ CardViewer::CardViewer(Window* parent, int id, long style)
...
@@ -20,10 +20,7 @@ CardViewer::CardViewer(Window* parent, int id, long style)
wxSize
CardViewer
::
DoGetBestSize
()
const
{
wxSize
CardViewer
::
DoGetBestSize
()
const
{
wxSize
ws
=
GetSize
(),
cs
=
GetClientSize
();
wxSize
ws
=
GetSize
(),
cs
=
GetClientSize
();
if
(
set
)
{
if
(
set
)
{
StyleSheetP
stylesheet
=
set
->
stylesheetFor
(
card
);
return
(
wxSize
)
getRotation
().
getExternalSize
()
+
ws
-
cs
;
if
(
stylesheet
)
{
return
wxSize
(
stylesheet
->
card_width
,
stylesheet
->
card_height
)
+
ws
-
cs
;
}
}
}
return
cs
;
return
cs
;
}
}
...
...
src/gui/control/native_look_editor.cpp
View file @
7b570b21
...
@@ -91,7 +91,7 @@ SetInfoEditor::SetInfoEditor(Window* parent, int id, long style)
...
@@ -91,7 +91,7 @@ SetInfoEditor::SetInfoEditor(Window* parent, int id, long style)
{}
{}
void
SetInfoEditor
::
onChangeSet
()
{
void
SetInfoEditor
::
onChangeSet
()
{
setStyles
(
set
->
stylesheet
->
set_info_style
);
setStyles
(
set
->
stylesheet
,
set
->
stylesheet
->
set_info_style
);
setData
(
set
->
data
);
setData
(
set
->
data
);
}
}
...
@@ -103,7 +103,7 @@ StylingEditor::StylingEditor(Window* parent, int id, long style)
...
@@ -103,7 +103,7 @@ StylingEditor::StylingEditor(Window* parent, int id, long style)
void
StylingEditor
::
showStylesheet
(
const
StyleSheetP
&
stylesheet
)
{
void
StylingEditor
::
showStylesheet
(
const
StyleSheetP
&
stylesheet
)
{
this
->
stylesheet
=
stylesheet
;
this
->
stylesheet
=
stylesheet
;
setStyles
(
stylesheet
->
styling_style
);
setStyles
(
s
et
->
stylesheet
,
s
tylesheet
->
styling_style
);
setData
(
set
->
stylingDataFor
(
*
stylesheet
));
setData
(
set
->
stylingDataFor
(
*
stylesheet
));
}
}
...
...
src/gui/control/text_ctrl.cpp
View file @
7b570b21
...
@@ -56,7 +56,7 @@ void TextCtrl::setValue(String* value) {
...
@@ -56,7 +56,7 @@ void TextCtrl::setValue(String* value) {
// assign to this control
// assign to this control
IndexMap
<
FieldP
,
StyleP
>
styles
;
styles
.
add
(
field
,
style
);
IndexMap
<
FieldP
,
StyleP
>
styles
;
styles
.
add
(
field
,
style
);
IndexMap
<
FieldP
,
ValueP
>
values
;
values
.
add
(
field
,
value
);
IndexMap
<
FieldP
,
ValueP
>
values
;
values
.
add
(
field
,
value
);
setStyles
(
styles
);
setStyles
(
s
et
->
stylesheet
,
s
tyles
);
setData
(
values
);
setData
(
values
);
// determine required height
// determine required height
viewers
.
front
()
->
getEditor
()
->
determineSize
();
viewers
.
front
()
->
getEditor
()
->
determineSize
();
...
...
src/gui/set/cards_panel.cpp
View file @
7b570b21
...
@@ -175,7 +175,7 @@ void CardsPanel::onCommand(int id) {
...
@@ -175,7 +175,7 @@ void CardsPanel::onCommand(int id) {
:
id
==
ID_CARD_ROTATE_180
?
180
:
id
==
ID_CARD_ROTATE_180
?
180
:
270
:
270
);
);
//onRenderSettingsChange(
);
set
->
actions
.
tellListeners
(
DisplayChangeAction
(),
true
);
break
;
break
;
}
}
case
ID_SELECT_COLUMNS
:
{
case
ID_SELECT_COLUMNS
:
{
...
@@ -196,8 +196,13 @@ bool CardsPanel::wantsToHandle(const Action&, bool undone) const {
...
@@ -196,8 +196,13 @@ bool CardsPanel::wantsToHandle(const Action&, bool undone) const {
return
false
;
return
false
;
}
}
void
CardsPanel
::
onAction
(
const
Action
&
action
,
bool
undo
)
{
void
CardsPanel
::
onAction
(
const
Action
&
action
,
bool
undone
)
{
// TODO
TYPE_CASE_
(
action
,
DisplayChangeAction
)
{
// The style changed, maybe also the size of editor
Layout
();
//if (current_panel) current_panel->Layout();
//fixMinWindowSize();
}
}
}
void
CardsPanel
::
onRenderSettingsChange
()
{
void
CardsPanel
::
onRenderSettingsChange
()
{
...
@@ -224,4 +229,5 @@ void CardsPanel::selectCard(const CardP& card) {
...
@@ -224,4 +229,5 @@ void CardsPanel::selectCard(const CardP& card) {
card_list
->
setCard
(
card
);
card_list
->
setCard
(
card
);
editor
->
setCard
(
card
);
editor
->
setCard
(
card
);
notes
->
setValue
(
card
?
&
card
->
notes
:
nullptr
);
notes
->
setValue
(
card
?
&
card
->
notes
:
nullptr
);
Layout
();
}
}
src/gui/set/style_panel.cpp
View file @
7b570b21
...
@@ -83,11 +83,13 @@ void StylePanel::onStyleSelect(wxCommandEvent&) {
...
@@ -83,11 +83,13 @@ void StylePanel::onStyleSelect(wxCommandEvent&) {
stylesheet
=
StyleSheetP
();
stylesheet
=
StyleSheetP
();
}
}
set
->
actions
.
add
(
new
ChangeCardStyleAction
(
card
,
stylesheet
));
set
->
actions
.
add
(
new
ChangeCardStyleAction
(
card
,
stylesheet
));
Layout
();
}
}
}
}
void
StylePanel
::
onUseForAll
(
wxCommandEvent
&
)
{
void
StylePanel
::
onUseForAll
(
wxCommandEvent
&
)
{
set
->
actions
.
add
(
new
ChangeSetStyleAction
(
*
set
,
card
));
set
->
actions
.
add
(
new
ChangeSetStyleAction
(
*
set
,
card
));
Layout
();
}
}
BEGIN_EVENT_TABLE
(
StylePanel
,
wxPanel
)
BEGIN_EVENT_TABLE
(
StylePanel
,
wxPanel
)
...
...
src/gui/set/window.cpp
View file @
7b570b21
...
@@ -27,6 +27,7 @@
...
@@ -27,6 +27,7 @@
#include <data/card.hpp>
#include <data/card.hpp>
#include <data/settings.hpp>
#include <data/settings.hpp>
#include <data/format/formats.hpp>
#include <data/format/formats.hpp>
#include <data/action/set.hpp>
DECLARE_TYPEOF_COLLECTION
(
SetWindowPanel
*
);
DECLARE_TYPEOF_COLLECTION
(
SetWindowPanel
*
);
DECLARE_TYPEOF_COLLECTION
(
SetWindow
*
);
DECLARE_TYPEOF_COLLECTION
(
SetWindow
*
);
...
@@ -231,11 +232,11 @@ void SetWindow::onChangeSet() {
...
@@ -231,11 +232,11 @@ void SetWindow::onChangeSet() {
}
}
void
SetWindow
::
onAction
(
const
Action
&
action
,
bool
undone
)
{
void
SetWindow
::
onAction
(
const
Action
&
action
,
bool
undone
)
{
// TYPE_CASE_(action, SetStyleChange
) {
TYPE_CASE_
(
action
,
DisplayChangeAction
)
{
// // The style changed, maybe also the size of the viewer
// The style changed, maybe also the size of card viewers
//
Layout();
if
(
current_panel
)
current_panel
->
Layout
();
//
fixMinWindowSize();
fixMinWindowSize
();
//
}
}
}
}
...
@@ -517,13 +518,10 @@ void SetWindow::onReplaceAll(wxFindDialogEvent&) {
...
@@ -517,13 +518,10 @@ void SetWindow::onReplaceAll(wxFindDialogEvent&) {
void
SetWindow
::
onEditPreferences
(
wxCommandEvent
&
)
{
void
SetWindow
::
onEditPreferences
(
wxCommandEvent
&
)
{
PreferencesWindow
wnd
(
this
);
PreferencesWindow
wnd
(
this
);
wnd
.
ShowModal
();
if
(
wnd
.
ShowModal
()
==
wxID_OK
)
{
// if (wnd.ShowModal() == wxID_OK) {
// render settings may have changed, notify all windows
// // render settings may have changed, notify all windows
set
->
actions
.
tellListeners
(
DisplayChangeAction
(),
true
);
// FOR_EACH(m, setWindows) {
}
// m->onRenderSettingsChange();
// }
// }
}
}
...
...
src/render/card/viewer.cpp
View file @
7b570b21
...
@@ -14,6 +14,8 @@
...
@@ -14,6 +14,8 @@
#include <data/field.hpp>
#include <data/field.hpp>
#include <data/settings.hpp>
#include <data/settings.hpp>
#include <data/action/value.hpp>
#include <data/action/value.hpp>
#include <data/action/set.hpp>
#include <gui/util.hpp> // clearDC
DECLARE_TYPEOF_COLLECTION
(
ValueViewerP
);
DECLARE_TYPEOF_COLLECTION
(
ValueViewerP
);
typedef
IndexMap
<
FieldP
,
StyleP
>
IndexMap_FieldP_StyleP
;
typedef
IndexMap
<
FieldP
,
StyleP
>
IndexMap_FieldP_StyleP
;
...
@@ -25,17 +27,14 @@ DECLARE_TYPEOF_NO_REV(IndexMap_FieldP_StyleP);
...
@@ -25,17 +27,14 @@ DECLARE_TYPEOF_NO_REV(IndexMap_FieldP_StyleP);
// ----------------------------------------------------------------------------- : Drawing
// ----------------------------------------------------------------------------- : Drawing
void
DataViewer
::
draw
(
DC
&
dc
)
{
void
DataViewer
::
draw
(
DC
&
dc
)
{
StyleSheetP
stylesheet
=
set
->
stylesheetFor
(
card
);
StyleSheetSettings
&
ss
=
settings
.
stylesheetSettingsFor
(
*
stylesheet
);
StyleSheetSettings
&
ss
=
settings
.
stylesheetSettingsFor
(
*
stylesheet
);
RotatedDC
rdc
(
dc
,
ss
.
card_angle
(),
stylesheet
->
getCardRect
(),
ss
.
card_zoom
(),
ss
.
card_anti_alias
()
&&
!
nativeLook
());
RotatedDC
rdc
(
dc
,
ss
.
card_angle
(),
stylesheet
->
getCardRect
(),
ss
.
card_zoom
(),
ss
.
card_anti_alias
()
&&
!
nativeLook
()
,
true
);
draw
(
rdc
,
s
et
->
s
tylesheet
->
card_background
);
draw
(
rdc
,
stylesheet
->
card_background
);
}
}
void
DataViewer
::
draw
(
RotatedDC
&
dc
,
const
Color
&
background
)
{
void
DataViewer
::
draw
(
RotatedDC
&
dc
,
const
Color
&
background
)
{
if
(
!
set
)
return
;
// no set specified, don't draw anything
if
(
!
set
)
return
;
// no set specified, don't draw anything
// fill with background color
// fill with background color
dc
.
SetPen
(
*
wxTRANSPARENT_PEN
);
clearDC
(
dc
.
getDC
(),
background
);
dc
.
SetBrush
(
background
);
dc
.
DrawRectangle
(
dc
.
getInternalRect
());
// update style scripts
// update style scripts
if
(
card
)
set
->
updateFor
(
card
);
if
(
card
)
set
->
updateFor
(
card
);
// draw values
// draw values
...
@@ -59,9 +58,8 @@ ValueViewer* DataViewer::focusedViewer() const { return nullptr; }
...
@@ -59,9 +58,8 @@ ValueViewer* DataViewer::focusedViewer() const { return nullptr; }
Context
&
DataViewer
::
getContext
()
const
{
return
set
->
getContext
();
}
Context
&
DataViewer
::
getContext
()
const
{
return
set
->
getContext
();
}
Rotation
DataViewer
::
getRotation
()
const
{
Rotation
DataViewer
::
getRotation
()
const
{
StyleSheetP
stylesheet
=
set
->
stylesheetFor
(
card
);
StyleSheetSettings
&
ss
=
settings
.
stylesheetSettingsFor
(
*
stylesheet
);
StyleSheetSettings
&
ss
=
settings
.
stylesheetSettingsFor
(
*
stylesheet
);
return
Rotation
(
ss
.
card_angle
(),
stylesheet
->
getCardRect
(),
ss
.
card_zoom
());
return
Rotation
(
ss
.
card_angle
(),
stylesheet
->
getCardRect
(),
ss
.
card_zoom
()
,
true
);
}
}
// ----------------------------------------------------------------------------- : Setting data
// ----------------------------------------------------------------------------- : Setting data
...
@@ -70,7 +68,8 @@ void DataViewer::setCard(const CardP& card) {
...
@@ -70,7 +68,8 @@ void DataViewer::setCard(const CardP& card) {
if
(
!
card
)
return
;
// TODO: clear editor?
if
(
!
card
)
return
;
// TODO: clear editor?
assert
(
set
);
assert
(
set
);
this
->
card
=
card
;
this
->
card
=
card
;
setStyles
(
set
->
stylesheet
->
card_style
);
stylesheet
=
set
->
stylesheetFor
(
card
);
setStyles
(
stylesheet
,
stylesheet
->
card_style
);
setData
(
card
->
data
);
setData
(
card
->
data
);
}
}
...
@@ -82,11 +81,12 @@ struct CompareViewer {
...
@@ -82,11 +81,12 @@ struct CompareViewer {
}
}
};
};
void
DataViewer
::
setStyles
(
IndexMap
<
FieldP
,
StyleP
>&
styles
)
{
void
DataViewer
::
setStyles
(
const
StyleSheetP
&
stylesheet
,
IndexMap
<
FieldP
,
StyleP
>&
styles
)
{
if
(
!
viewers
.
empty
()
&&
styles
.
contains
(
viewers
.
front
()
->
getStyle
()))
{
if
(
!
viewers
.
empty
()
&&
styles
.
contains
(
viewers
.
front
()
->
getStyle
()))
{
// already using these styles
// already using these styles
return
;
return
;
}
}
this
->
stylesheet
=
stylesheet
;
// create viewers
// create viewers
viewers
.
clear
();
viewers
.
clear
();
FOR_EACH
(
s
,
styles
)
{
FOR_EACH
(
s
,
styles
)
{
...
@@ -117,6 +117,11 @@ ValueViewerP DataViewer::makeViewer(const StyleP& style) {
...
@@ -117,6 +117,11 @@ ValueViewerP DataViewer::makeViewer(const StyleP& style) {
}
}
void
DataViewer
::
onAction
(
const
Action
&
action
,
bool
undone
)
{
void
DataViewer
::
onAction
(
const
Action
&
action
,
bool
undone
)
{
TYPE_CASE_
(
action
,
DisplayChangeAction
)
{
// refresh
setCard
(
card
);
return
;
}
TYPE_CASE
(
action
,
ValueAction
)
{
TYPE_CASE
(
action
,
ValueAction
)
{
FOR_EACH
(
v
,
viewers
)
{
FOR_EACH
(
v
,
viewers
)
{
if
(
v
->
getValue
()
==
action
.
valueP
)
{
if
(
v
->
getValue
()
==
action
.
valueP
)
{
...
...
src/render/card/viewer.hpp
View file @
7b570b21
...
@@ -21,10 +21,7 @@ class Context;
...
@@ -21,10 +21,7 @@ class Context;
/// A viewer can generate an image of some values, usually a card.
/// A viewer can generate an image of some values, usually a card.
class
DataViewer
:
public
SetView
{
class
DataViewer
:
public
SetView
{
public:
public:
/// Rotation and zoom to use when drawing
// Rotation rotation;
// --------------------------------------------------- : Drawing
// --------------------------------------------------- : Drawing
/// Draw the current (card/data) to the given dc
/// Draw the current (card/data) to the given dc
...
@@ -63,7 +60,7 @@ class DataViewer : public SetView {
...
@@ -63,7 +60,7 @@ class DataViewer : public SetView {
// --------------------------------------------------- : The viewers
// --------------------------------------------------- : The viewers
protected:
protected:
/// Set the styles for the data to be shown, recreating the viewers
/// Set the styles for the data to be shown, recreating the viewers
void
setStyles
(
IndexMap
<
FieldP
,
StyleP
>&
styles
);
void
setStyles
(
const
StyleSheetP
&
stylesheet
,
IndexMap
<
FieldP
,
StyleP
>&
styles
);
/// Set the data to be shown in the viewers, refresh them
/// Set the data to be shown in the viewers, refresh them
void
setData
(
IndexMap
<
FieldP
,
ValueP
>&
values
);
void
setData
(
IndexMap
<
FieldP
,
ValueP
>&
values
);
...
@@ -82,6 +79,8 @@ class DataViewer : public SetView {
...
@@ -82,6 +79,8 @@ class DataViewer : public SetView {
vector
<
ValueViewerP
>
viewers
;
///< The viewers for the different values in the data
vector
<
ValueViewerP
>
viewers
;
///< The viewers for the different values in the data
CardP
card
;
///< The card that is currently displayed, if any
CardP
card
;
///< The card that is currently displayed, if any
public:
StyleSheetP
stylesheet
;
///< Stylesheet being used
};
};
// ----------------------------------------------------------------------------- : EOF
// ----------------------------------------------------------------------------- : EOF
...
...
src/render/value/choice.cpp
View file @
7b570b21
...
@@ -23,12 +23,12 @@ void ChoiceValueViewer::draw(RotatedDC& dc) {
...
@@ -23,12 +23,12 @@ void ChoiceValueViewer::draw(RotatedDC& dc) {
ScriptableImage
&
img
=
it
->
second
;
ScriptableImage
&
img
=
it
->
second
;
ScriptImageP
i
;
ScriptImageP
i
;
if
(
nativeLook
())
{
if
(
nativeLook
())
{
i
=
img
.
update
(
viewer
.
getContext
(),
*
getSet
()
.
stylesheet
,
16
,
16
,
ASPECT_BORDER
,
false
);
i
=
img
.
update
(
viewer
.
getContext
(),
*
viewer
.
stylesheet
,
16
,
16
,
ASPECT_BORDER
,
false
);
}
else
if
(
style
().
render_style
&
RENDER_TEXT
)
{
}
else
if
(
style
().
render_style
&
RENDER_TEXT
)
{
// also drawing text
// also drawing text
i
=
img
.
update
(
viewer
.
getContext
(),
*
getSet
()
.
stylesheet
,
0
,
0
);
i
=
img
.
update
(
viewer
.
getContext
(),
*
viewer
.
stylesheet
,
0
,
0
);
}
else
{
}
else
{
i
=
img
.
update
(
viewer
.
getContext
(),
*
getSet
()
.
stylesheet
,
i
=
img
.
update
(
viewer
.
getContext
(),
*
viewer
.
stylesheet
,
dc
.
trS
(
style
().
width
),
dc
.
trS
(
style
().
height
),
dc
.
trS
(
style
().
width
),
dc
.
trS
(
style
().
height
),
style
().
alignment
==
ALIGN_STRETCH
?
ASPECT_STRETCH
:
ASPECT_FIT
style
().
alignment
==
ALIGN_STRETCH
?
ASPECT_STRETCH
:
ASPECT_FIT
);
);
...
...
src/util/rotation.cpp
View file @
7b570b21
...
@@ -17,12 +17,15 @@ int constrain_angle(int angle) {
...
@@ -17,12 +17,15 @@ int constrain_angle(int angle) {
return
(
a
/
90
)
*
90
;
// multiple of 90
return
(
a
/
90
)
*
90
;
// multiple of 90
}
}
Rotation
::
Rotation
(
int
angle
,
const
RealRect
&
rect
,
double
zoom
)
Rotation
::
Rotation
(
int
angle
,
const
RealRect
&
rect
,
double
zoom
,
bool
is_internal
)
:
angle
(
constrain_angle
(
angle
))
:
angle
(
constrain_angle
(
angle
))
,
size
(
rect
.
size
())
,
size
(
rect
.
size
())
,
origin
(
rect
.
position
())
,
origin
(
rect
.
position
())
,
zoom
(
zoom
)
,
zoom
(
zoom
)
{
{
if
(
is_internal
)
{
size
=
trNoNeg
(
size
);
}
// set origin
// set origin
if
(
revX
())
origin
.
x
+=
size
.
width
;
if
(
revX
())
origin
.
x
+=
size
.
width
;
if
(
revY
())
origin
.
y
+=
size
.
height
;
if
(
revY
())
origin
.
y
+=
size
.
height
;
...
@@ -108,12 +111,12 @@ Rotater::~Rotater() {
...
@@ -108,12 +111,12 @@ Rotater::~Rotater() {
// ----------------------------------------------------------------------------- : RotatedDC
// ----------------------------------------------------------------------------- : RotatedDC
RotatedDC
::
RotatedDC
(
DC
&
dc
,
int
angle
,
const
RealRect
&
rect
,
double
zoom
,
bool
high_quality
)
RotatedDC
::
RotatedDC
(
DC
&
dc
,
int
angle
,
const
RealRect
&
rect
,
double
zoom
,
bool
high_quality
,
bool
is_internal
)
:
Rotation
(
angle
,
rect
,
zoom
)
:
Rotation
(
angle
,
rect
,
zoom
,
is_internal
)
,
dc
(
dc
),
high_quality
(
high_quality
)
,
dc
(
dc
),
high_quality
(
high_quality
)
{}
{}
RotatedDC
::
RotatedDC
(
DC
&
dc
,
const
Rotation
&
rotation
,
bool
high_quality
=
false
)
RotatedDC
::
RotatedDC
(
DC
&
dc
,
const
Rotation
&
rotation
,
bool
high_quality
)
:
Rotation
(
rotation
)
:
Rotation
(
rotation
)
,
dc
(
dc
),
high_quality
(
high_quality
&&
false
)
,
dc
(
dc
),
high_quality
(
high_quality
&&
false
)
{}
{}
...
...
src/util/rotation.hpp
View file @
7b570b21
...
@@ -22,9 +22,11 @@
...
@@ -22,9 +22,11 @@
*/
*/
class
Rotation
{
class
Rotation
{
public:
public:
/// Construct a rotation object with the given rectangle of external coordinates
/// Construct a rotation object
/// and a given rotation angle and zoom factor
/** with the given rectangle of external coordinates and a given rotation angle and zoom factor.
Rotation
(
int
angle
,
const
RealRect
&
rect
,
double
zoom
=
1.0
);
* if is_internal then the rect gives the internal coordinates, its origin should be (0,0)
*/
Rotation
(
int
angle
,
const
RealRect
&
rect
,
double
zoom
=
1.0
,
bool
is_internal
=
false
);
/// Change the zoom factor
/// Change the zoom factor
inline
void
setZoom
(
double
z
)
{
zoom
=
z
;
}
inline
void
setZoom
(
double
z
)
{
zoom
=
z
;
}
...
@@ -34,6 +36,8 @@ class Rotation {
...
@@ -34,6 +36,8 @@ class Rotation {
inline
RealSize
getInternalSize
()
const
{
return
trInvNoNeg
(
size
);
}
inline
RealSize
getInternalSize
()
const
{
return
trInvNoNeg
(
size
);
}
/// The intarnal rectangle (origin at (0,0))
/// The intarnal rectangle (origin at (0,0))
inline
RealRect
getInternalRect
()
const
{
return
RealRect
(
RealPoint
(
0
,
0
),
getInternalSize
());
}
inline
RealRect
getInternalRect
()
const
{
return
RealRect
(
RealPoint
(
0
,
0
),
getInternalSize
());
}
/// The size of the external rectangle (as passed to the constructor) == trNoNeg(getInternalSize())
inline
RealSize
getExternalSize
()
const
{
return
size
;
}
/// The external rectangle (as passed to the constructor) == trNoNeg(getInternalRect())
/// The external rectangle (as passed to the constructor) == trNoNeg(getInternalRect())
RealRect
getExternalRect
()
const
;
RealRect
getExternalRect
()
const
;
...
@@ -120,7 +124,7 @@ class Rotater {
...
@@ -120,7 +124,7 @@ class Rotater {
*/
*/
class
RotatedDC
:
public
Rotation
{
class
RotatedDC
:
public
Rotation
{
public:
public:
RotatedDC
(
DC
&
dc
,
int
angle
,
const
RealRect
&
rect
,
double
zoom
,
bool
high_quality
);
RotatedDC
(
DC
&
dc
,
int
angle
,
const
RealRect
&
rect
,
double
zoom
,
bool
high_quality
,
bool
is_internal
=
false
);
RotatedDC
(
DC
&
dc
,
const
Rotation
&
rotation
,
bool
high_quality
);
RotatedDC
(
DC
&
dc
,
const
Rotation
&
rotation
,
bool
high_quality
);
// --------------------------------------------------- : Drawing
// --------------------------------------------------- : Drawing
...
...
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