mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-09-10 03:54:54 -06:00
Turtle: LaunchWebBrowser support
git-svn-id: svn://ultimatepp.org/upp/trunk@6878 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
84fcd51db2
commit
ddcc803994
5 changed files with 35 additions and 8 deletions
|
|
@ -415,6 +415,17 @@ void AppExit__()
|
|||
#endif
|
||||
}
|
||||
|
||||
#ifdef flagTURTLE
|
||||
|
||||
void Turtle_PutLink(const String& link);
|
||||
|
||||
void LaunchWebBrowser(const String& url)
|
||||
{
|
||||
Turtle_PutLink(url);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#if defined(PLATFORM_WIN32) && !defined(PLATFORM_WINCE)
|
||||
static auxthread_t auxthread__ sShellExecuteOpen(void *str)
|
||||
{
|
||||
|
|
@ -453,6 +464,8 @@ void LaunchWebBrowser(const String& url)
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
String GetDataFile(const char *filename)
|
||||
{
|
||||
String s = GetEnv("UPP_MAIN__");
|
||||
|
|
|
|||
|
|
@ -71,15 +71,10 @@ private:
|
|||
static void Signal(int signal);
|
||||
static void Broadcast(int signal);
|
||||
|
||||
static bool DoKeyFB(dword key, int cnt);
|
||||
|
||||
static TurtleStream turtle_stream;
|
||||
static Stream& OutputStream() { turtle_stream.SetDataFlag(); return turtle_stream; }
|
||||
static void Put8(int x) { turtle_stream.SetDataFlag(); turtle_stream.Put(x); }
|
||||
static void Put16(int x);
|
||||
static void Put32(int x);
|
||||
static void Put(Point p);
|
||||
static void Put(Size sz);
|
||||
static void Put(const Rect& r);
|
||||
static void Put(const String& s);
|
||||
|
||||
friend void DrawDragRect(Ctrl& q, const Rect& rect1, const Rect& rect2, const Rect& clip,
|
||||
int n, Color color, int type, int animation);
|
||||
|
|
@ -91,7 +86,13 @@ private:
|
|||
friend struct ImageSysData;
|
||||
|
||||
public:
|
||||
static bool DoKeyFB(dword key, int cnt);
|
||||
static void Put8(int x) { turtle_stream.SetDataFlag(); turtle_stream.Put(x); }
|
||||
static void Put16(int x);
|
||||
static void Put32(int x);
|
||||
static void Put(Point p);
|
||||
static void Put(Size sz);
|
||||
static void Put(const Rect& r);
|
||||
static void Put(const String& s);
|
||||
|
||||
static void SyncClient();
|
||||
|
||||
|
|
|
|||
|
|
@ -46,6 +46,12 @@ void Ctrl::Put(const String& s)
|
|||
turtle_stream.Put(s);
|
||||
}
|
||||
|
||||
void Turtle_PutLink(const String& link)
|
||||
{
|
||||
Ctrl::Put8(OPENLINK);
|
||||
Ctrl::Put(link);
|
||||
}
|
||||
|
||||
void Ctrl::Output()
|
||||
{
|
||||
socket.Timeout(20000);
|
||||
|
|
|
|||
|
|
@ -57,6 +57,8 @@ enum Command {
|
|||
|
||||
HORZDRAGLINE = 18,
|
||||
VERTDRAGLINE = 19,
|
||||
|
||||
OPENLINK = 20,
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -374,6 +374,11 @@ function ProcessDraw(s)
|
|||
var anim = Get16(p);
|
||||
DrawDragLine(x, y, 1, l, anim);
|
||||
}
|
||||
else
|
||||
if(Char(p, 20)) { // OPENLINK,
|
||||
var s = GetString(p);
|
||||
window.open(s);
|
||||
}
|
||||
else {
|
||||
alert("Unrecognized code: " + p.data[p.pos] + " after " + lastCommand + " lastLen " + lastLen + " lastString " + lastString);
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue