00001
00008 #ifndef __E32FRODO_H
00009 #define __E32FRODO_H
00010
00011 #include <coecntrl.h>
00012 #include <coeccntx.h>
00013 #include <coemain.h>
00014
00015 #include <eikappui.h>
00016 #include <eikapp.h>
00017 #include <eikdoc.h>
00018 #include <eikenv.h>
00019 #include <eiktbar.h>
00020
00021 #if defined(__ER6__)
00022 #include <eikfnlab.h>
00023 #else
00024 #include <eikcmds.hrh>
00025 #endif
00026
00027 #include "e32frodo.hrh"
00028 #include "main.h"
00029 #include "C64.h"
00030
00034 enum TSnapShotState
00035 {
00036 ESnapShotIdle,
00037 ESnapShotSave,
00038 ESnapShotLoad
00039 };
00040
00041
00042 class CE32FrodoDocument;
00043 class CE32FrodoAppUi;
00044
00045
00049 class CE32FrodoAppView : public CCoeControl, public MCoeControlBrushContext
00050 {
00051 friend class CE32FrodoAppUi;
00052
00053 public:
00054 void ConstructL(const TRect& aRect);
00055 ~CE32FrodoAppView();
00056
00057 void UpdateDrawPositions();
00058 void DrawBuf(bool bg_update);
00059 #if defined (__ER6__)
00060 void DrawDirect(bool bg_update);
00061 void DrawDirectStretched(bool bg_update);
00062 void DrawDirectZoomed(bool bg_update);
00063 #endif // __ER6__
00064 void DrawSpeed(int speed, int max_speed);
00065 void DrawLed(TPoint aPos, TInt aState);
00066
00067 private:
00068 void FocusChanged(TDrawNow aDrawNow);
00069 void HandlePointerEventL(const TPointerEvent& aPointerEvent);
00070 private:
00071 TDisplayMode iDispMode;
00072 public:
00073 #if defined (__ER6__)
00074
00075 #ifdef __WINS__
00076 CFbsBitmap* iWinsScreenBitmap;
00077 #endif
00078 TUint8* iMyScreenBuffer;
00079 TSize iMyBufferSize;
00080 TUint16* iMyColorTable;
00081 #else // __ER6__
00082 CFbsBitmap iTheBitMap;
00083 #endif // __ER6__
00084 TBool iIsC64ScreenZoomed;
00085 TBool iIsC64ScreenStretched;
00086
00087 #ifdef _DEBUG
00088 SidDebugData* iSidDebugData;
00089 TBool iShowDebugInfo;
00090 #endif
00091
00092 private:
00093 CFbsFont* iSpeedFont;
00094 TInt iDrawCount;
00095 TBool iIsColorMachine;
00096 TRect iC64screen;
00097 TPoint* iOffset;
00098 TPoint iNormalScreenOffset;
00099 TPoint iZoomedScreenOffset;
00100 TPoint iStretchedScreenOffset;
00101 TBool iBgUpdate;
00102 TBool iFullScreenMode;
00103 TBool iPauseFromUi;
00104 TBool iPause;
00105 TSize iScreenSize;
00106
00107 #if defined(__ER6__)
00108 TRect iDrawableArea;
00109 TUint8* iMyBufferAddress;
00110 TUint16* iHWScreenAddress;
00111 TInt iScreenStartOffset;
00112 TInt iScreenStartOffset2;
00113 TInt iJumpInPixelsInScreen;
00114 TInt iJumpInPixelsInBuffer;
00115 TRect iDrawableArea2;
00116 TUint8* iMyBufferAddress2;
00117 TUint16* iScreenAddress2;
00118 TInt iJumpInPixelsInScreen2;
00119 TInt iJumpInPixelsInBuffer2;
00120 #endif // __ER6__
00121 };
00122
00123
00127 class CE32FrodoAppUi : public CEikAppUi
00128 {
00129 public:
00130 void ConstructL();
00131 CE32FrodoAppUi();
00132 ~CE32FrodoAppUi();
00133 void SetPauseState();
00134 private:
00135
00136 virtual void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane);
00137 virtual void SetEmphasis(CCoeControl* aMenuControl,TBool aEmphasis);
00138
00139 virtual void HandleForegroundEventL(TBool aForeground);
00140 virtual void HandleCommandL(TInt aCommand);
00141 void SetFullScreenModeL(TBool aFullScreenMode);
00142 virtual void OpenFileL(const TDesC& aFileName);
00143 virtual TBool ProcessCommandParametersL(TApaCommand aCommand, TFileName& aDocumentName,const TDesC8& );
00144
00145 #if defined(__ER6__)
00146 TKeyResponse
00147 #else
00148 void
00149 #endif
00150 HandleKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
00151 void StartHelpL();
00152 void StopHelpL();
00153 public:
00154 inline CE32FrodoDocument* E32FrodoDocPtr() {return (CE32FrodoDocument*)Document();}
00155
00156 CE32FrodoAppView* iAppView;
00157 void ViewToolbar(TBool aView);
00158
00159 public:
00160
00161 int keystate[256];
00162 TUint8 rev_matrix[8];
00163 TUint8 key_matrix[8];
00164 TUint8 iJoyKey;
00165
00166 TBuf8<256> iCurrentFile;
00167 TSnapShotState iSnapState;
00168
00169 private:
00170 #define KKeyBufSize 0x10
00171
00172 TInt iLastC64KeyBuf[KKeyBufSize];
00173 TInt iLastC64KeyBufIx;
00174 TInt iLastCommand;
00175 TInt iMoveRate;
00176 };
00177
00178
00182 class CE32FrodoDocument : public CEikDocument
00183 {
00184 public:
00185
00186 CE32FrodoDocument(CEikApplication& aApp);
00187 ~CE32FrodoDocument();
00188 static CE32FrodoDocument* NewL(CEikApplication& aApp);
00189 void ConstructL();
00190 inline Frodo* FrodoPtr(){return iFrodo;}
00191 void ShowError(char *str1, char *str2);
00192
00193 public:
00194 CE32FrodoAppUi* iAppUiPtr;
00195 private:
00196 CEikAppUi* CreateAppUiL();
00197 public:
00198 Frodo* iFrodo;
00199 };
00200
00201
00202
00203
00204
00205 class CE32FrodoApplication : public CEikApplication
00206 {
00207 public:
00208 TFileName GetDriveAndPath();
00209 private:
00210 CApaDocument* CreateDocumentL();
00211 TUid AppDllUid() const;
00212 };
00213
00214
00220 class C64Starter : public CActive
00221 {
00222 public:
00223 C64Starter();
00224 private:
00225 virtual void DoCancel();
00226 virtual void RunL();
00227 };
00228
00229 #endif // __E32FRODO_H