[dasher: 4/21] iPhone fixes: call ScreenResized if it does; avoid training twice at startup



commit 602683f389d7b5438b07f42d7bb162bcde7b6100
Author: Alan Lawrence <acl33 inf phy cam ac uk>
Date:   Wed Jun 22 12:17:40 2011 +0100

    iPhone fixes: call ScreenResized if it does; avoid training twice at startup
    
    EAGLView.h imports / namespace

 Src/iPhone/Classes/CDasherInterfaceBridge.mm |    5 ++++-
 Src/iPhone/Classes/EAGLView.h                |   10 +++++-----
 Src/iPhone/Classes/EAGLView.mm               |    5 ++++-
 3 files changed, 13 insertions(+), 7 deletions(-)
---
diff --git a/Src/iPhone/Classes/CDasherInterfaceBridge.mm b/Src/iPhone/Classes/CDasherInterfaceBridge.mm
index dbb07f1..41588c2 100644
--- a/Src/iPhone/Classes/CDasherInterfaceBridge.mm
+++ b/Src/iPhone/Classes/CDasherInterfaceBridge.mm
@@ -108,7 +108,10 @@ void CDasherInterfaceBridge::SetupUI() {
 
 void CDasherInterfaceBridge::Realize() {
   CDasherInterfaceBase::Realize(get_time());
-  HandleEvent(SP_ALPHABET_ID); //calls dasherApp::SetAlphabet
+  
+  [dasherApp setAlphabet:GetActiveAlphabet()];
+  //don't call HandleEvent, would call superclass and reconstruct the NCManager!
+  //TODO maybe better to make ChangeAlphabet virtual and override that?  
 }
 
 void CDasherInterfaceBridge::SetupPaths() {
diff --git a/Src/iPhone/Classes/EAGLView.h b/Src/iPhone/Classes/EAGLView.h
index 414e405..2047a00 100644
--- a/Src/iPhone/Classes/EAGLView.h
+++ b/Src/iPhone/Classes/EAGLView.h
@@ -13,17 +13,17 @@
 #import <OpenGLES/ES1/glext.h>
 
 #import "../Common/OpenGLScreen.h"
-#import "DasherAppDelegate.h"
 
+ class DasherAppDelegate;
 @class EAGLView;
 
-class CDasherScreenBridge : public OpenGLScreen {
+class CDasherScreenBridge : public Dasher::OpenGLScreen {
   EAGLView *view;
 public:
-  CDasherScreenBridge(EAGLView *_view, screenint iWidth, screenint iHeight, GLshort backingWidth, GLshort backingHeight, GLfloat tc_x, GLfloat tc_y, GLuint *textures);
+  CDasherScreenBridge(EAGLView *_view, Dasher::screenint iWidth, Dasher::screenint iHeight, GLshort backingWidth, GLshort backingHeight, GLfloat tc_x, GLfloat tc_y, GLuint *textures);
   ///Only for EAGLView to call...
-  void resize(screenint iWidth, screenint iHeight, GLshort backingWidth, GLshort backingHeight, GLfloat tc_x, GLfloat tc_y);
-  bool GetTouchCoords(screenint &iX, screenint &iY);
+  void resize(Dasher::screenint iWidth, Dasher::screenint iHeight, GLshort backingWidth, GLshort backingHeight, GLfloat tc_x, GLfloat tc_y);
+  bool GetTouchCoords(Dasher::screenint &iX, Dasher::screenint &iY);
   void Display();
   void SendMarker(int iMarker);
   
diff --git a/Src/iPhone/Classes/EAGLView.mm b/Src/iPhone/Classes/EAGLView.mm
index 852522e..33301dd 100644
--- a/Src/iPhone/Classes/EAGLView.mm
+++ b/Src/iPhone/Classes/EAGLView.mm
@@ -11,7 +11,7 @@
 
 #import "EAGLView.h"
 #import "DasherUtil.h"
-#import "../Common/OpenGLScreen.h"
+#import "DasherAppDelegate.h"
 
 // A class extension to declare private methods
 @interface EAGLView ()
@@ -22,6 +22,8 @@
 @property (readonly) bool readyToDisplay;
 @end
 
+using namespace Dasher;
+
 CDasherScreenBridge::CDasherScreenBridge(EAGLView *_view, screenint iWidth, screenint iHeight, GLshort backingWidth, GLshort backingHeight, GLfloat tc_x, GLfloat tc_y, GLuint *textures)
 : OpenGLScreen(iWidth, iHeight, backingWidth, backingHeight, tc_x, tc_y, textures), view(_view) {
 }
@@ -155,6 +157,7 @@ CGSize CDasherScreenBridge::TextSize(NSString *str, unsigned int iFontSize, bool
   [self createFramebuffer];
   CGSize sz = [self bounds].size;
   dasherScreen->resize(sz.width, sz.height, backingWidth, backingHeight, texw, texh);
+  dasherApp.dasherInterface->ScreenResized(dasherScreen);
   doneLayout = YES;
   [self drawView];
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]