author | Tom Sutcliffe <thomas.sutcliffe@accenture.com> |
Tue, 24 Aug 2010 11:54:30 +0100 | |
changeset 34 | 284c68d7a3ac |
parent 33 | cfabd0207208 |
child 35 | f8e05215af4a |
permissions | -rw-r--r-- |
33
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
1 |
// terminalkeyboardcons.cpp |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
2 |
// |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
3 |
// Copyright (c) 2010 Accenture. All rights reserved. |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
4 |
// This component and the accompanying materials are made available |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
5 |
// under the terms of the "Eclipse Public License v1.0" |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
6 |
// which accompanies this distribution, and is available |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
7 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html". |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
8 |
// |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
9 |
// Initial Contributors: |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
10 |
// Accenture - Initial contribution |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
11 |
// |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
12 |
#include "terminalkeyboardcons.h" |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
13 |
#include <fshell/common.mmh> |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
14 |
#include <e32debug.h> |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
15 |
#include <fshell/memoryaccess.h> |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
16 |
|
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
17 |
const TInt KTkbdMessageId = 0xD6; |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
18 |
// These are the defaults unless overridden by --console-size |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
19 |
const TInt KWidth = 80; |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
20 |
const TInt KHeight = 24; |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
21 |
|
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
22 |
class CMessageWatcher : public CActive |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
23 |
{ |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
24 |
public: |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
25 |
CMessageWatcher(CTerminalKeyboardCons& aConsole) |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
26 |
: CActive(CActive::EPriorityStandard), iConsole(aConsole) |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
27 |
{ |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
28 |
CActiveScheduler::Add(this); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
29 |
iConsole.iDriver.RequestMessage(iStatus); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
30 |
SetActive(); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
31 |
} |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
32 |
|
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
33 |
void DoCancel() |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
34 |
{ |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
35 |
iConsole.iDriver.CancelMessage(); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
36 |
} |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
37 |
|
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
38 |
void RunL() |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
39 |
{ |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
40 |
iConsole.MessageReceived(iStatus.Int()); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
41 |
if (iStatus.Int() == KErrNone) |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
42 |
{ |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
43 |
iConsole.iDriver.RequestMessage(iStatus); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
44 |
SetActive(); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
45 |
} |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
46 |
} |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
47 |
|
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
48 |
~CMessageWatcher() |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
49 |
{ |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
50 |
Cancel(); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
51 |
} |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
52 |
|
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
53 |
private: |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
54 |
CTerminalKeyboardCons& iConsole; |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
55 |
}; |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
56 |
|
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
57 |
|
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
58 |
CTerminalKeyboardCons::CTerminalKeyboardCons() |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
59 |
: iTracker(TSize(KWidth, KHeight), this) |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
60 |
{ |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
61 |
} |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
62 |
|
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
63 |
CTerminalKeyboardCons::~CTerminalKeyboardCons() |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
64 |
{ |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
65 |
CleanupUnderlyingConsole(); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
66 |
delete iWatcher; |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
67 |
iDriver.Close(); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
68 |
iTextBuffer.Close(); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
69 |
iMungedTextBuffer.Close(); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
70 |
} |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
71 |
|
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
72 |
TInt CTerminalKeyboardCons::Create(const TDesC& aTitle, TSize aSize) |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
73 |
{ |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
74 |
TRAPD(err, ConstructL(aTitle, aSize)); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
75 |
HandleConsoleCreationError(_L("TerminalKeyboard"), err); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
76 |
return err; |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
77 |
} |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
78 |
|
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
79 |
void CTerminalKeyboardCons::ConstructL(const TDesC& aTitle, const TSize& aSize) |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
80 |
{ |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
81 |
if (aTitle == _L("debug")) SetDebug(ETrue); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
82 |
if (aSize.iWidth > 10 && aSize.iHeight > 10) |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
83 |
{ |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
84 |
// Override size now we know it, checking that it's sane-ish - be sure to do this before anything that uses the console size! |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
85 |
new (&iTracker) TCursorTracker(aSize, this); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
86 |
} |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
87 |
|
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
88 |
iTextBuffer.CreateMaxL(ScreenSize().iWidth * ScreenSize().iHeight); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
89 |
#ifdef SHOW_TEXTSHELL_BORDERS |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
90 |
iMungedTextBuffer.CreateL((ScreenSize().iWidth + 2) * (ScreenSize().iHeight + 2)); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
91 |
#endif |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
92 |
|
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
93 |
TInt err = User::LoadLogicalDevice(KTcLddDriverName); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
94 |
if (err && err != KErrAlreadyExists) |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
95 |
{ |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
96 |
Message(EError, _L("Couldn't load LDD %S: %d"), &KTcLddDriverName, err); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
97 |
User::Leave(err); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
98 |
} |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
99 |
|
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
100 |
// Idiotic driver only accepts connections from processes with nokia vid - like that will stop us |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
101 |
TUint originalVid = RProcess().VendorId(); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
102 |
RMemoryAccess memAccess; |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
103 |
User::LeaveIfError(memAccess.Open()); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
104 |
TProcessProperties props; |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
105 |
props.iVid = 0x101FB657; |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
106 |
RProcess me; me.Open(RProcess().Id()); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
107 |
memAccess.SetProcessProperties(me, props); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
108 |
|
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
109 |
err = iDriver.Open(); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
110 |
|
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
111 |
props.iVid = originalVid; |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
112 |
memAccess.SetProcessProperties(me, props); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
113 |
me.Close(); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
114 |
memAccess.Close(); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
115 |
|
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
116 |
if (err) |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
117 |
{ |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
118 |
Message(EError, _L("Couldn't open RTcDriver: %d"), err); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
119 |
User::Leave(err); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
120 |
} |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
121 |
|
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
122 |
err = iDriver.Subscribe(KTkbdMessageId); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
123 |
if (err) |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
124 |
{ |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
125 |
Message(EError, _L("Couldn't subscribe: %d"), err); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
126 |
User::Leave(err); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
127 |
} |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
128 |
|
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
129 |
iWatcher = new(ELeave) CMessageWatcher(*this); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
130 |
CleanupUnderlyingConsole(); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
131 |
|
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
132 |
ClearScreen(); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
133 |
} |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
134 |
|
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
135 |
|
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
136 |
TInt CTerminalKeyboardCons::Extension_(TUint aExtensionId, TAny*& a0, TAny* a1) |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
137 |
{ |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
138 |
/*if (aExtensionId == ConsoleMode::KSetConsoleModeExtension) |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
139 |
{ |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
140 |
ConsoleMode::TMode mode = (ConsoleMode::TMode)(TInt)a1; |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
141 |
iInputController->SetMode(mode); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
142 |
iOutputController->SetMode(mode); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
143 |
return KErrNone; |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
144 |
} |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
145 |
else*/ |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
146 |
/*else if (aExtensionId == ConsoleAttributes::KSetConsoleAttributesExtension) |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
147 |
{ |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
148 |
ConsoleAttributes::TAttributes* attributes = (ConsoleAttributes::TAttributes*)a1; |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
149 |
return iOutputController->SetAttributes(attributes->iAttributes, attributes->iForegroundColor, attributes->iBackgroundColor); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
150 |
}*/ |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
151 |
|
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
152 |
TInt ret = MIosrvConsoleHelper_Extension(aExtensionId, a0, a1); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
153 |
if (ret == KErrExtensionNotSupported) ret = CConsoleBase::Extension_(aExtensionId, a0, a1); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
154 |
return ret; |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
155 |
} |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
156 |
|
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
157 |
void CTerminalKeyboardCons::MessageReceived(TInt aError) |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
158 |
{ |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
159 |
Message(EDebug, _L("MessageReceived err=%d"), aError); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
160 |
TInt err = aError; |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
161 |
if (err == KErrNone) |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
162 |
{ |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
163 |
TPtrC8 data; |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
164 |
err = iDriver.GetMessageData(data); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
165 |
if (!err && data.Length() < 1) err = KErrCorrupt; |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
166 |
if (!err && !iGotKey) |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
167 |
{ |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
168 |
TUint16 rawkey = data[0]; |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
169 |
Message(EDebug, _L("CTerminalKeyboardCons got key %d"), (TInt)rawkey); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
170 |
|
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
171 |
// Terminal keyboard doesn't support control keys or cursor keys so we use our own two-stage sticky modifier (like unix meta key I think?) |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
172 |
if (iBacktickModifierDown) |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
173 |
{ |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
174 |
// Terminal keyboard sends 2,4,6,8 for cursors, so we translate backtick-2 (ie backtick-leftarrow) as meaning left arrow |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
175 |
if (rawkey == '2') rawkey = (TUint16)EKeyUpArrow; |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
176 |
else if (rawkey == '4') rawkey = (TUint16)EKeyLeftArrow; |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
177 |
else if (rawkey == '6') rawkey = (TUint16)EKeyRightArrow; |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
178 |
else if (rawkey == '8') rawkey = (TUint16)EKeyDownArrow; |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
179 |
else if (rawkey >= 'a' && rawkey <= 'z') |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
180 |
{ |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
181 |
// backtick-c means CTRL-C |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
182 |
rawkey = rawkey - 'a'+1; |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
183 |
} |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
184 |
else if (rawkey == ' ') rawkey = '`'; // backtick-space is how you do a backtick |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
185 |
else if (rawkey == '`') rawkey = (TUint16)EKeyEscape; // backtick-backtick is 'escape' |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
186 |
else if (rawkey == '1') rawkey = (TUint16)EKeyTab; // backtick-1 is 'tab' |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
187 |
iBacktickModifierDown = EFalse; |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
188 |
Message(EDebug, _L("Backtick escape converted to %d"), (TInt)rawkey); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
189 |
} |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
190 |
else if (rawkey == '`') |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
191 |
{ |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
192 |
iBacktickModifierDown = ETrue; |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
193 |
return; |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
194 |
} |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
195 |
|
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
196 |
iKeyCode = (TKeyCode)rawkey; // Close enough for now! |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
197 |
iGotKey = ETrue; |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
198 |
} |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
199 |
} |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
200 |
if (iClientStatus) |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
201 |
{ |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
202 |
User::RequestComplete(iClientStatus, err); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
203 |
if (err == KErrNone) iGotKey = EFalse; |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
204 |
} |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
205 |
} |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
206 |
|
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
207 |
void CTerminalKeyboardCons::Read(TRequestStatus& aStatus) |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
208 |
{ |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
209 |
/*if (iClientStatus) |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
210 |
{ |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
211 |
TRequestStatus* stat = &aStatus; |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
212 |
User::RequestComplete(stat, KErrInUse); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
213 |
} |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
214 |
else*/ |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
215 |
{ |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
216 |
aStatus = KRequestPending; |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
217 |
iClientStatus = &aStatus; |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
218 |
if (iGotKey) |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
219 |
{ |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
220 |
iGotKey = EFalse; |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
221 |
User::RequestComplete(iClientStatus, KErrNone); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
222 |
} |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
223 |
} |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
224 |
} |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
225 |
|
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
226 |
void CTerminalKeyboardCons::ReadCancel() |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
227 |
{ |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
228 |
if (iClientStatus) |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
229 |
{ |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
230 |
User::RequestComplete(iClientStatus, KErrCancel); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
231 |
} |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
232 |
} |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
233 |
|
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
234 |
void CTerminalKeyboardCons::Write(const TDesC& aDes) |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
235 |
{ |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
236 |
for (TInt i = 0; i < aDes.Length(); i++) |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
237 |
{ |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
238 |
TInt textBufPos = CursorPos().iY * ScreenSize().iWidth + CursorPos().iX; |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
239 |
TChar ch(aDes[i]); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
240 |
iTracker.WriteChar(ch); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
241 |
if (ch.IsPrint()) iTextBuffer[textBufPos] = aDes[i]; |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
242 |
} |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
243 |
|
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
244 |
Update(); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
245 |
} |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
246 |
|
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
247 |
TPoint CTerminalKeyboardCons::CursorPos() const |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
248 |
{ |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
249 |
return iTracker.CursorPos(); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
250 |
} |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
251 |
|
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
252 |
void CTerminalKeyboardCons::SetCursorPosAbs(const TPoint& aPoint) |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
253 |
{ |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
254 |
iTracker.SetCursorPosAbs(aPoint); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
255 |
} |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
256 |
|
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
257 |
void CTerminalKeyboardCons::SetCursorPosRel(const TPoint& aPoint) |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
258 |
{ |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
259 |
iTracker.SetCursorPosRel(aPoint); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
260 |
} |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
261 |
|
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
262 |
void CTerminalKeyboardCons::SetCursorHeight(TInt /*aPercentage*/) |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
263 |
{ |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
264 |
//iOutputController->SetCursorHeight(aPercentage); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
265 |
} |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
266 |
|
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
267 |
void CTerminalKeyboardCons::SetTitle(const TDesC& /*aDes*/) |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
268 |
{ |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
269 |
//iOutputController->SetTitle(aDes); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
270 |
} |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
271 |
|
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
272 |
void CTerminalKeyboardCons::ClearScreen() |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
273 |
{ |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
274 |
SetCursorPosAbs(TPoint(0,0)); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
275 |
iTextBuffer.Fill(' '); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
276 |
Update(); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
277 |
} |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
278 |
|
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
279 |
void CTerminalKeyboardCons::ClearToEndOfLine() |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
280 |
{ |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
281 |
iTextBuffer.MidTPtr(CursorPos().iY * ScreenSize().iWidth + CursorPos().iX, ScreenSize().iWidth - CursorPos().iX).Fill(' '); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
282 |
Update(); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
283 |
} |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
284 |
|
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
285 |
TSize CTerminalKeyboardCons::ScreenSize() const |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
286 |
{ |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
287 |
return iTracker.ConsoleSize(); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
288 |
} |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
289 |
|
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
290 |
TKeyCode CTerminalKeyboardCons::KeyCode() const |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
291 |
{ |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
292 |
return iKeyCode; |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
293 |
} |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
294 |
|
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
295 |
TUint CTerminalKeyboardCons::KeyModifiers() const |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
296 |
{ |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
297 |
return iKeyModifiers; |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
298 |
} |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
299 |
|
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
300 |
// All these magic vals are as per the DOS 437 codepage http://en.wikipedia.org/wiki/CP437 and not Windows-1252 like the ws_win.cpp source incorrectly states |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
301 |
// See also http://en.wikipedia.org/wiki/Box_drawing_characters |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
302 |
enum |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
303 |
{ |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
304 |
EBoxHorizontalBar = 0xCD, |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
305 |
EBoxVerticalBar = 0xBA, |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
306 |
EBoxTopLeft = 0xC9, |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
307 |
EBoxTopRight = 0xBB, |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
308 |
EBoxBottomLeft = 0xC8, |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
309 |
EBoxBottomRight = 0xBC, |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
310 |
}; |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
311 |
|
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
312 |
void CTerminalKeyboardCons::Update() |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
313 |
{ |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
314 |
#ifdef SHOW_TEXTSHELL_BORDERS |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
315 |
// Update munged buffer |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
316 |
const TInt contentWidth = ScreenSize().iWidth; |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
317 |
const TInt width = contentWidth + 2; |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
318 |
iMungedTextBuffer.SetLength(width); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
319 |
iMungedTextBuffer.Fill(TChar(EBoxHorizontalBar)); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
320 |
iMungedTextBuffer[0] = EBoxTopLeft; |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
321 |
iMungedTextBuffer[width-1] = EBoxTopRight; |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
322 |
|
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
323 |
for (TInt i = 0; i < ScreenSize().iHeight; i++) |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
324 |
{ |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
325 |
TPtrC line(iTextBuffer.Mid(i*contentWidth, contentWidth)); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
326 |
iMungedTextBuffer.AppendFormat(_L("%c%S%c"), EBoxVerticalBar, &line, EBoxVerticalBar); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
327 |
} |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
328 |
|
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
329 |
iMungedTextBuffer.Append(EBoxBottomLeft); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
330 |
iMungedTextBuffer.SetLength(iMungedTextBuffer.Length() + contentWidth); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
331 |
iMungedTextBuffer.RightTPtr(contentWidth).Fill(EBoxHorizontalBar); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
332 |
iMungedTextBuffer.Append(EBoxBottomRight); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
333 |
|
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
334 |
// And send the munged buffer |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
335 |
Transmit(iMungedTextBuffer, width, ScreenSize().iHeight + 2); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
336 |
#else |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
337 |
// Just send it straight |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
338 |
Transmit(iTextBuffer, ScreenSize().iWidth, ScreenSize().iHeight); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
339 |
#endif |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
340 |
} |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
341 |
|
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
342 |
void CTerminalKeyboardCons::Transmit(const TDesC& aBuf, TInt aWidth, TInt aHeight) |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
343 |
{ |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
344 |
// This is how terminal keyboard does it - pretty horrible really |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
345 |
|
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
346 |
static const TInt KMaxLen = 200; // This is what terminal keyboard uses - technically you could go as far as a total of 256 |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
347 |
TInt numLinesPerPrint = KMaxLen / aWidth; |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
348 |
|
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
349 |
TBuf<256> line; |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
350 |
TInt startLine = 0; |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
351 |
while (startLine < aHeight) |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
352 |
{ |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
353 |
if (startLine == 0) |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
354 |
{ |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
355 |
// First line has extra info |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
356 |
line.Format(_L("#$STIConsole#$%02d%02X%02X"), startLine, aWidth, aHeight); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
357 |
} |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
358 |
else |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
359 |
{ |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
360 |
line.Format(_L("#$STIConsole#$%02d"), startLine); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
361 |
} |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
362 |
|
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
363 |
for (TInt i = 0; i < numLinesPerPrint; i++) |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
364 |
{ |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
365 |
TPtrC theContents(aBuf.Mid((startLine+i)*aWidth, aWidth)); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
366 |
//RDebug::Printf("line len=%d theContents len=%d", line.Length(), theContents.Length()); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
367 |
line.Append(theContents); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
368 |
} |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
369 |
|
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
370 |
RDebug::Print(line); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
371 |
startLine += numLinesPerPrint; |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
372 |
} |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
373 |
} |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
374 |
|
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
375 |
void CTerminalKeyboardCons::ConsoleScrolled(TInt aNumberOfLines) |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
376 |
{ |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
377 |
TInt numChars = Abs(aNumberOfLines) * ScreenSize().iWidth; |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
378 |
if (aNumberOfLines > 0) |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
379 |
{ |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
380 |
iTextBuffer.Delete(0, numChars); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
381 |
iTextBuffer.AppendFill(' ', numChars); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
382 |
} |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
383 |
else if (aNumberOfLines < 0) |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
384 |
{ |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
385 |
iTextBuffer.SetLength(iTextBuffer.Length() - numChars); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
386 |
while (numChars--) iTextBuffer.Insert(0, _L(" ")); |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
387 |
} |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
388 |
} |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
389 |
|
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
390 |
extern "C" EXPORT_C TAny* NewConsole() |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
391 |
{ |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
392 |
return new CTerminalKeyboardCons; |
cfabd0207208
Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
393 |
} |