mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-11 05:07:00 -04:00
Added ScriptableImage plus the beginnings of dependency stuff
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@58 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
//+----------------------------------------------------------------------------+
|
||||
//| Description: Magic Set Editor - Program to make Magic (tm) cards |
|
||||
//| Copyright: (C) 2001 - 2006 Twan van Laarhoven |
|
||||
//| License: GNU General Public License 2 or later (see file COPYING) |
|
||||
//+----------------------------------------------------------------------------+
|
||||
|
||||
// ----------------------------------------------------------------------------- : Includes
|
||||
|
||||
#include <util/age.hpp>
|
||||
|
||||
// ----------------------------------------------------------------------------- : Age
|
||||
|
||||
// what a waste of a source file...
|
||||
|
||||
volatile LONG Age::new_age;
|
||||
@@ -0,0 +1,56 @@
|
||||
//+----------------------------------------------------------------------------+
|
||||
//| Description: Magic Set Editor - Program to make Magic (tm) cards |
|
||||
//| Copyright: (C) 2001 - 2006 Twan van Laarhoven |
|
||||
//| License: GNU General Public License 2 or later (see file COPYING) |
|
||||
//+----------------------------------------------------------------------------+
|
||||
|
||||
#ifndef HEADER_UTIL_AGE
|
||||
#define HEADER_UTIL_AGE
|
||||
|
||||
// ----------------------------------------------------------------------------- : Includes
|
||||
|
||||
#include <util/prec.hpp>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
extern "C" {
|
||||
LONG __cdecl _InterlockedIncrement(LONG volatile *Addend);
|
||||
LONG __cdecl _InterlockedDecrement(LONG volatile *Addend);
|
||||
}
|
||||
#pragma intrinsic (_InterlockedIncrement)
|
||||
#define InterlockedIncrement _InterlockedIncrement
|
||||
#pragma intrinsic (_InterlockedDecrement)
|
||||
#define InterlockedDecrement _InterlockedDecrement
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------- : Age
|
||||
|
||||
/// Represents the age of a value, higher values are newer
|
||||
/** Age is counted using a global variable */
|
||||
class Age {
|
||||
public:
|
||||
/// Construct a new age value,
|
||||
Age() {
|
||||
update();
|
||||
}
|
||||
|
||||
/// Update the age to become the newest one
|
||||
inline void update() {
|
||||
age = InterlockedIncrement(&new_age);
|
||||
}
|
||||
|
||||
/// Compare two ages, smaller means earlier
|
||||
inline bool operator < (Age a) const { return age < a.age; }
|
||||
|
||||
private:
|
||||
/// This age
|
||||
LONG age;
|
||||
/// Global age counter, value of the last age created
|
||||
static volatile LONG new_age;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------- : Aged
|
||||
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------- : EOF
|
||||
#endif
|
||||
@@ -33,6 +33,7 @@ enum Alignment
|
||||
, ALIGN_STRETCH = 0x2000
|
||||
// common combinations
|
||||
, ALIGN_TOP_LEFT = ALIGN_TOP | ALIGN_LEFT
|
||||
, ALIGN_MIDDLE_LEFT = ALIGN_MIDDLE | ALIGN_LEFT
|
||||
, ALIGN_MIDDLE_CENTER = ALIGN_MIDDLE | ALIGN_CENTER
|
||||
};
|
||||
|
||||
|
||||
@@ -146,8 +146,11 @@ void RotatedDC::SetFont(wxFont font, double size) {
|
||||
dc.SetFont(font);
|
||||
}
|
||||
|
||||
RealSize RotatedDC::GetTextExtent(const String& text) {
|
||||
RealSize RotatedDC::GetTextExtent(const String& text) const {
|
||||
int w, h;
|
||||
dc.GetTextExtent(text, &w, &h);
|
||||
return RealSize(w,h) / zoom;
|
||||
}
|
||||
double RotatedDC::GetCharHeight() const {
|
||||
return dc.GetCharHeight() / zoom;
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ class RotatedDC : public Rotation {
|
||||
RotatedDC(DC& dc, int angle, const RealRect& rect, double zoom, bool high_quality);
|
||||
RotatedDC(DC& dc, const Rotation& rotation, bool high_quality);
|
||||
|
||||
// ----------------------------- : Drawing
|
||||
// --------------------------------------------------- : Drawing
|
||||
|
||||
void DrawText (const String& text, const RealPoint& pos);
|
||||
/// Draw abitmap, it must already be zoomed!
|
||||
@@ -122,7 +122,7 @@ class RotatedDC : public Rotation {
|
||||
// Fill the dc with the color of the current brush
|
||||
void Fill();
|
||||
|
||||
// ----------------------------- : Forwarded properties
|
||||
// --------------------------------------------------- : Forwarded properties
|
||||
|
||||
/// Sets the pen for the dc, does not scale the line width
|
||||
void SetPen(const wxPen&);
|
||||
@@ -134,7 +134,8 @@ class RotatedDC : public Rotation {
|
||||
/** The font will get the given (internal) point size */
|
||||
void SetFont(wxFont font, double size);
|
||||
|
||||
RealSize GetTextExtent(const String& text);
|
||||
RealSize GetTextExtent(const String& text) const;
|
||||
double GetCharHeight() const;
|
||||
|
||||
inline wxDC& getDC() { return dc; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user