.reainbow: developing telpp

git-svn-id: svn://ultimatepp.org/upp/trunk@6632 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2013-12-03 07:17:16 +00:00
parent bb9e91b22a
commit 035ebecbe6
6 changed files with 94 additions and 10 deletions

View file

@ -18,7 +18,7 @@ class DHCtrl : Ctrl {};
#define GUI_APP_MAIN \
void GuiMainFn_(); \
\
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE, LPTSTR lpCmdLine, int nCmdShow) { \
extern "C" int main(int argc, const char **argv, const char **envptr) { \
UPP::AppInitEnvironment__(); \
UPP::Ctrl::InitTelpp(); \
GuiMainFn_(); \

View file

@ -163,7 +163,7 @@ void Ctrl::DoMouseFB(int event, Point p, int zdelta)
bool Ctrl::DoKeyFB(dword key, int cnt)
{
LLOG("DoKeyFB " << GetKeyDesc(key) << ", " << cnt);
DLOG("DoKeyFB " << GetKeyDesc(key) << ", " << cnt);
bool b = DispatchKey(key, cnt);
SyncCaret();
@ -290,6 +290,12 @@ bool Ctrl::ProcessEventQueue(const String& event_queue)
DoKeyFB(which + K_DELTA, 1);
}
else
if(p.Id("k")) {
int code = p.ReadInt();
int which = p.ReadInt();
DoKeyFB(K_KEYUP|(which + K_DELTA), 1);
}
else
if(p.Id("C")) {
int code = p.ReadInt();
int which = p.ReadInt();
@ -327,7 +333,8 @@ bool Ctrl::ProcessEvents(bool *quit)
return false;
}
String event_queue = socket.Get((int)http.GetContentLength());
LOG(event_queue);
if(event_queue.GetCount())
LOG(event_queue);
content.Clear();
bool r = ProcessEventQueue(event_queue);
_TODO_ // Resolve eventloop exit issue

View file

@ -21,8 +21,8 @@ Your browser does not support the HTML5 canvas tag.
<script>
function Log(msg)
{
if (window.console && console.log)
console.log(msg); //for firebug
// if (window.console && console.log)
// console.log(msg); //for firebug
}
function Char(p, ch)
@ -110,6 +110,12 @@ window.event_queue = "I\n";
var canvas = document.getElementById("myCanvas");
canvas.onmousemove = function(event)
{
event_queue += "M " + event.clientX + " " + event.clientY + "\n";
Ping();
}
canvas.onmousedown = function(event)
{
event_queue += "D " + event.button + " " + event.clientX + " " + event.clientY + "\n";
@ -125,16 +131,19 @@ canvas.onmouseup = function(event)
document.onkeydown = function(event)
{
event_queue += "K " + event.keyCode + " " + event.which + "\n";
event.preventDefault();
}
document.onkeypress = function(event)
{
event_queue += "C " + event.keyCode + " " + event.which + "\n";
event.preventDefault();
}
document.onkeyup = function(event)
{
event_queue += "k " + event.keyCode + " " + event.which + "\n";
event.preventDefault();
}
function ResizeCanvas()

View file

@ -19,14 +19,13 @@ FileSel& PdfFs()
return fs;
}
class UWord : public TopWindow {
struct UWord : public TopWindow {
public:
virtual void DragAndDrop(Point, PasteClip& d);
virtual void FrameDragAndDrop(Point, PasteClip& d);
virtual void ShutdownWindow();
protected:
RichEdit editor;
MenuBar menubar;
ToolBar toolbar;
@ -274,7 +273,7 @@ GUI_APP_MAIN
.DefaultExt("pdf");
LoadFromFile(callback(UWord::SerializeApp));
new UWord;
(new UWord)->editor.SetQTF(LoadFile(GetDataFile("test.qtf")));
Ctrl::EventLoop();
StoreToFile(callback(UWord::SerializeApp));
}

View file

@ -22,7 +22,8 @@ uses(WINGL) WinGl;
file
UWord.cpp,
UWord.iml;
UWord.iml,
test.qtf;
mainconfig
"" = "GUI SKELETON",
@ -33,5 +34,5 @@ mainconfig
"" = "GUI WINGL",
"" = "GUI",
"" = "GUI SDL20",
"" = "GUI TELPP";
"" = "TELPP";

68
rainbow/UWord/test.qtf Normal file
View file

@ -0,0 +1,68 @@
[ $$0,0#00000000000000000000000000000000:Default]
[*C@3+75 $$1,1#36268203433472503231438721581057:code]
[*/+117 $$2,0#07143242482611002448121871408047:title]
[@(128.0.255)2 $$3,0#65874547464505293575048467215454:QTF Chr]
[{_}%EN-US
[s0; [*4 QTF]&]
[s0;= [*8 QTF]&]
[s0; &]
[s0; QTF is the native format of Ultimate`+`+ rich texts (formatted
texts).&]
[s0; &]
[s0; It is byte oriented format. Bytes with values 2`-31 are ignored.
Other are interpreted as characters or formatting commands.&]
[s0; &]
[s0; Letters ([@4 a]`-[@4 zA]`-[@4 Z]), numbers ([@4 0]`-[@4 9]), space (32)
and characters&]
[s0; &]
[s0; [*@4 . , ; ! ? % ( ) / < > #]&]
[s0; &]
[s0; and bytes [* greater] than 127 are guaranteed to be never used as
command characters (not even in future versions of QTF). Other
characters should be prefixed with escape character `` (reverse
apostrophe). Group of characters can be escaped using byte 1.
Example:&]
[s0; &]
[s1; `\"`\1a`[x`]`\1`[`* bold`]`\"&]
[s0; Normal [* Bold] [/ Italic] [*/ Bold Italic] [_ Underline] [- Stroked]&]
[Rs0; Normal [* Bold] [/ Italic] [*/ Bold Italic] [_ Underline] [- Stroked]&]
[Cs0; Normal [* Bold] [/ Italic] [*/ Bold Italic] [_ Underline] [- Stroked]&]
[s0; Byte 0 represents the end of input sequence.&]
[s0; &]
[s0; Dimension units of QTF are dots `- one dot is defined as 1/600
of inch.&]
[s0; &]
[s0; Colors are described as either number [@(128.0.255) 0]`-[@(128.0.255) 9],
with meaning&]
[s0; &]
[ {{1000:1000:1000:1000:1000:1000:1000:1000:1000:1000<96;>96;f4; [s0;%- [* 0]]
:: [s0;%- [* 1]]
:: [s0;%- [* 2]]
:: [s0;%- [* 3]]
:: [s0;%- [* 4]]
:: [s0;%- [* 5]]
:: [s0;%- [* 6]]
:: [s0;%- [* 7]]
:: [s0;%- [* 8]]
:: [s0;%- [* 9]]
::l/0r/0t/0b/0@0 [s0; ]
::@1 [s0; ]
::@2 [s0; ]
::@3 [s0; ]
::@4 [s0; ]
::@5 [s0; ]
::@6 [s0; ]
::@7 [s0; ]
::@8 [s0; ]
::@9 [s0; ]
::l/25r/25t/15b/15@2 [s0;%- [1 Black]]
:: [s0; [1 LtGray]]
:: [s0; [1 White]]
:: [s0;%- [1 Red]]
:: [s0;%- [1 Green]]
:: [s0;%- [1 Blue]]
:: [s0;%- [1 LtRed]]
:: [s0;%- [1 WhiteGray]]
:: [s0;%- [1 LtCyan]]
:: [s0;%- [1 Yellow]]}}&]
[s0; &]