|
1 // fed.h |
|
2 // |
|
3 // Copyright (c) 2009 - 2010 Accenture. All rights reserved. |
|
4 // This component and the accompanying materials are made available |
|
5 // under the terms of the "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 // Accenture - Initial contribution |
|
11 // |
|
12 #ifndef FED_H_ |
|
13 #define FED_H_ |
|
14 |
|
15 #include <e32base.h> |
|
16 #include <f32file.h> |
|
17 |
|
18 #include "screenmngr.h" |
|
19 #include "cmdwindow.h" |
|
20 |
|
21 class CColorConsoleBase; |
|
22 class CFedBufferBase; |
|
23 class CFedViewBase; |
|
24 class CDesC16Array; |
|
25 class CCnvCharacterSetConverter; |
|
26 |
|
27 class CFed : public CActive |
|
28 { |
|
29 public: |
|
30 static CFed* NewL(CColorConsoleBase& aConsole, RFs& aFs); |
|
31 static CFed* NewL(CConsoleBase& aConsole, RFs& aFs); |
|
32 ~CFed(); |
|
33 |
|
34 //Main entrance to the editor |
|
35 void StartL(CDesC16Array* aFiles); // Takes ownership of aFiles immediately |
|
36 |
|
37 void RedrawEverythingL(); |
|
38 void ShowHelpL(HBufC* aHelpText); |
|
39 |
|
40 public: |
|
41 //CActive |
|
42 void DoCancel(); |
|
43 void RunL(); |
|
44 TInt RunError(TInt aError); |
|
45 |
|
46 private: |
|
47 CFed(CColorConsoleBase& aConsole, RFs& aFs); |
|
48 CFed(CConsoleBase& aConsole, RFs& aFs); |
|
49 void ConstructL(); |
|
50 //Construct all necessary views as specified in the command line |
|
51 void CreateViewsL(CDesC16Array* aFiles); |
|
52 //Some standard commands which need to be handled in the CFed class |
|
53 enum TCmdType |
|
54 { |
|
55 ECmdNone, |
|
56 ECmdHelp, |
|
57 ECmdPrevView, |
|
58 ECmdNextView, |
|
59 ECmdNewDocument, |
|
60 ECmdCloseCurrent, |
|
61 ECmdCloseAll, |
|
62 ECmdOpenDocument, |
|
63 ECmdRefresh, |
|
64 }; |
|
65 //Main function processing keys which should catch all commands related to the whole editor, not to any particular view |
|
66 TCmdType ProcessKeyL(const TKeyCode& aCode); |
|
67 //Execute commands returned by ProcessKeyL |
|
68 TBool ExecuteCommandL(TCmdType aCmd); |
|
69 |
|
70 //Closes the view which is currently active |
|
71 TBool CloseCurrentViewL(); |
|
72 //Closes all views, will cause the program to close only if special char has been pressed (EKeyEscape) |
|
73 void CloseAllViewsL(); |
|
74 //Removes the view from the array of views |
|
75 void DeleteView(); |
|
76 void NewViewL(const TDesC& aFileName, TBool aPromptOnNonexistantName=EFalse); |
|
77 void OpenDocumentL(); |
|
78 |
|
79 private: |
|
80 RFs& iFs; |
|
81 CConsoleBase& iConsole; |
|
82 CColorConsoleBase* iColorConsole; |
|
83 CScreenManager iScreenMngr; |
|
84 CCommandWindow* iCmdWindow; |
|
85 |
|
86 RArray<CFedViewBase*> iViewArray; |
|
87 TInt iViewIdx; |
|
88 CCnvCharacterSetConverter* iCharconv; // Shared between CFileBuffers, for doing UTF-8 conversion. May be null if charconv isn't available |
|
89 }; |
|
90 |
|
91 #endif /*FED_H_*/ |