|
1 /* |
|
2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <eikon.hrh> |
|
20 #include <coemain.h> |
|
21 #include <eikenv.h> |
|
22 #include <eikappui.h> |
|
23 #include <eiksbfrm.h> |
|
24 #include <aknsdrawutils.h> |
|
25 #include <aknslayeredbackgroundcontrolcontext.h> |
|
26 #include "JavaDebugAgent.hrh" |
|
27 #include "JavaDebugAgentLogScreen.h" |
|
28 #include "JavaDebugAgentBasicLogView.h" |
|
29 |
|
30 const TInt KMaxLogLineLength = 512; |
|
31 const TInt KMaxPrefixLength = 32; |
|
32 |
|
33 const TInt KTextMarginTop = 3; |
|
34 const TInt KTextMarginLeft = 3; |
|
35 const TInt KTextMarginRight = 5; |
|
36 const TInt KTextMarginBottom = 5; |
|
37 |
|
38 #define SUPER CCoeControl |
|
39 #define DEFAULT_FONT() CEikonEnv::Static()->DenseFont() |
|
40 |
|
41 CJavaDebugAgentLogScreen* |
|
42 CJavaDebugAgentLogScreen::NewL(CJavaDebugAgentBasicLogView* aView, |
|
43 const TRect& aRect) |
|
44 { |
|
45 CJavaDebugAgentLogScreen* me = new(ELeave)CJavaDebugAgentLogScreen(aView); |
|
46 CleanupStack::PushL(me); |
|
47 me->ConstructL(aRect); |
|
48 CleanupStack::Pop(me); |
|
49 return me; |
|
50 } |
|
51 |
|
52 void CJavaDebugAgentLogScreen::ConstructL(const TRect& aRect) |
|
53 { |
|
54 User::LeaveIfError(iFs.Connect()); |
|
55 iFs.ShareProtected(); |
|
56 |
|
57 CreateWindowL(); |
|
58 SetRect(aRect); |
|
59 |
|
60 iSBFrame = new(ELeave)CEikScrollBarFrame(this, NULL, ETrue); |
|
61 iSBFrame->CreateDoubleSpanScrollBarsL(ETrue, EFalse, ETrue, EFalse); |
|
62 iSBFrame->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, |
|
63 CEikScrollBarFrame::EOn); |
|
64 |
|
65 iViewRect = Rect(); |
|
66 DoLayoutL(); |
|
67 |
|
68 iCharFormatMask.SetAttrib(EAttColor); |
|
69 iCharFormatMask.SetAttrib(EAttFontHeight); |
|
70 const CFont* font = DEFAULT_FONT(); |
|
71 if (font) { |
|
72 iCharFormatMask.SetAttrib(EAttFontTypeface); |
|
73 iCharFormat.iFontSpec = font->FontSpecInTwips(); |
|
74 } else { |
|
75 iCharFormat.iFontSpec.iHeight = 90; |
|
76 } |
|
77 iDefaultFontHeightInTwips = iCharFormat.iFontSpec.iHeight; |
|
78 iCharFormat.iFontPresentation.iTextColor = TLogicalRgb(KRgbDarkBlue); |
|
79 iCharFormatLayer = CCharFormatLayer::NewL(iCharFormat, iCharFormatMask); |
|
80 |
|
81 iParaFormatMask.SetAttrib(EAttLineSpacing); |
|
82 iParaFormat.iLineSpacingInTwips = iCharFormat.iFontSpec.iHeight; |
|
83 iParaFormatLayer = CParaFormatLayer::NewL(&iParaFormat, iParaFormatMask); |
|
84 |
|
85 iGlobalText = CGlobalText::NewL(iParaFormatLayer, iCharFormatLayer); |
|
86 |
|
87 CBitmapDevice* bmp = CCoeEnv::Static()->ScreenDevice(); |
|
88 iLayout = CTextLayout::NewL(iGlobalText, iTextRect.Width()); |
|
89 iTextView = CTextView::NewL(iLayout, iTextRect, bmp, bmp, &Window(),0, |
|
90 &iCoeEnv->WsSession()); |
|
91 |
|
92 ActivateL(); |
|
93 } |
|
94 |
|
95 CJavaDebugAgentLogScreen:: |
|
96 CJavaDebugAgentLogScreen(CJavaDebugAgentBasicLogView* aView) : |
|
97 iView(aView), |
|
98 iFontSize(KDefaultDebugAgentFontSize) |
|
99 { |
|
100 } |
|
101 |
|
102 CJavaDebugAgentLogScreen::~CJavaDebugAgentLogScreen() |
|
103 { |
|
104 CloseLogFile(); |
|
105 iFs.Close(); |
|
106 iTextClipRegion.Close(); |
|
107 delete iBgBitmap; |
|
108 delete iBgMask; |
|
109 delete iBgContext; |
|
110 delete iTextView; |
|
111 delete iLayout; |
|
112 delete iGlobalText; |
|
113 delete iCharFormatLayer; |
|
114 delete iParaFormatLayer; |
|
115 delete iSBFrame; |
|
116 } |
|
117 |
|
118 void CJavaDebugAgentLogScreen::CloseLogFile() |
|
119 { |
|
120 if (iLogFileName) |
|
121 { |
|
122 delete iLogFileName; |
|
123 iLogFileName = NULL; |
|
124 iLogFile.Close(); |
|
125 } |
|
126 } |
|
127 |
|
128 void CJavaDebugAgentLogScreen::SetFontSize(TInt aFontSize) |
|
129 { |
|
130 TRAP_IGNORE(SetFontSizeL(aFontSize)); |
|
131 } |
|
132 |
|
133 void CJavaDebugAgentLogScreen::SetFontSizeL(TInt aFontSize) |
|
134 { |
|
135 if (UpdateFontSizeL(aFontSize)) |
|
136 { |
|
137 iTextView->FormatTextL(); |
|
138 UpdateScrollBars(ETrue); |
|
139 DrawNow(iTextRect); |
|
140 } |
|
141 } |
|
142 |
|
143 // Updates char and para format, returning True if it has actually changed |
|
144 TBool CJavaDebugAgentLogScreen::UpdateFontSizeL(TInt aFontSize) |
|
145 { |
|
146 iFontSize = aFontSize; |
|
147 TInt newHeight = (iDefaultFontHeightInTwips * iFontSize) / 100; |
|
148 if (iCharFormat.iFontSpec.iHeight != newHeight) { |
|
149 iCharFormat.iFontSpec.iHeight = newHeight; |
|
150 iCharFormatLayer->SetL(iCharFormat, iCharFormatMask); |
|
151 iParaFormat.iLineSpacingInTwips = iCharFormat.iFontSpec.iHeight; |
|
152 iParaFormatLayer->SetL(&iParaFormat, iParaFormatMask); |
|
153 return ETrue; |
|
154 } |
|
155 return EFalse; |
|
156 } |
|
157 |
|
158 void CJavaDebugAgentLogScreen::DoLayoutL() |
|
159 { |
|
160 CEikAppUi* appui = iEikonEnv->EikAppUi(); |
|
161 TRect appRect(appui->ApplicationRect()); |
|
162 TRect appClientRect(appui->ClientRect()); |
|
163 TRect clientRect(Rect()); |
|
164 TRect screenRect(Position(),Size()); |
|
165 |
|
166 TEikScrollBarModel m1; |
|
167 UpdateSBModel(&m1); |
|
168 TAknDoubleSpanScrollBarModel m2(m1); |
|
169 |
|
170 TRect inclusiveRect(Rect()); |
|
171 iViewRect = inclusiveRect; |
|
172 TEikScrollBarFrameLayout layout; |
|
173 layout.iTilingMode = TEikScrollBarFrameLayout::EInclusiveRectConstant; |
|
174 layout.SetClientMargin(0); |
|
175 layout.SetInclusiveMargin(0); |
|
176 |
|
177 iSBFrame->TileL(NULL, &m2, iViewRect, inclusiveRect, layout); |
|
178 iTextRect = iViewRect; |
|
179 iTextRect.iTl.iX += KTextMarginTop; |
|
180 iTextRect.iTl.iY += KTextMarginLeft; |
|
181 iTextRect.iBr.iX -= KTextMarginRight; |
|
182 iTextRect.iBr.iY -= KTextMarginBottom; |
|
183 |
|
184 iTextClipRegion.Clear(); |
|
185 iTextClipRegion.AddRect(Rect()); |
|
186 TRect subRect(iTextRect); |
|
187 subRect.iBr.iX++; |
|
188 subRect.iBr.iY++; |
|
189 iTextClipRegion.SubRect(subRect); |
|
190 |
|
191 // NOTE: gray-scale mask works as the alpha channel. We use that for |
|
192 // blending shadow with the background. Looks quite nice. The code is |
|
193 // written in such a way that even if alpha blending doesn't work, it |
|
194 // will still look OK. |
|
195 CFbsBitmap* m; |
|
196 CFbsBitmap* bg; |
|
197 TSize s(iViewRect.Size()); |
|
198 |
|
199 m = CreateBackgroundBitmapLC(s,KRgbBlack,KRgbBlack,KRgbWhite,KRgbDarkGray); |
|
200 bg = CreateBackgroundBitmapLC(s,KRgbWhite,KRgbWhite,KRgbBlack,KRgbBlack); |
|
201 CleanupStack::Pop(bg); |
|
202 CleanupStack::Pop(m); |
|
203 |
|
204 // Replace the bitmaps |
|
205 delete iBgBitmap; |
|
206 delete iBgMask; |
|
207 iBgBitmap = bg; |
|
208 iBgMask = m; |
|
209 |
|
210 // Setup the background context |
|
211 if (iBgContext) |
|
212 { |
|
213 delete iBgContext; |
|
214 iBgContext = NULL; |
|
215 } |
|
216 |
|
217 if (screenRect == appClientRect) |
|
218 { |
|
219 iBgContext = CAknsBasicBackgroundControlContext::NewL( |
|
220 KAknsIIDQsnBgAreaMain, clientRect, ETrue); |
|
221 } |
|
222 else |
|
223 { |
|
224 TRect statusRect(appRect); |
|
225 TRect controlRect(appRect); |
|
226 statusRect.iBr.iY = appClientRect.iTl.iY; |
|
227 controlRect.iTl.iY = appClientRect.iBr.iY; |
|
228 CAknsLayeredBackgroundControlContext* layerContext = |
|
229 CAknsLayeredBackgroundControlContext::NewL( |
|
230 KAknsIIDQsnBgAreaStatus, statusRect, ETrue, 3); |
|
231 layerContext->SetLayerImage(1,KAknsIIDQsnBgAreaMain); |
|
232 layerContext->SetLayerImage(2,KAknsIIDQsnBgAreaControl); |
|
233 layerContext->SetLayerRect(1,appClientRect); |
|
234 layerContext->SetLayerRect(2,controlRect); |
|
235 iBgContext = layerContext; |
|
236 } |
|
237 } |
|
238 |
|
239 void |
|
240 CJavaDebugAgentLogScreen::DrawBackground( |
|
241 CBitmapContext* aGc, |
|
242 const TRect& aRect, |
|
243 TRgb aBgColor, |
|
244 TRgb aFillColor, |
|
245 TRgb aBorderColor, |
|
246 TRgb aShadowColor) |
|
247 { |
|
248 aGc->SetBrushStyle(CGraphicsContext::ESolidBrush); |
|
249 aGc->SetBrushColor(aBgColor); |
|
250 aGc->Clear(aRect); |
|
251 |
|
252 TInt x1 = aRect.iTl.iX; |
|
253 TInt x2 = aRect.iBr.iX; |
|
254 TInt y1 = aRect.iTl.iY; |
|
255 TInt y2 = aRect.iBr.iY; |
|
256 |
|
257 TRect rect(x1+1,y1+1,x2-3,y2-3); |
|
258 aGc->SetPenColor(aBorderColor); |
|
259 aGc->SetPenStyle(CGraphicsContext::ESolidPen); |
|
260 aGc->SetBrushStyle(CGraphicsContext::ENullBrush); |
|
261 aGc->DrawRect(rect); |
|
262 |
|
263 rect.Shrink(1,1); |
|
264 aGc->SetPenColor(KRgbWhite); // White on both background and mask |
|
265 aGc->DrawRect(rect); |
|
266 |
|
267 aGc->SetPenColor(aShadowColor); |
|
268 aGc->DrawLine(TPoint(x1+3,y2-2),TPoint(x2-1,y2-2)); |
|
269 aGc->DrawLine(TPoint(x1+2,y2-3),TPoint(x2-1,y2-3)); |
|
270 aGc->DrawLine(TPoint(x2-3,y1+2),TPoint(x2-3,y2-3)); |
|
271 aGc->DrawLine(TPoint(x2-2,y1+3),TPoint(x2-2,y2-3)); |
|
272 |
|
273 rect.Shrink(1,1); |
|
274 aGc->SetBrushStyle(CGraphicsContext::ESolidBrush); |
|
275 aGc->SetBrushColor(aFillColor); |
|
276 aGc->SetPenColor(aFillColor); |
|
277 aGc->DrawRect(rect); |
|
278 } |
|
279 |
|
280 CFbsBitmap* |
|
281 CJavaDebugAgentLogScreen::CreateBackgroundBitmapLC( |
|
282 const TSize& aSize, |
|
283 TRgb aBgColor, |
|
284 TRgb aFillColor, |
|
285 TRgb aBorderColor, |
|
286 TRgb aShadowColor) |
|
287 { |
|
288 CFbsBitmap* bitmap = new(ELeave)CFbsBitmap; |
|
289 CleanupStack::PushL(bitmap); |
|
290 User::LeaveIfError(bitmap->Create(aSize, EGray256)); |
|
291 CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL(bitmap); |
|
292 CleanupStack::PushL(bitmapDevice); |
|
293 CFbsBitGc* gc = NULL; |
|
294 User::LeaveIfError(bitmapDevice->CreateContext(gc)); |
|
295 TRect rect(aSize); |
|
296 DrawBackground(gc,rect,aBgColor,aFillColor,aBorderColor,aShadowColor); |
|
297 delete gc; |
|
298 CleanupStack::PopAndDestroy(bitmapDevice); |
|
299 return bitmap; |
|
300 } |
|
301 |
|
302 void CJavaDebugAgentLogScreen::Draw(const TRect& /*aRect*/) const |
|
303 { |
|
304 CWindowGc& gc = SystemGc(); |
|
305 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
306 if (skin && iBgContext) |
|
307 { |
|
308 gc.SetClippingRegion(iTextClipRegion); |
|
309 AknsDrawUtils::Background(skin, iBgContext, gc, Rect()); |
|
310 gc.CancelClippingRegion(); |
|
311 TPoint p(0,0); |
|
312 TRect srcRect(iViewRect.Size()); |
|
313 gc.BitBltMasked(TPoint(0,0),iBgBitmap, srcRect, iBgMask, EFalse); |
|
314 } |
|
315 else |
|
316 { |
|
317 gc.DrawBitmap(iViewRect.iTl, iBgBitmap); |
|
318 } |
|
319 |
|
320 TRAP_IGNORE(iTextView->DrawL(iTextRect, gc)); |
|
321 } |
|
322 |
|
323 // Supplies background skin context for scroll bars. |
|
324 TTypeUid::Ptr CJavaDebugAgentLogScreen::MopSupplyObject(TTypeUid aId) |
|
325 { |
|
326 if (aId.iUid == MAknsControlContext::ETypeId && iBgContext) |
|
327 { |
|
328 return MAknsControlContext::SupplyMopObject(aId, iBgContext); |
|
329 } |
|
330 return SUPER::MopSupplyObject(aId); |
|
331 } |
|
332 |
|
333 TInt CJavaDebugAgentLogScreen::CountComponentControls() const |
|
334 { |
|
335 return iSBFrame->CountComponentControls(); |
|
336 } |
|
337 |
|
338 CCoeControl* CJavaDebugAgentLogScreen::ComponentControl(TInt aIndex) const |
|
339 { |
|
340 return iSBFrame->ComponentControl(aIndex); |
|
341 } |
|
342 |
|
343 void CJavaDebugAgentLogScreen::ClearL() |
|
344 { |
|
345 if (iLineCounter > 0) { |
|
346 iLineCounter = 0; |
|
347 iGlobalText->DeleteL(0,iGlobalText->DocumentLength()); |
|
348 iTextView->FormatTextL(); |
|
349 UpdateScrollBars(ETrue); |
|
350 DrawNow(iTextRect); |
|
351 } |
|
352 } |
|
353 |
|
354 void CJavaDebugAgentLogScreen::FormatPrefixL(TDes& aPrefix) |
|
355 { |
|
356 _LIT(KDateString5,"%-B%:0%J%:1%T%:2%S%:3"); |
|
357 _LIT(KDelim," "); |
|
358 TTime time; |
|
359 time.HomeTime(); |
|
360 time.FormatL(aPrefix, KDateString5); |
|
361 aPrefix.Append(KDelim); |
|
362 } |
|
363 |
|
364 void CJavaDebugAgentLogScreen::LogL(const TDesC& aString) |
|
365 { |
|
366 TBuf<KMaxPrefixLength> prefix; |
|
367 FormatPrefixL(prefix); |
|
368 LogToScreenL(prefix, aString); |
|
369 LogToFileL(prefix, aString); |
|
370 } |
|
371 |
|
372 void CJavaDebugAgentLogScreen::LogToFileL(const TDesC& aPrefix, |
|
373 const TDesC& aText) |
|
374 { |
|
375 _LIT8(KCRLF8,"\r\n"); |
|
376 if (iLogFileName) |
|
377 { |
|
378 TBuf8<KMaxLogLineLength> buf; |
|
379 buf.Copy(aPrefix); |
|
380 iLogFile.Write(buf); |
|
381 buf.Copy(aText); |
|
382 iLogFile.Write(buf); |
|
383 iLogFile.Write(KCRLF8); |
|
384 } |
|
385 } |
|
386 |
|
387 void CJavaDebugAgentLogScreen::LogToScreenL(const TDesC& aPrefix, |
|
388 const TDesC& aText) |
|
389 { |
|
390 iLineCounter++; |
|
391 |
|
392 TInt pos = iGlobalText->LdDocumentLength(); |
|
393 iGlobalText->InsertL(iGlobalText->LdDocumentLength(), aPrefix); |
|
394 iGlobalText->InsertL(iGlobalText->LdDocumentLength(), aText); |
|
395 iGlobalText->InsertL(iGlobalText->LdDocumentLength(), |
|
396 CEditableText::EParagraphDelimiter); |
|
397 |
|
398 FormatAndScrollL(); |
|
399 DrawNow(iTextRect); |
|
400 } |
|
401 |
|
402 void CJavaDebugAgentLogScreen::FormatAndScrollL() |
|
403 { |
|
404 iTextView->FormatTextL(); |
|
405 |
|
406 // Scroll the last line into the view |
|
407 TInt yPos = Rect().Height(); |
|
408 iTextView->SetViewL(iGlobalText->LdDocumentLength(), yPos); |
|
409 UpdateScrollBars(ETrue); |
|
410 } |
|
411 |
|
412 void CJavaDebugAgentLogScreen::UpdateSBModel(TEikScrollBarModel* aModel) const |
|
413 { |
|
414 if (iLayout) |
|
415 { |
|
416 TInt height = iViewRect.Height() - KTextMarginTop - KTextMarginBottom; |
|
417 aModel->iThumbPosition = iLayout->PixelsAboveBand(); |
|
418 aModel->iScrollSpan = iLayout->FormattedHeightInPixels(); |
|
419 aModel->iThumbSpan = Min(aModel->iScrollSpan, height); |
|
420 if (aModel->iScrollSpan > aModel->iThumbSpan) |
|
421 { |
|
422 // We've got something non-trivial |
|
423 return; |
|
424 } |
|
425 } |
|
426 |
|
427 // This essentially disables the scrollbar |
|
428 aModel->iThumbPosition = 0; |
|
429 aModel->iScrollSpan = 0; |
|
430 aModel->iThumbSpan = 0; |
|
431 } |
|
432 |
|
433 void CJavaDebugAgentLogScreen::UpdateScrollBars(TBool aDrawNow) |
|
434 { |
|
435 TEikScrollBarModel m1; |
|
436 UpdateSBModel(&m1); |
|
437 TAknDoubleSpanScrollBarModel m2(m1); |
|
438 iSBFrame->Tile(&m2); |
|
439 iSBFrame->MoveVertThumbTo(m1.iThumbPosition); |
|
440 if (aDrawNow) iSBFrame->DrawScrollBarsNow(); |
|
441 } |
|
442 |
|
443 void CJavaDebugAgentLogScreen::SetLogFileL(const TDesC* aFileName) |
|
444 { |
|
445 if ((!iLogFileName && aFileName) || |
|
446 (iLogFileName && !aFileName) || |
|
447 (iLogFileName && aFileName && iLogFileName->Compare(*aFileName))) |
|
448 { |
|
449 CloseLogFile(); |
|
450 if (aFileName) |
|
451 { |
|
452 iLogFileName = aFileName->AllocL(); |
|
453 const TDesC& fname = *iLogFileName; |
|
454 TInt err = iLogFile.Open(iFs,fname,EFileWrite|EFileShareAny); |
|
455 if (err != KErrNone) |
|
456 { |
|
457 iFs.MkDirAll(fname); |
|
458 err = iLogFile.Create(iFs,fname,EFileWrite|EFileShareAny); |
|
459 } |
|
460 |
|
461 if (err == KErrNone) |
|
462 { |
|
463 TInt sz; |
|
464 iLogFile.Size(sz); |
|
465 iLogFile.Seek(ESeekEnd,sz); |
|
466 LogFormatToScreen(_S("Log file %S"),&fname); |
|
467 } |
|
468 else |
|
469 { |
|
470 LogFormatToScreen(_S("Failed to open log file %S"),&fname); |
|
471 LogFormatToScreen(_S("Symbian error %d"),err); |
|
472 delete iLogFileName; |
|
473 iLogFileName = NULL; |
|
474 } |
|
475 } |
|
476 } |
|
477 } |
|
478 |
|
479 // Internal formatting function, only used by SetLogFileL |
|
480 // Never logs to file, only to screen. |
|
481 void CJavaDebugAgentLogScreen::LogFormatToScreen(const TText* aFormat, ...) |
|
482 { |
|
483 VA_LIST va; |
|
484 VA_START(va, aFormat); |
|
485 TBuf<KMaxLogLineLength> buf; |
|
486 TPtrC format(aFormat); |
|
487 TBuf<KMaxPrefixLength> prefix; |
|
488 TRAPD(err, FormatPrefixL(prefix)); |
|
489 buf.AppendFormatList(format, va, this); |
|
490 TRAP(err, LogToScreenL(prefix, buf)); |
|
491 } |
|
492 |
|
493 void CJavaDebugAgentLogScreen::ClearLog() |
|
494 { |
|
495 TRAP_IGNORE(ClearL()); |
|
496 } |
|
497 |
|
498 void CJavaDebugAgentLogScreen::SetLogFile(const TDesC* aFileName) |
|
499 { |
|
500 TRAP_IGNORE(SetLogFileL(aFileName)); |
|
501 } |
|
502 |
|
503 void CJavaDebugAgentLogScreen::SizeChangedL() |
|
504 { |
|
505 const CFont* font = DEFAULT_FONT(); |
|
506 if (font) { |
|
507 iDefaultFontHeightInTwips = font->FontSpecInTwips().iHeight; |
|
508 UpdateFontSizeL(iFontSize); |
|
509 } |
|
510 DoLayoutL(); |
|
511 iLayout->SetWrapWidth(iTextRect.Width()); |
|
512 iTextView->SetViewRect(iTextRect); |
|
513 FormatAndScrollL(); |
|
514 DrawNow(); |
|
515 } |
|
516 |
|
517 void CJavaDebugAgentLogScreen::SizeChanged() |
|
518 { |
|
519 // This method is invoked during ConstructL when iTextView is still NULL |
|
520 if (iTextView) { |
|
521 TRAP_IGNORE(SizeChangedL()); |
|
522 } |
|
523 } |
|
524 |
|
525 TKeyResponse CJavaDebugAgentLogScreen::OfferKeyEventL( |
|
526 const TKeyEvent& aKeyEvent, TEventCode aType) |
|
527 { |
|
528 if (aType != EEventKey) return EKeyWasNotConsumed; |
|
529 TInt code=aKeyEvent.iCode; |
|
530 TCursorPosition::TMovementType movement; |
|
531 switch (code) |
|
532 { |
|
533 case EKeyOK: |
|
534 case EKeyEnter: |
|
535 iView->TryDisplayMenuBarL(); |
|
536 return EKeyWasConsumed; |
|
537 |
|
538 // The rest has to do with scrolling |
|
539 case EKeyDownArrow: |
|
540 movement = TCursorPosition::EFLineDown; |
|
541 break; |
|
542 case EKeyUpArrow: |
|
543 movement = TCursorPosition::EFLineUp; |
|
544 break; |
|
545 case EKeyPageDown: |
|
546 movement = TCursorPosition::EFPageDown; |
|
547 break; |
|
548 case EKeyPageUp: |
|
549 movement = TCursorPosition::EFPageUp; |
|
550 break; |
|
551 default: |
|
552 return EKeyWasNotConsumed; |
|
553 } |
|
554 iTextView->ScrollDisplayL(movement); |
|
555 UpdateScrollBars(EFalse); |
|
556 return EKeyWasConsumed; |
|
557 } |
|
558 |
|
559 // MJavaDebugAgentLog |
|
560 void CJavaDebugAgentLogScreen::Log(const TText* aString) |
|
561 { |
|
562 TPtrC des(aString); |
|
563 TRAP_IGNORE(LogL(des)); |
|
564 } |
|
565 |
|
566 void CJavaDebugAgentLogScreen::LogFormat(const TText* aFormat, ...) |
|
567 { |
|
568 VA_LIST va; |
|
569 VA_START(va, aFormat); |
|
570 TBuf<KMaxLogLineLength> buf; |
|
571 TPtrC format(aFormat); |
|
572 buf.AppendFormatList(format, va, this); |
|
573 TRAP_IGNORE(LogL(buf)); |
|
574 } |
|
575 |
|
576 // TDesOverflow |
|
577 void CJavaDebugAgentLogScreen::Overflow(TDes& /*aDes*/) |
|
578 { |
|
579 } |
|
580 |
|
581 /** |
|
582 * Local Variables: |
|
583 * c-basic-offset: 4 |
|
584 * indent-tabs-mode: nil |
|
585 * End: |
|
586 */ |