Refactoring.
This commit is contained in:
parent
daa7ab72e6
commit
9ee4cf208b
|
@ -1,5 +1,7 @@
|
||||||
#include "vpgraphicstilegrid.h"
|
#include "vpgraphicstilegrid.h"
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
#include "../layout/vplayout.h"
|
#include "../layout/vplayout.h"
|
||||||
#include "../layout/vpsheet.h"
|
#include "../layout/vpsheet.h"
|
||||||
#include "../vmisc/theme/vscenestylesheet.h"
|
#include "../vmisc/theme/vscenestylesheet.h"
|
||||||
|
@ -57,7 +59,7 @@ auto OptimizeFontSizeToFitTextInRect(QPainter *painter, const QRectF &drawRect,
|
||||||
|
|
||||||
double const xFactor = drawRect.width() / fontBoundRect.width();
|
double const xFactor = drawRect.width() / fontBoundRect.width();
|
||||||
double const yFactor = drawRect.height() / fontBoundRect.height();
|
double const yFactor = drawRect.height() / fontBoundRect.height();
|
||||||
double factor;
|
double factor = NAN;
|
||||||
if (xFactor < 1 && yFactor < 1)
|
if (xFactor < 1 && yFactor < 1)
|
||||||
{
|
{
|
||||||
factor = std::min(xFactor, yFactor);
|
factor = std::min(xFactor, yFactor);
|
||||||
|
|
|
@ -1429,7 +1429,7 @@ void QmuParserBase::CreateRPN() const
|
||||||
ApplyRemainingOprt(stOpt, stVal);
|
ApplyRemainingOprt(stOpt, stVal);
|
||||||
|
|
||||||
// Check if the bracket content has been evaluated completely
|
// Check if the bracket content has been evaluated completely
|
||||||
if (stOpt.size() && stOpt.top().GetCode() == cmBO)
|
if (!stOpt.empty() && stOpt.top().GetCode() == cmBO)
|
||||||
{
|
{
|
||||||
// if opt is ")" and opta is "(" the bracket has been evaluated, now its time to check
|
// if opt is ")" and opta is "(" the bracket has been evaluated, now its time to check
|
||||||
// if there is either a function or a sign pending
|
// if there is either a function or a sign pending
|
||||||
|
@ -1437,7 +1437,7 @@ void QmuParserBase::CreateRPN() const
|
||||||
// the operator stack
|
// the operator stack
|
||||||
// Check if a function is standing in front of the opening bracket,
|
// Check if a function is standing in front of the opening bracket,
|
||||||
// if yes evaluate it afterwards check for infix operators
|
// if yes evaluate it afterwards check for infix operators
|
||||||
assert(stArgCount.size());
|
assert(!stArgCount.empty());
|
||||||
int const iArgCount = stArgCount.pop();
|
int const iArgCount = stArgCount.pop();
|
||||||
|
|
||||||
stOpt.pop(); // Take opening bracket from stack
|
stOpt.pop(); // Take opening bracket from stack
|
||||||
|
@ -1451,8 +1451,8 @@ void QmuParserBase::CreateRPN() const
|
||||||
|
|
||||||
// The opening bracket was popped from the stack now check if there
|
// The opening bracket was popped from the stack now check if there
|
||||||
// was a function before this bracket
|
// was a function before this bracket
|
||||||
if (stOpt.size() && stOpt.top().GetCode() != cmOPRT_INFIX && stOpt.top().GetCode() != cmOPRT_BIN &&
|
if (!stOpt.empty() && stOpt.top().GetCode() != cmOPRT_INFIX &&
|
||||||
stOpt.top().GetFuncAddr() != nullptr)
|
stOpt.top().GetCode() != cmOPRT_BIN && stOpt.top().GetFuncAddr() != nullptr)
|
||||||
{
|
{
|
||||||
ApplyFunc(stOpt, stVal, iArgCount);
|
ApplyFunc(stOpt, stVal, iArgCount);
|
||||||
}
|
}
|
||||||
|
@ -1485,11 +1485,12 @@ void QmuParserBase::CreateRPN() const
|
||||||
case cmASSIGN:
|
case cmASSIGN:
|
||||||
case cmOPRT_BIN:
|
case cmOPRT_BIN:
|
||||||
// A binary operator (user defined or built in) has been found.
|
// A binary operator (user defined or built in) has been found.
|
||||||
while (stOpt.size() && stOpt.top().GetCode() != cmBO && stOpt.top().GetCode() != cmELSE &&
|
while (!stOpt.empty() && stOpt.top().GetCode() != cmBO && stOpt.top().GetCode() != cmELSE &&
|
||||||
stOpt.top().GetCode() != cmIF)
|
stOpt.top().GetCode() != cmIF)
|
||||||
{
|
{
|
||||||
const token_type &topToken = stOpt.top();
|
const token_type &topToken = stOpt.top();
|
||||||
int nPrec1 = GetOprtPrecedence(topToken), nPrec2 = GetOprtPrecedence(opt);
|
int const nPrec1 = GetOprtPrecedence(topToken);
|
||||||
|
int const nPrec2 = GetOprtPrecedence(opt);
|
||||||
|
|
||||||
const ECmdCode code = topToken.GetCode();
|
const ECmdCode code = topToken.GetCode();
|
||||||
if (code == opt.GetCode())
|
if (code == opt.GetCode())
|
||||||
|
|
Loading…
Reference in New Issue
Block a user