mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-20 16:08:44 +00:00
Merge with develop
--HG-- branch : compatibility-develop
This commit is contained in:
commit
2d8407157b
8 changed files with 87 additions and 35 deletions
|
@ -29,7 +29,7 @@ namespace NLGUI
|
|||
DECLARE_UI_CLASS( CCtrlDraggable )
|
||||
|
||||
CCtrlDraggable( const TCtorParam ¶m );
|
||||
virtual ~CCtrlDraggable(){};
|
||||
virtual ~CCtrlDraggable(){}
|
||||
|
||||
static CCtrlDraggable *getDraggedSheet(){ return _LastDraggedSheet; }
|
||||
bool isDragged() const{ return dragged; }
|
||||
|
|
|
@ -72,10 +72,12 @@ namespace NLGUI
|
|||
GroupChildren = 4 /// module can parse when parsing the group children
|
||||
};
|
||||
|
||||
IParserModule(){
|
||||
IParserModule()
|
||||
{
|
||||
parser = NULL;
|
||||
parsingStage = None;
|
||||
}
|
||||
|
||||
virtual ~IParserModule(){}
|
||||
|
||||
bool canParseInStage( ParsingStage stage )
|
||||
|
|
|
@ -71,7 +71,7 @@ namespace NLGUI
|
|||
class IOnWidgetsDrawnHandler
|
||||
{
|
||||
public:
|
||||
virtual ~IOnWidgetsDrawnHandler(){};
|
||||
virtual ~IOnWidgetsDrawnHandler(){}
|
||||
virtual void process() = 0;
|
||||
};
|
||||
|
||||
|
|
|
@ -40,7 +40,8 @@ namespace NLGUI
|
|||
{
|
||||
char c = toLower( s[ i ] );
|
||||
|
||||
switch( c ){
|
||||
switch( c )
|
||||
{
|
||||
case 'l':
|
||||
_Align &= ~1;
|
||||
break;
|
||||
|
|
|
@ -5882,9 +5882,11 @@ namespace NLGUI
|
|||
{
|
||||
const char* digits = (Type == "I" ? upper : lower);
|
||||
uint8 i, d=0;
|
||||
do {
|
||||
do
|
||||
{
|
||||
uint32 num = number % 10;
|
||||
if (num % 5 < 4){
|
||||
if (num % 5 < 4)
|
||||
{
|
||||
for (i = num % 5; i > 0; i--)
|
||||
{
|
||||
ret.insert(ret.begin(), digits[d]);
|
||||
|
@ -5904,7 +5906,9 @@ namespace NLGUI
|
|||
}
|
||||
number /= 10;
|
||||
d += 2;
|
||||
} while (number > 0);
|
||||
}
|
||||
while (number > 0);
|
||||
|
||||
if (Type == "I")
|
||||
{
|
||||
ret = toUpper(ret);
|
||||
|
|
|
@ -121,69 +121,112 @@ namespace NLGUI
|
|||
|
||||
// ***************************************************************************
|
||||
// http://stackoverflow.com/a/18335183
|
||||
static std::string correct_non_utf_8(const std::string &str)
|
||||
static std::string correctNonUtf8(const std::string &str)
|
||||
{
|
||||
int i,f_size=str.size();
|
||||
int i, f_size=str.size();
|
||||
unsigned char c,c2,c3,c4;
|
||||
std::string to;
|
||||
to.reserve(f_size);
|
||||
|
||||
for(i=0 ; i<f_size ; i++){
|
||||
for(i=0 ; i<f_size ; i++)
|
||||
{
|
||||
c=(unsigned char)(str[i]);
|
||||
if(c<32){//control char
|
||||
if(c==9 || c==10 || c==13){//allow only \t \n \r
|
||||
if (c<32)
|
||||
{
|
||||
//control char
|
||||
if(c==9 || c==10 || c==13)
|
||||
{
|
||||
//allow only \t \n \r
|
||||
to.append(1,c);
|
||||
}
|
||||
continue;
|
||||
}else if(c<127){//normal ASCII
|
||||
}
|
||||
else if (c<127)
|
||||
{
|
||||
//normal ASCII
|
||||
to.append(1,c);
|
||||
continue;
|
||||
}else if(c<160){//control char (nothing should be defined here either ASCI, ISO_8859-1 or UTF8, so skipping)
|
||||
if(c==128){//fix microsoft mess, add euro
|
||||
}
|
||||
else if (c < 160)
|
||||
{
|
||||
//control char (nothing should be defined here either ASCI, ISO_8859-1 or UTF8, so skipping)
|
||||
if (c == 128)
|
||||
{
|
||||
//fix microsoft mess, add euro
|
||||
to.append(1,226);
|
||||
to.append(1,130);
|
||||
to.append(1,172);
|
||||
}
|
||||
if(c==133){//fix IBM mess, add NEL = \n\r
|
||||
|
||||
if (c == 133)
|
||||
{
|
||||
//fix IBM mess, add NEL = \n\r
|
||||
to.append(1,10);
|
||||
to.append(1,13);
|
||||
}
|
||||
continue;
|
||||
}else if(c<192){//invalid for UTF8, converting ASCII
|
||||
}
|
||||
else if (c < 192)
|
||||
{
|
||||
//invalid for UTF8, converting ASCII
|
||||
to.append(1,(unsigned char)194);
|
||||
to.append(1,c);
|
||||
continue;
|
||||
}else if(c<194){//invalid for UTF8, converting ASCII
|
||||
}
|
||||
else if (c < 194)
|
||||
{
|
||||
//invalid for UTF8, converting ASCII
|
||||
to.append(1,(unsigned char)195);
|
||||
to.append(1,c-64);
|
||||
continue;
|
||||
}else if(c<224 && i+1<f_size){//possibly 2byte UTF8
|
||||
c2=(unsigned char)(str[i+1]);
|
||||
if(c2>127 && c2<192){//valid 2byte UTF8
|
||||
if(c==194 && c2<160){//control char, skipping
|
||||
}
|
||||
else if (c < 224 && i + 1 < f_size)
|
||||
{
|
||||
//possibly 2byte UTF8
|
||||
c2 = (unsigned char)(str[i+1]);
|
||||
|
||||
if (c2 > 127 && c2 < 192)
|
||||
{
|
||||
//valid 2byte UTF8
|
||||
if (c == 194 && c2 < 160)
|
||||
{
|
||||
//control char, skipping
|
||||
;
|
||||
}else{
|
||||
}
|
||||
else
|
||||
{
|
||||
to.append(1,c);
|
||||
to.append(1,c2);
|
||||
}
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
}else if(c<240 && i+2<f_size){//possibly 3byte UTF8
|
||||
c2=(unsigned char)(str[i+1]);
|
||||
c3=(unsigned char)(str[i+2]);
|
||||
if(c2>127 && c2<192 && c3>127 && c3<192){//valid 3byte UTF8
|
||||
}
|
||||
else if (c < 240 && i + 2 < f_size)
|
||||
{
|
||||
// possibly 3byte UTF8
|
||||
c2 = (unsigned char)(str[i+1]);
|
||||
c3 = (unsigned char)(str[i+2]);
|
||||
|
||||
if (c2 > 127 && c2 < 192 && c3 > 127 && c3 < 192)
|
||||
{
|
||||
// valid 3byte UTF8
|
||||
to.append(1,c);
|
||||
to.append(1,c2);
|
||||
to.append(1,c3);
|
||||
i+=2;
|
||||
continue;
|
||||
}
|
||||
}else if(c<245 && i+3<f_size){//possibly 4byte UTF8
|
||||
c2=(unsigned char)(str[i+1]);
|
||||
c3=(unsigned char)(str[i+2]);
|
||||
c4=(unsigned char)(str[i+3]);
|
||||
if(c2>127 && c2<192 && c3>127 && c3<192 && c4>127 && c4<192){//valid 4byte UTF8
|
||||
}
|
||||
else if (c < 245 && i + 3 < f_size)
|
||||
{
|
||||
//possibly 4byte UTF8
|
||||
c2 = (unsigned char)(str[i+1]);
|
||||
c3 = (unsigned char)(str[i+2]);
|
||||
c4 = (unsigned char)(str[i+3]);
|
||||
if (c2 > 127 && c2 < 192 && c3 > 127 && c3 < 192 && c4 > 127 && c4 < 192)
|
||||
{
|
||||
//valid 4byte UTF8
|
||||
to.append(1,c);
|
||||
to.append(1,c2);
|
||||
to.append(1,c3);
|
||||
|
@ -192,6 +235,7 @@ namespace NLGUI
|
|||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
//invalid UTF8, converting ASCII (c>245 || string too short for multi-byte))
|
||||
to.append(1,(unsigned char)195);
|
||||
to.append(1,c-64);
|
||||
|
@ -250,7 +294,7 @@ namespace NLGUI
|
|||
}
|
||||
|
||||
// if there is invalid utf-8 chars, then libxml will break everything after first it finds.
|
||||
htmlString = correct_non_utf_8(htmlString);
|
||||
htmlString = correctNonUtf8(htmlString);
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
|
|
@ -49,7 +49,8 @@ static uint8 INTERLACED_OFFSET[] = { 0, 4, 2, 1 };
|
|||
static uint8 INTERLACED_JUMP[] = { 8, 8, 4, 2 };
|
||||
#endif
|
||||
|
||||
static int readGIFData(GifFileType *gif, GifByteType *data, int length){
|
||||
static int readGIFData(GifFileType *gif, GifByteType *data, int length)
|
||||
{
|
||||
NLMISC::IStream *f = static_cast<NLMISC::IStream *>(gif->UserData);
|
||||
|
||||
if(!f->isReading()) return 0;
|
||||
|
|
|
@ -99,7 +99,7 @@ public:
|
|||
void addTaskAt(T t, CTask<T>* task) { task->setTime(t); _Tasks.push_back(task);_Clean = false; }
|
||||
uint32 getSize() const { return (uint32)_Tasks.size(); }
|
||||
CTask<T>* getTaskAt(uint32 index) const { nlassert( index < _Tasks.size()); return _Tasks[index].getTask();}
|
||||
void removeTaskAt(uint32 index){ nlassert( index < _Tasks.size()); _Tasks.erase(_Tasks.begin() + index); };
|
||||
void removeTaskAt(uint32 index){ nlassert( index < _Tasks.size()); _Tasks.erase(_Tasks.begin() + index); }
|
||||
|
||||
|
||||
// Waiting task are discared
|
||||
|
|
Loading…
Reference in a new issue