Skip to content

Commit

Permalink
Now using getViewSize instead of size everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
bdejong committed Feb 10, 2018
1 parent cc8d929 commit c0ead7c
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 45 deletions.
14 changes: 7 additions & 7 deletions AnechoicRoomSimulator/TextDisplay.cpp
Expand Up @@ -21,7 +21,7 @@ void CTextDisplay::draw(CDrawContext* pContext)
//this should be done off-screen, but I didn't feel like it.
//I'll fix it in the next version (+ Mat's aplha-strip...)

CRect tmprect = size;
CRect tmprect = getViewSize();
tmprect.offset(3, -1);

#ifdef _DEBUG
Expand All @@ -32,15 +32,15 @@ void CTextDisplay::draw(CDrawContext* pContext)

pContext->setFrameColor(rectColor_);

pContext->drawRect(size);
pContext->drawRect(getViewSize());
//pContext->fillRect(size);

CRect sourcerect;
CPoint bitmapoffset;

int left = size.left; //our staring point!
int top = size.top; //our staring point!
int bottom = size.top + ascii_->getHeight(); //our staring point!
int left = getViewSize().left; //our staring point!
int top = getViewSize().top; //our staring point!
int bottom = getViewSize().top + ascii_->getHeight(); //our staring point!
int place;
int width;

Expand All @@ -67,9 +67,9 @@ void CTextDisplay::draw(CDrawContext* pContext)
}

if (middle)
left += (size.getWidth() - totalWidth) / 2;
left += (getViewSize().getWidth() - totalWidth) / 2;
else
left += size.getWidth() - totalWidth;
left += getViewSize().getWidth() - totalWidth;

for (int i = 0; i < 256; ++i)
{
Expand Down
10 changes: 5 additions & 5 deletions H2O/TextDisplay.cpp
Expand Up @@ -30,21 +30,21 @@ void CTextDisplay::draw(CDrawContext* pContext)
pContext->setFontColor(fontColor);
pContext->setFont(kSystemFont, 10);

CRect tmprect = size;
CRect tmprect = getViewSize();
tmprect.offset(3, -1);
pContext->setFillColor(rectColor);
pContext->setFrameColor(frameColor);

pContext->drawRect(size);
pContext->drawRect(getViewSize());
// pContext->fillRect(size);
// pContext->drawString(todisplay,tmprect,false,kLeftText);

CRect sourcerect;
CPoint bitmapoffset;

int left = size.left + 3; //our staring point!
int top = size.top; //our staring point!
int bottom = size.top + ascii->getHeight(); //our staring point!
int left = getViewSize().left + 3; //our staring point!
int top = getViewSize().top; //our staring point!
int bottom = getViewSize().top + ascii->getHeight(); //our staring point!
int place;
int width;

Expand Down
2 changes: 1 addition & 1 deletion H2O/TextDisplay.h
Expand Up @@ -11,7 +11,7 @@ class CTextDisplay : public CControl {

CBaseObject* newCopy () const override
{
return new CTextDisplay(size, listener, tag);
return new CTextDisplay(getViewSize(), listener, tag);
}

private:
Expand Down
4 changes: 2 additions & 2 deletions Smexoscope/Label.cpp
Expand Up @@ -14,12 +14,12 @@ void CLabel::draw(CDrawContext* pContext)
{
pContext->setFrameColor(backColor);
pContext->setFillColor(backColor);
pContext->drawRect(size);
pContext->drawRect(getViewSize());

pContext->setFrameColor(fontColor);
pContext->setFont(fontID);
pContext->setFontColor(fontColor);
pContext->drawString(_label.c_str(), size, kCenterText, true);
pContext->drawString(_label.c_str(), getViewSize(), kCenterText, true);

setDirty(false);
}
Expand Down
10 changes: 5 additions & 5 deletions Smexoscope/MultiStateButton.cpp
Expand Up @@ -34,23 +34,23 @@ void CMultiStateButton::draw(CDrawContext* pContext)

if (getBackground()) {
if (getTransparency())
getBackground()->draw(pContext, size, CPoint(0, off), 0.f);
getBackground()->draw(pContext, getViewSize(), CPoint(0, off), 0.f);
else
getBackground()->draw(pContext, size, CPoint(0, off));
getBackground()->draw(pContext, getViewSize(), CPoint(0, off));
} else {
if (value)
pContext->setFillColor(kRedCColor);
else
pContext->setFillColor(kGreenCColor);

pContext->drawRect(size);
pContext->drawRect(getViewSize());

pContext->setFrameColor(kWhiteCColor);

if (value)
pContext->drawString("on", size);
pContext->drawString("on", getViewSize());
else
pContext->drawString("off", size);
pContext->drawString("off", getViewSize());
}
setDirty(false);
}
Expand Down
16 changes: 8 additions & 8 deletions Smexoscope/WaveDisplay.cpp
Expand Up @@ -99,10 +99,10 @@ void CWaveDisplay::draw(CDrawContext* pContext)
{
CPoint offset(38, 16);

CRect R(0, 0, size.getWidth(), size.getHeight());
CRect R(0, 0, getViewSize().getWidth(), getViewSize().getHeight());
back->draw(pContext, R.offset(offset), offset);

R(615 - size.left, 240 - size.top, 615 + heads->getWidth() - size.left, 240 + heads->getHeight() / 4 - size.top);
R(615 - getViewSize().left, 240 - getViewSize().top, 615 + heads->getWidth() - getViewSize().left, 240 + heads->getHeight() / 4 - getViewSize().top);
heads->draw(pContext, R.offset(offset), CPoint(0, (display * heads->getHeight()) / 4));

pContext->setDrawMode(CDrawMode(kAntiAliasing));
Expand All @@ -111,17 +111,17 @@ void CWaveDisplay::draw(CDrawContext* pContext)
long triggerType = (long)(effect->getParameter(CSmartelectronixDisplay::kTriggerType) * CSmartelectronixDisplay::kNumTriggerTypes + 0.0001);

if (triggerType == CSmartelectronixDisplay::kTriggerRising || triggerType == CSmartelectronixDisplay::kTriggerFalling) {
long y = 1 + (long)((1.f - effect->getParameter(CSmartelectronixDisplay::kTriggerLevel)) * (size.getHeight() - 2));
long y = 1 + (long)((1.f - effect->getParameter(CSmartelectronixDisplay::kTriggerLevel)) * (getViewSize().getHeight() - 2));

CColor grey(229, 229, 229);
pContext->setFrameColor(grey);
pContext->drawLine(CPoint(0, y).offset(offset), CPoint(size.getWidth() - 1, y).offset(offset));
pContext->drawLine(CPoint(0, y).offset(offset), CPoint(getViewSize().getWidth() - 1, y).offset(offset));
}

// zero-line
CColor orange(179, 111, 56);
pContext->setFrameColor(orange);
pContext->drawLine(CPoint(0, size.getHeight() * 0.5 - 1).offset(offset), CPoint(size.getWidth() - 1, size.getHeight() * 0.5 - 1).offset(offset));
pContext->drawLine(CPoint(0, getViewSize().getHeight() * 0.5 - 1).offset(offset), CPoint(getViewSize().getWidth() - 1, getViewSize().getHeight() * 0.5 - 1).offset(offset));

// waveform
const std::vector<CPoint>& points = (effect->getParameter(CSmartelectronixDisplay::kSyncDraw) > 0.5f) ? effect->getCopy() : effect->getPeaks();
Expand All @@ -138,7 +138,7 @@ void CWaveDisplay::draw(CDrawContext* pContext)
double prevxi = points[0].x;
double prevyi = points[0].y;

for (long i = 1; i < size.getWidth() - 1; i++) {
for (long i = 1; i < getViewSize().getWidth() - 1; i++) {
long index = (long)phase;
double alpha = phase - (double)index;

Expand Down Expand Up @@ -169,8 +169,8 @@ void CWaveDisplay::draw(CDrawContext* pContext)
CPoint whereOffset = where;
whereOffset.offsetInverse(offset);

pContext->drawLine(CPoint(0, whereOffset.y).offset(offset), CPoint(size.getWidth() - 1, whereOffset.y).offset(offset));
pContext->drawLine(CPoint(whereOffset.x, 0).offset(offset), CPoint(whereOffset.x, size.getHeight() - 1).offset(offset));
pContext->drawLine(CPoint(0, whereOffset.y).offset(offset), CPoint(getViewSize().getWidth() - 1, whereOffset.y).offset(offset));
pContext->drawLine(CPoint(whereOffset.x, 0).offset(offset), CPoint(whereOffset.x, getViewSize().getHeight() - 1).offset(offset));

float gain = powf(10.f, effect->getParameter(CSmartelectronixDisplay::kAmpWindow) * 6.f - 3.f);
float y = (-2.f * ((float)whereOffset.y + 1.f) / (float)OSC_HEIGHT + 1.f) / gain;
Expand Down
2 changes: 1 addition & 1 deletion Smexoscope/WaveDisplay.h
Expand Up @@ -21,7 +21,7 @@ class CWaveDisplay : public CControl {

virtual CBaseObject* newCopy () const override
{
return new CWaveDisplay(size, effect, back, heads, readout);
return new CWaveDisplay(getViewSize(), effect, back, heads, readout);
};

CMessageResult notify (CBaseObject* sender, IdStringPtr message) override;
Expand Down
8 changes: 4 additions & 4 deletions SupaPhaser/CustomSplashScreen.cpp
Expand Up @@ -107,8 +107,8 @@ CMouseEventResult CCustomSplashScreen::onMouseDown(CPoint& where, const CButtonS
//ON
if(getParentView() && getParentView()->getFrame()->setModalView(this))
{
keepSize = size;
size = toDisplay;
keepSize = getViewSize();
setViewSize(toDisplay);
setDirty(true);
if (listener)
listener->valueChanged(this);
Expand All @@ -117,7 +117,7 @@ CMouseEventResult CCustomSplashScreen::onMouseDown(CPoint& where, const CButtonS
else
{
//OFF
size = keepSize;
setViewSize(keepSize);
if(getParentView())
{
getParentView()->getFrame()->setModalView(NULL);
Expand All @@ -137,7 +137,7 @@ void CCustomSplashScreen::unSplash ()
setDirty ();
value = offValue;

size = keepSize;
setViewSize(keepSize);
if (getParentView())
{
if (getParentView()->getFrame()->getModalView() == this)
Expand Down
10 changes: 5 additions & 5 deletions SupaPhaser/MultiStateButton.cpp
Expand Up @@ -32,9 +32,9 @@ void CMultiStateButton::draw (CDrawContext *pContext)
if (getBackground())
{
if (getTransparency())
getBackground()->draw(pContext, size, CPoint (0, off), 0.f);
getBackground()->draw(pContext, getViewSize(), CPoint (0, off), 0.f);
else
getBackground()->draw(pContext, size, CPoint (0, off));
getBackground()->draw(pContext, getViewSize(), CPoint (0, off));
}
else
{
Expand All @@ -43,14 +43,14 @@ void CMultiStateButton::draw (CDrawContext *pContext)
else
pContext->setFillColor(kGreenCColor);

pContext->drawRect(size);
pContext->drawRect(getViewSize());

pContext->setFrameColor(kWhiteCColor);

if(value)
pContext->drawString("on",size);
pContext->drawString("on",getViewSize());
else
pContext->drawString("off",size);
pContext->drawString("off",getViewSize());
}
setDirty (false);
}
Expand Down
14 changes: 7 additions & 7 deletions SupaPhaser/TextDisplay.cpp
Expand Up @@ -33,7 +33,7 @@ void CTextDisplay::draw (CDrawContext* pContext)
//this should be done off-screen, but I didn't feel like it.
//I'll fix it in the next version (+ Mat's aplha-strip...)

CRect tmprect = size;
CRect tmprect = getViewSize();
tmprect.offset(3,-1);

#ifdef _DEBUG
Expand All @@ -44,15 +44,15 @@ void CTextDisplay::draw (CDrawContext* pContext)

pContext->setFrameColor(_rectColor);

pContext->drawRect(size);
pContext->drawRect(getViewSize());
//pContext->fillRect(size);

CRect sourcerect;
CPoint bitmapoffset;

int left = size.left; //our staring point!
int top = size.top; //our staring point!
int bottom = size.top + _ascii->getHeight(); //our staring point!
int left = getViewSize().left; //our staring point!
int top = getViewSize().top; //our staring point!
int bottom = getViewSize().top + _ascii->getHeight(); //our staring point!
int place;
int width;

Expand All @@ -72,9 +72,9 @@ void CTextDisplay::draw (CDrawContext* pContext)
}

if(middle)
left += (size.getWidth() - totalWidth) / 2;
left += (getViewSize().getWidth() - totalWidth) / 2;
else
left += size.getWidth() - totalWidth;
left += getViewSize().getWidth() - totalWidth;

for(int i=0;i<256;i++)
{
Expand Down

0 comments on commit c0ead7c

Please sign in to comment.