mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 06:05:58 -06:00
reference: Turtle examples moved to UppHub.
git-svn-id: svn://ultimatepp.org/upp/trunk@15650 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
3cc74e6760
commit
d18b121a38
6 changed files with 0 additions and 264 deletions
|
|
@ -1,42 +0,0 @@
|
|||
#ifdef flagTURTLEGUI
|
||||
#include <Turtle/Turtle.h>
|
||||
#else
|
||||
#include <CtrlLib/CtrlLib.h>
|
||||
#endif
|
||||
|
||||
// Try connecting to "localhost:8888" via your web browser.
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
void AppMainLoop()
|
||||
{
|
||||
PromptOK("Hello, world!");
|
||||
}
|
||||
|
||||
#ifdef flagTURTLEGUI
|
||||
|
||||
CONSOLE_APP_MAIN
|
||||
{
|
||||
|
||||
#ifdef _DEBUG
|
||||
TurtleServer::DebugMode();
|
||||
#endif
|
||||
|
||||
// MemoryLimitKb(100000000); // Can aid preventing DDoS attacks.
|
||||
|
||||
TurtleServer guiserver;
|
||||
guiserver.Host("localhost");
|
||||
guiserver.Port(8888);
|
||||
guiserver.MaxConnections(100);
|
||||
RunTurtleGui(guiserver, AppMainLoop);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
GUI_APP_MAIN
|
||||
{
|
||||
AppMainLoop();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
description "A \"Hello world\" GUI example demonstrating the Turtle package\377";
|
||||
|
||||
uses(TURTLEGUI) Turtle;
|
||||
|
||||
uses(!TURTLEGUI) CtrlLib;
|
||||
|
||||
file
|
||||
WebHelloWorld.cpp;
|
||||
|
||||
mainconfig
|
||||
"" = "TURTLEGUI",
|
||||
"" = "GUI";
|
||||
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
#ifndef _WebWord_WebWord_h
|
||||
#define _WebWord_WebWord_h
|
||||
|
||||
#ifdef flagTURTLEGUI
|
||||
#include <Turtle/Turtle.h>
|
||||
#else
|
||||
#include <CtrlLib/CtrlLib.h>
|
||||
#endif
|
||||
|
||||
#include <RichEdit/RichEdit.h>
|
||||
#include <PdfDraw/PdfDraw.h>
|
||||
|
||||
namespace Upp {
|
||||
|
||||
class WebWord : public TopWindow {
|
||||
public:
|
||||
typedef WebWord CLASSNAME;
|
||||
WebWord();
|
||||
void ShowInfo();
|
||||
|
||||
RichEditWithToolBar editor;
|
||||
StatusBar statusbar;
|
||||
};
|
||||
|
||||
}
|
||||
#endif
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
description "A word processor example demonstrating the Turtle GUI virtualization package.\377";
|
||||
|
||||
uses
|
||||
RichEdit;
|
||||
|
||||
uses(TURTLEGUI) Turtle;
|
||||
|
||||
uses(!TURTLEGUI) CtrlLib;
|
||||
|
||||
uses(!TURTLEGUI) PdfDraw;
|
||||
|
||||
file
|
||||
WebWord.h,
|
||||
main.cpp;
|
||||
|
||||
mainconfig
|
||||
"" = "TURTLEGUI",
|
||||
"" = "GUI";
|
||||
|
||||
|
|
@ -1,92 +0,0 @@
|
|||
#include "WebWord.h"
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
String FormatSize(int64 n)
|
||||
{
|
||||
if(n < 10000)
|
||||
return Format("%d B", n);
|
||||
else
|
||||
if(n < 10000 * 1024)
|
||||
return Format("%d.%d KB", n >> 10, (n & 1023) / 103);
|
||||
else
|
||||
if(n < I64(10000000) * 1024)
|
||||
return Format("%d.%d MB", n >> 20, (n & 1023) / 103);
|
||||
else
|
||||
return Format("%d.%d GB", n >> 30, (n & 1023) / 103);
|
||||
}
|
||||
|
||||
void WebWord::ShowInfo()
|
||||
{
|
||||
String s;
|
||||
s << "Mem " << MemoryUsedKb() << " KB";
|
||||
static int sent_prev;
|
||||
#ifdef flagTURTLEGUI
|
||||
int secs = GetSysTime() - TurtleServer::stat_started;
|
||||
Time tm = Time(1, 1, 1, 0, 0, 0) + secs;
|
||||
s << ", uptime " << Format("%d:%0d:%02d:%02d", tm - Date(1, 1, 1), tm.hour, tm.minute, tm.second);
|
||||
s << ", data sent " << FormatSize(TurtleServer::stat_data_send);
|
||||
if(secs)
|
||||
s << ", average bandwidth " << FormatSize(TurtleServer::stat_data_send / secs) << "/s";
|
||||
s << ", actual bandwidth " << FormatSize(TurtleServer::stat_data_send - sent_prev);
|
||||
s << ", putimage " << TurtleServer::stat_putimage;
|
||||
s << ", putrect " << TurtleServer::stat_putrect;
|
||||
s << ", setimage " << TurtleServer::stat_setimage << " len " << FormatSize(TurtleServer::stat_setimage_len);
|
||||
s << ", roundtrip " << TurtleServer::stat_roundtrip_ms << " ms";
|
||||
s << ", client " << TurtleServer::stat_client_ms << " ms";
|
||||
#ifdef PLATFORM_POSIX
|
||||
s << ", cpu time " << int((double) clock() / CLOCKS_PER_SEC * 1000) << " ms";
|
||||
#endif
|
||||
sent_prev = TurtleServer::stat_data_send;
|
||||
statusbar.Set(s);
|
||||
#endif
|
||||
}
|
||||
|
||||
WebWord::WebWord()
|
||||
{
|
||||
AddFrame(statusbar);
|
||||
Add(editor.SizePos());
|
||||
Sizeable().Zoomable();
|
||||
// FrameLess();
|
||||
Maximize();
|
||||
Title("WebWord");
|
||||
Icon(CtrlImg::File());
|
||||
editor.ClearModify();
|
||||
ActiveFocus(editor);
|
||||
SetTimeCallback(-1000, THISBACK(ShowInfo));
|
||||
}
|
||||
|
||||
void AppMainLoop()
|
||||
{
|
||||
// "Main" stuff should go in here...
|
||||
|
||||
WebWord().Run();
|
||||
}
|
||||
|
||||
#ifdef flagTURTLEGUI
|
||||
|
||||
CONSOLE_APP_MAIN
|
||||
{
|
||||
|
||||
#ifdef _DEBUG
|
||||
TurtleServer::DebugMode();
|
||||
#endif
|
||||
|
||||
// MemoryLimitKb(100000000); // Can aid preventing DDoS attacks.
|
||||
|
||||
TurtleServer guiserver;
|
||||
guiserver.Host("localhost");
|
||||
guiserver.Port(8888);
|
||||
guiserver.MaxConnections(100);
|
||||
RunTurtleGui(guiserver, AppMainLoop);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
GUI_APP_MAIN
|
||||
{
|
||||
AppMainLoop();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue