mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-16 22:02:58 -06:00
Fixed Unicode__ clipboard issue
This commit is contained in:
parent
01119b24bd
commit
2db6c3dfd9
4 changed files with 4 additions and 26 deletions
|
|
@ -113,16 +113,6 @@ const void *GetInternalDropPtr__()
|
||||||
return sInternalPtr;
|
return sInternalPtr;
|
||||||
}
|
}
|
||||||
|
|
||||||
String Unicode__(const WString& w)
|
|
||||||
{
|
|
||||||
return String((const char *)~w, 2 * w.GetLength());
|
|
||||||
}
|
|
||||||
|
|
||||||
WString Unicode__(const String& s)
|
|
||||||
{
|
|
||||||
return WString((const wchar *)~s, s.GetLength() / 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
void GuiPlatformAdjustDragImage(ImageBuffer& b);
|
void GuiPlatformAdjustDragImage(ImageBuffer& b);
|
||||||
|
|
||||||
Image MakeDragImage(const Image& arrow, Image sample)
|
Image MakeDragImage(const Image& arrow, Image sample)
|
||||||
|
|
|
||||||
|
|
@ -305,9 +305,6 @@ public:
|
||||||
PasteClip();
|
PasteClip();
|
||||||
};
|
};
|
||||||
|
|
||||||
String Unicode__(const WString& w);
|
|
||||||
WString Unicode__(const String& s);
|
|
||||||
|
|
||||||
void GuiPlatformAdjustDragImage(ImageBuffer& b);
|
void GuiPlatformAdjustDragImage(ImageBuffer& b);
|
||||||
|
|
||||||
Image MakeDragImage(const Image& arrow, Image sample);
|
Image MakeDragImage(const Image& arrow, Image sample);
|
||||||
|
|
|
||||||
|
|
@ -278,7 +278,8 @@ static String sText(const Value& data)
|
||||||
|
|
||||||
static String sWText(const Value& data)
|
static String sWText(const Value& data)
|
||||||
{
|
{
|
||||||
return Unicode__(WString(data));
|
Vector<char16> h = ToUtf16(WString(data));
|
||||||
|
return String(h.begin(), sizeof(char16) * h.GetCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Append(VectorMap<String, ClipData>& data, const String& text)
|
void Append(VectorMap<String, ClipData>& data, const String& text)
|
||||||
|
|
@ -298,7 +299,7 @@ String GetTextClip(const WString& text, const String& fmt)
|
||||||
if(fmt == "text")
|
if(fmt == "text")
|
||||||
return text.ToString();
|
return text.ToString();
|
||||||
if(fmt == "wtext")
|
if(fmt == "wtext")
|
||||||
return Unicode__(text);
|
return sWText(text);
|
||||||
return Null;
|
return Null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -307,7 +308,7 @@ String GetTextClip(const String& text, const String& fmt)
|
||||||
if(fmt == "text")
|
if(fmt == "text")
|
||||||
return text;
|
return text;
|
||||||
if(fmt == "wtext")
|
if(fmt == "wtext")
|
||||||
return Unicode__(text.ToWString());
|
return sWText(text.ToWString());
|
||||||
return Null;
|
return Null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -260,8 +260,6 @@ String GetString(PasteClip& clip)
|
||||||
return ~clip;
|
return ~clip;
|
||||||
if(clip.Accept("UTF8_STRING"))
|
if(clip.Accept("UTF8_STRING"))
|
||||||
return ToUtf32(~clip).ToString();
|
return ToUtf32(~clip).ToString();
|
||||||
if(clip.Accept("text/unicode"))
|
|
||||||
return Unicode__(~clip).ToString();
|
|
||||||
return Null;
|
return Null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -270,8 +268,6 @@ WString GetWString(PasteClip& clip)
|
||||||
GuiLock __;
|
GuiLock __;
|
||||||
if(clip.Accept("UTF8_STRING"))
|
if(clip.Accept("UTF8_STRING"))
|
||||||
return ToUtf32(~clip);
|
return ToUtf32(~clip);
|
||||||
if(clip.Accept("text/unicode"))
|
|
||||||
return Unicode__(~clip);
|
|
||||||
if(clip.Accept("STRING") || clip.Accept("text/plain"))
|
if(clip.Accept("STRING") || clip.Accept("text/plain"))
|
||||||
return ToUnicode(~clip, CHARSET_ISO8859_1);
|
return ToUnicode(~clip, CHARSET_ISO8859_1);
|
||||||
return Null;
|
return Null;
|
||||||
|
|
@ -284,8 +280,6 @@ String GetTextClip(const WString& text, const String& fmt)
|
||||||
return text.ToString();
|
return text.ToString();
|
||||||
if(fmt == "UTF8_STRING")
|
if(fmt == "UTF8_STRING")
|
||||||
return ToUtf8(text);
|
return ToUtf8(text);
|
||||||
if(fmt == "text/unicode")
|
|
||||||
return Unicode__(text);
|
|
||||||
return Null;
|
return Null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -296,8 +290,6 @@ String GetTextClip(const String& text, const String& fmt)
|
||||||
return text;
|
return text;
|
||||||
if(fmt == "UTF8_STRING")
|
if(fmt == "UTF8_STRING")
|
||||||
return ToUtf8(text.ToWString());
|
return ToUtf8(text.ToWString());
|
||||||
if(fmt == "text/unicode")
|
|
||||||
return Unicode__(text.ToWString());
|
|
||||||
return Null;
|
return Null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -313,7 +305,6 @@ void Append(VectorMap<String, ClipData>& data, const String& text) // optimize
|
||||||
data.GetAdd("STRING", text);
|
data.GetAdd("STRING", text);
|
||||||
data.GetAdd("text/plain", text);
|
data.GetAdd("text/plain", text);
|
||||||
data.GetAdd("UTF8_STRING", ToUtf8(text.ToWString()));
|
data.GetAdd("UTF8_STRING", ToUtf8(text.ToWString()));
|
||||||
data.GetAdd("text/unicode", Unicode__(text.ToWString()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Append(VectorMap<String, ClipData>& data, const WString& text) // optimize
|
void Append(VectorMap<String, ClipData>& data, const WString& text) // optimize
|
||||||
|
|
@ -322,7 +313,6 @@ void Append(VectorMap<String, ClipData>& data, const WString& text) // optimize
|
||||||
data.GetAdd("STRING", text.ToString());
|
data.GetAdd("STRING", text.ToString());
|
||||||
data.GetAdd("text/plain", text.ToString());
|
data.GetAdd("text/plain", text.ToString());
|
||||||
data.GetAdd("UTF8_STRING", ToUtf8(text));
|
data.GetAdd("UTF8_STRING", ToUtf8(text));
|
||||||
data.GetAdd("text/unicode", Unicode__(text));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsClipboardAvailable(const char *fmt)
|
bool IsClipboardAvailable(const char *fmt)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue