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
+3 -3
View File
@@ -38,7 +38,7 @@ wxSize CardViewer::DoGetBestSize() const {
void CardViewer::redraw(const ValueViewer& v) {
if (drawing) return;
up_to_date = false;
RefreshRect(getRotation().tr(v.boundingBox()), false);
RefreshRect(getRotation().trRectToBB(v.boundingBox()), false);
}
void CardViewer::onChange() {
@@ -98,7 +98,7 @@ bool CardViewer::shouldDraw(const ValueViewer& v) const {
// int dx = GetScrollPos(wxHORIZONTAL), dy = GetScrollPos(wxVERTICAL);
// wxRegion clip = GetUpdateRegion();
// clip.Offset(dx, dy);
return GetUpdateRegion().Contains(getRotation().tr(v.boundingBox().toRect()).toRect()) != wxOutRegion;
return GetUpdateRegion().Contains(getRotation().trRectToBB(v.boundingBox().toRect()).toRect()) != wxOutRegion;
}
// helper class for overdrawDC()
@@ -133,7 +133,7 @@ Rotation CardViewer::getRotation() const {
if (!stylesheet) stylesheet = set->stylesheet;
StyleSheetSettings& ss = settings.stylesheetSettingsFor(*stylesheet);
int dx = GetScrollPos(wxHORIZONTAL), dy = GetScrollPos(wxVERTICAL);
return Rotation(ss.card_angle(), stylesheet->getCardRect().move(-dx,-dy,0,0), ss.card_zoom(), 1.0, true);
return Rotation(ss.card_angle(), stylesheet->getCardRect().move(-dx,-dy,0,0), ss.card_zoom(), 1.0, ROTATION_ATTACH_TOP_LEFT);
}
// ----------------------------------------------------------------------------- : Event table