Files
MagicSetEditor2/src/render/value/viewer.cpp
T
twanvl d2196eea09 Finally got precompiled headers to work.
Now all C++ files need to #include <util/prec.hpp>
 That is why all .cpp files are touched by this commit

Many changes to installers and update checking:
     - the window is now called PackagesWindow, in a new source file
     - update checking is now independent from the PackagesWindow. For update checking only a list of package versions are needed (vector<PackageDependency>). This is much less information to download at each startup.
     - the list of available packages is now a list of available Installers, since an installer can contain multiple packages.
     - moved the logic of dependency checking etc. to data/installer
     - moved the actual installation to util/io/package_manager
     - moved directory iteration/creation logic to util/file_utils
     - added PackageDirectory: the local and global package directory now have their own object (was part of PackageManager)
     - added PackageVersion: for detecting if a package has been modified after it was installed.
     - added PackageDescription: description/header of a package. Basicly the same as what Packaged provides.
     - added DownloadableInstaller: where to find an insaller, what does it contain?
     - added InstallablePackage: brining it all together: installer, package, status, action.

Current status: the insaller is currently broken in a few places, more on that soon.

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@792 0fc631ac-6414-0410-93d0-97cfa31319b6
2007-12-29 18:30:41 +00:00

62 lines
2.0 KiB
C++

//+----------------------------------------------------------------------------+
//| Description: Magic Set Editor - Program to make Magic (tm) cards |
//| Copyright: (C) 2001 - 2007 Twan van Laarhoven |
//| License: GNU General Public License 2 or later (see file COPYING) |
//+----------------------------------------------------------------------------+
// ----------------------------------------------------------------------------- : Includes
#include <util/prec.hpp>
#include <render/value/viewer.hpp>
#include <render/card/viewer.hpp>
// ----------------------------------------------------------------------------- : ValueViewer
ValueViewer::ValueViewer(DataViewer& parent, const StyleP& style)
: StyleListener(style), viewer(parent)
{}
Set& ValueViewer::getSet() const { return *viewer.getSet(); }
void ValueViewer::setValue(const ValueP& value) {
assert(value->fieldP == styleP->fieldP); // matching field
if (valueP == value) return;
valueP = value;
onValueChange();
}
bool ValueViewer::containsPoint(const RealPoint& p) const {
return p.x >= 0
&& p.y >= 0
&& p.x < styleP->width
&& p.y < styleP->height;
}
RealRect ValueViewer::boundingBox() const {
return styleP->getExternalRect().grow(1);
}
Rotation ValueViewer::getRotation() const {
return Rotation(getStyle()->angle, getStyle()->getExternalRect(), 1.0, getStretch());
}
void ValueViewer::drawFieldBorder(RotatedDC& dc) {
if (viewer.drawBorders() && getField()->editable) {
dc.SetPen(viewer.borderPen(isCurrent()));
dc.SetBrush(*wxTRANSPARENT_BRUSH);
dc.DrawRectangle(dc.getInternalRect().grow(dc.trInvS(1)));
}
}
bool ValueViewer::nativeLook() const {
return viewer.nativeLook();
}
bool ValueViewer::isCurrent() const {
return viewer.focusedViewer() == this;
}
void ValueViewer::onStyleChange(int changes) {
if (!(changes & CHANGE_ALREADY_PREPARED)) {
viewer.redraw(*this);
}
}