Merge with develop

--HG--
branch : compatibility-develop
hg/compatibility-develop
Nimetu 6 years ago
commit 5e42d09482

@ -82,7 +82,7 @@ namespace NLGUI
void setText (const ucstring &text);
void setFontName (const std::string &name);
void setFontSize (sint nFontSize);
void setFontSize (sint nFontSize, bool coef = true);
void setEmbolden (bool nEmbolden);
void setOblique (bool nOblique);
void setColor (const NLMISC::CRGBA &color);
@ -100,6 +100,9 @@ namespace NLGUI
void setMultiMaxLine(uint l) { _MultiMaxLine = l; }
void setMultiMinLine(uint l) { _MultiMinLine = l; }
// Override chars used to compute font size
void setFontSizing(const std::string &chars, const std::string &fallback);
// Force only a subset of letter to be displayed. Default is 0/0xFFFFFFFF
void enableStringSelection(uint start, uint end);
void disableStringSelection();
@ -240,10 +243,14 @@ namespace NLGUI
std::string _FontName;
/// the font size
sint _FontSize;
bool _FontSizeCoef;
bool _Embolden;
bool _Oblique;
// width of the font in pixel. Just a Hint for tabing format (computed with '_')
float _FontWidth;
// strings to use when computing font size
ucstring _FontSizingChars;
ucstring _FontSizingFallback;
// height of the font in pixel.
// use getFontHeight
float _FontHeight;

@ -65,6 +65,7 @@ namespace NLGUI
_FontSize = 12 +
CWidgetManager::getInstance()->getSystemOption( CWidgetManager::OptionAddCoefFont ).getValSInt32();
_FontSizeCoef = true;
_FontName.clear();
_Embolden = false;
_Oblique = false;
@ -97,7 +98,6 @@ namespace NLGUI
_InvalidTextContext= true;
_FirstLineX = 0;
computeFontSize ();
_SingleLineTextClamped= false;
_OverExtendViewText= false;
@ -110,6 +110,14 @@ namespace NLGUI
_LetterColors = NULL;
_Setuped= false;
_AutoClampOffset = 0;
// Letter size
// - "_" that should be the character with the lowest part
// - A with an accent for the highest part
_FontSizingChars.fromUtf8("_\xc3\x84");
// fallback if SizingChars are not supported by font
_FontSizingFallback.fromUtf8("|");
computeFontSize ();
}
// ***************************************************************************
@ -134,6 +142,7 @@ namespace NLGUI
setupDefault ();
_FontSize = FontSize + CWidgetManager::getInstance()->getSystemOption( CWidgetManager::OptionAddCoefFont).getValSInt32();
_FontSizeCoef = true;
_Color = Color;
_Shadow = Shadow;
_ShadowOutline = ShadowOutline;
@ -178,6 +187,7 @@ namespace NLGUI
_PosRef = vt._PosRef;
_FontSize = vt._FontSize;
_FontSizeCoef = vt._FontSizeCoef;
_Embolden = vt._Embolden;
_Oblique = vt._Oblique;
_Underlined = vt._Underlined;
@ -241,9 +251,15 @@ namespace NLGUI
else
if( name == "fontsize" )
{
return toString(
_FontSize - CWidgetManager::getInstance()->getSystemOption( CWidgetManager::OptionAddCoefFont ).getValSInt32()
);
if (_FontSizeCoef)
return toString(_FontSize - CWidgetManager::getInstance()->getSystemOption( CWidgetManager::OptionAddCoefFont ).getValSInt32());
return toString(_FontSize);
}
else
if ( name == "fontsize_coef" )
{
return toString(_FontSizeCoef);
}
else
if( name == "fontweight" )
@ -370,6 +386,16 @@ namespace NLGUI
{
return toString( _ContinuousUpdate );
}
else
if ( name == "sizing_chars" )
{
return _FontSizingChars.toUtf8();
}
else
if ( name == "sizing_fallback" )
{
return _FontSizingFallback.toUtf8();
}
else
return "";
}
@ -408,6 +434,22 @@ namespace NLGUI
return true;
}
else
if( name == "fontsize_coef" )
{
bool b;
bool oldValue = _FontSizeCoef;
if (fromString( value, b) )
_FontSizeCoef = b;
// must only change font size when current state changes
if (_FontSizeCoef != oldValue)
{
if (_FontSizeCoef)
_FontSize += CWidgetManager::getInstance()->getSystemOption( CWidgetManager::OptionAddCoefFont ).getValSInt32();
else
_FontSize -= CWidgetManager::getInstance()->getSystemOption( CWidgetManager::OptionAddCoefFont ).getValSInt32();
}
}
else
if( name == "fontweight" )
{
if (value == "bold")
@ -615,6 +657,18 @@ namespace NLGUI
return true;
}
else
if( name == "sizing_chars" )
{
_FontSizingChars.fromUtf8(value);
return true;
}
else
if( name == "sizing_fallback" )
{
_FontSizingFallback.fromUtf8(value);
return true;
}
else
return false;
}
@ -624,10 +678,11 @@ namespace NLGUI
{
xmlSetProp( node, BAD_CAST "color", BAD_CAST toString( _Color ).c_str() );
xmlSetProp( node, BAD_CAST "global_color", BAD_CAST toString( _ModulateGlobalColor ).c_str() );
xmlSetProp( node, BAD_CAST "fontsize",
BAD_CAST toString(
_FontSize - CWidgetManager::getInstance()->getSystemOption( CWidgetManager::OptionAddCoefFont ).getValSInt32()
).c_str() );
sint32 fontSize = _FontSize;
if (_FontSizeCoef) fontSize -= CWidgetManager::getInstance()->getSystemOption( CWidgetManager::OptionAddCoefFont ).getValSInt32();
xmlSetProp( node, BAD_CAST "fontsize", BAD_CAST toString(fontSize).c_str() );
xmlSetProp( node, BAD_CAST "fontsize_coef", BAD_CAST toString(_FontSizeCoef).c_str() );
std::string fontweight("normal");
if (_Embolden)
@ -679,6 +734,8 @@ namespace NLGUI
xmlSetProp( node, BAD_CAST "clamp_right", BAD_CAST toString( _ClampRight ).c_str() );
xmlSetProp( node, BAD_CAST "auto_clamp_offset", BAD_CAST toString( _AutoClampOffset ).c_str() );
xmlSetProp( node, BAD_CAST "continuous_update", BAD_CAST toString( _ContinuousUpdate ).c_str() );
xmlSetProp( node, BAD_CAST "sizing_chars", BAD_CAST _FontSizingChars.toUtf8().c_str() );
xmlSetProp( node, BAD_CAST "sizing_fallback", BAD_CAST _FontSizingFallback.toUtf8().c_str() );
return true;
}
@ -724,6 +781,16 @@ namespace NLGUI
_FontSize += CWidgetManager::getInstance()->getSystemOption( CWidgetManager::OptionAddCoefFont).getValSInt32();
}
prop = (char*) xmlGetProp( cur, (xmlChar*)"fontsize_coef" );
_FontSizeCoef = true;
if (prop)
{
_FontSizeCoef = convertBool(prop);
if (!_FontSizeCoef)
_FontSize -= CWidgetManager::getInstance()->getSystemOption( CWidgetManager::OptionAddCoefFont).getValSInt32();
}
prop = (char*) xmlGetProp( cur, (xmlChar*)"fontweight" );
_Embolden = false;
if (prop)
@ -854,6 +921,17 @@ namespace NLGUI
_ContinuousUpdate = convertBool(prop);
}
// "_Ä" lowest/highest chars (underscore, A+diaeresis)
_FontSizingChars.fromUtf8("_\xc3\x84");
prop = (char*) xmlGetProp( cur, (xmlChar*)"sizing_chars" );
if (prop)
_FontSizingChars.fromUtf8((const char*)prop);
// fallback if SizingChars are not supported by font
_FontSizingFallback.fromUtf8("|");
prop = (char*) xmlGetProp( cur, (xmlChar*)"sizing_fallback" );
if (prop)
_FontSizingFallback.fromUtf8((const char*)prop);
computeFontSize ();
}
@ -1328,6 +1406,15 @@ namespace NLGUI
_FormatTags.clear();
}
// ***************************************************************************
void CViewText::setFontSizing(const std::string &chars, const std::string &fallback)
{
_FontSizingChars.clear();
_FontSizingChars.fromUtf8(chars);
_FontSizingFallback.clear();
_FontSizingFallback.fromUtf8(fallback);
}
// ***************************************************************************
void CViewText::setFontName(const std::string &name)
{
@ -1347,9 +1434,11 @@ namespace NLGUI
}
// ***************************************************************************
void CViewText::setFontSize (sint nFontSize)
void CViewText::setFontSize (sint nFontSize, bool coef)
{
_FontSize = nFontSize + CWidgetManager::getInstance()->getSystemOption( CWidgetManager::OptionAddCoefFont).getValSInt32();
_FontSize = nFontSize;
if (coef) _FontSize += CWidgetManager::getInstance()->getSystemOption( CWidgetManager::OptionAddCoefFont).getValSInt32();
_FontSizeCoef = coef;
computeFontSize ();
invalidateContent();
}
@ -1357,7 +1446,10 @@ namespace NLGUI
// ***************************************************************************
sint CViewText::getFontSize() const
{
if (_FontSizeCoef)
return _FontSize - CWidgetManager::getInstance()->getSystemOption( CWidgetManager::OptionAddCoefFont).getValSInt32();
return _FontSize;
}
// ***************************************************************************
@ -2859,22 +2951,14 @@ namespace NLGUI
TextContext->setOblique (_Oblique);
// Letter size
ucstring chars;
// instead of using the height of "|" that depends on font,
// we're using 2 characters:
// - "_" that should be the character with the lowest part
// - A with an accent for the highest part
chars.fromUtf8("_\xc3\x84");
// for now we can't know that directly from UTextContext
UTextContext::CStringInfo si = TextContext->getStringInfo(chars);
UTextContext::CStringInfo si = TextContext->getStringInfo(_FontSizingChars);
// font generator changes unknown glyphs to dot '.'. use fallback if it looks odd
if (_FontSize > (si.StringHeight + si.StringLine))
{
chars.fromUtf8("|");
si = TextContext->getStringInfo(chars);
si = TextContext->getStringInfo(_FontSizingFallback);
}
// add a padding of 1 pixel else the top will be truncated
_FontHeight = si.StringHeight + 1;
_FontLegHeight = si.StringLine;
@ -2883,7 +2967,7 @@ namespace NLGUI
si = TextContext->getStringInfo(ucstring(" "));
_SpaceWidth = si.StringWidth;
// Font Width
// Font Width (used for <tab>)
si = TextContext->getStringInfo(ucstring("_"));
_FontWidth = si.StringWidth;
}

@ -4239,7 +4239,7 @@ public:
string fileName = getParam(sParams, "music");
// don't play if db is in init stage
if (IngameDbMngr.initInProgress()) return;
if (!ClientCfg.Local && IngameDbMngr.initInProgress()) return;
if(SoundMngr)
SoundMngr->playEventMusic(fileName, xFade, loop);
@ -4261,7 +4261,7 @@ public:
string fileName= getParam(sParams, "music");
// don't play if db is in init stage
if (IngameDbMngr.initInProgress()) return;
if (!ClientCfg.Local && IngameDbMngr.initInProgress()) return;
if(SoundMngr)
SoundMngr->stopEventMusic(fileName, xFade);

@ -54,7 +54,7 @@ REGISTER_ACTION_HANDLER( CHandlerBrowseHome, "browse_home");
static string getWebAuthKey()
{
if(!UserEntity) return "";
if(!UserEntity || !NetMngr.getLoginCookie().isValid()) return "";
// authkey = <sharid><name><cid><cookie>
uint32 cid = NetMngr.getLoginCookie().getUserId() * 16 + PlayerSelectedSlot;
@ -304,6 +304,8 @@ CGroupHTMLAuth::~CGroupHTMLAuth()
void CGroupHTMLAuth::addHTTPGetParams (string &url, bool trustedDomain)
{
if(!UserEntity || !NetMngr.getLoginCookie().isValid()) return;
addWebIGParams(url, trustedDomain);
}
@ -311,7 +313,7 @@ void CGroupHTMLAuth::addHTTPGetParams (string &url, bool trustedDomain)
void CGroupHTMLAuth::addHTTPPostParams (SFormFields &formfields, bool trustedDomain)
{
if(!UserEntity) return;
if(!UserEntity || !NetMngr.getLoginCookie().isValid()) return;
uint32 cid = NetMngr.getLoginCookie().getUserId() * 16 + PlayerSelectedSlot;
formfields.add("shardid", toString(CharacterHomeSessionId));

@ -2021,6 +2021,9 @@ bool SBagOptions::parse(xmlNodePtr cur, CInterfaceGroup * /* parentGroup */)
prop = xmlGetProp (cur, (xmlChar*)"filter_tool");
if (prop) DbFilterTool = NLGUI::CDBManager::getInstance()->getDbProp(prop.str());
prop = xmlGetProp (cur, (xmlChar*)"filter_pet");
if (prop) DbFilterPet = NLGUI::CDBManager::getInstance()->getDbProp(prop.str());
prop = xmlGetProp (cur, (xmlChar*)"filter_mp");
if (prop) DbFilterMP = NLGUI::CDBManager::getInstance()->getDbProp(prop.str());
@ -2097,6 +2100,13 @@ bool SBagOptions::isSomethingChanged()
LastDbFilterTool = (DbFilterTool->getValue8() != 0);
}
if (DbFilterPet != NULL)
if ((DbFilterPet->getValue8() != 0) != LastDbFilterPet)
{
bRet = true;
LastDbFilterPet = (DbFilterPet->getValue8() != 0);
}
if (DbFilterMP != NULL)
if ((DbFilterMP->getValue8() != 0) != LastDbFilterMP)
{
@ -2135,6 +2145,7 @@ bool SBagOptions::canDisplay(CDBCtrlSheet *pCS) const
bool bFilterArmor = getFilterArmor();
bool bFilterWeapon = getFilterWeapon();
bool bFilterTool = getFilterTool();
bool bFilterPet = getFilterPet();
bool bFilterMP = getFilterMP();
bool bFilterMissMP = getFilterMissMP();
bool bFilterTP = getFilterTP();
@ -2186,10 +2197,13 @@ bool SBagOptions::canDisplay(CDBCtrlSheet *pCS) const
(pIS->Family == ITEMFAMILY::HARVEST_TOOL) ||
(pIS->Family == ITEMFAMILY::TAMING_TOOL) ||
(pIS->Family == ITEMFAMILY::TRAINING_TOOL) ||
(pIS->Family == ITEMFAMILY::BAG) ||
(pIS->Family == ITEMFAMILY::PET_ANIMAL_TICKET) )
(pIS->Family == ITEMFAMILY::BAG))
if (!bFilterTool) bDisplay = false;
// Pet
if (pIS->Family == ITEMFAMILY::PET_ANIMAL_TICKET)
if (!bFilterPet) bDisplay = false;
// MP
if ((pIS->Family == ITEMFAMILY::RAW_MATERIAL) && pIS->canBuildSomeItemPart())
if (!bFilterMP) bDisplay = false;

@ -509,6 +509,7 @@ struct SBagOptions
NLMISC::CCDBNodeLeaf *DbFilterArmor;
NLMISC::CCDBNodeLeaf *DbFilterWeapon;
NLMISC::CCDBNodeLeaf *DbFilterTool;
NLMISC::CCDBNodeLeaf *DbFilterPet;
NLMISC::CCDBNodeLeaf *DbFilterMP;
NLMISC::CCDBNodeLeaf *DbFilterMissMP;
NLMISC::CCDBNodeLeaf *DbFilterTP;
@ -516,6 +517,7 @@ struct SBagOptions
bool LastDbFilterArmor;
bool LastDbFilterWeapon;
bool LastDbFilterTool;
bool LastDbFilterPet;
bool LastDbFilterMP;
bool LastDbFilterMissMP;
bool LastDbFilterTP;
@ -529,8 +531,8 @@ struct SBagOptions
SBagOptions()
{
InvType = CInventoryManager::InvUnknown;
DbFilterArmor = DbFilterWeapon = DbFilterTool = DbFilterMP = DbFilterMissMP = DbFilterTP = NULL;
LastDbFilterArmor = LastDbFilterWeapon = LastDbFilterTool = LastDbFilterMP = LastDbFilterMissMP = LastDbFilterTP = false;
DbFilterArmor = DbFilterWeapon = DbFilterTool = DbFilterPet = DbFilterMP = DbFilterMissMP = DbFilterTP = NULL;
LastDbFilterArmor = LastDbFilterWeapon = LastDbFilterTool = LastDbFilterPet = LastDbFilterMP = LastDbFilterMissMP = LastDbFilterTP = false;
SearchFilterChanged = false;
SearchQualityMin = 0;
SearchQualityMax = 999;
@ -561,6 +563,12 @@ struct SBagOptions
return (DbFilterTool->getValue8()!=0);
}
bool getFilterPet() const
{
if (DbFilterPet == NULL) return true;
return (DbFilterPet->getValue8()!=0);
}
bool getFilterMP() const
{
if (DbFilterMP == NULL) return true;

Loading…
Cancel
Save