mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-26 00:36:17 +00:00
Changed: Minor changes
This commit is contained in:
parent
81ca1a9a04
commit
f93dfcfefe
8 changed files with 87 additions and 35 deletions
|
@ -29,7 +29,7 @@ namespace NLGUI
|
||||||
DECLARE_UI_CLASS( CCtrlDraggable )
|
DECLARE_UI_CLASS( CCtrlDraggable )
|
||||||
|
|
||||||
CCtrlDraggable( const TCtorParam ¶m );
|
CCtrlDraggable( const TCtorParam ¶m );
|
||||||
virtual ~CCtrlDraggable(){};
|
virtual ~CCtrlDraggable(){}
|
||||||
|
|
||||||
static CCtrlDraggable *getDraggedSheet(){ return _LastDraggedSheet; }
|
static CCtrlDraggable *getDraggedSheet(){ return _LastDraggedSheet; }
|
||||||
bool isDragged() const{ return dragged; }
|
bool isDragged() const{ return dragged; }
|
||||||
|
|
|
@ -72,10 +72,12 @@ namespace NLGUI
|
||||||
GroupChildren = 4 /// module can parse when parsing the group children
|
GroupChildren = 4 /// module can parse when parsing the group children
|
||||||
};
|
};
|
||||||
|
|
||||||
IParserModule(){
|
IParserModule()
|
||||||
|
{
|
||||||
parser = NULL;
|
parser = NULL;
|
||||||
parsingStage = None;
|
parsingStage = None;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~IParserModule(){}
|
virtual ~IParserModule(){}
|
||||||
|
|
||||||
bool canParseInStage( ParsingStage stage )
|
bool canParseInStage( ParsingStage stage )
|
||||||
|
|
|
@ -71,7 +71,7 @@ namespace NLGUI
|
||||||
class IOnWidgetsDrawnHandler
|
class IOnWidgetsDrawnHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~IOnWidgetsDrawnHandler(){};
|
virtual ~IOnWidgetsDrawnHandler(){}
|
||||||
virtual void process() = 0;
|
virtual void process() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,8 @@ namespace NLGUI
|
||||||
{
|
{
|
||||||
char c = toLower( s[ i ] );
|
char c = toLower( s[ i ] );
|
||||||
|
|
||||||
switch( c ){
|
switch( c )
|
||||||
|
{
|
||||||
case 'l':
|
case 'l':
|
||||||
_Align &= ~1;
|
_Align &= ~1;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -5882,9 +5882,11 @@ namespace NLGUI
|
||||||
{
|
{
|
||||||
const char* digits = (Type == "I" ? upper : lower);
|
const char* digits = (Type == "I" ? upper : lower);
|
||||||
uint8 i, d=0;
|
uint8 i, d=0;
|
||||||
do {
|
do
|
||||||
|
{
|
||||||
uint32 num = number % 10;
|
uint32 num = number % 10;
|
||||||
if (num % 5 < 4){
|
if (num % 5 < 4)
|
||||||
|
{
|
||||||
for (i = num % 5; i > 0; i--)
|
for (i = num % 5; i > 0; i--)
|
||||||
{
|
{
|
||||||
ret.insert(ret.begin(), digits[d]);
|
ret.insert(ret.begin(), digits[d]);
|
||||||
|
@ -5904,7 +5906,9 @@ namespace NLGUI
|
||||||
}
|
}
|
||||||
number /= 10;
|
number /= 10;
|
||||||
d += 2;
|
d += 2;
|
||||||
} while (number > 0);
|
}
|
||||||
|
while (number > 0);
|
||||||
|
|
||||||
if (Type == "I")
|
if (Type == "I")
|
||||||
{
|
{
|
||||||
ret = toUpper(ret);
|
ret = toUpper(ret);
|
||||||
|
|
|
@ -121,69 +121,112 @@ namespace NLGUI
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
// http://stackoverflow.com/a/18335183
|
// 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;
|
unsigned char c,c2,c3,c4;
|
||||||
std::string to;
|
std::string to;
|
||||||
to.reserve(f_size);
|
to.reserve(f_size);
|
||||||
|
|
||||||
for(i=0 ; i<f_size ; i++){
|
for(i=0 ; i<f_size ; i++)
|
||||||
|
{
|
||||||
c=(unsigned char)(str[i]);
|
c=(unsigned char)(str[i]);
|
||||||
if(c<32){//control char
|
if (c<32)
|
||||||
if(c==9 || c==10 || c==13){//allow only \t \n \r
|
{
|
||||||
|
//control char
|
||||||
|
if(c==9 || c==10 || c==13)
|
||||||
|
{
|
||||||
|
//allow only \t \n \r
|
||||||
to.append(1,c);
|
to.append(1,c);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}else if(c<127){//normal ASCII
|
}
|
||||||
|
else if (c<127)
|
||||||
|
{
|
||||||
|
//normal ASCII
|
||||||
to.append(1,c);
|
to.append(1,c);
|
||||||
continue;
|
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,226);
|
||||||
to.append(1,130);
|
to.append(1,130);
|
||||||
to.append(1,172);
|
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,10);
|
||||||
to.append(1,13);
|
to.append(1,13);
|
||||||
}
|
}
|
||||||
continue;
|
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,(unsigned char)194);
|
||||||
to.append(1,c);
|
to.append(1,c);
|
||||||
continue;
|
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,(unsigned char)195);
|
||||||
to.append(1,c-64);
|
to.append(1,c-64);
|
||||||
continue;
|
continue;
|
||||||
}else if(c<224 && i+1<f_size){//possibly 2byte UTF8
|
}
|
||||||
c2=(unsigned char)(str[i+1]);
|
else if (c < 224 && i + 1 < f_size)
|
||||||
if(c2>127 && c2<192){//valid 2byte UTF8
|
{
|
||||||
if(c==194 && c2<160){//control char, skipping
|
//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,c);
|
||||||
to.append(1,c2);
|
to.append(1,c2);
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}else if(c<240 && i+2<f_size){//possibly 3byte UTF8
|
}
|
||||||
c2=(unsigned char)(str[i+1]);
|
else if (c < 240 && i + 2 < f_size)
|
||||||
c3=(unsigned char)(str[i+2]);
|
{
|
||||||
if(c2>127 && c2<192 && c3>127 && c3<192){//valid 3byte UTF8
|
// 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,c);
|
||||||
to.append(1,c2);
|
to.append(1,c2);
|
||||||
to.append(1,c3);
|
to.append(1,c3);
|
||||||
i+=2;
|
i+=2;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}else if(c<245 && i+3<f_size){//possibly 4byte UTF8
|
}
|
||||||
c2=(unsigned char)(str[i+1]);
|
else if (c < 245 && i + 3 < f_size)
|
||||||
c3=(unsigned char)(str[i+2]);
|
{
|
||||||
c4=(unsigned char)(str[i+3]);
|
//possibly 4byte UTF8
|
||||||
if(c2>127 && c2<192 && c3>127 && c3<192 && c4>127 && c4<192){//valid 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,c);
|
||||||
to.append(1,c2);
|
to.append(1,c2);
|
||||||
to.append(1,c3);
|
to.append(1,c3);
|
||||||
|
@ -192,6 +235,7 @@ namespace NLGUI
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//invalid UTF8, converting ASCII (c>245 || string too short for multi-byte))
|
//invalid UTF8, converting ASCII (c>245 || string too short for multi-byte))
|
||||||
to.append(1,(unsigned char)195);
|
to.append(1,(unsigned char)195);
|
||||||
to.append(1,c-64);
|
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.
|
// 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 };
|
static uint8 INTERLACED_JUMP[] = { 8, 8, 4, 2 };
|
||||||
#endif
|
#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);
|
NLMISC::IStream *f = static_cast<NLMISC::IStream *>(gif->UserData);
|
||||||
|
|
||||||
if(!f->isReading()) return 0;
|
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; }
|
void addTaskAt(T t, CTask<T>* task) { task->setTime(t); _Tasks.push_back(task);_Clean = false; }
|
||||||
uint32 getSize() const { return (uint32)_Tasks.size(); }
|
uint32 getSize() const { return (uint32)_Tasks.size(); }
|
||||||
CTask<T>* getTaskAt(uint32 index) const { nlassert( index < _Tasks.size()); return _Tasks[index].getTask();}
|
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
|
// Waiting task are discared
|
||||||
|
|
Loading…
Reference in a new issue