diff --git a/uppsrc/Core/App.cpp b/uppsrc/Core/App.cpp index cdc60c4db..f13ae6c52 100644 --- a/uppsrc/Core/App.cpp +++ b/uppsrc/Core/App.cpp @@ -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__"); diff --git a/uppsrc/Turtle/Ctrl.h b/uppsrc/Turtle/Ctrl.h index a03b55790..fc70786e2 100644 --- a/uppsrc/Turtle/Ctrl.h +++ b/uppsrc/Turtle/Ctrl.h @@ -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(); diff --git a/uppsrc/Turtle/Output.cpp b/uppsrc/Turtle/Output.cpp index d17c9a856..6830cbf61 100644 --- a/uppsrc/Turtle/Output.cpp +++ b/uppsrc/Turtle/Output.cpp @@ -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); diff --git a/uppsrc/Turtle/Turtle.h b/uppsrc/Turtle/Turtle.h index 37d8b98fe..b9f6a01c8 100644 --- a/uppsrc/Turtle/Turtle.h +++ b/uppsrc/Turtle/Turtle.h @@ -57,6 +57,8 @@ enum Command { HORZDRAGLINE = 18, VERTDRAGLINE = 19, + + OPENLINK = 20, }; diff --git a/uppsrc/Turtle/Turtle.html b/uppsrc/Turtle/Turtle.html index 511b625ef..263e9dae1 100644 --- a/uppsrc/Turtle/Turtle.html +++ b/uppsrc/Turtle/Turtle.html @@ -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;