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 -5
View File
@@ -25,7 +25,7 @@ void SymbolValueEditor::draw(RotatedDC& dc) {
dc.SetFont(wxFont(10,wxSWISS,wxNORMAL,wxNORMAL));
dc.SetTextForeground(*wxBLACK);
RealSize text_size = dc.GetTextExtent(_("double click to edit symbol"));
dc.DrawText(_("double click to edit symbol"), align_in_rect(ALIGN_MIDDLE_CENTER, text_size, style().getRect()));
dc.DrawText(_("double click to edit symbol"), align_in_rect(ALIGN_MIDDLE_CENTER, text_size, style().getInternalRect()));
}
if (nativeLook()) {
// draw editor buttons
@@ -38,8 +38,8 @@ void SymbolValueEditor::drawButton(RotatedDC& dc, int button, const String& text
bool down = button == button_down;
double height = style().height;
double width = style().height + 2;
double x = style().right - width - (width + 1) * button;
double y = style().top;
double x = style().width - width - (width + 1) * button;
double y = 0;
// draw button
dc.SetPen(*wxTRANSPARENT_PEN);
dc.SetBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
@@ -60,8 +60,8 @@ void SymbolValueEditor::drawButton(RotatedDC& dc, int button, const String& text
}
int SymbolValueEditor::findButton(const RealPoint& pos) {
if (pos.y < style().top || pos.y >= style().bottom) return -1;
int button = (int)floor( (style().right - pos.x) / (style().height + 3) );
if (pos.y < 0 || pos.y >= style().height) return -1;
int button = (int)floor( (style().width - pos.x) / (style().height + 3) );
if (button >= 0 && button <= 1) return button;
return -1;
}