Removed last of the BeginDrawing/EndDrawing calls;

Added english_number_ordinal script function;
Working on symbols with a different aspect ratio (i.e. wider/smaller symbols)

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@558 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2007-07-12 17:01:07 +00:00
parent b21192646b
commit d590819762
22 changed files with 137 additions and 54 deletions
-4
View File
@@ -26,9 +26,7 @@ AboutWindow::AboutWindow(Window* parent)
void AboutWindow::onPaint(wxPaintEvent& ev) {
wxBufferedPaintDC dc(this);
dc.BeginDrawing();
draw(dc);
dc.EndDrawing();
}
void AboutWindow::draw(DC& dc) {
@@ -151,9 +149,7 @@ void HoverButton::refreshIfNeeded() {
void HoverButton::onPaint(wxPaintEvent&) {
wxPaintDC dc(this);
dc.BeginDrawing();
draw(dc);
dc.EndDrawing();
}
void HoverButton::draw(DC& dc) {
// clear background (for transparent button images)
-4
View File
@@ -104,10 +104,6 @@ class CardViewer::OverdrawDC : private wxClientDC, public wxBufferedDC {
: wxClientDC(window)
{
wxBufferedDC::Init((wxClientDC*)this, window->buffer);
wxBufferedDC::BeginDrawing();
}
~OverdrawDC() {
wxBufferedDC::EndDrawing();
}
};
-2
View File
@@ -232,9 +232,7 @@ void DropDownList::redrawArrowOnParent() {
void DropDownList::onPaint(wxPaintEvent&) {
wxBufferedPaintDC dc(this);
dc.BeginDrawing();
draw(dc);
dc.EndDrawing();
}
void DropDownList::draw(DC& dc) {
-4
View File
@@ -353,9 +353,7 @@ wxSize ImageSlicePreview::DoGetBestSize() const {
void ImageSlicePreview::onPaint(wxPaintEvent&) {
wxPaintDC dc(this);
dc.BeginDrawing();
draw(dc);
dc.EndDrawing();
}
void ImageSlicePreview::draw(DC& dc) {
if (!bitmap.Ok()) {
@@ -436,9 +434,7 @@ void ImageSliceSelector::onSize(wxSizeEvent&) {
void ImageSliceSelector::onPaint(wxPaintEvent&) {
wxBufferedPaintDC dc(this);
dc.BeginDrawing();
draw(dc);
dc.EndDrawing();
}
void ImageSliceSelector::draw(DC& dc) {
if (!bitmap.Ok()) createBitmap();
+3 -3
View File
@@ -66,9 +66,9 @@ class SetWindowPanel : public wxPanel, public SetView {
virtual bool doReplaceAll(wxFindReplaceData&) { return false; } ///< Replace all matches
// --------------------------------------------------- : Selection
virtual CardP selectedCard() const; ///< Return the currently selected card, or CardP()
virtual void selectCard(const CardP& card) {} ///< Switch the view to another card
virtual void selectFirstCard() {} ///< Switch the view to the first card
virtual CardP selectedCard() const; ///< Return the currently selected card, or CardP()
virtual void selectCard(const CardP& card) {} ///< Switch the view to another card, can be null
virtual void selectFirstCard() {} ///< Switch the view to the first card
};
// ----------------------------------------------------------------------------- : EOF
+2 -2
View File
@@ -84,7 +84,7 @@ void StylePanel::onAction(const Action& action, bool undone) {
}
use_for_all->Enable(card && card->stylesheet);
use_custom_options->Enable(card);
use_custom_options->SetValue(card->has_styling);
use_custom_options->SetValue(card ? card->has_styling : false);
}
// ----------------------------------------------------------------------------- : Selection
@@ -97,7 +97,7 @@ void StylePanel::selectCard(const CardP& card) {
list->select(set->stylesheetFor(card).name(), false);
use_for_all->Enable(card && card->stylesheet);
use_custom_options->Enable(card);
use_custom_options->SetValue(card->has_styling);
use_custom_options->SetValue(card ? card->has_styling : false);
}
// ----------------------------------------------------------------------------- : Events
+17 -15
View File
@@ -177,20 +177,18 @@ void SymbolControl::draw(DC& dc) {
SymbolViewer::draw(dc);
// draw grid
if (settings.symbol_grid) {
RotatedDC rdc(dc, rotation, QUALITY_LOW);
double lines = settings.symbol_grid_size;
double end = rotation.trS(1);
for (int i = 0 ; i <= lines ; ++i) {
int x = (int) floor(rotation.trS(i/lines-0.0001));
//dc.SetPen(Color(0, i%5 == 0 ? 64 : 31, 0));
//dc.SetPen(Color(i%5 == 0 ? 64 : 31, 0, 0));
dc.SetLogicalFunction(wxAND);
dc.SetPen(i%5 == 0 ? Color(191,255,191) : Color(191, 255, 191));
dc.DrawLine(x, 0, x, end);
dc.DrawLine(0, x, end, x);
dc.SetLogicalFunction(wxOR);
dc.SetPen(i%5 == 0 ? Color(0,63,0) : Color(0, 31, 0));
dc.DrawLine(x, 0, x, end);
dc.DrawLine(0, x, end, x);
double x = (double)i/lines;
rdc.SetLogicalFunction(wxAND);
rdc.SetPen(i%5 == 0 ? Color(191,255,191) : Color(191, 255, 191));
rdc.DrawLine(RealPoint(0,x), RealPoint(1,x));
rdc.DrawLine(RealPoint(x,0), RealPoint(x,1));
rdc.SetLogicalFunction(wxOR);
rdc.SetPen(i%5 == 0 ? Color(0,63,0) : Color(0, 31, 0));
rdc.DrawLine(RealPoint(0,x), RealPoint(1,x));
rdc.DrawLine(RealPoint(x,0), RealPoint(x,1));
}
dc.SetLogicalFunction(wxCOPY);
}
@@ -201,9 +199,7 @@ void SymbolControl::draw(DC& dc) {
}
void SymbolControl::onPaint(wxPaintEvent&) {
wxBufferedPaintDC dc(this);
dc.BeginDrawing();
draw(dc);
dc.EndDrawing();
}
// ----------------------------------------------------------------------------- : Events
@@ -256,7 +252,13 @@ void SymbolControl::onChar(wxKeyEvent& ev) {
void SymbolControl::onSize(wxSizeEvent& ev) {
wxSize s = GetClientSize();
setZoom(min(s.GetWidth(), s.GetHeight()));
int zoom = min(s.x, s.y);
setZoom(zoom);
if (s.x > zoom) {
setOrigin(Vector2D((s.x - zoom) * 0.5, 0));
} else {
setOrigin(Vector2D(0, (s.y - zoom) * 0.5));
}
Refresh(false);
}
void SymbolControl::onUpdateUI(wxUpdateUIEvent& ev) {
+3 -3
View File
@@ -497,13 +497,13 @@ const Image& SymbolPartList::itemPreview(int i, const SymbolPartP& part) {
if (s->combine == SYMBOL_COMBINE_SUBTRACT) {
// temporarily render using subtract instead, otherwise we don't see anything
s->combine = SYMBOL_COMBINE_BORDER;
img = render_symbol(sym, filter, 0.08, ITEM_HEIGHT * 4, true);
img = render_symbol(sym, filter, 0.08, ITEM_HEIGHT * 4, ITEM_HEIGHT * 4, true);
s->combine = SYMBOL_COMBINE_SUBTRACT;
} else {
img = render_symbol(sym, filter, 0.08, ITEM_HEIGHT * 4, true);
img = render_symbol(sym, filter, 0.08, ITEM_HEIGHT * 4, ITEM_HEIGHT * 4, true);
}
} else {
img = render_symbol(sym, filter, 0.08, ITEM_HEIGHT * 4, true);
img = render_symbol(sym, filter, 0.08, ITEM_HEIGHT * 4, ITEM_HEIGHT * 4, true);
}
resample(img, p.image);
p.up_to_date = true;