Reordered methods a bit. SetOrigin() and so on is state related. PopState()
PushState() should be at the top of the state related methods. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25153 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+120
-120
@@ -994,60 +994,6 @@ BView::LeftTop() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
BView::SetOrigin(BPoint pt)
|
|
||||||
{
|
|
||||||
SetOrigin(pt.x, pt.y);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
BView::SetOrigin(float x, float y)
|
|
||||||
{
|
|
||||||
if (fState->IsValid(B_VIEW_ORIGIN_BIT)
|
|
||||||
&& x == fState->origin.x && y == fState->origin.y)
|
|
||||||
return;
|
|
||||||
|
|
||||||
fState->origin.x = x;
|
|
||||||
fState->origin.y = y;
|
|
||||||
|
|
||||||
if (_CheckOwnerLockAndSwitchCurrent()) {
|
|
||||||
fOwner->fLink->StartMessage(AS_VIEW_SET_ORIGIN);
|
|
||||||
fOwner->fLink->Attach<float>(x);
|
|
||||||
fOwner->fLink->Attach<float>(y);
|
|
||||||
|
|
||||||
fState->valid_flags |= B_VIEW_ORIGIN_BIT;
|
|
||||||
}
|
|
||||||
|
|
||||||
// our local coord system origin has changed, so when archiving we'll add
|
|
||||||
// this too
|
|
||||||
fState->archiving_flags |= B_VIEW_ORIGIN_BIT;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
BPoint
|
|
||||||
BView::Origin() const
|
|
||||||
{
|
|
||||||
if (!fState->IsValid(B_VIEW_ORIGIN_BIT)) {
|
|
||||||
// we don't keep graphics state information, therefor
|
|
||||||
// we need to ask the server for the origin after PopState()
|
|
||||||
_CheckOwnerLockAndSwitchCurrent();
|
|
||||||
|
|
||||||
fOwner->fLink->StartMessage(AS_VIEW_GET_ORIGIN);
|
|
||||||
|
|
||||||
int32 code;
|
|
||||||
if (fOwner->fLink->FlushWithReply(code) == B_OK
|
|
||||||
&& code == B_OK) {
|
|
||||||
fOwner->fLink->Read<BPoint>(&fState->origin);
|
|
||||||
|
|
||||||
fState->valid_flags |= B_VIEW_ORIGIN_BIT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return fState->origin;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BView::SetResizingMode(uint32 mode)
|
BView::SetResizingMode(uint32 mode)
|
||||||
{
|
{
|
||||||
@@ -1659,6 +1605,126 @@ BView::SetMouseEventMask(uint32 mask, uint32 options)
|
|||||||
// #pragma mark - Graphic State Functions
|
// #pragma mark - Graphic State Functions
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
BView::PushState()
|
||||||
|
{
|
||||||
|
_CheckOwnerLockAndSwitchCurrent();
|
||||||
|
|
||||||
|
fOwner->fLink->StartMessage(AS_VIEW_PUSH_STATE);
|
||||||
|
|
||||||
|
// initialize origin and scale
|
||||||
|
fState->valid_flags |= B_VIEW_SCALE_BIT | B_VIEW_ORIGIN_BIT;
|
||||||
|
fState->scale = 1.0f;
|
||||||
|
fState->origin.Set(0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
BView::PopState()
|
||||||
|
{
|
||||||
|
_CheckOwnerLockAndSwitchCurrent();
|
||||||
|
|
||||||
|
fOwner->fLink->StartMessage(AS_VIEW_POP_STATE);
|
||||||
|
|
||||||
|
// invalidate all flags (except those that are not part of pop/push)
|
||||||
|
fState->valid_flags = B_VIEW_VIEW_COLOR_BIT;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
BView::SetOrigin(BPoint pt)
|
||||||
|
{
|
||||||
|
SetOrigin(pt.x, pt.y);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
BView::SetOrigin(float x, float y)
|
||||||
|
{
|
||||||
|
if (fState->IsValid(B_VIEW_ORIGIN_BIT)
|
||||||
|
&& x == fState->origin.x && y == fState->origin.y)
|
||||||
|
return;
|
||||||
|
|
||||||
|
fState->origin.x = x;
|
||||||
|
fState->origin.y = y;
|
||||||
|
|
||||||
|
if (_CheckOwnerLockAndSwitchCurrent()) {
|
||||||
|
fOwner->fLink->StartMessage(AS_VIEW_SET_ORIGIN);
|
||||||
|
fOwner->fLink->Attach<float>(x);
|
||||||
|
fOwner->fLink->Attach<float>(y);
|
||||||
|
|
||||||
|
fState->valid_flags |= B_VIEW_ORIGIN_BIT;
|
||||||
|
}
|
||||||
|
|
||||||
|
// our local coord system origin has changed, so when archiving we'll add
|
||||||
|
// this too
|
||||||
|
fState->archiving_flags |= B_VIEW_ORIGIN_BIT;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BPoint
|
||||||
|
BView::Origin() const
|
||||||
|
{
|
||||||
|
if (!fState->IsValid(B_VIEW_ORIGIN_BIT)) {
|
||||||
|
// we don't keep graphics state information, therefor
|
||||||
|
// we need to ask the server for the origin after PopState()
|
||||||
|
_CheckOwnerLockAndSwitchCurrent();
|
||||||
|
|
||||||
|
fOwner->fLink->StartMessage(AS_VIEW_GET_ORIGIN);
|
||||||
|
|
||||||
|
int32 code;
|
||||||
|
if (fOwner->fLink->FlushWithReply(code) == B_OK
|
||||||
|
&& code == B_OK) {
|
||||||
|
fOwner->fLink->Read<BPoint>(&fState->origin);
|
||||||
|
|
||||||
|
fState->valid_flags |= B_VIEW_ORIGIN_BIT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return fState->origin;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
BView::SetScale(float scale) const
|
||||||
|
{
|
||||||
|
if (fState->IsValid(B_VIEW_SCALE_BIT) && scale == fState->scale)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (fOwner) {
|
||||||
|
_CheckLockAndSwitchCurrent();
|
||||||
|
|
||||||
|
fOwner->fLink->StartMessage(AS_VIEW_SET_SCALE);
|
||||||
|
fOwner->fLink->Attach<float>(scale);
|
||||||
|
|
||||||
|
fState->valid_flags |= B_VIEW_SCALE_BIT;
|
||||||
|
}
|
||||||
|
|
||||||
|
fState->scale = scale;
|
||||||
|
fState->archiving_flags |= B_VIEW_SCALE_BIT;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
float
|
||||||
|
BView::Scale() const
|
||||||
|
{
|
||||||
|
if (!fState->IsValid(B_VIEW_SCALE_BIT) && fOwner) {
|
||||||
|
_CheckLockAndSwitchCurrent();
|
||||||
|
|
||||||
|
fOwner->fLink->StartMessage(AS_VIEW_GET_SCALE);
|
||||||
|
|
||||||
|
int32 code;
|
||||||
|
if (fOwner->fLink->FlushWithReply(code) == B_OK
|
||||||
|
&& code == B_OK)
|
||||||
|
fOwner->fLink->Read<float>(&fState->scale);
|
||||||
|
|
||||||
|
fState->valid_flags |= B_VIEW_SCALE_BIT;
|
||||||
|
}
|
||||||
|
|
||||||
|
return fState->scale;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BView::SetLineMode(cap_mode lineCap, join_mode lineJoin, float miterLimit)
|
BView::SetLineMode(cap_mode lineCap, join_mode lineJoin, float miterLimit)
|
||||||
{
|
{
|
||||||
@@ -1735,72 +1801,6 @@ BView::LineMiterLimit() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
BView::PushState()
|
|
||||||
{
|
|
||||||
_CheckOwnerLockAndSwitchCurrent();
|
|
||||||
|
|
||||||
fOwner->fLink->StartMessage(AS_VIEW_PUSH_STATE);
|
|
||||||
|
|
||||||
// initialize origin and scale
|
|
||||||
fState->valid_flags |= B_VIEW_SCALE_BIT | B_VIEW_ORIGIN_BIT;
|
|
||||||
fState->scale = 1.0f;
|
|
||||||
fState->origin.Set(0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
BView::PopState()
|
|
||||||
{
|
|
||||||
_CheckOwnerLockAndSwitchCurrent();
|
|
||||||
|
|
||||||
fOwner->fLink->StartMessage(AS_VIEW_POP_STATE);
|
|
||||||
|
|
||||||
// invalidate all flags (except those that are not part of pop/push)
|
|
||||||
fState->valid_flags = B_VIEW_VIEW_COLOR_BIT;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
BView::SetScale(float scale) const
|
|
||||||
{
|
|
||||||
if (fState->IsValid(B_VIEW_SCALE_BIT) && scale == fState->scale)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (fOwner) {
|
|
||||||
_CheckLockAndSwitchCurrent();
|
|
||||||
|
|
||||||
fOwner->fLink->StartMessage(AS_VIEW_SET_SCALE);
|
|
||||||
fOwner->fLink->Attach<float>(scale);
|
|
||||||
|
|
||||||
fState->valid_flags |= B_VIEW_SCALE_BIT;
|
|
||||||
}
|
|
||||||
|
|
||||||
fState->scale = scale;
|
|
||||||
fState->archiving_flags |= B_VIEW_SCALE_BIT;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
float
|
|
||||||
BView::Scale() const
|
|
||||||
{
|
|
||||||
if (!fState->IsValid(B_VIEW_SCALE_BIT) && fOwner) {
|
|
||||||
_CheckLockAndSwitchCurrent();
|
|
||||||
|
|
||||||
fOwner->fLink->StartMessage(AS_VIEW_GET_SCALE);
|
|
||||||
|
|
||||||
int32 code;
|
|
||||||
if (fOwner->fLink->FlushWithReply(code) == B_OK
|
|
||||||
&& code == B_OK)
|
|
||||||
fOwner->fLink->Read<float>(&fState->scale);
|
|
||||||
|
|
||||||
fState->valid_flags |= B_VIEW_SCALE_BIT;
|
|
||||||
}
|
|
||||||
|
|
||||||
return fState->scale;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BView::SetDrawingMode(drawing_mode mode)
|
BView::SetDrawingMode(drawing_mode mode)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user