New rotation system (see forum thread).

Major changes:
  - when rotating, the top left corner of the rectangle stays in place.
  - ValueViewers get a dc that is pre-rotated/translated for them, i.e. (0,0) is the top-left of the viewer (with ValueViewer::getRotation).
  - moved 'angle' from individual Styles to the Style base class.
  - any rotation angle is now possible. angle is still an int for now.

This warrants a version bump

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@782 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2007-12-23 21:58:58 +00:00
parent 94e4a1ce9e
commit b79f52db84
47 changed files with 498 additions and 371 deletions
+5 -3
View File
@@ -44,6 +44,7 @@ void DataViewer::draw(RotatedDC& dc, const Color& background) {
bool changed_content_properties = false;
FOR_EACH(v, viewers) { // draw low z index fields first
if (v->getStyle()->visible) {
Rotater r(dc, v->getRotation());
try {
if (v->prepare(dc)) {
changed_content_properties = true;
@@ -59,6 +60,7 @@ void DataViewer::draw(RotatedDC& dc, const Color& background) {
// draw viewers
FOR_EACH(v, viewers) { // draw low z index fields first
if (v->getStyle()->visible) {// visible
Rotater r(dc, v->getRotation());
try {
drawViewer(dc, *v);
} catch (const Error& e) {
@@ -104,7 +106,7 @@ Context& DataViewer::getContext() const { return set->getContext(card); }
Rotation DataViewer::getRotation() const {
if (!stylesheet) stylesheet = set->stylesheet;
StyleSheetSettings& ss = settings.stylesheetSettingsFor(*stylesheet);
return Rotation(ss.card_angle(), stylesheet->getCardRect(), ss.card_zoom(), 1.0, true);
return Rotation(ss.card_angle(), stylesheet->getCardRect(), ss.card_zoom(), 1.0, ROTATION_ATTACH_TOP_LEFT);
}
// ----------------------------------------------------------------------------- : Setting data
@@ -154,8 +156,8 @@ void DataViewer::addStyles(IndexMap<FieldP,StyleP>& styles) {
FOR_EACH(s, styles) {
if ((s->visible || s->visible.isScripted()) &&
(nativeLook() || (
(s->width || s->width .isScripted() || s->right || s->right .isScripted()) &&
(s->height || s->height .isScripted() || s->bottom || s->bottom.isScripted())))) {
(s->width != -1 || s->width .isScripted() || s->right != -1 || s->right .isScripted()) &&
(s->height != -1 || s->height .isScripted() || s->bottom != -1 || s->bottom.isScripted())))) {
// no need to make a viewer for things that are always invisible
ValueViewerP viewer = makeViewer(s);
if (viewer) viewers.push_back(viewer);