[Avida-SVN] r1759 - in development: . Avida.xcodeproj source/targets/avida-viewer source/targets/viewer-text source/tools source/viewer-core

ofria at myxo.css.msu.edu ofria at myxo.css.msu.edu
Fri Jul 6 23:10:05 PDT 2007


Author: ofria
Date: 2007-07-07 02:10:05 -0400 (Sat, 07 Jul 2007)
New Revision: 1759

Modified:
   development/Avida.xcodeproj/project.pbxproj
   development/CMakeLists.txt
   development/source/targets/avida-viewer/cTextViewerDriver.cc
   development/source/targets/avida-viewer/cTextWindow.h
   development/source/targets/avida-viewer/cView.h
   development/source/targets/viewer-text/cDriver_TextViewer.cc
   development/source/targets/viewer-text/cDriver_TextViewer.h
   development/source/targets/viewer-text/ncurses-defs.h
   development/source/tools/tArray.h
   development/source/viewer-core/cCoreView_Info.cc
   development/source/viewer-core/cCoreView_Info.h
Log:
New text viewer is moving along slowly...


Modified: development/Avida.xcodeproj/project.pbxproj
===================================================================
--- development/Avida.xcodeproj/project.pbxproj	2007-07-06 22:03:23 UTC (rev 1758)
+++ development/Avida.xcodeproj/project.pbxproj	2007-07-07 06:10:05 UTC (rev 1759)
@@ -23,6 +23,11 @@
 /* End PBXAggregateTarget section */
 
 /* Begin PBXBuildFile section */
+		5629D8110C3EE14800C5F152 /* cTextWindow.cc in Sources */ = {isa = PBXBuildFile; fileRef = 5629D80D0C3EE13500C5F152 /* cTextWindow.cc */; };
+		5629D8180C3EE20C00C5F152 /* libncurses.5.4.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 70658C59085DF67D00486BED /* libncurses.5.4.dylib */; };
+		5629D8190C3EE21300C5F152 /* libavida-core.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7023EC330C0A426900362B9C /* libavida-core.a */; };
+		5629D81A0C3EE21300C5F152 /* libtcmalloc.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 70AA941909D486AE006A24C8 /* libtcmalloc.a */; };
+		5629D81C0C3EE26A00C5F152 /* cCoreView_Info.cc in Sources */ = {isa = PBXBuildFile; fileRef = 565121C60C3B055F009CBD3F /* cCoreView_Info.cc */; };
 		56F555E50C3B402A00E2E929 /* cDriver_TextViewer.cc in Sources */ = {isa = PBXBuildFile; fileRef = 56F555DF0C3B402A00E2E929 /* cDriver_TextViewer.cc */; };
 		56F555E70C3B402A00E2E929 /* viewer-text.cc in Sources */ = {isa = PBXBuildFile; fileRef = 56F555E40C3B402A00E2E929 /* viewer-text.cc */; };
 		700E2996085A1F6000CF158A /* avida in CopyFiles */ = {isa = PBXBuildFile; fileRef = DCC3164D07626CF3008F7A48 /* avida */; };
@@ -348,10 +353,13 @@
 		423335880BC067E3000DF681 /* cHardwareGX.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cHardwareGX.cc; sourceTree = "<group>"; };
 		423335890BC067E3000DF681 /* cHardwareGX.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cHardwareGX.h; sourceTree = "<group>"; };
 		42490EFE0BE2472800318058 /* cGermline.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cGermline.h; sourceTree = "<group>"; };
+		5629D80D0C3EE13500C5F152 /* cTextWindow.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cTextWindow.cc; sourceTree = "<group>"; };
+		5629D80E0C3EE13500C5F152 /* cTextWindow.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cTextWindow.h; sourceTree = "<group>"; };
+		5629D80F0C3EE13500C5F152 /* ncurses-defs.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = "ncurses-defs.h"; sourceTree = "<group>"; };
 		565121C60C3B055F009CBD3F /* cCoreView_Info.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cCoreView_Info.cc; sourceTree = "<group>"; };
 		565121C70C3B055F009CBD3F /* cCoreView_Info.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cCoreView_Info.h; sourceTree = "<group>"; };
 		565121C80C3B055F009CBD3F /* LAYOUT */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = LAYOUT; sourceTree = "<group>"; };
-		56F555D00C3B364E00E2E929 /* New Text Viewer */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "New Text Viewer"; sourceTree = BUILT_PRODUCTS_DIR; };
+		56F555D00C3B364E00E2E929 /* avida-text */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "avida-text"; sourceTree = BUILT_PRODUCTS_DIR; };
 		56F555DF0C3B402A00E2E929 /* cDriver_TextViewer.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cDriver_TextViewer.cc; sourceTree = "<group>"; };
 		56F555E00C3B402A00E2E929 /* cDriver_TextViewer.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cDriver_TextViewer.h; sourceTree = "<group>"; };
 		56F555E10C3B402A00E2E929 /* cTextViewerManager.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cTextViewerManager.cc; sourceTree = "<group>"; };
@@ -817,7 +825,7 @@
 		DCC315CE076253A5008F7A48 /* environment.rotate */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = environment.rotate; sourceTree = "<group>"; };
 		DCC315D0076253A5008F7A48 /* task_event_gen.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = task_event_gen.cc; sourceTree = "<group>"; };
 		DCC315D1076253A5008F7A48 /* task_event_gen.old.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = task_event_gen.old.cc; sourceTree = "<group>"; };
-		DCC3164D07626CF3008F7A48 /* avida */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = avida; sourceTree = BUILT_PRODUCTS_DIR; };
+		DCC3164D07626CF3008F7A48 /* avida */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = "compiled.mach-o.executable"; path = avida; sourceTree = BUILT_PRODUCTS_DIR; };
 /* End PBXFileReference section */
 
 /* Begin PBXFrameworksBuildPhase section */
@@ -825,6 +833,9 @@
 			isa = PBXFrameworksBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
+				5629D8180C3EE20C00C5F152 /* libncurses.5.4.dylib in Frameworks */,
+				5629D8190C3EE21300C5F152 /* libavida-core.a in Frameworks */,
+				5629D81A0C3EE21300C5F152 /* libtcmalloc.a in Frameworks */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -893,6 +904,9 @@
 		56F555DE0C3B402A00E2E929 /* viewer-text */ = {
 			isa = PBXGroup;
 			children = (
+				5629D80D0C3EE13500C5F152 /* cTextWindow.cc */,
+				5629D80E0C3EE13500C5F152 /* cTextWindow.h */,
+				5629D80F0C3EE13500C5F152 /* ncurses-defs.h */,
 				56F555DF0C3B402A00E2E929 /* cDriver_TextViewer.cc */,
 				56F555E00C3B402A00E2E929 /* cDriver_TextViewer.h */,
 				56F555E10C3B402A00E2E929 /* cTextViewerManager.cc */,
@@ -900,8 +914,7 @@
 				56F555E30C3B402A00E2E929 /* LAYOUT */,
 				56F555E40C3B402A00E2E929 /* viewer-text.cc */,
 			);
-			name = "viewer-text";
-			path = "source/targets/viewer-text";
+			path = "viewer-text";
 			sourceTree = "<group>";
 		};
 		701D9115094B770B008B845F /* drivers */ = {
@@ -1093,6 +1106,7 @@
 				70DCAC56097AF730002F8733 /* avida-s */,
 				70DCAC58097AF730002F8733 /* avida-viewer */,
 				701EF27D0BEA5D2300DAE168 /* unit-tests */,
+				56F555DE0C3B402A00E2E929 /* viewer-text */,
 			);
 			path = targets;
 			sourceTree = "<group>";
@@ -1255,7 +1269,6 @@
 		DCC30C490762532C008F7A48 = {
 			isa = PBXGroup;
 			children = (
-				56F555DE0C3B402A00E2E929 /* viewer-text */,
 				DCC30C670762539A008F7A48 /* Main Source */,
 				70920C1A0A9CCE2C00757CDB /* Documentation */,
 				707AF2D209EE8501001AEA89 /* Support */,
@@ -1269,7 +1282,6 @@
 		DCC30C670762539A008F7A48 /* Main Source */ = {
 			isa = PBXGroup;
 			children = (
-				565121C50C3B055F009CBD3F /* viewer-core */,
 				707AEEEE09E80699001AEA89 /* actions */,
 				70422A1B091B141000A5E67F /* analyze */,
 				70F7D8C8092546DC009E311D /* classification */,
@@ -1280,6 +1292,7 @@
 				70DCAD1E097AF81A002F8733 /* script */,
 				70DCAC54097AF730002F8733 /* targets */,
 				DCC314D8076253A2008F7A48 /* tools */,
+				565121C50C3B055F009CBD3F /* viewer-core */,
 				701384A10902A16F0087ED2E /* defs.h */,
 				DCC30FCF0762539D008F7A48 /* Doxyfile */,
 			);
@@ -1578,7 +1591,7 @@
 				70AA941909D486AE006A24C8 /* libtcmalloc.a */,
 				70B6514C0BEA6FAD002472ED /* unit-tests */,
 				7023EC330C0A426900362B9C /* libavida-core.a */,
-				56F555D00C3B364E00E2E929 /* New Text Viewer */,
+				56F555D00C3B364E00E2E929 /* avida-text */,
 			);
 			name = Products;
 			sourceTree = "<group>";
@@ -1603,9 +1616,9 @@
 /* End PBXHeadersBuildPhase section */
 
 /* Begin PBXNativeTarget section */
-		56F555CF0C3B364E00E2E929 /* New Text Viewer */ = {
+		56F555CF0C3B364E00E2E929 /* avida-text */ = {
 			isa = PBXNativeTarget;
-			buildConfigurationList = 56F555D40C3B36AD00E2E929 /* Build configuration list for PBXNativeTarget "New Text Viewer" */;
+			buildConfigurationList = 56F555D40C3B36AD00E2E929 /* Build configuration list for PBXNativeTarget "avida-text" */;
 			buildPhases = (
 				56F555CD0C3B364E00E2E929 /* Sources */,
 				56F555CE0C3B364E00E2E929 /* Frameworks */,
@@ -1616,9 +1629,9 @@
 				56F555DB0C3B36FC00E2E929 /* PBXTargetDependency */,
 				56F555DD0C3B370100E2E929 /* PBXTargetDependency */,
 			);
-			name = "New Text Viewer";
+			name = "avida-text";
 			productName = "New Text Viewer";
-			productReference = 56F555D00C3B364E00E2E929 /* New Text Viewer */;
+			productReference = 56F555D00C3B364E00E2E929 /* avida-text */;
 			productType = "com.apple.product-type.tool";
 		};
 		700E2AF3085DE50C00CF158A /* avida-viewer */ = {
@@ -1746,10 +1759,10 @@
 				DCC3164C07626CF3008F7A48 /* avida */,
 				70DCAC9D097AF7CC002F8733 /* avida-s */,
 				700E2AF3085DE50C00CF158A /* avida-viewer */,
+				56F555CF0C3B364E00E2E929 /* avida-text */,
 				7023EC320C0A426900362B9C /* avida-core */,
 				70AA941809D486AE006A24C8 /* tcmalloc */,
 				70B6514B0BEA6FAD002472ED /* unit-tests */,
-				56F555CF0C3B364E00E2E929 /* New Text Viewer */,
 			);
 		};
 /* End PBXProject section */
@@ -1777,6 +1790,8 @@
 			files = (
 				56F555E50C3B402A00E2E929 /* cDriver_TextViewer.cc in Sources */,
 				56F555E70C3B402A00E2E929 /* viewer-text.cc in Sources */,
+				5629D8110C3EE14800C5F152 /* cTextWindow.cc in Sources */,
+				5629D81C0C3EE26A00C5F152 /* cCoreView_Info.cc in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -2031,7 +2046,7 @@
 				GCC_OPTIMIZATION_LEVEL = 0;
 				INSTALL_PATH = "$(HOME)/bin";
 				PREBINDING = NO;
-				PRODUCT_NAME = "New Text Viewer";
+				PRODUCT_NAME = "avida-text";
 				ZERO_LINK = YES;
 			};
 			name = Development;
@@ -2045,7 +2060,7 @@
 				GCC_MODEL_TUNING = G5;
 				INSTALL_PATH = "$(HOME)/bin";
 				PREBINDING = NO;
-				PRODUCT_NAME = "New Text Viewer";
+				PRODUCT_NAME = "avida-text";
 				ZERO_LINK = NO;
 			};
 			name = Deployment;
@@ -2057,7 +2072,7 @@
 				GCC_MODEL_TUNING = G5;
 				INSTALL_PATH = "$(HOME)/bin";
 				PREBINDING = NO;
-				PRODUCT_NAME = "New Text Viewer";
+				PRODUCT_NAME = "avida-text";
 				ZERO_LINK = YES;
 			};
 			name = "Deployment-G5";
@@ -2069,7 +2084,7 @@
 				GCC_MODEL_TUNING = G5;
 				INSTALL_PATH = "$(HOME)/bin";
 				PREBINDING = NO;
-				PRODUCT_NAME = "New Text Viewer";
+				PRODUCT_NAME = "avida-text";
 				ZERO_LINK = YES;
 			};
 			name = "Deployment-Universal";
@@ -2081,7 +2096,7 @@
 				GCC_MODEL_TUNING = G5;
 				INSTALL_PATH = "$(HOME)/bin";
 				PREBINDING = NO;
-				PRODUCT_NAME = "New Text Viewer";
+				PRODUCT_NAME = "avida-text";
 				ZERO_LINK = YES;
 			};
 			name = Profile;
@@ -2637,7 +2652,7 @@
 /* End XCBuildConfiguration section */
 
 /* Begin XCConfigurationList section */
-		56F555D40C3B36AD00E2E929 /* Build configuration list for PBXNativeTarget "New Text Viewer" */ = {
+		56F555D40C3B36AD00E2E929 /* Build configuration list for PBXNativeTarget "avida-text" */ = {
 			isa = XCConfigurationList;
 			buildConfigurations = (
 				56F555D50C3B36AD00E2E929 /* Development */,

Modified: development/CMakeLists.txt
===================================================================
--- development/CMakeLists.txt	2007-07-06 22:03:23 UTC (rev 1758)
+++ development/CMakeLists.txt	2007-07-07 06:10:05 UTC (rev 1759)
@@ -318,9 +318,6 @@
   ADD_EXECUTABLE(avida ${AVIDA_CMDLINE_SOURCES})
 
   SET(AVIDA_CMDLINE_LIBS avidacore)  
-  IF(NOT MSVC)
-    LIST(APPEND AVIDA_CMDLINE_LIBS pthread)
-  ENDIF(NOT MSVC)
   IF(AVD_ENABLE_TCMALLOC)
     LIST(APPEND AVIDA_CMDLINE_LIBS tcmalloc)
   ENDIF(AVD_ENABLE_TCMALLOC)  
@@ -378,9 +375,6 @@
     ADD_EXECUTABLE(avida-viewer ${AVIDA_VIEWER_SOURCES})
     
     SET(AVIDA_VIEWER_LIBS avidacore ${NCURSES_LIBRARY})
-    IF(NOT MSVC)
-      LIST(APPEND AVIDA_VIEWER_LIBS pthread)
-    ENDIF(NOT MSVC)
     IF(AVD_ENABLE_TCMALLOC)
       LIST(APPEND AVIDA_VIEWER_LIBS tcmalloc)
     ENDIF(AVD_ENABLE_TCMALLOC)
@@ -428,7 +422,7 @@
 #      ${AVIDA_TEXT_VIEWER_DIR}/cScreen.cc
 #      ${AVIDA_TEXT_VIEWER_DIR}/cStatsScreen.cc
 #      ${AVIDA_TEXT_VIEWER_DIR}/cSymbolUtil.cc
-#      ${AVIDA_TEXT_VIEWER_DIR}/cTextWindow.cc
+      ${AVIDA_TEXT_VIEWER_DIR}/cTextWindow.cc
 #      ${AVIDA_TEXT_VIEWER_DIR}/cView.cc
 #      ${AVIDA_TEXT_VIEWER_DIR}/cViewInfo.cc
 #      ${AVIDA_TEXT_VIEWER_DIR}/cZoomScreen.cc
@@ -439,13 +433,14 @@
     SOURCE_GROUP(targets\\viewer-text FILES ${AVIDA_TEXT_VIEWER_SOURCES})
     ADD_EXECUTABLE(avida-textview ${AVIDA_TEXT_VIEWER_SOURCES})
     
-    SET(AVIDA_TEXT_VIEWER_LIBS avidacore ${NCURSES_LIBRARY})
+    SET(AVIDA_TEXT_VIEWER_LIBS avidacore)
     IF(NOT MSVC)
       LIST(APPEND AVIDA_TEXT_VIEWER_LIBS pthread)
     ENDIF(NOT MSVC)
     IF(AVD_ENABLE_TCMALLOC)
       LIST(APPEND AVIDA_TEXT_VIEWER_LIBS tcmalloc)
     ENDIF(AVD_ENABLE_TCMALLOC)
+    LIST(APPEND AVIDA_TEXT_VIEWER_LIBS ${NCURSES_LIBRARY})
     TARGET_LINK_LIBRARIES(avida-textview ${AVIDA_TEXT_VIEWER_LIBS})
     
     INSTALL_TARGETS(/work avida-textview)
@@ -487,9 +482,6 @@
     ADD_EXECUTABLE(avida-fltkview ${AVIDA_FLTK_VIEWER_SOURCES})
     
     SET(AVIDA_FLTK_VIEWER_LIBS avidacore ${FLTK_BASE_LIBRARY})
-    IF(NOT MSVC)
-      LIST(APPEND AVIDA_FLTK_VIEWER_LIBS pthread)
-    ENDIF(NOT MSVC)
     IF(AVD_ENABLE_TCMALLOC)
       LIST(APPEND AVIDA_FLTK_VIEWER_LIBS tcmalloc)
     ENDIF(AVD_ENABLE_TCMALLOC)

Modified: development/source/targets/avida-viewer/cTextViewerDriver.cc
===================================================================
--- development/source/targets/avida-viewer/cTextViewerDriver.cc	2007-07-06 22:03:23 UTC (rev 1758)
+++ development/source/targets/avida-viewer/cTextViewerDriver.cc	2007-07-07 06:10:05 UTC (rev 1759)
@@ -128,12 +128,10 @@
     // end of update stats...
     population.CalcUpdateStats();
     
-    
     // Setup the viewer for the new update.
     if (m_view->GetStepOrganism() == -1) {
-      m_view->NotifyUpdate();
       m_view->NewUpdate();
-      
+ 
       // This is needed to have the top bar drawn properly; I'm not sure why...
       static bool first_update = true;
       if (first_update) {

Modified: development/source/targets/avida-viewer/cTextWindow.h
===================================================================
--- development/source/targets/avida-viewer/cTextWindow.h	2007-07-06 22:03:23 UTC (rev 1758)
+++ development/source/targets/avida-viewer/cTextWindow.h	2007-07-07 06:10:05 UTC (rev 1759)
@@ -81,6 +81,7 @@
   inline int Width() { return win_id->_maxx + 1; }
   inline int Height() { return win_id->_maxy + 1; }
 #endif
+  WINDOW * GetWinID() { return win_id; } // DEBUG!!!
 
   // Clear the screen and redraw all text on it.
   inline void RedrawMain() { touchwin(win_id); wrefresh(win_id); }

Modified: development/source/targets/avida-viewer/cView.h
===================================================================
--- development/source/targets/avida-viewer/cView.h	2007-07-06 22:03:23 UTC (rev 1758)
+++ development/source/targets/avida-viewer/cView.h	2007-07-07 06:10:05 UTC (rev 1759)
@@ -97,6 +97,8 @@
 
   // Methods called by sub-windows.
   void Redraw();
+
+  void TestDEBUG();
 };
 
 

Modified: development/source/targets/viewer-text/cDriver_TextViewer.cc
===================================================================
--- development/source/targets/viewer-text/cDriver_TextViewer.cc	2007-07-06 22:03:23 UTC (rev 1758)
+++ development/source/targets/viewer-text/cDriver_TextViewer.cc	2007-07-07 06:10:05 UTC (rev 1759)
@@ -39,14 +39,21 @@
 
 #include "cDriverManager.h"
 #include "cTextViewerManager.h"
+#include "cTextWindow.h"
 
 #include <cstdlib>
 
 using namespace std;
 
 cDriver_TextViewer::cDriver_TextViewer(cWorld* world)
-  : m_world(world), m_info(m_world->GetPopulation(), 12), m_done(false)
+  : m_world(world)
+  , m_info(m_world->GetPopulation(), 12)
+  , m_main_window(NULL, m_info)
+  , m_bar_window(&m_main_window, m_info)
+  , m_done(false)
 {
+  m_info.fp << "::cDriver_TextViewer()" << endl; // DEBUG!!!!!!!!!
+
   // Setup the initial view mode (loaded from avida.cfg)
   m_info.SetViewMode(world->GetConfig().VIEW_MODE.Get());
     
@@ -54,14 +61,14 @@
   world->SetDriver(this);
 
   // Setup NCURSES...
-  initscr();                // Set up the terminal for curses.
-  //  cbreak();                 // Don't buffer input.
-  raw();                    // Don't even buffer escape characters!
-  noecho();                 // Don't echo keypresses to the screen.
-  nonl();                   // No new line with CR (when echo is on)
+  initscr();            // Set up the terminal for curses.
+  //  cbreak();             // Don't buffer input.
+  raw();                // Don't even buffer escape characters!
+  noecho();             // Don't echo keypresses to the screen.
+  nonl();               // No new line with CR (when echo is on)
 
-  keypad(stdscr, 1);        // Allows the keypad to be used.
-  nodelay(stdscr, 1);       // Don't wait for input if no key is pressed.
+  keypad(stdscr, 1);    // Allows the keypad to be used.
+  NoDelay();            // Don't wait for input if no key is pressed.
 
   // Setup colors
 
@@ -74,10 +81,37 @@
   init_pair(COLOR_YELLOW,  COLOR_YELLOW,  COLOR_BLACK);
   init_pair(COLOR_MAGENTA, COLOR_MAGENTA, COLOR_BLACK);
   init_pair(COLOR_OFF,     COLOR_BLACK,   COLOR_BLACK);
+
+  // Build the main body of this window.
+  m_main_window.Construct(0,0,3,0);
+  m_info.fp << "Base Width = " << m_main_window.GetWidth()
+	    << "   Height = " << m_main_window.GetHeight()
+	    << endl;
+  m_bar_window.Construct(3,0,0,0);
+  m_info.fp << "Bar Width = " << m_bar_window.GetWidth()
+	    << "   Height = " << m_bar_window.GetHeight()
+	    << endl;
+
+  m_bar_window.Box();
+  m_main_window.SetBoldColor(COLOR_WHITE);
+  m_main_window.Box(5, 5, 30, 30);
+  m_main_window.Print(10, 10, "This is a test!");
+  m_main_window.Refresh();
+
+  int tmp = 5;
+  for (int i = 0; i < 1000000000; i++) tmp = tmp + 2;
+
+  //  NoDelay(false);
+  m_bar_window.Redraw();
+  getch();
+
+  exit(0);
 }
 
 cDriver_TextViewer::~cDriver_TextViewer()
 {
+  m_info.fp << "::~cDriver_TextViewer()" << endl; // DEBUG!!!!!!!!!
+
   cDriverManager::Unregister(static_cast<cAvidaDriver*>(this));
   delete m_world;
     
@@ -87,7 +121,7 @@
 
 void cDriver_TextViewer::Run()
 {
-  clog << "Ping!" << endl;
+  m_info.fp << "::Run()" << endl; // DEBUG!!!!!!!!!
 
   cClassificationManager& classmgr = m_world->GetClassificationManager();
   cPopulation& population = m_world->GetPopulation();
@@ -140,7 +174,7 @@
           // This is needed to have the top bar drawn properly; I'm not sure why...
           static bool first_update = true;
           if (first_update) {
-//            Refresh();
+            m_main_window.Refresh();
             first_update = false;
           }
         }
@@ -164,7 +198,7 @@
       // This is needed to have the top bar drawn properly; I'm not sure why...
       static bool first_update = true;
       if (first_update) {
-//        Refresh();
+        m_main_window.Refresh();
         first_update = false;
       }
     }
@@ -193,6 +227,8 @@
 
 void cDriver_TextViewer::Flush()
 {
+  m_info.fp << "::Flush()" << endl; // DEBUG!!!!!!!!!
+
   cStringList & out_list = m_info.GetOutList();
   cStringList & err_list = m_info.GetErrList();
   
@@ -211,6 +247,8 @@
 
 bool cDriver_TextViewer::ProcessKeypress(int keypress)
 {
+  m_info.fp << "::ProcessKeypress()" << endl; // DEBUG!!!!!!!!!
+
   bool unknown = false;
 
   switch (keypress) {
@@ -270,9 +308,10 @@
 //    if (!Confirm("Are you sure you want to quit?")) break;
   case 'Q':      // Note: Capital 'Q' quits w/o confirming.
     // clear the windows before we go.  Do bar window last to end at top.
-//     base_window->Redraw();
-//     bar_screen->Clear();
-//     bar_screen->Refresh();
+    m_main_window.Clear();
+    m_main_window.Redraw();
+    m_bar_window.Clear();
+    m_bar_window.Redraw();
     ExitTextViewer(0);  // This implementation calls exit(), blowing us clean away
     break;
 //   case 's':
@@ -295,7 +334,7 @@
     exit(0);
     break;
   case 12: // CTRL-L...
-//    Refresh();
+    m_main_window.Refresh();
     break;
   case 26: // CTRL-Z
     kill(getpid(), SIGTSTP);
@@ -310,7 +349,7 @@
 // 	menu.AddOption(j, message);
 //       }
 //       menu.SetActive(3);
-//       menu.Activate(base_window);
+//       menu.Activate(main_window);
 //       Redraw();
 //     }
 //     break;
@@ -339,14 +378,18 @@
 
 void cDriver_TextViewer::NotifyUpdate()
 {
+  m_info.fp << "::NotifyUpdate()" << endl; // DEBUG!!!!!!!!!
+
   // @CAO What else should happen on an update?
   // - Update bar at top of screen
   // - Update current view
   // - Check for Inputs...
 
-  const int update = m_world->GetStats().GetUpdate();
-  if (update % 10 == 0) clog << update << endl;
+//   const int update = m_world->GetStats().GetUpdate();
+//   if (update % 10 == 0) clog << update << endl;
 
+  m_main_window.Refresh();
+
   const int pause_level = m_info.GetPauseLevel();
 
   // If we are stepping in some way, we've come to a stop, so revert to a normal pause.
@@ -369,6 +412,7 @@
 
     // If we couldn't manage the keypress here, check the current screen.
 //    if (found_keypress == false && cur_screen) cur_screen->DoInput(cur_char);
+    m_main_window.Refresh();
   }
 
   nodelay(stdscr, true);
@@ -404,6 +448,7 @@
 
 void cDriver_TextViewer::Notify(const cString& in_string)
 {
+  m_info.fp << "::Notify()" << endl; // DEBUG!!!!!!!!!
   // @CAO We need to display this!
 }
 
@@ -412,8 +457,8 @@
 void ExitTextViewer(int exit_code)
 {
   signal(SIGINT, SIG_IGN);           // Ignore all future interupts.
-//  mvcur(0, COLS - 1, LINES - 1, 0);  // Move curser to the lower left.
-//  endwin();                          // Restore terminal mode.
+  mvcur(0, COLS - 1, LINES - 1, 0);  // Move curser to the lower left.
+  endwin();                          // Restore terminal mode.
 
   printf ("Exit Code: %d\n", exit_code);
 

Modified: development/source/targets/viewer-text/cDriver_TextViewer.h
===================================================================
--- development/source/targets/viewer-text/cDriver_TextViewer.h	2007-07-06 22:03:23 UTC (rev 1758)
+++ development/source/targets/viewer-text/cDriver_TextViewer.h	2007-07-07 06:10:05 UTC (rev 1759)
@@ -33,6 +33,9 @@
 #include "cCoreView_Info.h"
 #endif
  
+#ifndef cTextWindow_h
+#include "cTextWindow.h"
+#endif
 
 #ifndef cWorldDriver_h
 #include "cWorldDriver.h"
@@ -44,18 +47,21 @@
 
 #include <sstream>
 #include <iostream>
+#include <fstream>
 
 class cWorld;
 
+using namespace std;
 
 class cDriver_TextViewer : public cAvidaDriver, public cWorldDriver {
 private:
   cWorld* m_world;
   cCoreView_Info m_info;
+  cTextWindow m_main_window;
+  cTextWindow m_bar_window;
 
-  bool m_done;                 // This is set to true when run should finish.
+  bool m_done;           // This is set to true when run should finish.
 
-  cDriver_TextViewer();  // Intentionally not implemented
 public:
   cDriver_TextViewer(cWorld* world);
   ~cDriver_TextViewer();
@@ -68,16 +74,13 @@
 
   // IO
   void Flush();
-  int GetKeypress() { return getch(); }
+  int GetKeypress() { m_info.fp << "GK" << endl; return getch(); }
   bool ProcessKeypress(int keypress);
-  
+  void NoDelay(bool _nd=true) { m_info.fp << "ND" << endl; nodelay(stdscr, _nd); }  // Don't wait for input if no key is pressed.
+
   void RaiseException(const cString& in_string);
   void RaiseFatalException(int exit_code, const cString& in_string);
 
-  // Screen manipulations...
-  void Refresh();      // Update any changes to the screen...
-  void Redraw();       // Clear the screen and redraw its contents.
-  
   // Notifications
   void NotifyUpdate();
   void NotifyComment(const cString& in_string);

Modified: development/source/targets/viewer-text/ncurses-defs.h
===================================================================
--- development/source/targets/viewer-text/ncurses-defs.h	2007-07-06 22:03:23 UTC (rev 1758)
+++ development/source/targets/viewer-text/ncurses-defs.h	2007-07-07 06:10:05 UTC (rev 1759)
@@ -9,6 +9,10 @@
 #undef OK
 #endif
 
+#ifndef platform_h
+#include "platform.h"
+#endif
+
 // All colors are defined except black on black:
 #define COLOR_OFF    8
 

Modified: development/source/tools/tArray.h
===================================================================
--- development/source/tools/tArray.h	2007-07-06 22:03:23 UTC (rev 1758)
+++ development/source/tools/tArray.h	2007-07-07 06:10:05 UTC (rev 1759)
@@ -140,10 +140,12 @@
     return m_data[index];
   }    
 
-  void Push(const T& value)
+  int Push(const T& value)
   {
+    const int new_pos = m_size;
     Resize(m_size + 1);
-    m_data[m_size - 1] = value;
+    m_data[new_pos] = value;
+    return new_pos;
   }
 
   void SetAll(const T& value)

Modified: development/source/viewer-core/cCoreView_Info.cc
===================================================================
--- development/source/viewer-core/cCoreView_Info.cc	2007-07-06 22:03:23 UTC (rev 1758)
+++ development/source/viewer-core/cCoreView_Info.cc	2007-07-07 06:10:05 UTC (rev 1759)
@@ -7,6 +7,7 @@
   , m_pause_level(PAUSE_OFF)
   , m_step_organism_id(-1)
   , m_step_organism_thread(-1)
+  , fp("debug.dat")
 {
   // Redirect standard output...
   std::cout.rdbuf(m_cout_stream.rdbuf());

Modified: development/source/viewer-core/cCoreView_Info.h
===================================================================
--- development/source/viewer-core/cCoreView_Info.h	2007-07-06 22:03:23 UTC (rev 1758)
+++ development/source/viewer-core/cCoreView_Info.h	2007-07-07 06:10:05 UTC (rev 1759)
@@ -7,13 +7,15 @@
 
 #include <iostream>
 #include <sstream>
+#include <fstream>
 
 #include "cStringList.h"
 #include "tList.h"
 
 class cPopulation;
-class cCoreView_Base;
 
+using namespace std;
+
 class cCoreView_Info {
 protected:
   cPopulation & m_population;
@@ -43,6 +45,7 @@
 public:
   // Constant Information across all viewers.
   enum ePause { PAUSE_ON, PAUSE_OFF, PAUSE_ADVANCE_INST, PAUSE_ADVANCE_UPDATE, PAUSE_ADVANCE_DIVIDE };
+  ofstream fp; // DEBUG!!!!
 
 public:
   cCoreView_Info(cPopulation & in_pop, int in_total_colors);




More information about the Avida-cvs mailing list