mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-28 23:06:43 +00:00
Merge remote-tracking branch 'zini/next' into animation2
This commit is contained in:
commit
6a9755778e
19 changed files with 261 additions and 92 deletions
|
@ -391,11 +391,11 @@ if(WIN32)
|
||||||
INSTALL(DIRECTORY "${OpenMW_BINARY_DIR}/resources" DESTINATION ".")
|
INSTALL(DIRECTORY "${OpenMW_BINARY_DIR}/resources" DESTINATION ".")
|
||||||
|
|
||||||
SET(CPACK_GENERATOR "NSIS")
|
SET(CPACK_GENERATOR "NSIS")
|
||||||
SET(CPACK_PACKAGE_NAME "OpenMW")
|
SET(CPACK_PACKAGE_NAME "OpenMW ${OPENMW_VERSION}")
|
||||||
SET(CPACK_PACKAGE_VENDOR "OpenMW.org")
|
SET(CPACK_PACKAGE_VENDOR "OpenMW.org")
|
||||||
SET(CPACK_PACKAGE_VERSION ${OPENMW_VERSION})
|
SET(CPACK_PACKAGE_VERSION ${OPENMW_VERSION})
|
||||||
SET(CPACK_PACKAGE_VERSION_MAJOR ${OPENMW_VERSION_MAJOR})
|
SET(CPACK_PACKAGE_VERSION_MAJOR ${OPENMW_VERSION_MAJOR})
|
||||||
SET(CPACK_PACKAGE_VERSION_MINOR ${OPENMW_VERSION_MINO})
|
SET(CPACK_PACKAGE_VERSION_MINOR ${OPENMW_VERSION_MINOR})
|
||||||
SET(CPACK_PACKAGE_VERSION_PATCH ${OPENMW_VERSION_RELEASE})
|
SET(CPACK_PACKAGE_VERSION_PATCH ${OPENMW_VERSION_RELEASE})
|
||||||
SET(CPACK_PACKAGE_EXECUTABLES "openmw;OpenMW;omwlauncher;OpenMW Launcher")
|
SET(CPACK_PACKAGE_EXECUTABLES "openmw;OpenMW;omwlauncher;OpenMW Launcher")
|
||||||
SET(CPACK_NSIS_CREATE_ICONS_EXTRA "CreateShortCut '\$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Readme.lnk' '\$INSTDIR\\\\readme.txt'")
|
SET(CPACK_NSIS_CREATE_ICONS_EXTRA "CreateShortCut '\$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Readme.lnk' '\$INSTDIR\\\\readme.txt'")
|
||||||
|
|
|
@ -3,19 +3,19 @@
|
||||||
|
|
||||||
CSMWorld::RecordBase::~RecordBase() {}
|
CSMWorld::RecordBase::~RecordBase() {}
|
||||||
|
|
||||||
bool CSMWorld::RecordBase::RecordBase::isDeleted() const
|
bool CSMWorld::RecordBase::isDeleted() const
|
||||||
{
|
{
|
||||||
return mState==State_Deleted || mState==State_Erased;
|
return mState==State_Deleted || mState==State_Erased;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool CSMWorld::RecordBase::RecordBase::isErased() const
|
bool CSMWorld::RecordBase::isErased() const
|
||||||
{
|
{
|
||||||
return mState==State_Erased;
|
return mState==State_Erased;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool CSMWorld::RecordBase::RecordBase::isModified() const
|
bool CSMWorld::RecordBase::isModified() const
|
||||||
{
|
{
|
||||||
return mState==State_Modified || mState==State_ModifiedOnly;
|
return mState==State_Modified || mState==State_ModifiedOnly;
|
||||||
}
|
}
|
|
@ -35,7 +35,7 @@ void CSVDoc::Operation::updateLabel (int threads)
|
||||||
CSVDoc::Operation::Operation (int type) : mType (type), mStalling (false)
|
CSVDoc::Operation::Operation (int type) : mType (type), mStalling (false)
|
||||||
{
|
{
|
||||||
/// \todo Add a cancel button or a pop up menu with a cancel item
|
/// \todo Add a cancel button or a pop up menu with a cancel item
|
||||||
|
setBarColor( type);
|
||||||
updateLabel();
|
updateLabel();
|
||||||
|
|
||||||
/// \todo assign different progress bar colours to allow the user to distinguish easily between operation types
|
/// \todo assign different progress bar colours to allow the user to distinguish easily between operation types
|
||||||
|
@ -51,4 +51,70 @@ void CSVDoc::Operation::setProgress (int current, int max, int threads)
|
||||||
int CSVDoc::Operation::getType() const
|
int CSVDoc::Operation::getType() const
|
||||||
{
|
{
|
||||||
return mType;
|
return mType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSVDoc::Operation::setBarColor (int type)
|
||||||
|
{
|
||||||
|
QString style ="QProgressBar {"
|
||||||
|
"text-align: center;"
|
||||||
|
"}"
|
||||||
|
"QProgressBar::chunk {"
|
||||||
|
"background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 %1, stop:.50 %2 stop: .51 %3 stop:1 %4);"
|
||||||
|
"text-align: center;"
|
||||||
|
"margin: 2px 1px 1p 2px;"
|
||||||
|
"}";
|
||||||
|
|
||||||
|
// "QProgressBar::chunk {background-color: %1;}";
|
||||||
|
|
||||||
|
QString topColor = "#F2F6F8";
|
||||||
|
QString bottomColor = "#E0EFF9";
|
||||||
|
QString midTopColor = "#D8E1E7";
|
||||||
|
QString midBottomColor = "#B5C6D0"; // default gray gloss
|
||||||
|
|
||||||
|
// colors inspired by samples from:
|
||||||
|
// http://www.colorzilla.com/gradient-editor/
|
||||||
|
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case CSMDoc::State_Saving:
|
||||||
|
|
||||||
|
topColor = "#FECCB1";
|
||||||
|
midTopColor = "#F17432";
|
||||||
|
midBottomColor = "#EA5507";
|
||||||
|
bottomColor = "#FB955E"; // red gloss #2
|
||||||
|
//break;
|
||||||
|
|
||||||
|
case CSMDoc::State_Searching:
|
||||||
|
|
||||||
|
topColor = "#EBF1F6";
|
||||||
|
midTopColor = "#ABD3EE";
|
||||||
|
midBottomColor = "#89C3EB";
|
||||||
|
bottomColor = "#D5EBFB"; //blue gloss #4
|
||||||
|
//break;
|
||||||
|
|
||||||
|
case CSMDoc::State_Verifying:
|
||||||
|
|
||||||
|
topColor = "#BFD255";
|
||||||
|
midTopColor = "#8EB92A";
|
||||||
|
midBottomColor = "#72AA00";
|
||||||
|
bottomColor = "#9ECB2D"; //green gloss
|
||||||
|
//break;
|
||||||
|
|
||||||
|
case CSMDoc::State_Compiling:
|
||||||
|
|
||||||
|
topColor = "#F3E2C7";
|
||||||
|
midTopColor = "#C19E67";
|
||||||
|
midBottomColor = "#B68D4C";
|
||||||
|
bottomColor = "#E9D4B3"; //l Brown 3D
|
||||||
|
//break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
|
||||||
|
topColor = "#F2F6F8";
|
||||||
|
bottomColor = "#E0EFF9";
|
||||||
|
midTopColor = "#D8E1E7";
|
||||||
|
midBottomColor = "#B5C6D0"; // gray gloss for undefined ops
|
||||||
|
}
|
||||||
|
|
||||||
|
setStyleSheet(style.arg(topColor).arg(midTopColor).arg(midBottomColor).arg(bottomColor));
|
||||||
|
}
|
||||||
|
|
|
@ -25,7 +25,11 @@ namespace CSVDoc
|
||||||
void setProgress (int current, int max, int threads);
|
void setProgress (int current, int max, int threads);
|
||||||
|
|
||||||
int getType() const;
|
int getType() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
void setBarColor (int type);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -126,6 +126,12 @@ if(APPLE)
|
||||||
find_library(COCOA_FRAMEWORK Cocoa)
|
find_library(COCOA_FRAMEWORK Cocoa)
|
||||||
find_library(IOKIT_FRAMEWORK IOKit)
|
find_library(IOKIT_FRAMEWORK IOKit)
|
||||||
target_link_libraries(openmw ${CARBON_FRAMEWORK} ${COCOA_FRAMEWORK} ${IOKIT_FRAMEWORK})
|
target_link_libraries(openmw ${CARBON_FRAMEWORK} ${COCOA_FRAMEWORK} ${IOKIT_FRAMEWORK})
|
||||||
|
|
||||||
|
if (FFMPEG_FOUND)
|
||||||
|
find_library(COREVIDEO_FRAMEWORK CoreVideo)
|
||||||
|
find_library(VDA_FRAMEWORK VideoDecodeAcceleration)
|
||||||
|
target_link_libraries(openmw ${COREVIDEO_FRAMEWORK} ${VDA_FRAMEWORK})
|
||||||
|
endif()
|
||||||
endif(APPLE)
|
endif(APPLE)
|
||||||
|
|
||||||
if(DPKG_PROGRAM)
|
if(DPKG_PROGRAM)
|
||||||
|
|
|
@ -199,6 +199,7 @@ namespace MWBase
|
||||||
///< Hides dialog and schedules dialog to be deleted.
|
///< Hides dialog and schedules dialog to be deleted.
|
||||||
|
|
||||||
virtual void messageBox (const std::string& message, const std::vector<std::string>& buttons) = 0;
|
virtual void messageBox (const std::string& message, const std::vector<std::string>& buttons) = 0;
|
||||||
|
virtual void enterPressed () = 0;
|
||||||
virtual int readPressedButton() = 0;
|
virtual int readPressedButton() = 0;
|
||||||
///< returns the index of the pressed button or -1 if no button was pressed (->MessageBoxmanager->InteractiveMessageBox)
|
///< returns the index of the pressed button or -1 if no button was pressed (->MessageBoxmanager->InteractiveMessageBox)
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,9 @@
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
|
|
||||||
#include <boost/algorithm/string/replace.hpp>
|
#include <boost/algorithm/string/replace.hpp>
|
||||||
|
#include <boost/algorithm/string/predicate.hpp>
|
||||||
#include <boost/lexical_cast.hpp>
|
#include <boost/lexical_cast.hpp>
|
||||||
|
#include <OgreUTFString.h>
|
||||||
|
|
||||||
using namespace MWGui;
|
using namespace MWGui;
|
||||||
|
|
||||||
|
@ -67,118 +69,135 @@ namespace
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Ogre::UTFString::unicode_char unicodeCharFromChar(char ch)
|
||||||
|
{
|
||||||
|
std::string s;
|
||||||
|
s += ch;
|
||||||
|
Ogre::UTFString string(s);
|
||||||
|
return string.getChar(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> BookTextParser::split(std::string text, const int width, const int height)
|
std::vector<std::string> BookTextParser::split(std::string utf8Text, const int width, const int height)
|
||||||
{
|
{
|
||||||
|
using Ogre::UTFString;
|
||||||
std::vector<std::string> result;
|
std::vector<std::string> result;
|
||||||
|
|
||||||
MWScript::InterpreterContext interpreterContext(NULL, MWWorld::Ptr()); // empty arguments, because there is no locals or actor
|
MWScript::InterpreterContext interpreterContext(NULL, MWWorld::Ptr()); // empty arguments, because there is no locals or actor
|
||||||
text = Interpreter::fixDefinesBook(text, interpreterContext);
|
utf8Text = Interpreter::fixDefinesBook(utf8Text, interpreterContext);
|
||||||
|
|
||||||
boost::algorithm::replace_all(text, "<BR>", "\n");
|
boost::algorithm::replace_all(utf8Text, "\n", "");
|
||||||
boost::algorithm::replace_all(text, "<P>", "\n\n");
|
boost::algorithm::replace_all(utf8Text, "<BR>", "\n");
|
||||||
|
boost::algorithm::replace_all(utf8Text, "<P>", "\n\n");
|
||||||
|
|
||||||
|
UTFString text(utf8Text);
|
||||||
const int spacing = 48;
|
const int spacing = 48;
|
||||||
|
|
||||||
while (text.size() > 0)
|
const UTFString::unicode_char LEFT_ANGLE = unicodeCharFromChar('<');
|
||||||
|
const UTFString::unicode_char NEWLINE = unicodeCharFromChar('\n');
|
||||||
|
const UTFString::unicode_char SPACE = unicodeCharFromChar(' ');
|
||||||
|
|
||||||
|
while (!text.empty())
|
||||||
{
|
{
|
||||||
// read in characters until we have exceeded the size, or run out of text
|
// read in characters until we have exceeded the size, or run out of text
|
||||||
int currentWidth = 0;
|
int currentWidth = 0;
|
||||||
int currentHeight = 0;
|
int currentHeight = 0;
|
||||||
std::string currentText;
|
|
||||||
std::string currentWord;
|
|
||||||
|
|
||||||
unsigned int i=0;
|
size_t currentWordStart = 0;
|
||||||
while (currentHeight <= height-spacing && i<text.size())
|
size_t index = 0;
|
||||||
|
while (currentHeight <= height - spacing && index < text.size())
|
||||||
{
|
{
|
||||||
if (text[i] == '<')
|
const UTFString::unicode_char ch = text.getChar(index);
|
||||||
|
if (ch == LEFT_ANGLE)
|
||||||
{
|
{
|
||||||
if (text.find('>', i) == std::string::npos)
|
const size_t tagStart = index + 1;
|
||||||
|
const size_t tagEnd = text.find('>', tagStart);
|
||||||
|
if (tagEnd == UTFString::npos)
|
||||||
throw std::runtime_error("BookTextParser Error: Tag is not terminated");
|
throw std::runtime_error("BookTextParser Error: Tag is not terminated");
|
||||||
|
const std::string tag = text.substr(tagStart, tagEnd - tagStart).asUTF8();
|
||||||
|
|
||||||
if (text.size() > i+4 && text.substr(i, 4) == "<IMG")
|
if (boost::algorithm::starts_with(tag, "IMG"))
|
||||||
{
|
{
|
||||||
int h = mHeight;
|
const int h = mHeight;
|
||||||
parseImage(text.substr(i, text.find('>', i)-i), false);
|
parseImage(tag, false);
|
||||||
currentHeight += (mHeight-h);
|
currentHeight += (mHeight - h);
|
||||||
currentWidth = 0;
|
currentWidth = 0;
|
||||||
}
|
}
|
||||||
else if (text.size() > i+5 && text.substr(i, 5) == "<FONT")
|
else if (boost::algorithm::starts_with(tag, "FONT"))
|
||||||
{
|
{
|
||||||
parseFont(text.substr(i, text.find('>', i)-i));
|
parseFont(tag);
|
||||||
currentHeight += 18; // keep this in sync with the font size
|
if (currentWidth != 0) {
|
||||||
|
currentHeight += currentFontHeight();
|
||||||
|
currentWidth = 0;
|
||||||
|
}
|
||||||
currentWidth = 0;
|
currentWidth = 0;
|
||||||
}
|
}
|
||||||
else if (text.size() > i+4 && text.substr(i, 4) == "<DIV")
|
else if (boost::algorithm::starts_with(tag, "DIV"))
|
||||||
{
|
{
|
||||||
parseDiv(text.substr(i, text.find('>', i)-i));
|
parseDiv(tag);
|
||||||
currentHeight += 18; // keep this in sync with the font size
|
if (currentWidth != 0) {
|
||||||
currentWidth = 0;
|
currentHeight += currentFontHeight();
|
||||||
|
currentWidth = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
index = tagEnd;
|
||||||
currentText += text.substr(i, text.find('>', i)-i+1);
|
|
||||||
i = text.find('>', i);
|
|
||||||
}
|
}
|
||||||
else if (text[i] == '\n')
|
else if (ch == NEWLINE)
|
||||||
{
|
{
|
||||||
currentHeight += 18; // keep this in sync with the font size
|
currentHeight += currentFontHeight();
|
||||||
currentWidth = 0;
|
currentWidth = 0;
|
||||||
currentWord = "";
|
currentWordStart = index;
|
||||||
currentText += text[i];
|
|
||||||
}
|
}
|
||||||
else if (text[i] == ' ')
|
else if (ch == SPACE)
|
||||||
{
|
{
|
||||||
currentWidth += 3; // keep this in sync with the font's SpaceWidth property
|
currentWidth += 3; // keep this in sync with the font's SpaceWidth property
|
||||||
currentWord = "";
|
currentWordStart = index;
|
||||||
currentText += text[i];
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
currentWidth +=
|
currentWidth += widthForCharGlyph(ch);
|
||||||
MyGUI::FontManager::getInstance().getByName (mTextStyle.mFont == "Default" ? "EB Garamond" : mTextStyle.mFont)
|
|
||||||
->getGlyphInfo(static_cast<unsigned int>(text[i]))->width;
|
|
||||||
currentWord += text[i];
|
|
||||||
currentText += text[i];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentWidth > width)
|
if (currentWidth > width)
|
||||||
{
|
{
|
||||||
currentHeight += 18; // keep this in sync with the font size
|
currentHeight += currentFontHeight();
|
||||||
currentWidth = 0;
|
currentWidth = 0;
|
||||||
|
|
||||||
// add size of the current word
|
// add size of the current word
|
||||||
unsigned int j=0;
|
UTFString word = text.substr(currentWordStart, index - currentWordStart);
|
||||||
while (j<currentWord.size())
|
for (UTFString::const_iterator it = word.begin(), end = word.end(); it != end; ++it)
|
||||||
{
|
currentWidth += widthForCharGlyph(it.getCharacter());
|
||||||
currentWidth +=
|
|
||||||
MyGUI::FontManager::getInstance().getByName (mTextStyle.mFont == "Default" ? "EB Garamond" : mTextStyle.mFont)
|
|
||||||
->getGlyphInfo(static_cast<unsigned int>(currentWord[j]))->width;
|
|
||||||
++j;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
index += UTFString::_utf16_char_length(ch);
|
||||||
++i;
|
|
||||||
}
|
|
||||||
if (currentHeight > height-spacing)
|
|
||||||
{
|
|
||||||
// remove the last word
|
|
||||||
currentText.erase(currentText.size()-currentWord.size(), currentText.size());
|
|
||||||
}
|
}
|
||||||
|
const size_t pageEnd = (currentHeight > height - spacing && currentWordStart != 0)
|
||||||
|
? currentWordStart : index;
|
||||||
|
|
||||||
result.push_back(currentText);
|
result.push_back(text.substr(0, pageEnd).asUTF8());
|
||||||
text.erase(0, currentText.size());
|
text.erase(0, pageEnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float BookTextParser::widthForCharGlyph(unsigned unicodeChar) const
|
||||||
|
{
|
||||||
|
std::string fontName(mTextStyle.mFont == "Default" ? "EB Garamond" : mTextStyle.mFont);
|
||||||
|
return MyGUI::FontManager::getInstance().getByName(fontName)
|
||||||
|
->getGlyphInfo(unicodeChar)->width;
|
||||||
|
}
|
||||||
|
|
||||||
|
float BookTextParser::currentFontHeight() const
|
||||||
|
{
|
||||||
|
std::string fontName(mTextStyle.mFont == "Default" ? "EB Garamond" : mTextStyle.mFont);
|
||||||
|
return MyGUI::FontManager::getInstance().getByName(fontName)->getDefaultHeight();
|
||||||
|
}
|
||||||
|
|
||||||
MyGUI::IntSize BookTextParser::parse(std::string text, MyGUI::Widget* parent, const int width)
|
MyGUI::IntSize BookTextParser::parse(std::string text, MyGUI::Widget* parent, const int width)
|
||||||
{
|
{
|
||||||
MWScript::InterpreterContext interpreterContext(NULL, MWWorld::Ptr()); // empty arguments, because there is no locals or actor
|
MWScript::InterpreterContext interpreterContext(NULL, MWWorld::Ptr()); // empty arguments, because there is no locals or actor
|
||||||
text = Interpreter::fixDefinesBook(text, interpreterContext);
|
text = Interpreter::fixDefinesBook(text, interpreterContext);
|
||||||
|
|
||||||
|
|
||||||
mParent = parent;
|
mParent = parent;
|
||||||
mWidth = width;
|
mWidth = width;
|
||||||
mHeight = 0;
|
mHeight = 0;
|
||||||
|
@ -189,12 +208,13 @@ MyGUI::IntSize BookTextParser::parse(std::string text, MyGUI::Widget* parent, co
|
||||||
MyGUI::Gui::getInstance().destroyWidget(mParent->getChildAt(0));
|
MyGUI::Gui::getInstance().destroyWidget(mParent->getChildAt(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boost::algorithm::replace_all(text, "\n", "");
|
||||||
boost::algorithm::replace_all(text, "<BR>", "\n");
|
boost::algorithm::replace_all(text, "<BR>", "\n");
|
||||||
boost::algorithm::replace_all(text, "<P>", "\n\n");
|
boost::algorithm::replace_all(text, "<P>", "\n\n");
|
||||||
|
|
||||||
// remove leading newlines
|
// remove leading newlines
|
||||||
//while (text[0] == '\n')
|
// while (text[0] == '\n')
|
||||||
// text.erase(0);
|
// text.erase(0);
|
||||||
|
|
||||||
// remove trailing "
|
// remove trailing "
|
||||||
if (text[text.size()-1] == '\"')
|
if (text[text.size()-1] == '\"')
|
||||||
|
@ -279,28 +299,30 @@ void BookTextParser::parseSubText(std::string text)
|
||||||
{
|
{
|
||||||
if (text[0] == '<')
|
if (text[0] == '<')
|
||||||
{
|
{
|
||||||
if (text.find('>') == std::string::npos)
|
const size_t tagStart = 1;
|
||||||
|
const size_t tagEnd = text.find('>', tagStart);
|
||||||
|
if (tagEnd == std::string::npos)
|
||||||
throw std::runtime_error("BookTextParser Error: Tag is not terminated");
|
throw std::runtime_error("BookTextParser Error: Tag is not terminated");
|
||||||
|
const std::string tag = text.substr(tagStart, tagEnd - tagStart);
|
||||||
|
|
||||||
if (text.size() > 4 && text.substr(0, 4) == "<IMG")
|
if (boost::algorithm::starts_with(tag, "IMG"))
|
||||||
parseImage(text.substr(0, text.find('>')));
|
parseImage(tag);
|
||||||
else if (text.size() > 5 && text.substr(0, 5) == "<FONT")
|
if (boost::algorithm::starts_with(tag, "FONT"))
|
||||||
parseFont(text.substr(0, text.find('>')));
|
parseFont(tag);
|
||||||
else if (text.size() > 4 && text.substr(0, 4) == "<DIV")
|
if (boost::algorithm::starts_with(tag, "DOV"))
|
||||||
parseDiv(text.substr(0, text.find('>')));
|
parseDiv(tag);
|
||||||
|
|
||||||
text.erase(0, text.find('>')+1);
|
text.erase(0, tagEnd + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool tagFound = false;
|
size_t tagStart = std::string::npos;
|
||||||
std::string realText; // real text, without tags
|
std::string realText; // real text, without tags
|
||||||
unsigned int i=0;
|
for (size_t i = 0; i<text.size(); ++i)
|
||||||
for (; i<text.size(); ++i)
|
|
||||||
{
|
{
|
||||||
char c = text[i];
|
char c = text[i];
|
||||||
if (c == '<')
|
if (c == '<')
|
||||||
{
|
{
|
||||||
if (text[i+1] == '/') // ignore closing tags
|
if ((i + 1 < text.size()) && text[i+1] == '/') // ignore closing tags
|
||||||
{
|
{
|
||||||
while (c != '>')
|
while (c != '>')
|
||||||
{
|
{
|
||||||
|
@ -313,7 +335,7 @@ void BookTextParser::parseSubText(std::string text)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tagFound = true;
|
tagStart = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -336,8 +358,8 @@ void BookTextParser::parseSubText(std::string text)
|
||||||
box->setSize(box->getSize().width, box->getTextSize().height);
|
box->setSize(box->getSize().width, box->getTextSize().height);
|
||||||
mHeight += box->getTextSize().height;
|
mHeight += box->getTextSize().height;
|
||||||
|
|
||||||
if (tagFound)
|
if (tagStart != std::string::npos)
|
||||||
{
|
{
|
||||||
parseSubText(text.substr(i, text.size()));
|
parseSubText(text.substr(tagStart, text.size()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,8 @@ namespace MWGui
|
||||||
std::vector<std::string> split(std::string text, const int width, const int height);
|
std::vector<std::string> split(std::string text, const int width, const int height);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
float widthForCharGlyph(unsigned unicodeChar) const;
|
||||||
|
float currentFontHeight() const;
|
||||||
void parseSubText(std::string text);
|
void parseSubText(std::string text);
|
||||||
|
|
||||||
void parseImage(std::string tag, bool createWidget=true);
|
void parseImage(std::string tag, bool createWidget=true);
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#include <components/misc/stringops.hpp>
|
||||||
|
|
||||||
#include "messagebox.hpp"
|
#include "messagebox.hpp"
|
||||||
|
|
||||||
using namespace MWGui;
|
using namespace MWGui;
|
||||||
|
@ -133,6 +135,10 @@ void MessageBoxManager::setMessageBoxSpeed (int speed)
|
||||||
mMessageBoxSpeed = speed;
|
mMessageBoxSpeed = speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MessageBoxManager::enterPressed ()
|
||||||
|
{
|
||||||
|
mInterMessageBoxe->enterPressed();
|
||||||
|
}
|
||||||
|
|
||||||
int MessageBoxManager::readPressedButton ()
|
int MessageBoxManager::readPressedButton ()
|
||||||
{
|
{
|
||||||
|
@ -359,7 +365,28 @@ InteractiveMessageBox::InteractiveMessageBox(MessageBoxManager& parMessageBoxMan
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void InteractiveMessageBox::enterPressed()
|
||||||
|
{
|
||||||
|
|
||||||
|
std::string ok = Misc::StringUtils::lowerCase(MyGUI::LanguageManager::getInstance().replaceTags("#{sOK}"));
|
||||||
|
std::vector<MyGUI::ButtonPtr>::const_iterator button;
|
||||||
|
for(button = mButtons.begin(); button != mButtons.end(); ++button)
|
||||||
|
{
|
||||||
|
if(Misc::StringUtils::lowerCase((*button)->getCaption()) == ok)
|
||||||
|
{
|
||||||
|
buttonActivated(*button);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void InteractiveMessageBox::mousePressed (MyGUI::Widget* pressed)
|
void InteractiveMessageBox::mousePressed (MyGUI::Widget* pressed)
|
||||||
|
{
|
||||||
|
buttonActivated (pressed);
|
||||||
|
}
|
||||||
|
|
||||||
|
void InteractiveMessageBox::buttonActivated (MyGUI::Widget* pressed)
|
||||||
{
|
{
|
||||||
mMarkedToDelete = true;
|
mMarkedToDelete = true;
|
||||||
int index = 0;
|
int index = 0;
|
||||||
|
|
|
@ -34,7 +34,8 @@ namespace MWGui
|
||||||
void removeMessageBox (float time, MessageBox *msgbox);
|
void removeMessageBox (float time, MessageBox *msgbox);
|
||||||
bool removeMessageBox (MessageBox *msgbox);
|
bool removeMessageBox (MessageBox *msgbox);
|
||||||
void setMessageBoxSpeed (int speed);
|
void setMessageBoxSpeed (int speed);
|
||||||
|
|
||||||
|
void enterPressed();
|
||||||
int readPressedButton ();
|
int readPressedButton ();
|
||||||
|
|
||||||
MWBase::WindowManager *mWindowManager;
|
MWBase::WindowManager *mWindowManager;
|
||||||
|
@ -70,12 +71,15 @@ namespace MWGui
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
InteractiveMessageBox (MessageBoxManager& parMessageBoxManager, const std::string& message, const std::vector<std::string>& buttons);
|
InteractiveMessageBox (MessageBoxManager& parMessageBoxManager, const std::string& message, const std::vector<std::string>& buttons);
|
||||||
|
void enterPressed ();
|
||||||
void mousePressed (MyGUI::Widget* _widget);
|
void mousePressed (MyGUI::Widget* _widget);
|
||||||
int readPressedButton ();
|
int readPressedButton ();
|
||||||
|
|
||||||
bool mMarkedToDelete;
|
bool mMarkedToDelete;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void buttonActivated (MyGUI::Widget* _widget);
|
||||||
|
|
||||||
MessageBoxManager& mMessageBoxManager;
|
MessageBoxManager& mMessageBoxManager;
|
||||||
MyGUI::EditPtr mMessageWidget;
|
MyGUI::EditPtr mMessageWidget;
|
||||||
MyGUI::WidgetPtr mButtonsWidget;
|
MyGUI::WidgetPtr mButtonsWidget;
|
||||||
|
|
|
@ -560,6 +560,11 @@ void WindowManager::messageBox (const std::string& message, const std::vector<st
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WindowManager::enterPressed ()
|
||||||
|
{
|
||||||
|
mMessageBoxManager->enterPressed();
|
||||||
|
}
|
||||||
|
|
||||||
int WindowManager::readPressedButton ()
|
int WindowManager::readPressedButton ()
|
||||||
{
|
{
|
||||||
return mMessageBoxManager->readPressedButton();
|
return mMessageBoxManager->readPressedButton();
|
||||||
|
|
|
@ -189,6 +189,7 @@ namespace MWGui
|
||||||
virtual void removeDialog(OEngine::GUI::Layout* dialog); ///< Hides dialog and schedules dialog to be deleted.
|
virtual void removeDialog(OEngine::GUI::Layout* dialog); ///< Hides dialog and schedules dialog to be deleted.
|
||||||
|
|
||||||
virtual void messageBox (const std::string& message, const std::vector<std::string>& buttons);
|
virtual void messageBox (const std::string& message, const std::vector<std::string>& buttons);
|
||||||
|
virtual void enterPressed ();
|
||||||
virtual int readPressedButton (); ///< returns the index of the pressed button or -1 if no button was pressed (->MessageBoxmanager->InteractiveMessageBox)
|
virtual int readPressedButton (); ///< returns the index of the pressed button or -1 if no button was pressed (->MessageBoxmanager->InteractiveMessageBox)
|
||||||
|
|
||||||
virtual void onFrame (float frameDuration);
|
virtual void onFrame (float frameDuration);
|
||||||
|
|
|
@ -51,6 +51,7 @@ namespace MWInput
|
||||||
, mUIYMultiplier (Settings::Manager::getFloat("ui y multiplier", "Input"))
|
, mUIYMultiplier (Settings::Manager::getFloat("ui y multiplier", "Input"))
|
||||||
, mPreviewPOVDelay(0.f)
|
, mPreviewPOVDelay(0.f)
|
||||||
, mTimeIdle(0.f)
|
, mTimeIdle(0.f)
|
||||||
|
, mEnterPressed(false)
|
||||||
{
|
{
|
||||||
Ogre::RenderWindow* window = ogre.getWindow ();
|
Ogre::RenderWindow* window = ogre.getWindow ();
|
||||||
size_t windowHnd;
|
size_t windowHnd;
|
||||||
|
@ -239,6 +240,10 @@ namespace MWInput
|
||||||
|
|
||||||
void InputManager::update(float dt, bool loading)
|
void InputManager::update(float dt, bool loading)
|
||||||
{
|
{
|
||||||
|
// Pressing enter when a messagebox is prompting for "ok" will activate the ok button
|
||||||
|
if(mEnterPressed && MWBase::Environment::get().getWindowManager()->isGuiMode() && MWBase::Environment::get().getWindowManager()->getMode() == MWGui::GM_InterMessageBox)
|
||||||
|
MWBase::Environment::get().getWindowManager()->enterPressed();
|
||||||
|
|
||||||
// Tell OIS to handle all input events
|
// Tell OIS to handle all input events
|
||||||
mKeyboard->capture();
|
mKeyboard->capture();
|
||||||
mMouse->capture();
|
mMouse->capture();
|
||||||
|
@ -251,7 +256,7 @@ namespace MWInput
|
||||||
// update values of channels (as a result of pressed keys)
|
// update values of channels (as a result of pressed keys)
|
||||||
if (!loading)
|
if (!loading)
|
||||||
mInputCtrl->update(dt);
|
mInputCtrl->update(dt);
|
||||||
|
|
||||||
// Update windows/gui as a result of input events
|
// Update windows/gui as a result of input events
|
||||||
// For instance this could mean opening a new window/dialog,
|
// For instance this could mean opening a new window/dialog,
|
||||||
// by doing this after the input events are handled we
|
// by doing this after the input events are handled we
|
||||||
|
@ -431,6 +436,9 @@ namespace MWInput
|
||||||
|
|
||||||
bool InputManager::keyPressed( const OIS::KeyEvent &arg )
|
bool InputManager::keyPressed( const OIS::KeyEvent &arg )
|
||||||
{
|
{
|
||||||
|
if(arg.key == OIS::KC_RETURN && MWBase::Environment::get().getWindowManager()->isGuiMode() && MWBase::Environment::get().getWindowManager()->getMode() != MWGui::GM_Console)
|
||||||
|
mEnterPressed = true;
|
||||||
|
|
||||||
mInputCtrl->keyPressed (arg);
|
mInputCtrl->keyPressed (arg);
|
||||||
unsigned int text = arg.text;
|
unsigned int text = arg.text;
|
||||||
#ifdef __APPLE__ // filter \016 symbol for F-keys on OS X
|
#ifdef __APPLE__ // filter \016 symbol for F-keys on OS X
|
||||||
|
@ -447,6 +455,9 @@ namespace MWInput
|
||||||
|
|
||||||
bool InputManager::keyReleased( const OIS::KeyEvent &arg )
|
bool InputManager::keyReleased( const OIS::KeyEvent &arg )
|
||||||
{
|
{
|
||||||
|
if(arg.key == OIS::KC_RETURN)
|
||||||
|
mEnterPressed = false;
|
||||||
|
|
||||||
mInputCtrl->keyReleased (arg);
|
mInputCtrl->keyReleased (arg);
|
||||||
|
|
||||||
MyGUI::InputManager::getInstance().injectKeyRelease(MyGUI::KeyCode::Enum(arg.key));
|
MyGUI::InputManager::getInstance().injectKeyRelease(MyGUI::KeyCode::Enum(arg.key));
|
||||||
|
|
|
@ -151,6 +151,8 @@ namespace MWInput
|
||||||
|
|
||||||
std::map<std::string, bool> mControlSwitch;
|
std::map<std::string, bool> mControlSwitch;
|
||||||
|
|
||||||
|
bool mEnterPressed;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void adjustMouseRegion(int width, int height);
|
void adjustMouseRegion(int width, int height);
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,11 @@
|
||||||
#include "../mwsound/sound_decoder.hpp"
|
#include "../mwsound/sound_decoder.hpp"
|
||||||
#include "../mwsound/sound.hpp"
|
#include "../mwsound/sound.hpp"
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include <BaseTsd.h>
|
||||||
|
|
||||||
|
typedef SSIZE_T ssize_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace MWRender
|
namespace MWRender
|
||||||
{
|
{
|
||||||
|
@ -361,7 +366,11 @@ class MovieAudioDecoder : public MWSound::Sound_Decoder
|
||||||
}
|
}
|
||||||
|
|
||||||
void open(const std::string&)
|
void open(const std::string&)
|
||||||
|
#ifdef _WIN32
|
||||||
|
{ fail(std::string("Invalid call to ")+__FUNCSIG__); }
|
||||||
|
#else
|
||||||
{ fail(std::string("Invalid call to ")+__PRETTY_FUNCTION__); }
|
{ fail(std::string("Invalid call to ")+__PRETTY_FUNCTION__); }
|
||||||
|
#endif
|
||||||
|
|
||||||
void close() { }
|
void close() { }
|
||||||
|
|
||||||
|
|
|
@ -160,6 +160,7 @@ void FFmpeg_Decoder::open(const std::string &fname)
|
||||||
{
|
{
|
||||||
if(mFormatCtx->streams[j]->codec->codec_type == AVMEDIA_TYPE_AUDIO)
|
if(mFormatCtx->streams[j]->codec->codec_type == AVMEDIA_TYPE_AUDIO)
|
||||||
{
|
{
|
||||||
|
mFormatCtx->streams[j]->codec->request_sample_fmt = AV_SAMPLE_FMT_S16;
|
||||||
mStream = &mFormatCtx->streams[j];
|
mStream = &mFormatCtx->streams[j];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@ gugus / gus
|
||||||
Jacob Essex (Yacoby)
|
Jacob Essex (Yacoby)
|
||||||
Jannik Heller (scrawl)
|
Jannik Heller (scrawl)
|
||||||
Jason Hooks (jhooks)
|
Jason Hooks (jhooks)
|
||||||
|
Joel Graff (graffy)
|
||||||
Karl-Felix Glatzer (k1ll)
|
Karl-Felix Glatzer (k1ll)
|
||||||
lazydev
|
lazydev
|
||||||
Leon Saunders (emoose)
|
Leon Saunders (emoose)
|
||||||
|
|
18
extern/shiny/Main/Factory.cpp
vendored
18
extern/shiny/Main/Factory.cpp
vendored
|
@ -15,6 +15,7 @@
|
||||||
namespace sh
|
namespace sh
|
||||||
{
|
{
|
||||||
Factory* Factory::sThis = 0;
|
Factory* Factory::sThis = 0;
|
||||||
|
const std::string Factory::mBinaryCacheName = "binaryCache";
|
||||||
|
|
||||||
Factory& Factory::getInstance()
|
Factory& Factory::getInstance()
|
||||||
{
|
{
|
||||||
|
@ -198,16 +199,16 @@ namespace sh
|
||||||
if (mShadersLastModified[sourceRelative] != lastModified)
|
if (mShadersLastModified[sourceRelative] != lastModified)
|
||||||
{
|
{
|
||||||
// delete any outdated shaders based on this shader set
|
// delete any outdated shaders based on this shader set
|
||||||
removeCache (it->first);
|
if (removeCache (it->first))
|
||||||
// remove the whole binary cache (removing only the individual shaders does not seem to be possible at this point with OGRE)
|
removeBinaryCache = true;
|
||||||
removeBinaryCache = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// if we get here, this is either the first run or a new shader file was added
|
// if we get here, this is either the first run or a new shader file was added
|
||||||
// in both cases we can safely delete
|
// in both cases we can safely delete
|
||||||
removeCache (it->first);
|
if (removeCache (it->first))
|
||||||
|
removeBinaryCache = true;
|
||||||
}
|
}
|
||||||
mShaderSets.insert(std::make_pair(it->first, newSet));
|
mShaderSets.insert(std::make_pair(it->first, newSet));
|
||||||
}
|
}
|
||||||
|
@ -304,7 +305,7 @@ namespace sh
|
||||||
|
|
||||||
if (mPlatform->supportsShaderSerialization () && mReadMicrocodeCache && !removeBinaryCache)
|
if (mPlatform->supportsShaderSerialization () && mReadMicrocodeCache && !removeBinaryCache)
|
||||||
{
|
{
|
||||||
std::string file = mPlatform->getCacheFolder () + "/shShaderCache.txt";
|
std::string file = mPlatform->getCacheFolder () + "/" + mBinaryCacheName;
|
||||||
if (boost::filesystem::exists(file))
|
if (boost::filesystem::exists(file))
|
||||||
{
|
{
|
||||||
mPlatform->deserializeShaders (file);
|
mPlatform->deserializeShaders (file);
|
||||||
|
@ -316,7 +317,7 @@ namespace sh
|
||||||
{
|
{
|
||||||
if (mPlatform->supportsShaderSerialization () && mWriteMicrocodeCache)
|
if (mPlatform->supportsShaderSerialization () && mWriteMicrocodeCache)
|
||||||
{
|
{
|
||||||
std::string file = mPlatform->getCacheFolder () + "/shShaderCache.txt";
|
std::string file = mPlatform->getCacheFolder () + "/" + mBinaryCacheName;
|
||||||
mPlatform->serializeShaders (file);
|
mPlatform->serializeShaders (file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -590,8 +591,9 @@ namespace sh
|
||||||
m->createForConfiguration (configuration, 0);
|
m->createForConfiguration (configuration, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Factory::removeCache(const std::string& pattern)
|
bool Factory::removeCache(const std::string& pattern)
|
||||||
{
|
{
|
||||||
|
bool ret = false;
|
||||||
if ( boost::filesystem::exists(mPlatform->getCacheFolder())
|
if ( boost::filesystem::exists(mPlatform->getCacheFolder())
|
||||||
&& boost::filesystem::is_directory(mPlatform->getCacheFolder()))
|
&& boost::filesystem::is_directory(mPlatform->getCacheFolder()))
|
||||||
{
|
{
|
||||||
|
@ -620,10 +622,12 @@ namespace sh
|
||||||
if (shaderName == pattern)
|
if (shaderName == pattern)
|
||||||
{
|
{
|
||||||
boost::filesystem::remove(file);
|
boost::filesystem::remove(file);
|
||||||
|
ret = true;
|
||||||
std::cout << "Removing outdated shader: " << file << std::endl;
|
std::cout << "Removing outdated shader: " << file << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
5
extern/shiny/Main/Factory.hpp
vendored
5
extern/shiny/Main/Factory.hpp
vendored
|
@ -203,7 +203,10 @@ namespace sh
|
||||||
MaterialInstance* findInstance (const std::string& name);
|
MaterialInstance* findInstance (const std::string& name);
|
||||||
MaterialInstance* searchInstance (const std::string& name);
|
MaterialInstance* searchInstance (const std::string& name);
|
||||||
|
|
||||||
void removeCache (const std::string& pattern);
|
/// @return was anything removed?
|
||||||
|
bool removeCache (const std::string& pattern);
|
||||||
|
|
||||||
|
static const std::string mBinaryCacheName;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue