[Avida-cvs] [Avida2-svn] r360 - in branches/brysonda: Avida2.xcodeproj source/viewer
brysonda@myxo.css.msu.edu
brysonda at myxo.css.msu.edu
Sat Oct 22 22:07:25 PDT 2005
Author: brysonda
Date: 2005-10-23 00:43:06 -0400 (Sun, 23 Oct 2005)
New Revision: 360
Added:
branches/brysonda/source/viewer/cAvidaDriver_TextPopViewer.cc
branches/brysonda/source/viewer/cAvidaDriver_TextPopViewer.h
branches/brysonda/source/viewer/cBarScreen.cc
branches/brysonda/source/viewer/cBarScreen.h
branches/brysonda/source/viewer/cBaseTextWindow.h
branches/brysonda/source/viewer/cEnvironmentScreen.cc
branches/brysonda/source/viewer/cEnvironmentScreen.h
branches/brysonda/source/viewer/cHistScreen.cc
branches/brysonda/source/viewer/cHistScreen.h
branches/brysonda/source/viewer/cMapScreen.cc
branches/brysonda/source/viewer/cMapScreen.h
branches/brysonda/source/viewer/cMenuWindow.cc
branches/brysonda/source/viewer/cMenuWindow.h
branches/brysonda/source/viewer/cOptionsScreen.cc
branches/brysonda/source/viewer/cOptionsScreen.h
branches/brysonda/source/viewer/cScreen.cc
branches/brysonda/source/viewer/cScreen.h
branches/brysonda/source/viewer/cStatsScreen.cc
branches/brysonda/source/viewer/cStatsScreen.h
branches/brysonda/source/viewer/cSymbolUtil.cc
branches/brysonda/source/viewer/cSymbolUtil.h
branches/brysonda/source/viewer/cTextWindow.cc
branches/brysonda/source/viewer/cTextWindow.h
branches/brysonda/source/viewer/cView.cc
branches/brysonda/source/viewer/cView.h
branches/brysonda/source/viewer/cViewInfo.cc
branches/brysonda/source/viewer/cViewInfo.h
branches/brysonda/source/viewer/cZoomScreen.cc
branches/brysonda/source/viewer/cZoomScreen.h
Removed:
branches/brysonda/source/viewer/ansi.cc
branches/brysonda/source/viewer/ansi.hh
branches/brysonda/source/viewer/bar_screen.cc
branches/brysonda/source/viewer/bar_screen.hh
branches/brysonda/source/viewer/environment_screen.cc
branches/brysonda/source/viewer/environment_screen.hh
branches/brysonda/source/viewer/hist_screen.cc
branches/brysonda/source/viewer/hist_screen.hh
branches/brysonda/source/viewer/map_screen.cc
branches/brysonda/source/viewer/map_screen.hh
branches/brysonda/source/viewer/menu.cc
branches/brysonda/source/viewer/menu.hh
branches/brysonda/source/viewer/ncurses.cc
branches/brysonda/source/viewer/ncurses.hh
branches/brysonda/source/viewer/options_screen.cc
branches/brysonda/source/viewer/options_screen.hh
branches/brysonda/source/viewer/stats_screen.cc
branches/brysonda/source/viewer/stats_screen.hh
branches/brysonda/source/viewer/symbol_util.cc
branches/brysonda/source/viewer/symbol_util.hh
branches/brysonda/source/viewer/text_screen.cc
branches/brysonda/source/viewer/text_screen.hh
branches/brysonda/source/viewer/text_window.hh
branches/brysonda/source/viewer/view.cc
branches/brysonda/source/viewer/view.hh
branches/brysonda/source/viewer/viewer.hh
branches/brysonda/source/viewer/zoom_screen.cc
branches/brysonda/source/viewer/zoom_screen.hh
Modified:
branches/brysonda/Avida2.xcodeproj/project.pbxproj
Log:
Rename files in viewer to match naming scheme. Separate classes into distinct files.
Modified: branches/brysonda/Avida2.xcodeproj/project.pbxproj
===================================================================
--- branches/brysonda/Avida2.xcodeproj/project.pbxproj 2005-10-23 04:16:36 UTC (rev 359)
+++ branches/brysonda/Avida2.xcodeproj/project.pbxproj 2005-10-23 04:43:06 UTC (rev 360)
@@ -54,6 +54,38 @@
7040D36D09095E5200AA820F /* cAnalyzeGenotype.cc in Sources */ = {isa = PBXBuildFile; fileRef = 702D4F3D08DA61FE007BA469 /* cAnalyzeGenotype.cc */; };
7040D36E09095E5900AA820F /* cAvidaDriver_Analyze.cc in Sources */ = {isa = PBXBuildFile; fileRef = 702D4EF908DA5341007BA469 /* cAvidaDriver_Analyze.cc */; };
7040D3A6090964D100AA820F /* cMxCodeArray.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70B0865808F4974300FC65FE /* cMxCodeArray.cc */; };
+ 704866D3090B51310048600A /* cAvidaDriver_TextPopViewer.cc in Sources */ = {isa = PBXBuildFile; fileRef = 704866B3090B51310048600A /* cAvidaDriver_TextPopViewer.cc */; };
+ 704866D4090B51310048600A /* cAvidaDriver_TextPopViewer.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 704866B4090B51310048600A /* cAvidaDriver_TextPopViewer.h */; };
+ 704866D5090B51310048600A /* cBarScreen.cc in Sources */ = {isa = PBXBuildFile; fileRef = 704866B5090B51310048600A /* cBarScreen.cc */; };
+ 704866D6090B51310048600A /* cBarScreen.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 704866B6090B51310048600A /* cBarScreen.h */; };
+ 704866D7090B51310048600A /* cBaseTextWindow.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 704866B7090B51310048600A /* cBaseTextWindow.h */; };
+ 704866D8090B51310048600A /* cEnvironmentScreen.cc in Sources */ = {isa = PBXBuildFile; fileRef = 704866B8090B51310048600A /* cEnvironmentScreen.cc */; };
+ 704866D9090B51310048600A /* cEnvironmentScreen.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 704866B9090B51310048600A /* cEnvironmentScreen.h */; };
+ 704866DA090B51310048600A /* cHistScreen.cc in Sources */ = {isa = PBXBuildFile; fileRef = 704866BA090B51310048600A /* cHistScreen.cc */; };
+ 704866DB090B51310048600A /* cHistScreen.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 704866BB090B51310048600A /* cHistScreen.h */; };
+ 704866DC090B51310048600A /* CMakeLists.txt in CopyFiles */ = {isa = PBXBuildFile; fileRef = 704866BC090B51310048600A /* CMakeLists.txt */; };
+ 704866DD090B51310048600A /* cMapScreen.cc in Sources */ = {isa = PBXBuildFile; fileRef = 704866BD090B51310048600A /* cMapScreen.cc */; };
+ 704866DE090B51310048600A /* cMapScreen.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 704866BE090B51310048600A /* cMapScreen.h */; };
+ 704866DF090B51310048600A /* cMenuWindow.cc in Sources */ = {isa = PBXBuildFile; fileRef = 704866BF090B51310048600A /* cMenuWindow.cc */; };
+ 704866E0090B51310048600A /* cMenuWindow.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 704866C0090B51310048600A /* cMenuWindow.h */; };
+ 704866E1090B51310048600A /* cOptionsScreen.cc in Sources */ = {isa = PBXBuildFile; fileRef = 704866C1090B51310048600A /* cOptionsScreen.cc */; };
+ 704866E2090B51310048600A /* cOptionsScreen.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 704866C2090B51310048600A /* cOptionsScreen.h */; };
+ 704866E3090B51310048600A /* cScreen.cc in Sources */ = {isa = PBXBuildFile; fileRef = 704866C3090B51310048600A /* cScreen.cc */; };
+ 704866E4090B51310048600A /* cScreen.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 704866C4090B51310048600A /* cScreen.h */; };
+ 704866E5090B51310048600A /* cStatsScreen.cc in Sources */ = {isa = PBXBuildFile; fileRef = 704866C5090B51310048600A /* cStatsScreen.cc */; };
+ 704866E6090B51310048600A /* cStatsScreen.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 704866C6090B51310048600A /* cStatsScreen.h */; };
+ 704866E7090B51310048600A /* cSymbolUtil.cc in Sources */ = {isa = PBXBuildFile; fileRef = 704866C7090B51310048600A /* cSymbolUtil.cc */; };
+ 704866E8090B51310048600A /* cSymbolUtil.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 704866C8090B51310048600A /* cSymbolUtil.h */; };
+ 704866E9090B51310048600A /* cTextWindow.cc in Sources */ = {isa = PBXBuildFile; fileRef = 704866C9090B51310048600A /* cTextWindow.cc */; };
+ 704866EA090B51310048600A /* cTextWindow.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 704866CA090B51310048600A /* cTextWindow.h */; };
+ 704866EB090B51310048600A /* cView.cc in Sources */ = {isa = PBXBuildFile; fileRef = 704866CB090B51310048600A /* cView.cc */; };
+ 704866EC090B51310048600A /* cView.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 704866CC090B51310048600A /* cView.h */; };
+ 704866ED090B51310048600A /* cViewInfo.cc in Sources */ = {isa = PBXBuildFile; fileRef = 704866CD090B51310048600A /* cViewInfo.cc */; };
+ 704866EE090B51310048600A /* cViewInfo.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 704866CE090B51310048600A /* cViewInfo.h */; };
+ 704866EF090B51310048600A /* cZoomScreen.cc in Sources */ = {isa = PBXBuildFile; fileRef = 704866CF090B51310048600A /* cZoomScreen.cc */; };
+ 704866F0090B51310048600A /* cZoomScreen.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 704866D0090B51310048600A /* cZoomScreen.h */; };
+ 704866F1090B51310048600A /* key_chart in CopyFiles */ = {isa = PBXBuildFile; fileRef = 704866D1090B51310048600A /* key_chart */; };
+ 704866F2090B51310048600A /* viewer.cc in Sources */ = {isa = PBXBuildFile; fileRef = 704866D2090B51310048600A /* viewer.cc */; };
70486BA00826722F009328F0 /* analyze.cfg in CopyFiles */ = {isa = PBXBuildFile; fileRef = DCC3114B0762539E008F7A48 /* analyze.cfg */; };
70486BA10826722F009328F0 /* environment.cfg in CopyFiles */ = {isa = PBXBuildFile; fileRef = DCC311800762539F008F7A48 /* environment.cfg */; };
70486BA20826722F009328F0 /* events.cfg in CopyFiles */ = {isa = PBXBuildFile; fileRef = DCC311810762539F008F7A48 /* events.cfg */; };
@@ -324,6 +356,23 @@
70C5BC6609059A970028A785 /* cWorld.h in CopyFiles */,
70C5BD6E0905CE5F0028A785 /* cHardwareManager.h in CopyFiles */,
7040CF1F0906A52E00AA820F /* cEventManager.h in CopyFiles */,
+ 704866D4090B51310048600A /* cAvidaDriver_TextPopViewer.h in CopyFiles */,
+ 704866D6090B51310048600A /* cBarScreen.h in CopyFiles */,
+ 704866D7090B51310048600A /* cBaseTextWindow.h in CopyFiles */,
+ 704866D9090B51310048600A /* cEnvironmentScreen.h in CopyFiles */,
+ 704866DB090B51310048600A /* cHistScreen.h in CopyFiles */,
+ 704866DC090B51310048600A /* CMakeLists.txt in CopyFiles */,
+ 704866DE090B51310048600A /* cMapScreen.h in CopyFiles */,
+ 704866E0090B51310048600A /* cMenuWindow.h in CopyFiles */,
+ 704866E2090B51310048600A /* cOptionsScreen.h in CopyFiles */,
+ 704866E4090B51310048600A /* cScreen.h in CopyFiles */,
+ 704866E6090B51310048600A /* cStatsScreen.h in CopyFiles */,
+ 704866E8090B51310048600A /* cSymbolUtil.h in CopyFiles */,
+ 704866EA090B51310048600A /* cTextWindow.h in CopyFiles */,
+ 704866EC090B51310048600A /* cView.h in CopyFiles */,
+ 704866EE090B51310048600A /* cViewInfo.h in CopyFiles */,
+ 704866F0090B51310048600A /* cZoomScreen.h in CopyFiles */,
+ 704866F1090B51310048600A /* key_chart in CopyFiles */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -393,6 +442,38 @@
703F684207B437B800C1CA76 /* status.xml */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xml; path = status.xml; sourceTree = "<group>"; };
7040CF1A0906A52E00AA820F /* cEventManager.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cEventManager.cc; sourceTree = "<group>"; };
7040CF1B0906A52E00AA820F /* cEventManager.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cEventManager.h; sourceTree = "<group>"; };
+ 704866B3090B51310048600A /* cAvidaDriver_TextPopViewer.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cAvidaDriver_TextPopViewer.cc; sourceTree = "<group>"; };
+ 704866B4090B51310048600A /* cAvidaDriver_TextPopViewer.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cAvidaDriver_TextPopViewer.h; sourceTree = "<group>"; };
+ 704866B5090B51310048600A /* cBarScreen.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cBarScreen.cc; sourceTree = "<group>"; };
+ 704866B6090B51310048600A /* cBarScreen.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cBarScreen.h; sourceTree = "<group>"; };
+ 704866B7090B51310048600A /* cBaseTextWindow.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cBaseTextWindow.h; sourceTree = "<group>"; };
+ 704866B8090B51310048600A /* cEnvironmentScreen.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cEnvironmentScreen.cc; sourceTree = "<group>"; };
+ 704866B9090B51310048600A /* cEnvironmentScreen.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cEnvironmentScreen.h; sourceTree = "<group>"; };
+ 704866BA090B51310048600A /* cHistScreen.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cHistScreen.cc; sourceTree = "<group>"; };
+ 704866BB090B51310048600A /* cHistScreen.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cHistScreen.h; sourceTree = "<group>"; };
+ 704866BC090B51310048600A /* CMakeLists.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = CMakeLists.txt; sourceTree = "<group>"; };
+ 704866BD090B51310048600A /* cMapScreen.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cMapScreen.cc; sourceTree = "<group>"; };
+ 704866BE090B51310048600A /* cMapScreen.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cMapScreen.h; sourceTree = "<group>"; };
+ 704866BF090B51310048600A /* cMenuWindow.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cMenuWindow.cc; sourceTree = "<group>"; };
+ 704866C0090B51310048600A /* cMenuWindow.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cMenuWindow.h; sourceTree = "<group>"; };
+ 704866C1090B51310048600A /* cOptionsScreen.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cOptionsScreen.cc; sourceTree = "<group>"; };
+ 704866C2090B51310048600A /* cOptionsScreen.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cOptionsScreen.h; sourceTree = "<group>"; };
+ 704866C3090B51310048600A /* cScreen.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cScreen.cc; sourceTree = "<group>"; };
+ 704866C4090B51310048600A /* cScreen.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cScreen.h; sourceTree = "<group>"; };
+ 704866C5090B51310048600A /* cStatsScreen.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cStatsScreen.cc; sourceTree = "<group>"; };
+ 704866C6090B51310048600A /* cStatsScreen.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cStatsScreen.h; sourceTree = "<group>"; };
+ 704866C7090B51310048600A /* cSymbolUtil.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cSymbolUtil.cc; sourceTree = "<group>"; };
+ 704866C8090B51310048600A /* cSymbolUtil.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cSymbolUtil.h; sourceTree = "<group>"; };
+ 704866C9090B51310048600A /* cTextWindow.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cTextWindow.cc; sourceTree = "<group>"; };
+ 704866CA090B51310048600A /* cTextWindow.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cTextWindow.h; sourceTree = "<group>"; };
+ 704866CB090B51310048600A /* cView.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cView.cc; sourceTree = "<group>"; };
+ 704866CC090B51310048600A /* cView.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cView.h; sourceTree = "<group>"; };
+ 704866CD090B51310048600A /* cViewInfo.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cViewInfo.cc; sourceTree = "<group>"; };
+ 704866CE090B51310048600A /* cViewInfo.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cViewInfo.h; sourceTree = "<group>"; };
+ 704866CF090B51310048600A /* cZoomScreen.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cZoomScreen.cc; sourceTree = "<group>"; };
+ 704866D0090B51310048600A /* cZoomScreen.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cZoomScreen.h; sourceTree = "<group>"; };
+ 704866D1090B51310048600A /* key_chart */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = key_chart; sourceTree = "<group>"; };
+ 704866D2090B51310048600A /* viewer.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = viewer.cc; sourceTree = "<group>"; };
70658C59085DF67D00486BED /* libncurses.5.4.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libncurses.5.4.dylib; path = /usr/lib/libncurses.5.4.dylib; sourceTree = "<absolute>"; };
706D30CC0852328F00D7DC8F /* tInstLib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tInstLib.h; sourceTree = "<group>"; };
706D330E0854A7B900D7DC8F /* organism.smt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = organism.smt; sourceTree = "<group>"; };
@@ -988,6 +1069,45 @@
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
+ 704866B2090B51310048600A /* viewer */ = {
+ isa = PBXGroup;
+ children = (
+ 704866B3090B51310048600A /* cAvidaDriver_TextPopViewer.cc */,
+ 704866B4090B51310048600A /* cAvidaDriver_TextPopViewer.h */,
+ 704866B5090B51310048600A /* cBarScreen.cc */,
+ 704866B6090B51310048600A /* cBarScreen.h */,
+ 704866B7090B51310048600A /* cBaseTextWindow.h */,
+ 704866B8090B51310048600A /* cEnvironmentScreen.cc */,
+ 704866B9090B51310048600A /* cEnvironmentScreen.h */,
+ 704866BA090B51310048600A /* cHistScreen.cc */,
+ 704866BB090B51310048600A /* cHistScreen.h */,
+ 704866BC090B51310048600A /* CMakeLists.txt */,
+ 704866BD090B51310048600A /* cMapScreen.cc */,
+ 704866BE090B51310048600A /* cMapScreen.h */,
+ 704866BF090B51310048600A /* cMenuWindow.cc */,
+ 704866C0090B51310048600A /* cMenuWindow.h */,
+ 704866C1090B51310048600A /* cOptionsScreen.cc */,
+ 704866C2090B51310048600A /* cOptionsScreen.h */,
+ 704866C3090B51310048600A /* cScreen.cc */,
+ 704866C4090B51310048600A /* cScreen.h */,
+ 704866C5090B51310048600A /* cStatsScreen.cc */,
+ 704866C6090B51310048600A /* cStatsScreen.h */,
+ 704866C7090B51310048600A /* cSymbolUtil.cc */,
+ 704866C8090B51310048600A /* cSymbolUtil.h */,
+ 704866C9090B51310048600A /* cTextWindow.cc */,
+ 704866CA090B51310048600A /* cTextWindow.h */,
+ 704866CB090B51310048600A /* cView.cc */,
+ 704866CC090B51310048600A /* cView.h */,
+ 704866CD090B51310048600A /* cViewInfo.cc */,
+ 704866CE090B51310048600A /* cViewInfo.h */,
+ 704866CF090B51310048600A /* cZoomScreen.cc */,
+ 704866D0090B51310048600A /* cZoomScreen.h */,
+ 704866D1090B51310048600A /* key_chart */,
+ 704866D2090B51310048600A /* viewer.cc */,
+ );
+ path = viewer;
+ sourceTree = "<group>";
+ };
DCC30C490762532C008F7A48 = {
isa = PBXGroup;
children = (
@@ -1010,6 +1130,7 @@
DCC31340076253A0008F7A48 /* third-party */,
DCC314D8076253A2008F7A48 /* tools */,
DCC315B6076253A5008F7A48 /* utils */,
+ 704866B2090B51310048600A /* viewer */,
DCC30F7B0762539D008F7A48 /* CMakeLists.txt */,
701384A10902A16F0087ED2E /* defs.h */,
DCC30FCF0762539D008F7A48 /* Doxyfile */,
@@ -2187,6 +2308,21 @@
70C5BC6709059A970028A785 /* cWorld.cc in Sources */,
70C5BD6D0905CE5F0028A785 /* cHardwareManager.cc in Sources */,
7040CF1E0906A52E00AA820F /* cEventManager.cc in Sources */,
+ 704866D3090B51310048600A /* cAvidaDriver_TextPopViewer.cc in Sources */,
+ 704866D5090B51310048600A /* cBarScreen.cc in Sources */,
+ 704866D8090B51310048600A /* cEnvironmentScreen.cc in Sources */,
+ 704866DA090B51310048600A /* cHistScreen.cc in Sources */,
+ 704866DD090B51310048600A /* cMapScreen.cc in Sources */,
+ 704866DF090B51310048600A /* cMenuWindow.cc in Sources */,
+ 704866E1090B51310048600A /* cOptionsScreen.cc in Sources */,
+ 704866E3090B51310048600A /* cScreen.cc in Sources */,
+ 704866E5090B51310048600A /* cStatsScreen.cc in Sources */,
+ 704866E7090B51310048600A /* cSymbolUtil.cc in Sources */,
+ 704866E9090B51310048600A /* cTextWindow.cc in Sources */,
+ 704866EB090B51310048600A /* cView.cc in Sources */,
+ 704866ED090B51310048600A /* cViewInfo.cc in Sources */,
+ 704866EF090B51310048600A /* cZoomScreen.cc in Sources */,
+ 704866F2090B51310048600A /* viewer.cc in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Deleted: branches/brysonda/source/viewer/ansi.cc
===================================================================
--- branches/brysonda/source/viewer/ansi.cc 2005-10-23 04:16:36 UTC (rev 359)
+++ branches/brysonda/source/viewer/ansi.cc 2005-10-23 04:43:06 UTC (rev 360)
@@ -1,764 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2001 California Institute of Technology //
-// Portions Copyright (C) Microsoft Corporation, 1996. //
-// //
-// Read the COPYING and README files, or contact 'avida at alife.org', //
-// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
-//////////////////////////////////////////////////////////////////////////////
-
-#include "ansi.hh"
-
-// A single Critical Section is used to make these calls thread safe
-
-#ifdef VIEW_ANSI
-
-#include <conio.h> // for _kbhit()
-
-
-using namespace std;
-
-
-////////////////////
-// cTextWindow
-////////////////////
-
-cTextWindow::cTextWindow()
- {
- }
-
-cTextWindow::cTextWindow(int y_size, int x_size, int y_start, int x_start)
- {
- Construct(y_size, x_size, y_start, x_start);
- }
-
-cTextWindow::~cTextWindow()
- {
- // Erase the window, and do whatever else is needed to destory it.
-
- GetExclusiveAccess();
- Clear (); // clear the space (puts cursor at 0,0)
- iRefresh(); // show that
- delete pciScreenChars;
- delete pbScreenFlags;
- ReleaseExclusiveAccess();
-
- DeleteCriticalSection (&csTextWindow);
-
- // Don't free the standard handles !!! Just exit...
- }
-
-void cTextWindow::Construct(int y_size, int x_size, int y_start, int x_start)
- {
- // Initialize the window to be the proper size. If eiter size is 0,
- // the window should extend to the end of the screen in that direction.
-
- // This "window" is actually just a section of the current console window.
-
- // If the calls to set up our console window fail, we will print an error
- // message and exit. Don't know if this is std practice for Avida; would
- // prefer to return a failure code but that does not yet seem supported.
-
- int rc, i;
- SMALL_RECT srWindowPos;
- CONSOLE_SCREEN_BUFFER_INFO csbi; // Console screen buf information
-
- hConsoleOutput = GetStdHandle (STD_OUTPUT_HANDLE);
- if (hConsoleOutput == INVALID_HANDLE_VALUE) {
- rc = GetLastError();
- printf ("cTextWindow ERROR - Cannot get Std Output handle, rc= %i\n", rc);
- exit (rc);
- }
-
- // Get the console Screen Buffer information
- if (!GetConsoleScreenBufferInfo (hConsoleOutput, &csbi)) {
- rc = GetLastError();
- printf ("cTextWindow ERROR - Cannot retrieve Screen Buffer Info for StdOut, rc= %i\n", rc);
- exit (rc);
- }
-
- // Now setup the window size the user requested
- srWindowPos.Left = csbi.srWindow.Left; // keep current upper left position
- srWindowPos.Top = csbi.srWindow.Top;
-
- if (x_size > 0) srWindowPos.Right =
- max ((short) x_size + srWindowPos.Left, csbi.srWindow.Right);
- else srWindowPos.Right = csbi.srWindow.Right;
-
- if (y_size > 0) srWindowPos.Bottom =
- max ((short) y_size + srWindowPos.Top, csbi.srWindow.Bottom);
- else srWindowPos.Bottom = csbi.srWindow.Bottom;
-
-/***************
- // Set position in screen buffer coordinates
- if (!SetConsoleWindowInfo (hConsoleOutput, FALSE, &srWindowPos)) {
- rc = GetLastError();
- printf("cTextWindow ERROR - Could not resize StdOut window, rc= %i\n", rc);
- exit (rc);
- }
-************/
-
- // Init the "outout window" size variables
- width =
- x_size ? x_size : (srWindowPos.Right - srWindowPos.Left + 1) - x_start;
- height =
- y_size ? y_size : (srWindowPos.Bottom - srWindowPos.Top + 1) - y_start;
- this->x_start = x_start;
- this->y_start = y_start;
-
- // Track the screen buffer dimensions
- dwWindowDimensions.X = csbi.dwSize.X;
- dwWindowDimensions.Y = csbi.dwSize.Y;
-
- // Alloc the buffer for the screen and attributes
- pciScreenChars = new CHAR_INFO [width * height];
- pbScreenFlags = new BYTE [width * height];
-
- if (pciScreenChars == NULL || pbScreenFlags == NULL) {
- printf ("CTextWindow ERROR - Not enough memory for display buffers\n");
- exit (-1);
- }
-
- for (i = 0; i < width * height; i++) {
- pbScreenFlags[i] = SCREEN_UPDATE; // force updates the first time thru
- }
-
- // Initialize the Critical Section
- InitializeCriticalSection (&csTextWindow);
-
- // Set the cursor position (do BEFORE other calls since they use cursor
- // position info)
-
- iMove (x_start, y_start);
-
- // initialise the color variable
- SetColor (COLOR_WHITE);
-
- // Clear the screen
- iClear();
- iRefresh(); // force the update out
- }
-
-
-void cTextWindow::RedrawMain()
- {
- // Fully redraw the window (assume random characters currently in its
- // place).
-
- int i;
-
- GetExclusiveAccess();
- // first set all the redraw flag for all bits
- for (i = 0; i < width * height; i++) pbScreenFlags[i] |= SCREEN_UPDATE;
-
- iRefresh ();
- ReleaseExclusiveAccess();
- }
-
-void cTextWindow::iMove(int new_y, int new_x)
- {
- // Move the cursor to these coords. Coordinates are origin 0, with (0,0) as
- // the upper left corner. Coordinates are relative to the start of the
- // "window" created by the class constructor.
-
- curs_x = new_x;
- curs_y = new_y;
- }
-
-void cTextWindow::Move(int new_y, int new_x)
- {
- GetExclusiveAccess();
- iMove (new_y, new_x);
- ReleaseExclusiveAccess();
- }
-
-void cTextWindow::iRefresh()
- {
- // Update the screen with any changes made to the window.
-
- int x, y, i, j;
- BOOL bLineUnchanged;
- COORD coCursor, coWindowSize;
- SMALL_RECT srOutput;
-
- // Init the window size
- coWindowSize.X = (WORD) Width();
- coWindowSize.Y = (WORD) Height();
-
- for (y = 0; y < height; y++) {
- // See if there are any altered characters on this line
- bLineUnchanged = TRUE;
- for (x = 0; bLineUnchanged && x < width; x++) {
- i = x + y*width;
- bLineUnchanged = !(pbScreenFlags[i] & SCREEN_UPDATE);
- }
- if (!bLineUnchanged) {
- // Found changes on this line moving fm start, now check BACKWARDS too.
- // Note that first changed location is given by "i", ans "x-1" is cursor
- // position for starting our output.
-
- x--; // Adjust to correct position
-
- // Now look backwards for the last change
-
- bLineUnchanged = TRUE;
- for (j = (y + 1) * width - 1; bLineUnchanged && j > i; j--)
- bLineUnchanged = !(pbScreenFlags[j] & SCREEN_UPDATE);
-
- j += bLineUnchanged ? 0:1; // adjust end loc. according to exit condition
-
- // We want to output starting from offset "i" through to offset "j - i"
- srOutput.Top = (SHORT)(y + y_start);
- srOutput.Bottom = srOutput.Top; // one line
- srOutput.Left = (SHORT) (x + x_start);
- srOutput.Right = srOutput.Left + (SHORT) j - i;// some # of columns
-
- coCursor.X = (WORD) x; // Cursor location in pciScreenChars
- coCursor.Y = (WORD) y;
-
- WriteConsoleOutput (hConsoleOutput, pciScreenChars, coWindowSize,
- coCursor, &srOutput);
-
- // Now reset the change flags
- for (; i <= j; i++) pbScreenFlags[i] &= ~SCREEN_UPDATE;
-
- } /*** End of "if (!bLineUnchanged) ***/
- } /*** End of "for (y = 0..." ***/
-
- // When we are done, move the physical cursor to the location contained in
- // the cursor variables...
- coCursor.X = (WORD) (CursorX() + x_start);
- coCursor.Y = (WORD) (CursorY() + y_start);
- SetConsoleCursorPosition (hConsoleOutput, coCursor);
- }
-
-void cTextWindow::RefreshMain()
- {
- GetExclusiveAccess();
- iRefresh();
- ReleaseExclusiveAccess();
- }
-
-
-void cTextWindow::iClear()
- {
- // Fill the window with blank space. Cursor position is undefined when
- // completed, but we'll move it back to where it was before we started.
-
- int iXCursor, iYCursor;
- int y;
-
- iXCursor = CursorX(); // save current position
- iYCursor = CursorY();
-
- for (y = 0; y < Height(); y++) {
- iMove (y, 0);
- iClearToEOL();
- }
- iMove (iYCursor, iXCursor);
- }
-
-
-void cTextWindow::iClearToBot()
- {
- // Clear the window from the current position to the bottom of the screen.
-
- // Return cursor to current position on completion.
- int iXCursor, iYCursor;
- int y, x;
-
- iXCursor = CursorX(); // save current position
- iYCursor = CursorY();
-
- x = iXCursor; // initial X position is important
- y = iYCursor;
-
- do {
- iMove (y, x);
- iClearToEOL();
- x = 0;
- } while (++y < Height());
-
- iMove (iYCursor, iXCursor);
- }
-
-void cTextWindow::iClearToEOL()
- {
- // Clear the window from the current position to the end of the line.
-
- // restore cursor to current position when done
- int iXCursor, iYCursor;
- int x;
-
- iXCursor = CursorX(); // save current position
- iYCursor = CursorY();
-
- SetColor (COLOR_WHITE); // White text on black background
- for (x = iXCursor; x < Width(); x++) iPrint (' ');
-
- iMove (iYCursor, iXCursor); // restore cursor position
- }
-
-void cTextWindow::ClearMain()
- {
- GetExclusiveAccess();
- iClear();
- ReleaseExclusiveAccess();
- }
-
-void cTextWindow::ClearToBot()
- {
- GetExclusiveAccess();
- iClearToBot();
- ReleaseExclusiveAccess();
- }
-
-void cTextWindow::ClearToEOL()
- {
- GetExclusiveAccess();
- iClearToEOL();
- ReleaseExclusiveAccess();
- }
-
-
-void cTextWindow::Box(int x, int y, int w, int h)
- {
- // Draw a box starting at y, x (relative to the window corner, of course)
- // with a width of w and height of h.
-
- // All of the inputs default to 0; if w or h is 0, the box should fill
- // up the screen in that direction; thus if this method is called without
- // arguments, a box forms along the edge of this window. In the code,
- // Box() is only called with all 4 arguments or none at all, so you may
- // split it into two seperate functions (with and without arguments) if
- // you choose.
-
- // Here is one way to impliment it if there are no special tricks in the
- // package you're using.
-
- if (!w) w = Width() - x;
- if (!h) h = Height() - y;
-
- int i;
-
- // Draw the horizontal lines.
- for (i = 1; i < w - 1; i++) {
- Print(y, x + i, CHAR_HLINE);
- Print(y + h - 1, x + i, CHAR_HLINE);
- }
-
- // Draw the vertical lines.
- for (i = 1; i < h - 1; i++) {
- Print(y + i, x, CHAR_VLINE);
- Print(y + i, x + w - 1, CHAR_VLINE);
- }
-
- // Draw the corners
- Print(y, x, CHAR_ULCORNER);
- Print(y + h - 1, x, CHAR_LLCORNER);
- Print(y, x + w - 1, CHAR_URCORNER);
- Print(y + h - 1, x + w - 1, CHAR_LRCORNER);
- }
-
-void cTextWindow::VLine(int in_x)
- {
- // This method draws a vertical line cutting a window in half and ending
- // in the proper T's. This will work once everything else is working...
-
- // Draw the line.
- for (int y = 1; y < Height() - 1; y++) {
- Print(y, in_x, CHAR_VLINE);
- }
-
- // Put on the ends.
- Print(0, in_x, CHAR_TTEE);
- Print(Height() - 1, in_x, CHAR_BTEE);
- }
-
-void cTextWindow::HLine(int in_y)
- {
- // This method draws a horizontal line cutting a window in half and ending
- // in the proper T's. This will work once everything else is working...
-
- // Draw the line.
- for (int i = 1; i < Width() - 1; i++) {
- Print(in_y, i, CHAR_HLINE);
- }
-
- // Put on the ends.
- Print(in_y, 0, CHAR_LTEE);
- Print(in_y, Width() - 1, CHAR_RTEE);
- }
-
-void cTextWindow::HLine(int in_y, int start_x, int length)
- {
- // This method draws a horizontal line starting from (in_y, start_x) with
- // the entered length. Both ends, again, have the the proper T's. This
- // will work once everything else is working...
-
- // Draw the line.
- for (int i = 1; i < length - 1; i++) {
- Print(in_y, start_x + i, CHAR_HLINE);
- }
-
- // Put on the ends.
- Print(in_y, start_x, CHAR_LTEE);
- Print(in_y, start_x + length - 1, CHAR_RTEE);
- }
-
-// >>>>>>>> private methodds used to compute wrapping behavior <<<<<<
-// "n" is the number of characters just output
-void cTextWindow::WrapCursor (int n)
- {
- // Handle LOGICAL wrapping within our "window". The cursor wraps at our
- // window boundries
- curs_x += n;
- if (curs_x >= width) {
- curs_y += curs_x/width; // how many lines wrapped
- curs_x %= width; // actual X position
- if (curs_y >= height)
- curs_y %= height; // wrapped from bottom to top
- }
- }
-
-void cTextWindow::WrapCursor (int n, COORD *pco)
- {
- // Handle wrapping for the console buffer output; used for writing text out
- // to the display
- pco->X += n;
- if (pco->X >= dwWindowDimensions.X) {
- pco->Y += pco->X/dwWindowDimensions.X; // how many lines wrapped
- pco->X %= dwWindowDimensions.X; // actual X position
- pco->Y = min (pco->Y, dwWindowDimensions.Y); // physical cursor pins to bottom
- }
- }
-
-// The following functions print characters onto the screen. If they
-// begin with an y, x then they first move to those coords.
-
-void cTextWindow::iPrint(int ch)
- {
- // Places the character represented by ch at the current position.
-
- int o = curs_x + curs_y * width;
- if (pciScreenChars[o].Char.AsciiChar != (char) ch || pciScreenChars[o].Attributes != color)
- {
- pciScreenChars[o].Char.AsciiChar = (char) ch;
- pciScreenChars[o].Attributes = color;
- pbScreenFlags[o] |= SCREEN_UPDATE;
- }
- WrapCursor (1);
- }
-
-void cTextWindow::Print(int ch)
- {
- GetExclusiveAccess();
- iPrint(ch);
- ReleaseExclusiveAccess();
- }
-
-void cTextWindow::Print(int in_y, int in_x, int ch)
- {
- // Places the character represented by ch at (in_y, in_x).
- GetExclusiveAccess();
- iMove (in_y, in_x);
- iPrint (ch);
- ReleaseExclusiveAccess();
- }
-
-void cTextWindow::Print(const char * fmt, ...)
- {
- // Works like printf(), but places the output at the current cursor
- // position.
-
- va_list argp;
- int i, j;
- char cBuf[1024];
-
- va_start(argp, fmt);
- i = vsprintf(cBuf, fmt, argp);
- va_end(argp);
-
- // "i" will be negative if an error occurs, but errors should be obvious so quickly
- // that we will not test for it...
- GetExclusiveAccess();
- for (j = 0; j < i; j++)
- iPrint (cBuf[j]);
- ReleaseExclusiveAccess();
-
- }
-
-void cTextWindow::Print(int in_y, int in_x, const char * fmt, ...)
- {
- // Works like printf(), but places the output at (in_y, in_x).
- va_list argp;
- int i, j;
- char cBuf[1024];
-
- va_start(argp, fmt);
- i = vsprintf(cBuf, fmt, argp);
- va_end(argp);
-
- // "i" will be negative if an error occurs, but errors should be obvious so quickly
- // that we will not test for it...
- GetExclusiveAccess();
- iMove (in_y, in_x);
- for (j = 0; j < i; j++)
- Print (cBuf[j]);
- ReleaseExclusiveAccess();
- }
-
-// These functions check or set the screen colors (BG is black by default)
-int cTextWindow::HasColors()
- {
- // Returns TRUE if this window has the ability to display colors, or
- // FALSE if not.
-
- return TRUE; // Win32 console always supports this...
- }
-
-void cTextWindow::SetColor(int color)
- {
- // Sets the current color to 'color'. All text printed will be in that
- // color.
- this->color = (WORD) color;
- }
-
-void cTextWindow::SetBoldColor(int color)
- {
- // Sets the current color to the high intesity version of 'color'. All
- // text printed will be in that color.
- SetColor (color | FOREGROUND_INTENSITY);
- }
-
-int cTextWindow::ScreenXToWindow (int iX)
- {
- // convert X screen coordinate to a window coordinate
- return iX - x_start;
- }
-
-int cTextWindow::ScreenYToWindow (int iY)
- {
- // convert Y screen coordinate to a window coordinate
- return iY - y_start;
- }
-
-int cTextWindow::WindowXToScreen (int iX)
- {
- // convert X window coordinate to a screen coordinate
- return iX + x_start;
- }
-
-int cTextWindow::WindowYToScreen (int iY)
- {
- // convert Y window coordinate to a screen coordinate
- return iY + y_start;
- }
-
-int cTextWindow::IsCoordInWindow(int iX, int iY)
- {
- // Return TRUE if Screen coords are within the window, else false
- return (iX >= x_start && iX < x_start + width) &&
- (iY >= y_start && iY < y_start + height);
- }
-
-/////////////////////////
-// Other functions... not methods
-/////////////////////////
-
-static tList<MOUSE_INFO> *pcInputQueue; // "global" input queue (local to this module)
-static HANDLE hConsoleInput; // likewise... the console input handle
-static int gFlag; // Set to TRUE to enable mouse events
-
-void StartProg()
- {
- // All functions which are needed in order to setup the text manipulation
- // package should be placed here.
-
- pcInputQueue = new tList<MOUSE_INFO>; // initialize our input queue
- EnableMouseEvents (FALSE); // No mouse event queueing yet
-
- // Get the console input handle. Since we NEVER free
- // std handles, it is ok if we exit with this in place (in fact, it is REQUIRED).
- hConsoleInput = GetStdHandle (STD_INPUT_HANDLE);
- if (hConsoleInput == INVALID_HANDLE_VALUE) {
- int rc;
- rc = GetLastError();
- printf ("cTextWindow ERROR - Cannot get Std Input handle, rc= %i\n", rc);
- exit (rc);
- }
- }
-
-void EndProg(int exit_code)
- {
- // Include here anything which shoule be done before the viewer exits.
-
- signal(SIGINT, SIG_IGN); // Ignore all future interrupts
- delete pcInputQueue; // Nuke the input queue
- // Note: NEVER, NEVER even think of freeing the console input handle in here!!
- exit(exit_code);
- }
-
-int GetInput()
- {
- // Get the first character in the input buffer and return it (without
- // the need for the user to press return!!!!) If the buffer is empty,
- // return ERR.
-
- int key;
- /**************
- // Could also use ReadConsoleInput...
- if (_kbhit())
- {
- key = _getch();
- if (key == 0xE0)
- // Extended keycode, so get the second byte (keep the E0 as the hi byte)
- key = _getch() | 0xE000;
- }
- else
- key = ERR;
- ***********************/
- INPUT_RECORD irInput;
- DWORD dwRecords;
- BOOL bKeepLooking = TRUE;
-
- while (bKeepLooking)
- {
- // First see if anything is there to be read (if API fails, dwRecords will be 0)
- dwRecords = 0;
- GetNumberOfConsoleInputEvents (hConsoleInput, &dwRecords);
- if (dwRecords)
- {
- if (PeekConsoleInput (hConsoleInput, &irInput, 1, &dwRecords) )
- {
- if (irInput.EventType == KEY_EVENT && irInput.Event.KeyEvent.bKeyDown)
- {
- // We have a kybd hit event...
-
- // It was too hard to get ReadConsoleInput to work for kbd events,
- // so when a keybd event is waiting, use _kbhit()
- if (_kbhit())
- {
- // C lib agrees this is a keyhit... go get it
- key = _getch();
- if (key == 0xE0)
- // Extended keycode, so get the second byte (keep the E0 as the hi byte)
- key = _getch() | 0xE000;
- bKeepLooking = FALSE; // we found something
- }
- else
- {
- // Console code treats make on Shift keys as key hits, so we need
- // to tackle cases where C does not agree w/ ReadConsole and do a
- // read to pop the event off our stack. Fun...
- ReadConsoleInput (hConsoleInput, &irInput, 1, &dwRecords);
- key = ERR;
- }
- }
-
- else
- {
- // something other than a key hit... check it out
- if (!ReadConsoleInput (hConsoleInput, &irInput, 1, &dwRecords))
- {
- //g_debug.Error ("ReadConsoleInput failed, rc= %d\n", GetLastError() );
- key = ERR;
- }
- // got the event... process it
- MOUSE_INFO *pmiData;
-
- switch (irInput.EventType)
- {
- case MOUSE_EVENT:
- key = ERR; // no keystrokes in this case
- // Track Double Clicks and track Single Click w/ left button when
- // gFlag is TRUE.
- if (gFlag && (irInput.Event.MouseEvent.dwEventFlags & DOUBLE_CLICK ||
- (irInput.Event.MouseEvent.dwEventFlags == 0 &&
- irInput.Event.MouseEvent.dwButtonState && FROM_LEFT_1ST_BUTTON_PRESSED)
- ))
- {
- bKeepLooking = FALSE; // take this as an event we want
- pmiData = new MOUSE_INFO; // needs its own storage
- if (pmiData == NULL)
- {
- //g_debug.Error("GetInput() unable to allocate "
- "MOUSE_INFO for queue\n");
- key = ERR;
- }
- else
- {
- // We have a record... populate it with data!
- pmiData->X = (int) (irInput.Event.MouseEvent.dwMousePosition.X);
- pmiData->Y = (int) (irInput.Event.MouseEvent.dwMousePosition.Y);
- pmiData->iEvent = 0; // start w/ flags cleared
- // Figure out what flags to set
- if (irInput.Event.MouseEvent.dwEventFlags & DOUBLE_CLICK)
- pmiData->iEvent |= MOUSE_DBLCLICK; // dbl click
-
- else if (irInput.Event.MouseEvent.dwEventFlags == 0 &&
- irInput.Event.MouseEvent.dwButtonState &
- FROM_LEFT_1ST_BUTTON_PRESSED)
- pmiData->iEvent |= MOUSE_CLICK; // ... or single click
- if (pcInputQueue->Push(pmiData) != 0)
- // It's in the queue
- key = KEY_MOUSE; // signal a mouse event
- else
- {
- // Could not add to queue
- //g_debug.Error("GetInput() unable to add to Mouse "
- "event queue\n");
- key = ERR;
- }
- }
- }
- break;
-
- default:
- key = ERR;
- break;
- } // *** End of SWITCH
- } // end of ELSE on if (irInput.EventType...)
- } // end of if (PeekConsole....)
- else
- {
- // g_debug.Error ("PeekConsoleInput failed, rc= %d", GetLastError() );
- key = ERR;
- }
- }
- else
- {
- // No records pending
- key = ERR;
- bKeepLooking = FALSE;
- }
- }
-
- return key;
- }
-
-// Routine to return mouse input data. Returns a pointer if we have data, else NULL. This
-// program returns the next mouse record off the queue. Since GetInput() allocates memory
-// for this, it is UP TO THE CALLER to free the memory when done. Could implement a slower
-// but somewhat cleaner version that requires the caller to pass in a pointer to a
-// MOUSE_INFO record. Then we copy the contents of the queue record into the caller's
-// buffer, and delete the queue record memory ourselves...
-
-MOUSE_INFO * GetMouseInput(void)
- {
- return (MOUSE_INFO *)pcInputQueue->Pop();
- }
-
-void FlushMouseQueue(void)
- {
- while (pcInputQueue->GetSize()) {
- delete pcInputQueue->Pop();
- }
- }
-
-void EnableMouseEvents(int Flag)
- {
- // Set to TRUE to enable mouse events, FALSE to disable (so queue doesn't fill up)
- gFlag = Flag;
- }
-
-#endif
Deleted: branches/brysonda/source/viewer/ansi.hh
===================================================================
--- branches/brysonda/source/viewer/ansi.hh 2005-10-23 04:16:36 UTC (rev 359)
+++ branches/brysonda/source/viewer/ansi.hh 2005-10-23 04:43:06 UTC (rev 360)
@@ -1,224 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2000 California Institute of Technology //
-// Portions Copyright (C) Microsoft Corporation, 1996. //
-// //
-// Read the COPYING and README files, or contact 'avida at alife.org', //
-// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
-//////////////////////////////////////////////////////////////////////////////
-
-#ifndef VIEW_ANSI_HH
-#define VIEW_ANSI_HH
-
-#include "defs.h"
-
-#ifdef VIEW_ANSI
-
-// Place #include statements here
-#include <signal.h>
-
-// Flag used in change map to flag a change (requires updates to the screen)
-#define SCREEN_UPDATE 0x01
-
-// Set up the following #defines such that when passed through to
-// SetColor(int) and SetBoldColor(int), these functions will be able to
-// recognize them (COLOR_OFF is black on black - used in SetBoldColor as
-// dark gray on black; it should be used instead of COLOR_BLACK)
-#define COLOR_BLACK 0
-#define COLOR_RED FOREGROUND_RED
-#define COLOR_GREEN FOREGROUND_GREEN
-#define COLOR_YELLOW (FOREGROUND_RED|FOREGROUND_GREEN)
-#define COLOR_BLUE FOREGROUND_BLUE
-#define COLOR_MAGENTA (FOREGROUND_BLUE|FOREGROUND_RED)
-#define COLOR_CYAN (FOREGROUND_BLUE|FOREGROUND_GREEN)
-#define COLOR_WHITE (FOREGROUND_BLUE|FOREGROUND_RED|FOREGROUND_GREEN)
-#define COLOR_OFF 0
-
-// These are the IBM PC OEM charset linedraw characters...
-#define CHAR_TTEE 194 /* 'T' connection of solid lines */
-#define CHAR_BTEE 193 /* Upsidedown 'T' connection of solid lines */
-#define CHAR_LTEE 195 /* "|-" shaped 'T' connection of solid lines */
-#define CHAR_RTEE 180 /* "-|" shaped 'T' connection of solid lines */
-#define CHAR_PLUS 197 /* cross connection of solid lines */
-#define CHAR_HLINE 196 /* Straight horizontal line */
-#define CHAR_VLINE 179 /* Straight veritcal line */
-#define CHAR_ULCORNER 218 /* Upper-left corner of a box */
-#define CHAR_URCORNER 191 /* Upper-right corner of a box */
-#define CHAR_LLCORNER 192 /* Lower-left corner of a box */
-#define CHAR_LRCORNER 217 /* Lower-right corner of a box */
-#define CHAR_BULLET 2 /* use for "bullet" */
-
-// Keys, home, and end. (IBM PC char codes for "Gray Keys" only).
-
-#define KEY_DOWN 0xE050
-#define KEY_UP 0xE048
-#define KEY_LEFT 0xE04B
-#define KEY_RIGHT 0xE04D
-#define KEY_HOME 0xE047
-#define KEY_END 0xE04F
-#define ERR -1
-
-// DRA - added for Mouse Support. This is the return code from GetInputs() when a mouse
-// event is pending. Other defines are used in the returns from GetMouseInput()
-#define KEY_MOUSE -2
-#define MOUSE_CLICK 1
-#define MOUSE_DBLCLICK 2
-
-typedef struct _MOUSE_INFO {
- int X;
- int Y;
- int iEvent; // MOUSE_CLICK or MOUSE_DBLCLICK
-} MOUSE_INFO;
-
-
-// We need three special functions: One to initialize the viewer, one to
-// close it up, and one to interactively get inputs from the buffer without
-// needing <return> to be pressed. They will be further described in
-// ansi.cc where they are defined.
-
-void StartProg();
-void EndProg(int exit_code);
-int GetInput();
-//int GetBlockingInput(){ return GetInput(); }
-
-MOUSE_INFO * GetMouseInput(void);
-void FlushMouseQueue(void);
-void EnableMouseEvents(int Flag);
-
-// Finally, we have the cTextWindow class. This class handles a sub-section
-// of the screen henceforth called a window. It should manage the internals
-// of that window, and not let anything be displayed outside of it. A window
-// keeps an internal representation of its own state, and when its Refresh()
-// method is run, it updates its section of the screen all at once (rather
-// than one character at a time, as they are entered.) If two windows
-// occupy the same area of the screen, the one which has been refreshed most
-// recently should be on top.
-
-typedef int chtype;
-#include "text_window.hh"
-
-class cTextWindow : public cBaseTextWindow {
-protected:
-
- // These four variables define the size and position of the window
- // - an array of some sort should also be made to store the current state
- // of the screen.
- int width;
- int height;
- int y_start;
- int x_start;
-
- // Current color used for char output
- WORD color;
-
- // Physcial window dimensions. Needed to accurately predict cursor behavior.
- // This is based on the console buffer sizing.
- COORD dwWindowDimensions;
-
- HANDLE hConsoleOutput; // Console output handle
-
- // The current position of the cursor on the screen.
- int curs_x;
- int curs_y;
-
- // Screen data buffers (for characters & change flags)
- CHAR_INFO *pciScreenChars;
- BYTE *pbScreenFlags;
-
- // Internal method for calculating cursor wrapping
- void cTextWindow::WrapCursor (int n);
- void cTextWindow::WrapCursor (int n, COORD *pco);
-
- // Critical section used to make calls thread safe
- CRITICAL_SECTION csTextWindow;
-
- inline void cTextWindow::GetExclusiveAccess() {
- EnterCriticalSection (&csTextWindow);
- }
-
- inline void cTextWindow::ReleaseExclusiveAccess() {
- LeaveCriticalSection (&csTextWindow);
- }
-
- // Internal versions of functions that we can call when we have the
- // Critical Section
- void cTextWindow::iMove(int new_y, int new_x);
- void cTextWindow::iRefresh();
- void cTextWindow::iClear();
- void cTextWindow::iClearToBot();
- void cTextWindow::iClearToEOL();
- void cTextWindow::iPrint(int ch);
-
-
-public:
- // These functions are briefly described here, and further elaborated on
- // in ansi.cc. You may want to move several of the smaller definitions
- // back here and make them inline.
-
- cTextWindow();
- cTextWindow(int y_size, int x_size, int y_start=0, int x_start=0);
- ~cTextWindow();
-
- void Construct(int y_size, int x_size, int y_start=0, int x_start=0);
-
- // These function return the number of characters wide or high
- // (respectively) that the screen is.
- inline int cTextWindow::Width() { return width; }
- inline int cTextWindow::Height() { return height; }
-
- // Return the current Cursor Position
- inline int cTextWindow::CursorX() { return curs_x; }
- inline int cTextWindow::CursorY() { return curs_y; }
-
- // Convert screen co-ords to window co-ords & vice-versa
- int cTextWindow::ScreenXToWindow (int iX);
- int cTextWindow::ScreenYToWindow (int iY);
- int cTextWindow::WindowXToScreen (int iX);
- int cTextWindow::WindowYToScreen (int iY);
-
- // Is a screen coordinate within our window?
- int cTextWindow::IsCoordInWindow(int iX, int iY);
-
- // Clear the screen and redraw all text on it.
- void cTextWindow::RedrawMain();
-
- // Move the active position of the cursor.
- void Move(int new_y, int new_x);
-
- // Print all of the changes made onto the screen.
- void cTextWindow::RefreshMain();
-
- // These functions clear sections of the screen.
- void cTextWindow::ClearMain();
- void cTextWindow::ClearToBot();
- void cTextWindow::ClearToEOL();
-
- // The following functions print characters onto the screen. If they
- // begin with an y, x then they first move to those coords.
-
- void cTextWindow::Print(int ch);
- void cTextWindow::Print(int in_y, int in_x, int ch);
- void cTextWindow::Print(const char * fmt, ...);
- void cTextWindow::Print(int in_y, int in_x, const char * fmt, ...);
-
- // These functions check or set the screen colors (BG is black by default)
- int cTextWindow::HasColors();
- void cTextWindow::SetColor(int color);
- void cTextWindow::SetBoldColor(int color);
-
- // Various 'graphic' functions. Box() draws a box-frame around the window.
- // With arguments, it draws a box starting at x, y, with size w by h.
- // VLine and HLine draw lines across the screen ending in the appropriate
- // facing T's (hence, they are used to cut boxes in half. With two
- // coords and a length, they only draw the line from the specified start,
- // to the specified distance.
- void cTextWindow::Box(int x, int y, int w=0, int h=0);
- inline void cTextWindow::Box() { Box(0,0,0,0); }
-
- void cTextWindow::VLine(int in_x);
- void cTextWindow::HLine(int in_y);
- void cTextWindow::HLine(int in_y, int start_x, int length);
-};
-
-#endif
-
-#endif
Deleted: branches/brysonda/source/viewer/bar_screen.cc
===================================================================
--- branches/brysonda/source/viewer/bar_screen.cc 2005-10-23 04:16:36 UTC (rev 359)
+++ branches/brysonda/source/viewer/bar_screen.cc 2005-10-23 04:43:06 UTC (rev 360)
@@ -1,72 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2001 California Institute of Technology //
-// //
-// Read the COPYING and README files, or contact 'avida at alife.org', //
-// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
-//////////////////////////////////////////////////////////////////////////////
-
-#include "cPopulation.h"
-#include "cStats.h"
-#include "cEnvironment.h"
-
-#include "bar_screen.hh"
-
-
-using namespace std;
-
-
-///////////////////
-// The Bar Screen
-///////////////////
-
-void cBarScreen::Draw()
-{
- SetBoldColor(COLOR_WHITE);
-
- Box();
- VLine(18);
-
-
- int offset = prog_name.GetSize() + 4;
- VLine(Width() - offset - 2);
- Print(1, Width() - offset, "%s", prog_name());
-
- Print(1, 2, "Update:");
-
- if(info.GetPopulation().GetEnvironment().GetResourceLib().GetSize() > 0)
- Print(1, 20, "[M]ap [S]tats [O]ptions [Z]oom [E]nviron [Q]uit");
- else
- Print(1, 20, "[M]ap [S]tats [O]ptions [Z]oom [Q]uit");
-
- SetBoldColor(COLOR_CYAN);
-
- if(info.GetPopulation().GetEnvironment().GetResourceLib().GetSize() > 0)
- {
- Print(1, 21, 'M');
- Print(1, 27, 'S');
- Print(1, 35, 'O');
- Print(1, 45, 'Z');
- Print(1, 52, 'E');
- Print(1, 62, 'Q');
- }
- else
- {
- Print(1, 21, 'M');
- Print(1, 28, 'S');
- Print(1, 37, 'O');
- Print(1, 48, 'Z');
- Print(1, 56, 'Q');
- }
-
- Refresh();
-}
-
-void cBarScreen::Update()
-{
- SetBoldColor(COLOR_WHITE);
- Print(1, 11, "%d", population.GetUpdate());
- SetColor(COLOR_WHITE);
-
- Refresh();
-}
-
Deleted: branches/brysonda/source/viewer/bar_screen.hh
===================================================================
--- branches/brysonda/source/viewer/bar_screen.hh 2005-10-23 04:16:36 UTC (rev 359)
+++ branches/brysonda/source/viewer/bar_screen.hh 2005-10-23 04:43:06 UTC (rev 360)
@@ -1,32 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2000 California Institute of Technology //
-// //
-// Read the COPYING and README files, or contact 'avida at alife.org', //
-// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
-//////////////////////////////////////////////////////////////////////////////
-
-#ifndef VIEW_BAR_SCREEN_HH
-#define VIEW_BAR_SCREEN_HH
-
-#include "text_screen.hh"
-
-class cBarScreen : public cScreen {
-protected:
- cPopulation & population;
- cString prog_name;
-public:
- cBarScreen(int y_size, int x_size, int y_start, int x_start,
- cViewInfo & in_info, const cString & in_name,
- cPopulation & in_pop) :
- cScreen(y_size, x_size, y_start, x_start, in_info),
- population(in_pop),
- prog_name(in_name) { ; }
- ~cBarScreen() { ; }
-
- // Virtual in base screen...
- void Draw();
- void Update();
- void DoInput(int in_char) { (void) in_char; }
-};
-
-#endif
Copied: branches/brysonda/source/viewer/cAvidaDriver_TextPopViewer.cc (from rev 359, branches/brysonda/source/viewer/viewer.cc)
Copied: branches/brysonda/source/viewer/cAvidaDriver_TextPopViewer.h (from rev 359, branches/brysonda/source/viewer/viewer.hh)
Copied: branches/brysonda/source/viewer/cBarScreen.cc (from rev 359, branches/brysonda/source/viewer/bar_screen.cc)
Copied: branches/brysonda/source/viewer/cBarScreen.h (from rev 359, branches/brysonda/source/viewer/bar_screen.hh)
Copied: branches/brysonda/source/viewer/cBaseTextWindow.h (from rev 359, branches/brysonda/source/viewer/text_window.hh)
Copied: branches/brysonda/source/viewer/cEnvironmentScreen.cc (from rev 359, branches/brysonda/source/viewer/environment_screen.cc)
Copied: branches/brysonda/source/viewer/cEnvironmentScreen.h (from rev 359, branches/brysonda/source/viewer/environment_screen.hh)
Copied: branches/brysonda/source/viewer/cHistScreen.cc (from rev 359, branches/brysonda/source/viewer/hist_screen.cc)
Copied: branches/brysonda/source/viewer/cHistScreen.h (from rev 359, branches/brysonda/source/viewer/hist_screen.hh)
Copied: branches/brysonda/source/viewer/cMapScreen.cc (from rev 359, branches/brysonda/source/viewer/map_screen.cc)
Copied: branches/brysonda/source/viewer/cMapScreen.h (from rev 359, branches/brysonda/source/viewer/map_screen.hh)
Copied: branches/brysonda/source/viewer/cMenuWindow.cc (from rev 359, branches/brysonda/source/viewer/menu.cc)
Copied: branches/brysonda/source/viewer/cMenuWindow.h (from rev 359, branches/brysonda/source/viewer/menu.hh)
Copied: branches/brysonda/source/viewer/cOptionsScreen.cc (from rev 359, branches/brysonda/source/viewer/options_screen.cc)
Copied: branches/brysonda/source/viewer/cOptionsScreen.h (from rev 359, branches/brysonda/source/viewer/options_screen.hh)
Copied: branches/brysonda/source/viewer/cScreen.cc (from rev 359, branches/brysonda/source/viewer/text_screen.cc)
===================================================================
--- branches/brysonda/source/viewer/text_screen.cc 2005-10-23 04:16:36 UTC (rev 359)
+++ branches/brysonda/source/viewer/cScreen.cc 2005-10-23 04:43:06 UTC (rev 360)
@@ -0,0 +1,24 @@
+//////////////////////////////////////////////////////////////////////////////
+// Copyright (C) 1993 - 2001 California Institute of Technology //
+// //
+// Read the COPYING and README files, or contact 'avida at alife.org', //
+// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
+//////////////////////////////////////////////////////////////////////////////
+
+#include <fstream>
+
+#include "cSpecies.h"
+#include "cGenotype.h"
+#include "cGenebank.h"
+#include "cInjectGenotype.h"
+#include "cInjectGenebank.h"
+#include "cPopulation.h"
+#include "cPopulationCell.h"
+#include "cOrganism.h"
+
+#include "symbol_util.hh"
+#include "text_screen.hh"
+
+
+using namespace std;
+
Copied: branches/brysonda/source/viewer/cScreen.h (from rev 359, branches/brysonda/source/viewer/text_screen.hh)
===================================================================
--- branches/brysonda/source/viewer/text_screen.hh 2005-10-23 04:16:36 UTC (rev 359)
+++ branches/brysonda/source/viewer/cScreen.h 2005-10-23 04:43:06 UTC (rev 360)
@@ -0,0 +1,150 @@
+//////////////////////////////////////////////////////////////////////////////
+// Copyright (C) 1993 - 2001 California Institute of Technology //
+// //
+// Read the COPYING and README files, or contact 'avida at alife.org', //
+// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef VIEW_TEXT_SCREEN_HH
+#define VIEW_TEXT_SCREEN_HH
+
+
+#include "cMerit.h"
+#include "cInstSet.h"
+#include "defs.h"
+
+#include "ncurses.hh"
+#include "ansi.hh"
+
+class cEnvironment;
+class cSpecies;
+class cGenotype;
+class cPopulation;
+class cPopulationCell;
+class cOrganism;
+class cGenebank;
+class cInjectGenotype;
+class cInjectGenebank;
+
+#define NUM_SYMBOLS 12
+#define SYMBOL_THRESHOLD 10
+
+#define PAUSE_OFF 0
+#define PAUSE_ON 1
+#define PAUSE_ADVANCE_STEP 2
+#define PAUSE_ADVANCE_UPDATE 3
+#define PAUSE_ADVANCE_GESTATION 4
+
+
+#define MAP_BASIC 0
+#define MAP_SPECIES 1
+#define MAP_BREED_TRUE 2
+#define MAP_PARASITE 3
+#define MAP_MUTATIONS 4
+#define MAP_THREAD 5
+#define MAP_INJECT 6
+#define MAP_LINEAGE 7
+#define NUM_MAPS 8
+
+// Other map modes currently inactive...
+#define MAP_COMBO 9
+#define MAP_RESOURCE 10
+#define MAP_AGE 11
+#define NUM_MAP_MODES 12
+
+class cScreen : public cTextWindow {
+protected:
+ cViewInfo & info;
+
+ inline void SetSymbolColor(char color);
+ inline void PrintMerit(int in_y, int in_x, cMerit in_merit);
+ inline void PrintFitness(int in_y, int in_x, double in_fitness);
+public:
+ cScreen(int y_size, int x_size, int y_start, int x_start,
+ cViewInfo & in_info) :
+ cTextWindow(y_size, x_size, y_start, x_start), info(in_info) { ; }
+ virtual ~cScreen() { ; }
+
+ virtual void Draw() = 0;
+ virtual void Update() = 0;
+ virtual void AdvanceUpdate() { ; }
+ virtual void DoInput(int in_char) = 0;
+ virtual void DoMouseClick(int x, int y) { (void) x; (void) y; }
+ virtual void Exit() { ; }
+};
+
+
+inline void cScreen::SetSymbolColor(char color)
+{
+ switch (color) {
+ case '.':
+ case '-':
+ SetColor(COLOR_WHITE);
+ break;
+ case '*':
+ case '+':
+ case '1':
+ SetBoldColor(COLOR_WHITE);
+ break;
+ case 'A':
+ case 'B':
+ case 'C':
+ case 'D':
+ case 'E':
+ case 'F':
+ SetBoldColor((int) color - 'A' + 1);
+ break;
+ case 'G':
+ case 'H':
+ case 'I':
+ case 'J':
+ case 'K':
+ case 'L':
+ SetColor((int) color - 'G' + 1);
+ break;
+ case ' ':
+ SetColor(COLOR_OFF);
+ break;
+ case '0':
+ default:
+ SetColor(COLOR_WHITE);
+ break;
+ }
+}
+
+inline void cScreen::PrintMerit(int in_y, int in_x, cMerit in_merit)
+{
+ // if we can print the merit normally, do so.
+ //if (in_merit.GetDouble() < 1000000) {
+ //Print(in_y, in_x, "%7d", in_merit.GetUInt());
+ //}
+
+ // otherwise use scientific notation. (or somesuch)
+ //else {
+ Print(in_y, in_x, "%7.1e", in_merit.GetDouble());
+ //}
+}
+
+inline void cScreen::PrintFitness(int in_y, int in_x, double in_fitness)
+{
+ // If we can print the fitness, do so!
+ if (in_fitness <= 0.0) {
+ Print(in_y, in_x, " 0.0000");
+ }
+ else if (in_fitness < 10)
+ Print(in_y, in_x, "%7.4f", in_fitness);
+ // else if (in_fitness < 100)
+ // Print(in_y, in_x, "%7.3f", in_fitness);
+ else if (in_fitness < 1000)
+ Print(in_y, in_x, "%7.2f", in_fitness);
+ // else if (in_fitness < 10000)
+ // Print(in_y, in_x, "%7.1f", in_fitness);
+ else if (in_fitness < 100000)
+ Print(in_y, in_x, "%7.0f", in_fitness);
+
+ // Otherwise use scientific notations.
+ else
+ Print(in_y, in_x, "%7.1e", in_fitness);
+}
+
+#endif
Copied: branches/brysonda/source/viewer/cStatsScreen.cc (from rev 359, branches/brysonda/source/viewer/stats_screen.cc)
Copied: branches/brysonda/source/viewer/cStatsScreen.h (from rev 359, branches/brysonda/source/viewer/stats_screen.hh)
Copied: branches/brysonda/source/viewer/cSymbolUtil.cc (from rev 359, branches/brysonda/source/viewer/symbol_util.cc)
Copied: branches/brysonda/source/viewer/cSymbolUtil.h (from rev 359, branches/brysonda/source/viewer/symbol_util.hh)
Copied: branches/brysonda/source/viewer/cTextWindow.cc (from rev 359, branches/brysonda/source/viewer/ncurses.cc)
Copied: branches/brysonda/source/viewer/cTextWindow.h (from rev 359, branches/brysonda/source/viewer/ncurses.hh)
Copied: branches/brysonda/source/viewer/cView.cc (from rev 359, branches/brysonda/source/viewer/view.cc)
Copied: branches/brysonda/source/viewer/cView.h (from rev 359, branches/brysonda/source/viewer/view.hh)
Copied: branches/brysonda/source/viewer/cViewInfo.cc (from rev 359, branches/brysonda/source/viewer/text_screen.cc)
Copied: branches/brysonda/source/viewer/cViewInfo.h (from rev 359, branches/brysonda/source/viewer/text_screen.hh)
===================================================================
--- branches/brysonda/source/viewer/text_screen.hh 2005-10-23 04:16:36 UTC (rev 359)
+++ branches/brysonda/source/viewer/cViewInfo.h 2005-10-23 04:43:06 UTC (rev 360)
@@ -0,0 +1,161 @@
+//////////////////////////////////////////////////////////////////////////////
+// Copyright (C) 1993 - 2001 California Institute of Technology //
+// //
+// Read the COPYING and README files, or contact 'avida at alife.org', //
+// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef VIEW_TEXT_SCREEN_HH
+#define VIEW_TEXT_SCREEN_HH
+
+
+#include "cMerit.h"
+#include "cInstSet.h"
+#include "defs.h"
+
+#include "ncurses.hh"
+#include "ansi.hh"
+
+class cEnvironment;
+class cSpecies;
+class cGenotype;
+class cPopulation;
+class cPopulationCell;
+class cOrganism;
+class cGenebank;
+class cInjectGenotype;
+class cInjectGenebank;
+
+#define NUM_SYMBOLS 12
+#define SYMBOL_THRESHOLD 10
+
+#define PAUSE_OFF 0
+#define PAUSE_ON 1
+#define PAUSE_ADVANCE_STEP 2
+#define PAUSE_ADVANCE_UPDATE 3
+#define PAUSE_ADVANCE_GESTATION 4
+
+
+#define MAP_BASIC 0
+#define MAP_SPECIES 1
+#define MAP_BREED_TRUE 2
+#define MAP_PARASITE 3
+#define MAP_MUTATIONS 4
+#define MAP_THREAD 5
+#define MAP_INJECT 6
+#define MAP_LINEAGE 7
+#define NUM_MAPS 8
+
+// Other map modes currently inactive...
+#define MAP_COMBO 9
+#define MAP_RESOURCE 10
+#define MAP_AGE 11
+#define NUM_MAP_MODES 12
+
+
+class cViewInfo {
+private:
+ cPopulation & population;
+ cPopulationCell * active_cell;
+
+ int pause_level;
+ int thread_lock;
+ int step_organism_id;
+ int map_mode;
+
+ // Instruction Libraries.
+ cInstSet const * saved_inst_set;
+ cInstSet alt_inst_set;
+
+ // Symbol information
+ cGenotype * genotype_chart[NUM_SYMBOLS];
+ cSpecies * species_chart[NUM_SYMBOLS];
+ cInjectGenotype * inject_genotype_chart[NUM_SYMBOLS];
+ char symbol_chart[NUM_SYMBOLS];
+
+ tArray<char> map;
+ tArray<char> color_map;
+
+ inline bool InGenChart(cGenotype * in_gen);
+ inline bool InSpeciesChart(cSpecies * in_species);
+ inline bool InInjectGenChart(cInjectGenotype * in_gen);
+ void AddGenChart(cGenotype * in_gen);
+ void AddSpeciesChart(cSpecies * in_species);
+ void AddInjectGenChart(cInjectGenotype * in_gen);
+public:
+ cViewInfo(cPopulation & in_population);
+ ~cViewInfo() { ; }
+
+ void UpdateSymbols();
+ void SetupSymbolMaps(int map_mode, bool use_color);
+ tArray<char> & GetMap() { return map; }
+ tArray<char> & GetColorMap() { return color_map; }
+ char & MapSymbol(int pos) { return map[pos]; }
+ char & ColorSymbol(int pos) { return color_map[pos]; }
+ int GetMapMode() { return map_mode; }
+ void IncMapMode() { ++map_mode%=NUM_MAPS; }
+ void DecMapMode();
+
+ void EngageStepMode();
+ void DisEngageStepMode();
+
+ cGenebank & GetGenebank();
+ cPopulation & GetPopulation() { return population; }
+
+ int GetNumSymbols() { return NUM_SYMBOLS; }
+ cGenotype * GetGenotype(int index) { return genotype_chart[index]; }
+ cSpecies * GetSpecies(int index) { return species_chart[index]; }
+ cInjectGenotype * GetInjectGenotype(int index) { return inject_genotype_chart[index]; }
+
+ cPopulationCell * GetActiveCell() { return active_cell; }
+
+ cGenotype * GetActiveGenotype();
+ cSpecies * GetActiveSpecies();
+ cString GetActiveName();
+
+ int GetActiveID();
+ int GetActiveGenotypeID();
+ int GetActiveSpeciesID();
+
+ void SetActiveCell(cPopulationCell * in_cell) { active_cell = in_cell; }
+
+ int GetPauseLevel() { return pause_level; }
+ int GetThreadLock() { return thread_lock; }
+ int GetStepOrganism() { return step_organism_id; }
+
+ void SetPauseLevel(int in_level) { pause_level = in_level; }
+ void SetThreadLock(int in_lock) { thread_lock = in_lock; }
+ void SetStepOrganism(int in_id) { step_organism_id = in_id; }
+};
+
+inline void cViewInfo::DecMapMode()
+{
+ map_mode+=NUM_MAPS;
+ --map_mode %= NUM_MAPS;
+}
+
+inline bool cViewInfo::InGenChart(cGenotype * in_gen)
+{
+ for (int i = 0; i < NUM_SYMBOLS; i++) {
+ if (genotype_chart[i] == in_gen) return true;
+ }
+ return false;
+}
+
+inline bool cViewInfo::InSpeciesChart(cSpecies * in_species)
+{
+ for (int i = 0; i < NUM_SYMBOLS; i++) {
+ if (species_chart[i] == in_species) return true;
+ }
+ return false;
+}
+
+inline bool cViewInfo::InInjectGenChart(cInjectGenotype * in_gen)
+{
+ for (int i = 0; i < NUM_SYMBOLS; i++) {
+ if (inject_genotype_chart[i] == in_gen) return true;
+ }
+ return false;
+}
+
+#endif
Copied: branches/brysonda/source/viewer/cZoomScreen.cc (from rev 359, branches/brysonda/source/viewer/zoom_screen.cc)
Copied: branches/brysonda/source/viewer/cZoomScreen.h (from rev 359, branches/brysonda/source/viewer/zoom_screen.hh)
Deleted: branches/brysonda/source/viewer/environment_screen.cc
===================================================================
--- branches/brysonda/source/viewer/environment_screen.cc 2005-10-23 04:16:36 UTC (rev 359)
+++ branches/brysonda/source/viewer/environment_screen.cc 2005-10-23 04:43:06 UTC (rev 360)
@@ -1,298 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2001 California Institute of Technology //
-// //
-// Read the COPYING and README files, or contact 'avida at alife.org', //
-// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
-//////////////////////////////////////////////////////////////////////////////
-
-#include "cConfig.h"
-#include "cEnvironment.h"
-#include "cGenebank.h"
-#include "cGenotype.h"
-#include "cPopulation.h"
-#ifndef REACTION_HH
-#include "cReaction.h"
-#endif
-#ifndef REACTION_PROCESS_HH
-#include "cReactionProcess.h"
-#endif
-#ifndef RESOURCE_HH
-#include "cResource.h"
-#endif
-#include "cSpecies.h"
-#include "cStats.h"
-#include "cPopulationCell.h"
-#include "cOrganism.h"
-
-#include "environment_screen.hh"
-
-
-using namespace std;
-
-
-void cEnvironmentScreen::Draw()
-{
- SetBoldColor(COLOR_WHITE);
- Print(1, 54, "[ ] [ ]");
- if (info.GetPauseLevel()) {
- Print(3, 54, "Un-[ ]ause");
- Print(4, 54, "[ ]ext Update");
- } else {
- Print(3, 54, "[ ]ause ");
- Print(4, 54, " ");
- }
-
- SetBoldColor(COLOR_CYAN);
- Print(1, 55, "<");
- Print(1, 73, ">");
- Print(5, 54, "[ ]");
- if (info.GetPauseLevel()) {
- Print(3, 58, "P");
- Print(4, 55, "N");
- } else {
- Print(3, 55, "P");
- }
- Print(5, 55, "UP, DOWN");
-
- if(mode==ENVIRONMENT_MODE_RESOURCE)
- DrawResource();
- else
- DrawReaction();
- Update();
-}
-
-void cEnvironmentScreen::DrawResource()
-{
- const cResourceLib & res_lib = population.GetEnvironment().GetResourceLib();
-
- SetBoldColor(COLOR_WHITE);
-
- Print(0, 0, " --Name-- ");
- Print(0, 12, "--Inflow--");
- Print(0, 24, "--Outflow--");
- Print(0, 37, "--Quantity--");
-
- Print(res_lib.GetSize()+3, 2, "Reactions associated with Resource ");
- Print(res_lib.GetSize()+4, 2, "--Name-- --Num Rxns (last update)-- --");
-
- Print(6, 54, "Next Resource");
-
- SetBoldColor(COLOR_CYAN);
- for(int i=0; i<res_lib.GetSize(); i++)
- {
- Print(i+1, 1, res_lib.GetResource(i)->GetName());
- Print(i+1, 12, "%7.2f", res_lib.GetResource(i)->GetInflow());
- Print(i+1, 24, "%7.2f", res_lib.GetResource(i)->GetOutflow());
- }
- if (info.GetPauseLevel()) {
- Print(3, 58, "P");
- Print(4, 55, "N");
- } else {
- Print(3, 55, "P");
- }
- Print(5, 55, "UP, DOWN");
-
-
- SetColor(COLOR_WHITE);
- Box(0, res_lib.GetSize()+2, Width(), Height()-res_lib.GetSize()-2);
-
- SetBoldColor(COLOR_YELLOW);
- Print(1, 58, "Resource View");
-}
-
-void cEnvironmentScreen::DrawReaction()
-{
- const cReactionLib & rxn_lib = population.GetEnvironment().GetReactionLib();
-
- SetBoldColor(COLOR_WHITE);
-
- Print(0, 0, " --Name-- ");
- //Print(0, 12, "--Inflow--");
- //Print(0, 24, "--Outflow--");
- //Print(0, 37, "--Quantity--");
-
- Print(rxn_lib.GetSize()+3, 2, "Resources associated with Reaction ");
- Print(rxn_lib.GetSize()+4, 2, "--Name-- --Inflow-- --Outflow-- --Quantity--");
-
- Print(6, 54, "Next Reaction");
-
- SetBoldColor(COLOR_CYAN);
- for(int i=0; i<rxn_lib.GetSize(); i++)
- {
- Print(i+1, 1, rxn_lib.GetReaction(i)->GetName());
- //Print(i+1, 12, "%7.2f", res_lib.GetResource(i)->GetInflow());
- //Print(i+1, 24, "%7.2f", res_lib.GetResource(i)->GetOutflow());
- }
-
- SetColor(COLOR_WHITE);
- Box(0, rxn_lib.GetSize()+2, Width(), Height()-rxn_lib.GetSize()-2);
-
- SetBoldColor(COLOR_YELLOW);
- Print(1, 58, "Reaction View");
-}
-
-void cEnvironmentScreen::Update()
-{
- if(mode==ENVIRONMENT_MODE_RESOURCE)
- UpdateResource();
- else
- UpdateReaction();
- Refresh();
-}
-
-void cEnvironmentScreen::UpdateResource()
-{
- const cResourceLib & res_lib = population.GetEnvironment().GetResourceLib();
- const cReactionLib & rxn_lib = population.GetEnvironment().GetReactionLib();
-
- SetBoldColor(COLOR_CYAN);
- //int j=0;
- //int last_count=0;
- for(int i=0; i<population.GetResources().GetSize(); i++)
- {
- Print(i+1, 40, "%7.2f", population.GetResources()[i]);
- //if(population.GetResources()[i]/last_count < population.GetResources()[i].
- //Print(i+2, 65, "%7.2f", population.GetResources()[i]/last_count);
- }
-
- SetBoldColor(COLOR_BLUE);
- Print(res_selection+1, 1, res_lib.GetResource(res_selection)->GetName());
- Print(res_selection+1, 12, "%7.2f", res_lib.GetResource(res_selection)->GetInflow());
- Print(res_selection+1, 24, "%7.2f", res_lib.GetResource(res_selection)->GetOutflow());
- Print(res_selection+1, 40, "%7.2f", population.GetResources()[res_selection]);
-
- int offset=0;
-
- SetBoldColor(COLOR_CYAN);
- for(int i=0; i<rxn_lib.GetSize(); i++)
- {
- for(int j=0; j<rxn_lib.GetReaction(i)->GetProcesses().GetSize(); j++)
- {
- if(rxn_lib.GetReaction(i)->GetProcesses().GetPos(j)->GetResource()->GetName() ==
- res_lib.GetResource(res_selection)->GetName())
- {
- Print(population.GetResources().GetSize()+5+offset, 2,
- rxn_lib.GetReaction(i)->GetName());
- offset++;
- }
- }
- }
-
- SetBoldColor(COLOR_WHITE);
- Print(res_lib.GetSize()+3, 37, "%s", res_lib.GetResource(res_selection)->GetName().GetData());
- Print(res_lib.GetSize()+3, res_lib.GetResource(res_selection)->GetName().GetSize()+37, ":");
- Print(res_lib.GetSize()+3, res_lib.GetResource(res_selection)->GetName().GetSize()+38, " ");
-
-}
-
-void cEnvironmentScreen::UpdateReaction()
-{
- const cReactionLib & rxn_lib = population.GetEnvironment().GetReactionLib();
- const cResourceLib & res_lib = population.GetEnvironment().GetResourceLib();
-
- SetBoldColor(COLOR_CYAN);
- //int j=0;
- //int last_count=0;
- for(int i=0; i<population.GetStats().GetReactions().GetSize(); i++)
- {
- Print(i+1, 40, "%7.2f", population.GetStats().GetReactions()[i]);
- //if(population.GetResources()[i]/last_count < population.GetResources()[i].
- //Print(i+2, 65, "%7.2f", population.GetResources()[i]/last_count);
- }
-
- SetBoldColor(COLOR_BLUE);
- Print(rxn_selection+1, 1, rxn_lib.GetReaction(rxn_selection)->GetName());
- Print(rxn_selection+1, 40, "%7.2f", population.GetStats().GetReactions()[rxn_selection]);
-
-
- int offset=0;
-
- SetBoldColor(COLOR_CYAN);
- for(int i=0; i<rxn_lib.GetReaction(rxn_selection)->GetProcesses().GetSize(); i++)
- {
- Print(population.GetStats().GetReactions().GetSize()+5+offset, 2,
- rxn_lib.GetReaction(rxn_selection)->GetProcesses().GetPos(i)->GetResource()->GetName());
- Print(population.GetStats().GetReactions().GetSize()+5+offset, 13, "%7.2f",
- rxn_lib.GetReaction(rxn_selection)->GetProcesses().GetPos(i)->GetResource()->GetInflow());
- Print(population.GetStats().GetReactions().GetSize()+5+offset, 25, "%7.2f",
- rxn_lib.GetReaction(rxn_selection)->GetProcesses().GetPos(i)->GetResource()->GetOutflow());
- for(int j=0; j<res_lib.GetSize(); j++)
- {
- if(res_lib.GetResource(j)->GetName() ==
- rxn_lib.GetReaction(rxn_selection)->GetProcesses().GetPos(i)->GetResource()->GetName())
- Print(population.GetStats().GetReactions().GetSize()+5+offset, 40, "%7.2f",
- population.GetResources()[j]);
- }
- offset++;
- }
- SetBoldColor(COLOR_WHITE);
- Print(rxn_lib.GetSize()+3, 37, "%s", rxn_lib.GetReaction(rxn_selection)->GetName().GetData());
- Print(rxn_lib.GetSize()+3, rxn_lib.GetReaction(rxn_selection)->GetName().GetSize()+37, ":");
- Print(rxn_lib.GetSize()+3, rxn_lib.GetReaction(rxn_selection)->GetName().GetSize()+38, " ");
-
-}
-
-void cEnvironmentScreen::DoInput(int in_char)
-{
- int last_selection;
- const cResourceLib & res_lib = population.GetEnvironment().GetResourceLib();
- const cReactionLib & rxn_lib = population.GetEnvironment().GetReactionLib();
- SetBoldColor(COLOR_CYAN);
-
- switch (in_char) {
- case KEY_DOWN:
- if(mode==ENVIRONMENT_MODE_RESOURCE ) {
- last_selection=res_selection;
- res_selection++;
- res_selection%=population.GetResources().GetSize();
-
- Print(last_selection+1, 1, res_lib.GetResource(last_selection)->GetName());
- Print(last_selection+1, 12, "%7.2f", res_lib.GetResource(last_selection)->GetInflow());
- Print(last_selection+1, 24, "%7.2f", res_lib.GetResource(last_selection)->GetOutflow());
- }
- else {
- last_selection=rxn_selection;
- rxn_selection++;
- rxn_selection%=population.GetStats().GetReactions().GetSize();
-
- Print(last_selection+1, 1, rxn_lib.GetReaction(last_selection)->GetName());
- //Print(last_selection+1, 12, "%7.2f", rxn_lib.GetReaction(last_selection)->GetInflow());
- //Print(last_selection+1, 24, "%7.2f", rxn_lib.GetReaction(last_selection)->GetOutflow());
- }
-
- Update();
- break;
- case KEY_UP:
- if(mode==ENVIRONMENT_MODE_RESOURCE) {
- last_selection=res_selection;
- res_selection--;
- if(res_selection < 0) res_selection=population.GetResources().GetSize()-1;
-
- Print(last_selection+1, 1, res_lib.GetResource(last_selection)->GetName());
- Print(last_selection+1, 12, "%7.2f", res_lib.GetResource(last_selection)->GetInflow());
- Print(last_selection+1, 24, "%7.2f", res_lib.GetResource(last_selection)->GetOutflow());
- }
- else {
- last_selection=rxn_selection;
- rxn_selection--;
- if(rxn_selection < 0) rxn_selection=population.GetStats().GetReactions().GetSize()-1;
-
- Print(last_selection+1, 1, rxn_lib.GetReaction(last_selection)->GetName());
- //Print(last_selection+1, 12, "%7.2f", rxn_lib.GetReaction(last_selection)->GetInflow());
- //Print(last_selection+1, 24, "%7.2f", rxn_lib.GetReaction(last_selection)->GetOutflow());
- }
-
- Update();
- break;
- case '>':
- case '<':
- if(mode==ENVIRONMENT_MODE_RESOURCE)
- mode=ENVIRONMENT_MODE_REACTION;
- else
- mode=ENVIRONMENT_MODE_RESOURCE;
- Clear();
- Draw();
- break;
- }
-}
-
Deleted: branches/brysonda/source/viewer/environment_screen.hh
===================================================================
--- branches/brysonda/source/viewer/environment_screen.hh 2005-10-23 04:16:36 UTC (rev 359)
+++ branches/brysonda/source/viewer/environment_screen.hh 2005-10-23 04:43:06 UTC (rev 360)
@@ -1,46 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2001 California Institute of Technology //
-// //
-// Read the COPYING and README files, or contact 'avida at alife.org', //
-// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
-//////////////////////////////////////////////////////////////////////////////
-
-#ifndef VIEW_ENVIRONMENT_SCREEN_HH
-#define VIEW_ENVIRONMENT_SCREEN_HH
-
-#include "text_screen.hh"
-
-class cEnvironmentScreen : public cScreen {
-protected:
- cPopulation & population;
- int mode;
- int res_selection;
- int rxn_selection;
- //int task_offset;
- //int task_rows;
- //int task_cols;
- static const int ENVIRONMENT_MODE_RESOURCE = 0;
- static const int ENVIRONMENT_MODE_REACTION = 1;
-
-public:
- cEnvironmentScreen(int y_size, int x_size, int y_start, int x_start,
- cViewInfo & in_info, cPopulation & in_pop) :
- cScreen(y_size, x_size, y_start, x_start, in_info),
- population(in_pop) { mode=ENVIRONMENT_MODE_RESOURCE; res_selection=rxn_selection=0; }
- //task_rows = Height() - 16;
- // task_cols = Width() / 20;
- //}
- virtual ~cEnvironmentScreen() { ; }
-
- // Virtual in base screen...
- void Draw();
- void Update();
- void DoInput(int in_char);
-
- void DrawResource();
- void DrawReaction();
- void UpdateResource();
- void UpdateReaction();
-};
-
-#endif
Deleted: branches/brysonda/source/viewer/hist_screen.cc
===================================================================
--- branches/brysonda/source/viewer/hist_screen.cc 2005-10-23 04:16:36 UTC (rev 359)
+++ branches/brysonda/source/viewer/hist_screen.cc 2005-10-23 04:43:06 UTC (rev 360)
@@ -1,180 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2001 California Institute of Technology //
-// //
-// Read the COPYING and README files, or contact 'avida at alife.org', //
-// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
-//////////////////////////////////////////////////////////////////////////////
-
-#include <fstream>
-
-#include "cGenebank.h"
-#include "cGenotype.h"
-#include "cSpecies.h"
-
-#include "hist_screen.hh"
-
-
-using namespace std;
-
-
-void cHistScreen::PrintGenotype(cGenotype * in_gen, int in_pos,
- int max_num)
-{
- SetBoldColor(COLOR_CYAN);
- PrintFitness(in_pos, 0, in_gen->GetFitness());
-
- SetBoldColor(COLOR_WHITE);
- Print(in_pos, 8, "%s: ", in_gen->GetName()());
-
- int max_stars = Width() - 28;
- int star_size = (max_num / max_stars);
- if (max_num % max_stars) star_size++;
-
- int cur_num = in_gen->GetNumOrganisms();
- int cur_stars = cur_num / star_size;
- if (cur_num % star_size) cur_stars++;
-
- // Set the color for this bar.
- SetSymbolColor(in_gen->GetSymbol());
-
- // Draw the bar.
- int i;
- for (i = 0; i < cur_stars; i++) {
- cSpecies * cur_species = in_gen->GetSpecies();
- if (cur_species != NULL) {
- Print(in_gen->GetSpecies()->GetSymbol());
- } else {
- Print(CHAR_BULLET);
- }
- }
-
- // Draw the spaces following the bar.
- while (i++ < max_stars) Print(' ');
-
- // Display the true length of the bar (highlighted)
- SetBoldColor(COLOR_WHITE);
- Print(in_pos, Width() - 8, " %5d", cur_num);
-
- // Reset the color to normal
- SetColor(COLOR_WHITE);
-}
-
-void cHistScreen::PrintSpecies(cSpecies * in_species, int in_pos, int max_num)
-{
- // SetBoldColor(COLOR_CYAN);
- // if (in_gen->GetGestationTime())
- // PrintFitness(in_pos, 0, in_gen->GetFitness());
- // else Print(in_pos, 0, " 0.0");
-
- SetBoldColor(COLOR_WHITE);
- Print(in_pos, 0, " sp-%06d: ", in_species->GetID());
-
- int max_stars = Width() - 28;
- int star_size = (max_num / max_stars);
- if (max_num % max_stars) star_size++;
-
- int cur_num = in_species->GetNumOrganisms();
- int cur_stars = cur_num / star_size;
- if (cur_num % star_size) cur_stars++;
-
- // Set the color for this bar.
- SetSymbolColor(in_species->GetSymbol());
-
- // Draw the bar.
- int i;
- for (i = 0; i < cur_stars; i++) {
- Print(in_species->GetSymbol());
- }
-
- // Draw the spaces following the bar.
- while (i++ < max_stars) Print(' ');
-
- // Display the true length of the bar (highlighted)
- SetBoldColor(COLOR_WHITE);
- Print(in_pos, Width() - 8, " %5d", cur_num);
-
- // Reset the color to normal
- SetColor(COLOR_WHITE);
-}
-
-
-void cHistScreen::Draw()
-{
- SetBoldColor(COLOR_WHITE);
- Print(1, 0, "Fitness Name");
- Print(1, 19, "Histogram: [ ]");
- Print(1, 53, "[ ]");
- SetBoldColor(COLOR_CYAN);
- Print(1, 31, '<');
- Print(1, 54, '>');
-
- Update();
-}
-
-void cHistScreen::Update()
-{
- int max_num = 0;
- int i;
-
- switch(mode) {
- case HIST_GENOTYPE:
- max_num = info.GetGenebank().GetBestGenotype()->GetNumOrganisms();
- SetBoldColor(COLOR_WHITE);
- Print(1, 34, "Genotype Abundance");
- // Print out top NUM_SYMBOL genotypes in fixed order.
- for (i = 0; i < info.GetNumSymbols(); i++) {
- if (info.GetGenotype(i)) {
- PrintGenotype(info.GetGenotype(i), i + 2, max_num);
- }
- else {
- Move(i + 2, 0);
- ClearToEOL();
- }
- }
- break;
- case HIST_SPECIES:
- max_num = 0;
- for (i = 0; i < NUM_SYMBOLS; i++) {
- if (info.GetSpecies(i) && info.GetSpecies(i)->GetNumOrganisms()
- > max_num)
- max_num = info.GetSpecies(i)->GetNumOrganisms();
- }
-
- SetBoldColor(COLOR_WHITE);
- Print(1, 34, "Species Abundance");
-
- // Print out top number of symbols species in fixed order.
- for (i = 0; i < info.GetNumSymbols(); i++) {
- if (info.GetSpecies(i)) {
- PrintSpecies(info.GetSpecies(i), i + 2, max_num);
- }
- else {
- Move(i + 2, 0);
- ClearToEOL();
- }
- }
- break;
- }
-
- ClearToBot();
- Refresh();
-}
-
-void cHistScreen::DoInput(int in_char)
-{
- switch(in_char) {
- case '<':
- case ',':
- ++mode %= NUM_HIST;
- Update();
- break;
- case '>':
- case '.':
- mode += NUM_HIST;
- --mode %= NUM_HIST;
- Update();
- break;
- }
-}
-
-
Deleted: branches/brysonda/source/viewer/hist_screen.hh
===================================================================
--- branches/brysonda/source/viewer/hist_screen.hh 2005-10-23 04:16:36 UTC (rev 359)
+++ branches/brysonda/source/viewer/hist_screen.hh 2005-10-23 04:43:06 UTC (rev 360)
@@ -1,44 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2001 California Institute of Technology //
-// //
-// Read the COPYING and README files, or contact 'avida at alife.org', //
-// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
-//////////////////////////////////////////////////////////////////////////////
-
-#ifndef VIEW_HIST_SCREEN_HH
-#define VIEW_HIST_SCREEN_HH
-
-#include "text_screen.hh"
-
-class cGenotype;
-class cSpecies;
-
-#define HIST_GENOTYPE 0
-#define HIST_SPECIES 1
-#define NUM_HIST 2
-
-// Unimplemented histogram modes...
-#define HIST_TASKS 3
-#define HIST_SIZE 4
-
-class cHistScreen : public cScreen {
-protected:
- cPopulation & population;
- int mode;
-
- void PrintGenotype(cGenotype * in_gen, int in_pos, int max_num);
- void PrintSpecies(cSpecies * in_species, int in_pos, int max_num);
-public:
- cHistScreen(int y_size, int x_size, int y_start, int x_start,
- cViewInfo & in_info, cPopulation & in_pop)
- : cScreen(y_size, x_size, y_start, x_start, in_info), population(in_pop)
- { mode = HIST_GENOTYPE; }
- virtual ~cHistScreen() { ; }
-
- // Virtual in base screen...
- void Draw();
- void Update();
- void DoInput(int in_char);
-};
-
-#endif
Deleted: branches/brysonda/source/viewer/map_screen.cc
===================================================================
--- branches/brysonda/source/viewer/map_screen.cc 2005-10-23 04:16:36 UTC (rev 359)
+++ branches/brysonda/source/viewer/map_screen.cc 2005-10-23 04:43:06 UTC (rev 360)
@@ -1,368 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2001 California Institute of Technology //
-// //
-// Read the COPYING and README files, or contact 'avida at alife.org', //
-// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
-//////////////////////////////////////////////////////////////////////////////
-
-#include <fstream>
-
-#include "cGenotype.h"
-#include "cPopulation.h"
-#include "cPopulationCell.h"
-
-#include "map_screen.hh"
-
-
-using namespace std;
-
-
-///////////////////
-// The Map Screen
-///////////////////
-
-cMapScreen::cMapScreen(int _y_size, int _x_size, int _y_start,
- int _x_start, cViewInfo & in_info, cPopulation & in_pop) :
- cScreen(_y_size, _x_size, _y_start, _x_start, in_info),
- x_size(in_pop.GetWorldX()),
- y_size(in_pop.GetWorldY()),
- population(in_pop)
-{
- info.SetActiveCell( &(population.GetCell(0)) );
- CenterActiveCPU();
-}
-
-cMapScreen::~cMapScreen()
-{
-}
-
-void cMapScreen::Draw()
-{
- CenterActiveCPU();
- Update();
-
-}
-void cMapScreen::Update()
-{
- // Get working in multiple modes!!
-
- SetBoldColor(COLOR_WHITE);
-
- const int name_x = Width() - 20;
- const int name_y = Height() - 1;
- if (info.GetMapMode() == MAP_BASIC) Print(name_y, name_x, " Genotype View ");
- else if (info.GetMapMode() == MAP_SPECIES) Print(name_y, name_x, " Species View ");
- else if (info.GetMapMode() == MAP_COMBO) Print(name_y, name_x, " Combo View ");
- else if (info.GetMapMode() == MAP_INJECT) Print(name_y, name_x, " Modified View ");
- else if (info.GetMapMode() == MAP_RESOURCE) Print(name_y, name_x, " Resource View ");
- else if (info.GetMapMode() == MAP_AGE) Print(name_y, name_x, " Age View ");
- else if (info.GetMapMode() == MAP_BREED_TRUE) Print(name_y, name_x, "Breed True View");
- else if (info.GetMapMode() == MAP_PARASITE) Print(name_y, name_x, " Parasite View ");
- else if (info.GetMapMode() == MAP_MUTATIONS) Print(name_y, name_x, " Mutation View ");
- else if (info.GetMapMode() == MAP_THREAD) Print(name_y, name_x, " Thread View ");
- else if (info.GetMapMode() == MAP_LINEAGE) Print(name_y, name_x, " Lineage View ");
-
-
- // Draw the [<] and [>] around the map mode....
- Print(Height() - 1, Width() - 24, "[ ]");
- Print(Height() - 1, Width() - 4, "[ ]");
- SetBoldColor(COLOR_CYAN);
- Print(Height() - 1, Width() - 23, '<');
- Print(Height() - 1, Width() - 3, '>');
- SetColor(COLOR_WHITE);
-
- if (y_size >= Height() && Width() > 60) {
- // Map is too big for the display window (since last line is reserved for
- // the display mode text). Tell users how much is clipped.
- Print(Height() - 1, 0, "* Clipping last %i line(s) *",
- y_size - Height() + 1);
- }
-
- int virtual_x = corner_id % x_size;
- int virtual_y = corner_id / x_size;
-
- info.SetupSymbolMaps(info.GetMapMode(), HasColors());
-
- for (int y = 0; y < Height() - 1 && y < y_size; y++) {
- Move(y, 0);
- int cur_y = (y + virtual_y) % y_size;
- for (int x=0; (AVIDA_MAP_X_SPACING * x) < Width() - 1 && x < x_size; x++){
- int cur_x = (x + virtual_x) % x_size;
- int index = cur_y * x_size + cur_x;
-
- SetSymbolColor(info.ColorSymbol(index));
- if (info.MapSymbol(index) > 0) Print(info.MapSymbol(index));
- else Print(CHAR_BULLET);
-
- // Skip spaces before the next map symbol
- for (int i = 0; i < AVIDA_MAP_X_SPACING - 1; i++) Print(' ');
- }
- }
- SetColor(COLOR_WHITE);
-
- Refresh();
-}
-
-
-void cMapScreen::DoInput(int in_char)
-{
- switch(in_char) {
- case '2':
- case KEY_DOWN:
- corner_id += x_size;
- corner_id %= population.GetSize();
- Update();
- break;
- case '8':
- case KEY_UP:
- corner_id -= x_size;
- if (corner_id < 0) corner_id += population.GetSize();
- Update();
- break;
- case '6':
- case KEY_RIGHT:
- corner_id++;
- if (corner_id == population.GetSize()) corner_id = 0;
- Update();
- break;
- case '4':
- case KEY_LEFT:
- corner_id--;
- if (corner_id < 0) corner_id += population.GetSize();
- Update();
- break;
- case '>':
- case '.':
- info.IncMapMode();
- //++map_mode %= NUM_MAPS;
- Update();
- break;
- case '<':
- case ',':
- info.DecMapMode();
- //map_mode += NUM_MAPS;
- //--map_mode %= NUM_MAPS;
- Update();
- break;
- }
-}
-
-void cMapScreen::CenterActiveCPU()
-{
- assert(x_size > 0 && y_size > 0);
-
- // first find the map position of the active cpu
- int active_x = info.GetActiveID() % x_size;
- int active_y = info.GetActiveID() / x_size;
-
- // Now find the relative position of the corner to adjust for this
- int corner_x = active_x - Width() / (2 * AVIDA_MAP_X_SPACING);
- int corner_y = active_y - Height() / 2;
-
- // Make sure the corner co-ordinates are positive
- if (corner_x < 0) corner_x = (corner_x % x_size) + x_size;
- if (corner_y < 0) corner_y = (corner_y % y_size) + y_size;
-
- // Now, find the ID for these corner co-ordinates
- corner_id = corner_y * x_size + corner_x;
-}
-
-void cMapScreen::CenterXCoord()
-{
- // first find the map position of the active cpu
- int active_x = info.GetActiveID() % x_size;
-
- // Now find the relative position of the corner to adjust for this
- int corner_x = active_x - Width() / (2 * AVIDA_MAP_X_SPACING);
- int corner_y = corner_id / x_size;
-
- // Make sure the corner co-ordinates are positive
- if (corner_x < 0) corner_x = (corner_x % x_size) + x_size;
-
- // finally find the ID for these corner co-ordinates
- corner_id = corner_y * x_size + corner_x;
-}
-
-void cMapScreen::CenterYCoord()
-{
- // first find the map position of the active cpu
- int active_y = info.GetActiveID() / x_size;
-
- // Now find the relative position of the corner to adjust for this
- int corner_x = corner_id % x_size;
- int corner_y = active_y - Height() / 2;
-
- // Make sure the corner co-ordinates are positive
- if (corner_y < 0) corner_y = (corner_y % y_size) + y_size;
-
- // finally find the ID for these corner co-ordinates
- corner_id = corner_y * x_size + corner_x;
-}
-
-void cMapScreen::PlaceCursor()
-{
- int x_offset = info.GetActiveID() - corner_id;
- x_offset %= x_size;
- if (x_offset < 0) x_offset += x_size;
-
- int y_offset = (info.GetActiveID() / x_size) - (corner_id / x_size);
- if (y_offset < 0) y_offset += y_size;
-
- cGenotype * cpu_gen = info.GetActiveGenotype();
-
- if (!cpu_gen) {
- Print(Height() - 1, 33,
- "(%2d, %2d) - (empty) ", info.GetActiveID() % x_size,
- info.GetActiveID() / x_size);
- } else {
- Print(Height() - 1, 33, "(%2d, %2d) - %s",
- info.GetActiveID() % x_size,
- info.GetActiveID() / x_size,
- cpu_gen->GetName()());
- }
-
- if (x_offset == 0 || x_offset == Width()/2 - 1) {
- CenterXCoord();
- Clear();
- Draw();
- PlaceCursor();
- }
- else if (y_offset == 0 || y_offset == Height() - 2) {
- CenterYCoord();
- Clear();
- Draw();
- PlaceCursor();
- }
- else {
- Move(y_offset, x_offset * 2);
- Refresh();
- }
-}
-
-void cMapScreen::Navigate()
-{
- // Setup for choosing a cpu...
-
- CenterActiveCPU();
- Clear();
- Update();
- Print(Height() - 1, 0, "Choose a CPU and press ENTER");
- Refresh();
-
- PlaceCursor();
-
- cPopulationCell * old_cell = info.GetActiveCell();
- int temp_cell_id;
-
- bool finished = false;
- int cur_char;
- int iXMove, iYMove;
-
-#ifdef VIEW_ANSI
- MOUSE_INFO * pmiData; // For mouse input (see ANSI.HH)
- // Map dim's run from 0 to iXMax and 0 to iYMax; use this to regulate
- // cursor position
-
- int iXMax = min(x_size * AVIDA_MAP_X_SPACING, Width()) - 1;
- int iYMax = min(y_size, Height()-1) - 1;
- // extra -1 due to text at bottom
-
- FlushMouseQueue(); // Make sure queue is clear
- EnableMouseEvents(true); // and enable mouse event tracking
-#endif
-
- while (finished == false) {
- iXMove = iYMove = 0; // nothing moves yet
- cur_char = GetInput();
- switch (cur_char) {
- case 'q':
- case 'Q':
- info.SetActiveCell(old_cell);
- finished = true;
- break;
- case '2':
- case KEY_DOWN:
- iYMove = 1;
- break;
- case '8':
- case KEY_UP:
- iYMove = -1;
- break;
- case '4':
- case KEY_LEFT:
- iXMove = -1;
- break;
- case '6':
- case KEY_RIGHT:
- iXMove = 1;
- break;
- case ' ':
- case '\r':
- case '\n':
- finished = true;
- break;
-
-#ifdef VIEW_ANSI
- // Mouse processing code (only works for ANSI right now). Other view
- // methods will need a GetMouseInput() stub before this #IFDEF can
- // come out. #defines and MOUSE_INFO struct defined in ansi.hh
- case KEY_MOUSE:
- if (NULL != (pmiData = GetMouseInput()) &&
- IsCoordInWindow (pmiData->X, pmiData->Y)) {
- // deal with MOUSE_DBLCLICK and MOUSE_CLICK input. Single click
- // moves cursor. Dbl click selects cell and runs '\r' code.
-
- // We already know the click occured within our window
- if (pmiData->iEvent & (MOUSE_DBLCLICK || MOUSE_CLICK)) {
- // Reposition cursor on single or dbl click. Pin the cursor
- // movement within the map region.
- iXMove = min (iXMax, ScreenXToWindow(pmiData->X)) -
- CursorX();
- iYMove = min (iYMax, ScreenYToWindow(pmiData->Y)) -
- CursorY();
- iXMove /= AVIDA_MAP_X_SPACING; // Correct for spaces in horizontal
- }
- // On dbl click, we are done (act like Enter was hit)
- finished = pmiData->iEvent & MOUSE_DBLCLICK;
- }
- delete (pmiData); // free up the storage now
- break;
-#endif
-
- default:
- break;
- } // End of SWITCH
-
- // Now deal with the cursor movement
- temp_cell_id = info.GetActiveID();
- if (iXMove) {
- int i = temp_cell_id % x_size; // column we are in
- temp_cell_id -= i; // cell id, less column
- i += iXMove;
- while (i >= x_size) i -= x_size;
- while (i < 0) i += x_size;
- temp_cell_id += i; // cell id readjusted to new column
- }
- if (iYMove) {
- temp_cell_id += x_size * iYMove;
- while (temp_cell_id >= population.GetSize())
- temp_cell_id -= population.GetSize();
- while (temp_cell_id < 0) temp_cell_id += population.GetSize();
- }
- if (iXMove || iYMove) {
- info.SetActiveCell( &(population.GetCell(temp_cell_id)) );
- PlaceCursor();
- }
- } // End of WHILE
-
-#ifdef VIEW_ANSI
- // Turn off mouse events, flush the queue and we are finished
- EnableMouseEvents (false);
- FlushMouseQueue();
-#endif
-
- CenterActiveCPU(); // Set map w/ active CPU in the center
- Clear();
-}
-
-
Deleted: branches/brysonda/source/viewer/map_screen.hh
===================================================================
--- branches/brysonda/source/viewer/map_screen.hh 2005-10-23 04:16:36 UTC (rev 359)
+++ branches/brysonda/source/viewer/map_screen.hh 2005-10-23 04:43:06 UTC (rev 360)
@@ -1,45 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2000 California Institute of Technology //
-// //
-// Read the COPYING and README files, or contact 'avida at alife.org', //
-// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
-//////////////////////////////////////////////////////////////////////////////
-
-#ifndef VIEW_MAP_SCREEN_HH
-#define VIEW_MAP_SCREEN_HH
-
-#include "text_screen.hh"
-
-#define AVIDA_MAP_X_SPACING 2
-
-class cMapScreen : public cScreen {
-private:
- //int mode;
-
- int x_size;
- int y_size;
- int corner_id;
- cPopulation & population;
-
- // Private Methods...
- void CenterActiveCPU();
- void CenterXCoord();
- void CenterYCoord();
- void PlaceCursor();
-
-public:
- cMapScreen(int y_size, int x_size, int y_start, int x_start,
- cViewInfo & in_info, cPopulation & in_pop);
- ~cMapScreen();
-
- // Virtual in base screen!
- void Draw();
- void Update();
- void DoInput(int in_char);
-
- // Virtual in map screen.
- void Navigate();
-};
-
-
-#endif
Deleted: branches/brysonda/source/viewer/menu.cc
===================================================================
--- branches/brysonda/source/viewer/menu.cc 2005-10-23 04:16:36 UTC (rev 359)
+++ branches/brysonda/source/viewer/menu.cc 2005-10-23 04:43:06 UTC (rev 360)
@@ -1,199 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2001 California Institute of Technology //
-// //
-// Read the COPYING and README files, or contact 'avida at alife.org', //
-// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
-//////////////////////////////////////////////////////////////////////////////
-
-#include "menu.hh"
-
-
-using namespace std;
-
-
-cMenuWindow::cMenuWindow(int menu_size)
-{
- window = NULL;
- option_list = new cString[menu_size];
- key_list = new char[menu_size];
- num_options = menu_size;
- active_id = 0;
-}
-
-cMenuWindow::~cMenuWindow()
-{
- if (window) delete window;
- delete [] option_list;
- delete [] key_list;
-}
-
-void cMenuWindow::AddOption(int option_id, const char * in_option)
-{
- option_list[option_id] = in_option;
- int hot_pos = FindHotkeyPos(in_option);
- key_list[option_id] = (hot_pos == -1) ? -1 : in_option[hot_pos];
-}
-
-int cMenuWindow::Activate()
-{
- int i;
-
- // Calculate number of columns needed and the width of each
-
- max_width = 0;
- for (i = 0; i < num_options; i++) {
- if (max_width < option_list[i].GetSize())
- max_width = option_list[i].GetSize();
- }
-
- // @CAO should make these more flexible.
- int max_lines = title.IsEmpty() ? 20 : 18;
- // int max_cols = 80 / (max_width + 3);
-
- // The minimum number of columns available is determined by the title.
- int min_cols = (title.GetSize() + 2) / (max_width + 2) ;
-
- cols = num_options / max_lines + 1;
- if (cols < min_cols) cols = min_cols;
- lines = num_options / cols;
- if (lines * cols < num_options) lines++; // In case of roundoff error.
-
- // Determine dimenstions for window
- int win_height = lines + 4;
- int win_width = (max_width + 2) * cols + 2;
-
- // Adjust the dimensions to make sure the title will fit.
- if (!title.IsEmpty()) win_height += 2;
- if (win_width < title.GetSize() + 4) win_width = title.GetSize() + 4;
-
- // Create and draw the window.
- window = new cTextWindow(win_height, win_width,
- (23 - win_height) / 2, (80 - win_width) / 2);
- window->Box();
- if (!title.IsEmpty()) {
- window->SetBoldColor(COLOR_WHITE);
-// window->Print (2, 2, title());
- }
-
- for (i = 0; i < num_options; i++) {
- DrawOption(i);
- }
- DrawOption(active_id, true);
- window->Refresh();
-
- // Wait for the results.
- bool finished = false;
- int cur_char;
-
- while (!finished) {
- cur_char = GetInput();
-
- // First see if we have hit a hotkey for an option.
-
- for (i = 0; i < num_options; i++) {
- const char test_char = key_list[i];
- if (test_char != -1 &&
- (test_char == cur_char || test_char - 'A' + 'a' == cur_char)) {
- active_id = i;
- finished = true;
- break;
- }
- }
- if (finished == true) break;
-
- // Then check all of the default options.
- switch (cur_char) {
- case 'q':
- case 'Q':
- // Abort!
- finished = true;
- active_id = -1;
- break;
- case ' ':
- case '\n':
- case '\r':
- // Select current entry.
- finished = true;
- break;
- case KEY_UP:
- MoveActiveID(active_id - 1);
- break;
- case KEY_DOWN:
- MoveActiveID(active_id + 1);
- break;
- case KEY_LEFT:
- MoveActiveID(active_id - lines);
- break;
- case KEY_RIGHT:
- MoveActiveID(active_id + lines);
- break;
- case KEY_HOME:
- MoveActiveID(0);
- break;
-#ifdef KEY_END
- case KEY_END:
- MoveActiveID(num_options - 1);
- break;
-#endif
- }
- }
-
- // Delete the window and return the results.
- delete window;
- window = NULL;
-
- return active_id;
-}
-
-void cMenuWindow::DrawOption(int option_id, bool is_active)
-{
- if (is_active) window->SetBoldColor(COLOR_CYAN);
- else window->SetColor(COLOR_CYAN);
-
- int line_id = option_id % lines;
- int col_id = option_id / lines;
- int x_pos = col_id * (max_width + 2) + 2;
- int y_pos = line_id + ((title.IsEmpty()) ? 2 : 4);
- window->Print(y_pos, x_pos, option_list[option_id]());
-
- int hot_pos = FindHotkeyPos(option_list[option_id]);
- if (hot_pos != -1) {
- window->SetBoldColor(COLOR_WHITE);
- window->Print(y_pos, x_pos + hot_pos, option_list[option_id][hot_pos]);
- }
- window->Move(y_pos, x_pos + option_list[option_id].GetSize());
-}
-
-void cMenuWindow::MoveActiveID(int new_id)
-{
- // Don't do anything if we are not really moving, or else trying to
- // move out of range.
- if (active_id == new_id || new_id < 0 || new_id >= num_options) return;
-
- // Dull out old active ID.
- DrawOption(active_id);
-
- // Reset the active ID.
- active_id = new_id;
- // while (active_id < 0) active_id += num_options;
- // active_id %= num_options;
-
- // Hi-lite the new ID.
- DrawOption(active_id, true);
-
- // Refresh the screen.
- window->Refresh();
-}
-
-int cMenuWindow::FindHotkeyPos(const cString & in_entry)
-{
- int pos = -1;
- while ( (pos = in_entry.Find('[', pos+1)) != -1) {
- if (pos + 2 < in_entry.GetSize() &&
- in_entry[pos + 2] == ']')
- return pos + 1;
- }
-
- return -1;
-}
-
Deleted: branches/brysonda/source/viewer/menu.hh
===================================================================
--- branches/brysonda/source/viewer/menu.hh 2005-10-23 04:16:36 UTC (rev 359)
+++ branches/brysonda/source/viewer/menu.hh 2005-10-23 04:43:06 UTC (rev 360)
@@ -1,45 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2001 California Institute of Technology //
-// //
-// Read the COPYING and README files, or contact 'avida at alife.org', //
-// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
-//////////////////////////////////////////////////////////////////////////////
-
-#ifndef VIEW_MENU_HH
-#define VIEW_MENU_HH
-
-#include "cString.h"
-
-#include "ncurses.hh"
-#include "ansi.hh"
-
-class cMenuWindow {
-private:
- cTextWindow * window;
- cString title;
- cString * option_list;
- char * key_list;
- int num_options;
-
- // menu status variables
- int active_id;
- int max_width;
- int lines;
- int cols;
-
- // Private helper functions
- void DrawOption(int option_id, bool is_active=false);
- void MoveActiveID(int new_id);
- int FindHotkeyPos(const cString & in_entry);
-public:
- cMenuWindow(int menu_size);
- ~cMenuWindow();
-
- void SetTitle(const char * in_title) { title = in_title; }
- void AddOption(int option_id, const char * in_option);
- int Activate();
-
- inline void SetActive(int in_id) { active_id = in_id; }
-};
-
-#endif
Deleted: branches/brysonda/source/viewer/ncurses.cc
===================================================================
--- branches/brysonda/source/viewer/ncurses.cc 2005-10-23 04:16:36 UTC (rev 359)
+++ branches/brysonda/source/viewer/ncurses.cc 2005-10-23 04:43:06 UTC (rev 360)
@@ -1,133 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2003 California Institute of Technology //
-// //
-// Read the COPYING and README files, or contact 'avida at alife.org', //
-// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
-//////////////////////////////////////////////////////////////////////////////
-
-#include "ncurses.hh"
-
-#include <stdlib.h>
-
-
-using namespace std;
-
-
-////////////////////
-// cTextWindow
-////////////////////
-
-void cTextWindow::NoDelay() {
- nodelay(stdscr, 1); // Don't wait for input if no key is pressed.
-}
-
-cTextWindow::cTextWindow(int y_size, int x_size, int y_start, int x_start)
-{
- win_id = newwin(y_size, x_size, y_start, x_start);
- keypad(win_id, 1); // Allows the keypad to be used.
- NoDelay();
-}
-
-cTextWindow::cTextWindow()
-{
- win_id = NULL;
-}
-
-cTextWindow::~cTextWindow()
-{
- werase(win_id);
- wrefresh(win_id);
- delwin(win_id);
-}
-
-void cTextWindow::Construct(int y_size, int x_size, int y_start, int x_start)
-{
- assert (win_id == NULL);
-
- win_id = newwin(y_size, x_size, y_start, x_start);
- keypad(win_id, 1); // Allows the keypad to be used.
-}
-
-void cTextWindow::Box(int x, int y, int w, int h)
-{
- int i;
- for (i = 1; i < h - 1; i++) {
- mvwaddch(win_id, i + y, x, ACS_VLINE);
- mvwaddch(win_id, i + y, x + w - 1, ACS_VLINE);
- }
- for (i = 1; i < w - 1; i++) {
- mvwaddch(win_id, y, i + x, ACS_HLINE);
- mvwaddch(win_id, y + h - 1, i + x, ACS_HLINE);
- }
- mvwaddch(win_id, y, x, ACS_ULCORNER);
- mvwaddch(win_id, y + h - 1, x, ACS_LLCORNER);
- mvwaddch(win_id, y, x + w - 1, ACS_URCORNER);
- mvwaddch(win_id, y + h - 1, x + w - 1, ACS_LRCORNER);
-}
-
-void cTextWindow::VLine(int in_x)
-{
- mvwaddch(win_id, 0, in_x, ACS_TTEE);
- mvwaddch(win_id, Height() - 1, in_x, ACS_BTEE);
- for (int i = 1; i < Height() - 1; i++) {
- mvwaddch(win_id, i, in_x, ACS_VLINE);
- }
-}
-
-void cTextWindow::HLine(int in_y)
-{
- mvwaddch(win_id, in_y, 0, ACS_LTEE);
- mvwaddch(win_id, in_y, Width() - 1, ACS_RTEE);
- for (int i = 1; i < Width() - 1; i++) {
- mvwaddch(win_id, in_y, i, ACS_HLINE);
- }
-}
-
-void cTextWindow::HLine(int in_y, int start_x, int length)
-{
- mvwaddch(win_id, in_y, start_x, ACS_LTEE);
- mvwaddch(win_id, in_y, start_x + length - 1, ACS_RTEE);
- for (int i = 1; i < length - 1; i++) {
- mvwaddch(win_id, in_y, start_x + i, ACS_HLINE);
- }
-}
-
-
-/////////////////////////
-// Other functions...
-/////////////////////////
-
-void StartProg()
-{
- initscr(); // Set up the terminal for curses.
- cbreak(); // Don't buffer input.
- 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.
-
- // Setup colors
-
- if (has_colors()) start_color();
- init_pair(COLOR_WHITE, COLOR_WHITE, COLOR_BLACK);
- init_pair(COLOR_GREEN, COLOR_GREEN, COLOR_BLACK);
- init_pair(COLOR_RED, COLOR_RED, COLOR_BLACK);
- init_pair(COLOR_BLUE, COLOR_BLUE, COLOR_BLACK);
- init_pair(COLOR_CYAN, COLOR_CYAN, COLOR_BLACK);
- init_pair(COLOR_YELLOW, COLOR_YELLOW, COLOR_BLACK);
- init_pair(COLOR_MAGENTA, COLOR_MAGENTA, COLOR_BLACK);
- init_pair(COLOR_OFF, COLOR_BLACK, COLOR_BLACK);
-}
-
-void EndProg(int ignore)
-{
- 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.
-
- printf ("Exit Code: %d\n", ignore);
-
- exit(0);
-}
-
Deleted: branches/brysonda/source/viewer/ncurses.hh
===================================================================
--- branches/brysonda/source/viewer/ncurses.hh 2005-10-23 04:16:36 UTC (rev 359)
+++ branches/brysonda/source/viewer/ncurses.hh 2005-10-23 04:43:06 UTC (rev 360)
@@ -1,135 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2001 California Institute of Technology //
-// //
-// Read the COPYING and README files, or contact 'avida at alife.org', //
-// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
-//////////////////////////////////////////////////////////////////////////////
-
-#ifndef VIEW_NCURSES_HH
-#define VIEW_NCURSES_HH
-
-#ifdef HAVE_NCURSES_H
-#include <ncurses.h>
-#else
-#include <curses.h>
-#endif
-
-#include <signal.h>
-
-#include "text_window.hh"
-#include <cstdarg>
-using namespace std;
-
-
-// All colors are defines except black on black:
-#define COLOR_OFF 8
-
-// Define special characters
-
-#define CHAR_TTEE ACS_TTEE
-#define CHAR_BTEE ACS_BTEE
-#define CHAR_LTEE ACS_LTEE
-#define CHAR_RTEE ACS_RTEE
-#define CHAR_PLUS ACS_PLUS
-#define CHAR_HLINE ACS_HLINE
-#define CHAR_VLINE ACS_VLINE
-#define CHAR_ULCORNER ACS_ULCORNER
-#define CHAR_URCORNER ACS_URCORNER
-#define CHAR_LLCORNER ACS_LLCORNER
-#define CHAR_LRCORNER ACS_LRCORNER
-#define CHAR_BULLET '#' // ACS_BULLET
-
-// We need three special functions: One to initialize the viewer, one to
-// close it up, and one to interactively get inputs from the buffer without
-// needing <return> to be pressed.
-
-void StartProg();
-void EndProg(int ignore);
-inline int GetInput() { return getch(); }
-
-//inline int GetBlockingInput() {
-// nodelay(stdscr, FALSE);
-// char c = getch();
-// nodelay(stdscr, TRUE);
-// return c; }
-
-class cTextWindow : public cBaseTextWindow {
-protected:
- WINDOW * win_id;
-
- void NoDelay();
-public:
- cTextWindow();
- cTextWindow(int y_size, int x_size, int y_start=0, int x_start=0);
- ~cTextWindow();
-
- void Construct(int y_size, int x_size, int y_start=0, int x_start=0);
-
- // These function return the number of characters wide or high
- // (respectively) that the screen is.
- inline int Width() { return win_id->_maxx + 1; }
- inline int Height() { return win_id->_maxy + 1; }
-
- // Clear the screen and redraw all text on it.
- inline void RedrawMain() { touchwin(win_id); wrefresh(win_id); }
-
- // Move the active position of the cursor.
- inline void Move(int new_y, int new_x) { wmove(win_id, new_y, new_x); }
-
- // Print all of the changes made onto the screen.
- inline void RefreshMain() { wrefresh(win_id); }
-
- // These functions clear sections of the screen.
- inline void ClearMain() { wclear(win_id); }
- inline void ClearToBot() { wclrtobot(win_id); }
- inline void ClearToEOL() { wclrtoeol(win_id); }
-
- // Various 'graphic' functions. Box() draws a box-frame around the window.
- // With arguments, it draws a box starting at x, y, with size w by h.
- // VLine and HLine draw lines across the screen ending in the appropriate
- // facing T's (hence, they are used to cut boxes in half. With two
- // coords and a length, they only draw the line from the specified start,
- // to the specified distance.
- inline void Box() { box(win_id, 0, 0); }
- void Box(int x, int y, int w, int h);
- void VLine(int in_x);
- void HLine(int in_y);
- void HLine(int in_y, int start_x, int length);
-
- // The following functions print characters onto the screen. If they
- // begin with an y, x then they first move to those coords.
-
- inline void Print(chtype ch) { waddch(win_id, ch); }
- inline void Print(int in_y, int in_x, chtype ch)
- { mvwaddch(win_id, in_y, in_x, ch); }
- inline void Print(const char * fmt, ...) {
- va_list argp;
- char buf[BUFSIZ];
-
- va_start(argp, fmt);
- vsprintf(buf, fmt, argp);
- va_end(argp);
- waddstr(win_id, buf);
- }
- inline void Print(int in_y, int in_x, const char * fmt, ...) {
- va_list argp;
- char buf[BUFSIZ];
-
- va_start(argp, fmt);
- vsprintf(buf, fmt, argp);
- va_end(argp);
- wmove(win_id, in_y, in_x);
- waddstr(win_id, buf);
- }
-
- // These functions check or set the screen colors (BG is always black)
- inline int HasColors() { return has_colors(); }
- inline void SetColor(int color) {
- wattrset(win_id, COLOR_PAIR(color));
- }
- inline void SetBoldColor(int color) {
- wattrset(win_id, COLOR_PAIR(color) | A_BOLD);
- }
-};
-
-#endif
Deleted: branches/brysonda/source/viewer/options_screen.cc
===================================================================
--- branches/brysonda/source/viewer/options_screen.cc 2005-10-23 04:16:36 UTC (rev 359)
+++ branches/brysonda/source/viewer/options_screen.cc 2005-10-23 04:43:06 UTC (rev 360)
@@ -1,186 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2001 California Institute of Technology //
-// //
-// Read the COPYING and README files, or contact 'avida at alife.org', //
-// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
-//////////////////////////////////////////////////////////////////////////////
-
-#include "cConfig.h"
-#include "cPopulation.h"
-
-#include "options_screen.hh"
-
-
-using namespace std;
-
-
-///////////////////////
-// The Basic Options
-///////////////////////
-
-void cOptionsScreen::Draw()
-{
- // Options - Used: ABCEIMOPQRSVWZ
-
- SetBoldColor(COLOR_WHITE);
-
- Print(5, 0, "Max Updates..:");
- Print(6, 0, "World Size...:");
- Print(7, 0, "Random Seed..:");
- Print(8, 0, "Threshold....:");
-
- Print(11, 0, "Inst Set.....:");
- Print(12, 0, "Environment..:");
- Print(13, 0, "Events File..:");
-
- Print(1, 40, "Time Slicing.:");
- Print(2, 40, "Task Merit...:");
- Print(3, 40, "Size Merit...:");
- Print(4, 40, "Birth Method.:");
- Print(5, 40, "Ave TimeSlice:");
-
- Print(7, 40, "Point Mut:");
- Print(8, 40, "Copy Mut:");
- Print(9, 40, "Divide Mut: Ins: Del:");
-
- Print(1, 0, "Current CPU..:");
- Print(2, 0, "Genotype.....:");
- Print(3, 0, "ID #.........:");
-
- // SetBoldColor(COLOR_WHITE);
- // Print(Height() - 5, 2, "-- Screen --");
- Print(Height() - 4, 2, "[H]istogram Screen");
- Print(Height() - 3, 2, "[B]lank Screen");
- Print(Height() - 2, 2, "[CTRL-L] Redraw Screen");
-
- Print(Height() - 4, 30, "[C]hoose New CPU");
- Print(Height() - 3, 30, "E[x]tract Creature");
- // Print(Height() - 3, 30, "[I]nject Creature");
- Print(Height() - 2, 30, "[W]rite Soup Clone");
-
- // Print(Height() - 5, 55, "[V]iew Instructions");
- if (info.GetPauseLevel()) {
- Print(Height() - 4, 55, "Un-[P]ause");
- Print(Height() - 3, 55, "[N]ext Update");
- } else {
- Print(Height() - 4, 55, "[P]ause ");
- Print(Height() - 3, 55, " ");
- }
-
- SetBoldColor(COLOR_CYAN);
- Print(Height() - 4, 3, 'H');
- Print(Height() - 3, 3, 'B');
- Print(Height() - 2, 3, "CTRL-L");
-
- Print(Height() - 4, 31, 'C');
- Print(Height() - 3, 32, 'x');
- Print(Height() - 2, 31, 'W');
- if (info.GetPauseLevel()) {
- Print(Height() - 4, 59, 'P');
- Print(Height() - 3, 56, 'N');
- } else {
- Print(Height() - 4, 56, 'P');
- }
-
- SetColor(COLOR_WHITE);
- Box(0, Height() - 5, Width(), 5);
-
- SetBoldColor(COLOR_CYAN);
- Print(5, 15, "%d", cConfig::GetMaxUpdates());
- Print(6, 15, "%dx%d", info.GetPopulation().GetWorldX(),
- info.GetPopulation().GetWorldY());
- Print(7, 15, "%d", g_random.GetSeed());
- Print(8, 15, "%d", cConfig::GetThreshold());
-
- Print(11, 15, "%s", cConfig::GetInstFilename()());
- Print(12, 15, "%s", cConfig::GetEnvironmentFilename()());
- Print(13, 15, "%s", cConfig::GetEventFilename()());
-
- switch(cConfig::GetSlicingMethod()) {
- case SLICE_CONSTANT:
- Print(1, 55, "Constant");
- break;
- case SLICE_PROB_MERIT:
- Print(1, 55, "Probablistic");
- break;
- case SLICE_INTEGRATED_MERIT:
- Print(1, 55, "Integrated");
- break;
- }
-
- switch(cConfig::GetTaskMeritMethod()) {
- case TASK_MERIT_NONE:
- Print(2, 55, "No Task Bonuses");
- break;
- case TASK_MERIT_NORMAL:
- Print(2, 55, "Normal");
- break;
- }
-
- switch(cConfig::GetSizeMeritMethod()) {
- case SIZE_MERIT_OFF:
- Print(3, 55, "Off");
- break;
- case SIZE_MERIT_COPIED:
- Print(3, 55, "Copied Size");
- break;
- case SIZE_MERIT_EXECUTED:
- Print(3, 55, "Executed Size");
- break;
- case SIZE_MERIT_FULL:
- Print(3, 55, "Full Size");
- break;
- case SIZE_MERIT_LEAST:
- Print(3, 55, "Least Size");
- break;
- }
-
- switch(cConfig::GetBirthMethod()) {
- case POSITION_CHILD_AGE:
- Print(4, 55, "Replace max age");
- break;
- case POSITION_CHILD_MERIT:
- Print(4, 55, "Replace max age/merit");
- break;
- case POSITION_CHILD_RANDOM:
- Print(4, 55, "Replace random");
- break;
- case POSITION_CHILD_EMPTY:
- Print(4, 55, "Place in empty only");
- break;
- }
-
- Print(5, 55, "%d", cConfig::GetAveTimeslice());
-
- Print(7, 52, "%.3f", cConfig::GetPointMutProb());
- Print(8, 52, "%.3f", cConfig::GetCopyMutProb());
- Print(9, 52, "%.3f", cConfig::GetDivideMutProb());
- Print(9, 62, "%.3f", cConfig::GetDivideInsProb());
- Print(9, 72, "%.3f", cConfig::GetDivideDelProb());
-
- SetColor(COLOR_WHITE);
-
- Update();
- Refresh();
-}
-
-
-void cOptionsScreen::Update()
-{
- if (info.GetActiveCell() == NULL)
- info.SetActiveCell( &(info.GetPopulation().GetCell(0)) );
- if (!info.GetActiveGenotype()) return;
-
- SetBoldColor(COLOR_CYAN);
- Print(1, 15, "(%d, %d)",
- info.GetActiveID() % info.GetPopulation().GetWorldX(),
- info.GetActiveID() / info.GetPopulation().GetWorldY());
- Print(2, 15, "%s", info.GetActiveName()());
- Print(3, 15, "%d", info.GetActiveID());
-
- SetColor(COLOR_WHITE);
-
- Refresh();
-}
-
-
Deleted: branches/brysonda/source/viewer/options_screen.hh
===================================================================
--- branches/brysonda/source/viewer/options_screen.hh 2005-10-23 04:16:36 UTC (rev 359)
+++ branches/brysonda/source/viewer/options_screen.hh 2005-10-23 04:43:06 UTC (rev 360)
@@ -1,27 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2001 California Institute of Technology //
-// //
-// Read the COPYING and README files, or contact 'avida at alife.org', //
-// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
-//////////////////////////////////////////////////////////////////////////////
-
-#ifndef VIEW_OPTIONS_SCREEN_HH
-#define VIEW_OPTIONS_SCREEN_HH
-
-#include "text_screen.hh"
-
-class cOptionsScreen : public cScreen {
-protected:
-public:
- cOptionsScreen(int y_size, int x_size, int y_start, int x_start,
- cViewInfo & in_info) :
- cScreen(y_size, x_size, y_start, x_start, in_info) { ; }
- ~cOptionsScreen() { ; }
-
- // Virtual in base screen...
- void Draw();
- void Update();
- void DoInput(int in_char) { (void) in_char; }
-};
-
-#endif
Deleted: branches/brysonda/source/viewer/stats_screen.cc
===================================================================
--- branches/brysonda/source/viewer/stats_screen.cc 2005-10-23 04:16:36 UTC (rev 359)
+++ branches/brysonda/source/viewer/stats_screen.cc 2005-10-23 04:43:06 UTC (rev 360)
@@ -1,213 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2001 California Institute of Technology //
-// //
-// Read the COPYING and README files, or contact 'avida at alife.org', //
-// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
-//////////////////////////////////////////////////////////////////////////////
-
-#include "cConfig.h"
-#include "cEnvironment.h"
-#include "cGenebank.h"
-#include "cGenotype.h"
-#include "cPopulation.h"
-#include "cSpecies.h"
-#include "cStats.h"
-
-#ifndef TASK_ENTRY_HH
-#include "cTaskEntry.h"
-#endif
-
-#include "stats_screen.hh"
-
-
-using namespace std;
-
-
-void cStatsScreen::Draw()
-{
- SetBoldColor(COLOR_WHITE);
-
- // Print(0, 0, "--- Soup Status ---");
- Print(1, 0, "Tot Births.:");
- Print(2, 0, "Breed True.:");
- Print(3, 0, "Parasites..:");
- Print(4, 0, "Energy.....:");
- Print(5, 0, "Max Fitness:");
- Print(6, 0, "Max Merit..:");
-
- Print(1, 23, "-- Dominant Genotype --");
- Print(2, 23, "Name........:");
- Print(3, 23, "ID..........:");
- Print(4, 23, "Species ID..:");
- Print(5, 23, "Age.........:");
-
- Print(8, 11, "Current Total Ave Age Entropy");
- Print(9, 0, "Creatures:");
- Print(10, 0, "Genotypes:");
- Print(11, 0, "Threshold:");
- Print(12, 0, "Species..:");
-
- Print(1, 61, "Dominant Average");
- Print(2, 50, "Fitness..:");
- Print(3, 50, "Merit....:");
- Print(4, 50, "Gestation:");
- Print(5, 50, "Size.....:");
- Print(6, 50, "Copy Size:");
- Print(7, 50, "Exec Size:");
- Print(8, 50, "Abundance:");
- Print(9, 50, "Births...:");
- Print(10, 50, "BirthRate:");
- Print(11, 50, "TreeDepth:");
- Print(12, 50, "Gen. Ave.:");
-
-
- int task_num = task_offset;
- const cTaskLib & task_lib = population.GetEnvironment().GetTaskLib();
- for (int col_id = 3; task_num < cConfig::GetNumTasks(); col_id += 20) {
- if (col_id + 16 > Width()) break;
- for (int row_id = 15;
- row_id < 15 + task_rows && task_num < cConfig::GetNumTasks();
- row_id++) {
- Print(row_id, col_id, ".........:");
- Print(row_id, col_id, "%s", task_lib.GetTask(task_num).GetName()());
- task_num++;
- }
- }
-
- SetColor(COLOR_WHITE);
-
- Box(0, 14, Width(), task_rows + 2);
-
- if (task_num < cConfig::GetNumTasks() || task_offset != 0) {
- SetBoldColor(COLOR_WHITE);
- Print(15 + task_rows, Width() - 20, " [<-] More [->] ");
- SetBoldColor(COLOR_CYAN);
- Print(15 + task_rows, Width() - 18, "<-");
- Print(15 + task_rows, Width() - 8, "->");
- }
-
- Update();
-}
-
-void cStatsScreen::Update()
-{
- cGenotype * best_gen = population.GetGenebank().GetBestGenotype();
-
- SetBoldColor(COLOR_CYAN);
-
- cStats & stats = population.GetStats();
-
- Print(1, 13, "%7d", stats.GetNumBirths());
- Print(2, 13, "%7d", stats.GetBreedTrue());
- Print(3, 13, "%7d", stats.GetNumParasites());
- Print(4, 13, "%7.2f", stats.GetEnergy());
- PrintFitness(5, 13, stats.GetMaxFitness());
- // Print(5, 13, "%.1e", stats.GetMaxFitness());
- Print(6, 13, "%.1e", stats.GetMaxMerit());
-
- Print(9, 13, "%5d", stats.GetNumCreatures());
- Print(10, 13, "%5d", stats.GetNumGenotypes());
- Print(11, 13, "%5d", stats.GetNumThreshold());
- Print(12, 13, "%5d", stats.GetNumSpecies());
-
- Print(2, 37, "%s", best_gen->GetName()());
- Print(3, 37, "%9d", best_gen->GetID());
- Print(4, 37, "%9d", (best_gen->GetSpecies()) ?
- (best_gen->GetSpecies()->GetID()) : -1);
- Print(5, 37, "%9d", stats.GetUpdate() - best_gen->GetUpdateBorn());
-
- Print(9, 20, "%.1e", (double) stats.GetTotCreatures());
- Print(10, 20, "%.1e", (double) stats.GetTotGenotypes());
- Print(11, 20, "%.1e", (double) stats.GetTotThreshold());
- Print(12, 20, "%.1e", (double) stats.GetTotSpecies());
-
- Print(9, 30, "%6.1f", stats.GetAveCreatureAge());
- Print(10, 30, "%6.1f", stats.GetAveGenotypeAge());
- Print(11, 30, "%6.1f", stats.GetAveThresholdAge());
- Print(12, 30, "%6.1f", stats.GetAveSpeciesAge());
-
- Print(9, 39, "%6.2f",
- log((double) stats.GetNumCreatures()));
- Print(10, 39, "%6.2f", stats.GetEntropy());
- Print(12, 39, "%6.2f", stats.GetSpeciesEntropy());
-
- PrintFitness(2, 62, best_gen->GetFitness());
- // Print(2, 62, "%.1e", best_gen->GetFitness());
- //PrintMerit(3, 62, best_gen->GetMerit());
- Print(3, 62, "%.1e", best_gen->GetMerit());
- Print(4, 63, "%6.2f", best_gen->GetGestationTime());
- Print(5, 63, "%6d", best_gen->GetLength());
- Print(6, 63, "%6.2f", best_gen->GetCopiedSize());
- Print(7, 63, "%6.2f", best_gen->GetExecutedSize());
- Print(8, 63, "%6d", best_gen->GetNumOrganisms());
- Print(9, 63, "%6d", best_gen->GetThisBirths());
- if (stats.GetAveMerit() == 0) {
- Print(10, 66, "0.0");
- } else {
- Print(10, 63, "%6.3f", ((double) cConfig::GetAveTimeslice()) * best_gen->GetFitness() / stats.GetAveMerit());
- }
- Print(11, 63, "%6d", best_gen->GetDepth());
- // Print(12, 63, "");
-
- PrintFitness(2, 71, stats.GetAveFitness());
- Print(3, 71, "%.1e", stats.GetAveMerit());
- //PrintMerit(3, 72, stats.GetAveMerit());
- Print(4, 72, "%6.1f", stats.GetAveGestation());
- Print(5, 72, "%6.1f", stats.GetAveSize());
- Print(6, 72, "%6.1f", stats.GetAveCopySize());
- Print(7, 72, "%6.1f", stats.GetAveExeSize());
- Print(8, 71, "%7.2f",
- ((double) stats.GetNumCreatures()) /
- ((double) stats.GetNumGenotypes()));
- // @CAO this next line should be get num births, which doesn't exist!
- Print(9, 70, "%8.3f",
- ((double) stats.GetNumDeaths()) /
- ((double) stats.GetNumGenotypes()));
- if (stats.GetAveMerit() != 0) {
- Print(10, 71, "%7.3f", ((double) cConfig::GetAveTimeslice()) * stats.GetAveFitness() / stats.GetAveMerit());
- } else {
- Print(10, 71, "%7.3f", 0.0);
- }
- Print(11, 72, "%6.2f", stats.SumGenotypeDepth().Average());
- Print(12, 72, "%6.2f", stats.SumGeneration().Average());
-
- // This section needs to be changed to work with new task_lib @TCC
- int task_num = task_offset;
- for (int col_id = 14; task_num < cConfig::GetNumTasks(); col_id += 20) {
- if (col_id + 5 > Width()) break;
- for (int row_id = 15;
- row_id < 15 + task_rows && task_num < cConfig::GetNumTasks();
- row_id++) {
- Print(row_id, col_id, "%4d", stats.GetTaskLastCount(task_num));
- task_num++;
- }
- }
-
- SetColor(COLOR_WHITE);
-
- Refresh();
-}
-
-void cStatsScreen::DoInput(int in_char)
-{
- switch (in_char) {
- case '4':
- case KEY_LEFT:
- if (task_offset > 0) {
- task_offset -= 5;
- Draw();
- }
- break;
- case '6':
- case KEY_RIGHT:
- if (task_rows * task_cols + task_offset < cConfig::GetNumTasks()) {
- task_offset += 5;
- Draw();
- }
- break;
- default:
- // g_debug.Warning("Unknown Command (#%d): [%c]", in_char, in_char);
- break;
- }
-}
-
Deleted: branches/brysonda/source/viewer/stats_screen.hh
===================================================================
--- branches/brysonda/source/viewer/stats_screen.hh 2005-10-23 04:16:36 UTC (rev 359)
+++ branches/brysonda/source/viewer/stats_screen.hh 2005-10-23 04:43:06 UTC (rev 360)
@@ -1,35 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2001 California Institute of Technology //
-// //
-// Read the COPYING and README files, or contact 'avida at alife.org', //
-// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
-//////////////////////////////////////////////////////////////////////////////
-
-#ifndef VIEW_STATS_SCREEN_HH
-#define VIEW_STATS_SCREEN_HH
-
-#include "text_screen.hh"
-
-class cStatsScreen : public cScreen {
-protected:
- cPopulation & population;
- int task_offset;
- int task_rows;
- int task_cols;
-public:
- cStatsScreen(int y_size, int x_size, int y_start, int x_start,
- cViewInfo & in_info, cPopulation & in_pop) :
- cScreen(y_size, x_size, y_start, x_start, in_info),
- population(in_pop), task_offset(0) {
- task_rows = Height() - 16;
- task_cols = Width() / 20;
- }
- virtual ~cStatsScreen() { ; }
-
- // Virtual in base screen...
- void Draw();
- void Update();
- void DoInput(int in_char);
-};
-
-#endif
Deleted: branches/brysonda/source/viewer/symbol_util.cc
===================================================================
--- branches/brysonda/source/viewer/symbol_util.cc 2005-10-23 04:16:36 UTC (rev 359)
+++ branches/brysonda/source/viewer/symbol_util.cc 2005-10-23 04:43:06 UTC (rev 360)
@@ -1,142 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2001 California Institute of Technology //
-// //
-// Read the COPYING and README files, or contact 'avida at alife.org', //
-// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
-//////////////////////////////////////////////////////////////////////////////
-
-#include <fstream>
-
-#include "symbol_util.hh"
-
-#include "cGenotype.h"
-#include "cOrganism.h"
-#include "cPopulationCell.h"
-#include "cSpecies.h"
-#include "cConfig.h"
-#include "cHardwareBase.h"
-#include "cHardware4Stack.h"
-#include "cHardwareCPU.h"
-#include "cHardwareSMT.h"
-
-using namespace std;
-
-
-char cSymbolUtil::GetBasicSymbol(const cPopulationCell & cell)
-{
- if (cell.IsOccupied() == false) return ' ';
- const cOrganism & organism = *(cell.GetOrganism());
- return organism.GetGenotype()->GetSymbol();
-}
-
-char cSymbolUtil::GetSpeciesSymbol(const cPopulationCell & cell)
-{
- if (cell.IsOccupied() == false) return ' ';
- const cOrganism & organism = *(cell.GetOrganism());
-
- cSpecies * cur_species = organism.GetGenotype()->GetSpecies();
- if (cur_species == NULL) return '.'; // no species
- return cur_species->GetSymbol(); // symbol!
-}
-
-char cSymbolUtil::GetModifiedSymbol(const cPopulationCell & cell)
-{
- if (cell.IsOccupied() == false) return ' ';
- const cOrganism & organism = *(cell.GetOrganism());
-
- const bool modifier = organism.GetPhenotype().IsModifier();
- const bool modified = organism.GetPhenotype().IsModified();
-
- // 'I' = Injector 'H' = Host (Injected into)
- // 'B' = Both '-' = Neither
-
- if (modifier == true && modified == true) return 'B';
- if (modifier == true) return 'I'-6;
- if (modified == true) return 'H'-6;
- return '-';
-}
-
-char cSymbolUtil::GetResourceSymbol(const cPopulationCell & cell)
-{
- // @CAO Not Implemented yet...
- if (cell.IsOccupied() == false) return ' ';
- return '.';
-}
-
-char cSymbolUtil::GetAgeSymbol(const cPopulationCell & cell)
-{
- if (cell.IsOccupied() == false) return ' ';
- const cOrganism & organism = *(cell.GetOrganism());
-
- const int age = organism.GetPhenotype().GetAge();
- if (age < 0) return '-';
- if (age < 10) return (char) ('0' + age);
- if (age < 20) return 'X';
- if (age < 80) return 'L';
- if (age < 200) return 'C';
-
- return '+';
-}
-
-char cSymbolUtil::GetBreedSymbol(const cPopulationCell & cell)
-{
- if (cell.IsOccupied() == false) return ' ';
- const cOrganism & organism = *(cell.GetOrganism());
-
- if (organism.GetPhenotype().ParentTrue() == true) return '*';
- return '-';
-}
-
-char cSymbolUtil::GetParasiteSymbol(const cPopulationCell & cell)
-{
- if (cell.IsOccupied() == false) return ' ';
- const cOrganism & organism = *(cell.GetOrganism());
-
- if (organism.GetPhenotype().IsParasite() == true) return '*';
- return '-';
-}
-
-char cSymbolUtil::GetMutSymbol(const cPopulationCell & cell)
-{
- if (cell.IsOccupied() == false) return ' ';
- const cOrganism & organism = *(cell.GetOrganism());
-
- if (organism.GetPhenotype().IsMutated() == true) return '*';
- return '-';
-}
-
-char cSymbolUtil::GetThreadSymbol(const cPopulationCell & cell)
-{
- if (cell.IsOccupied() == false) return ' ';
-// const cOrganism & organism = *(cell.GetOrganism());
-
-// int thread_count = organism->GetHardware()->GetNumThreads();
-// if (thread_count < 0) return '-';
-// if (thread_count < 10) return (char) ('0' + thread_count);
-// if (thread_count < 20) return 'X';
-// if (thread_count < 80) return 'L';
-// if (thread_count < 200) return 'C';
- //const cHardwareBase * hardware;
- int num_threads;
- switch (cConfig::GetHardwareType())
- {
- case HARDWARE_TYPE_CPU_ORIGINAL:
- num_threads = ((cHardwareCPU &) cell.GetOrganism()->GetHardware()).GetNumThreads();
- return (char) ('0' + num_threads);
- case HARDWARE_TYPE_CPU_4STACK:
- num_threads = ((cHardware4Stack &) cell.GetOrganism()->GetHardware()).GetNumThreads();
- return (char) ('0' + num_threads);
- case HARDWARE_TYPE_CPU_SMT:
- num_threads = static_cast<cHardwareSMT&>(cell.GetOrganism()->GetHardware()).GetNumThreads();
- return (char) ('0' + num_threads);
- }
-}
-
-char cSymbolUtil::GetLineageSymbol(const cPopulationCell & cell)
-{
- if (cell.IsOccupied() == false) return ' ';
- const cOrganism & organism = *(cell.GetOrganism());
-
- return 'A' + (organism.GetLineageLabel() % 12);
-}
-
Deleted: branches/brysonda/source/viewer/symbol_util.hh
===================================================================
--- branches/brysonda/source/viewer/symbol_util.hh 2005-10-23 04:16:36 UTC (rev 359)
+++ branches/brysonda/source/viewer/symbol_util.hh 2005-10-23 04:43:06 UTC (rev 360)
@@ -1,27 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2001 California Institute of Technology //
-// //
-// Read the COPYING and README files, or contact 'avida at alife.org', //
-// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
-//////////////////////////////////////////////////////////////////////////////
-
-#ifndef SYMBOL_UTIL_HH
-#define SYMBOL_UTIL_HH
-
-class cPopulationCell;
-
-class cSymbolUtil {
-public:
- static char GetBasicSymbol( const cPopulationCell & cell );
- static char GetSpeciesSymbol( const cPopulationCell & cell );
- static char GetModifiedSymbol( const cPopulationCell & cell );
- static char GetResourceSymbol( const cPopulationCell & cell );
- static char GetAgeSymbol( const cPopulationCell & cell );
- static char GetBreedSymbol( const cPopulationCell & cell );
- static char GetParasiteSymbol( const cPopulationCell & cell );
- static char GetMutSymbol( const cPopulationCell & cell );
- static char GetThreadSymbol( const cPopulationCell & cell );
- static char GetLineageSymbol( const cPopulationCell & cell );
-};
-
-#endif
Deleted: branches/brysonda/source/viewer/text_screen.cc
===================================================================
--- branches/brysonda/source/viewer/text_screen.cc 2005-10-23 04:16:36 UTC (rev 359)
+++ branches/brysonda/source/viewer/text_screen.cc 2005-10-23 04:43:06 UTC (rev 360)
@@ -1,244 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2001 California Institute of Technology //
-// //
-// Read the COPYING and README files, or contact 'avida at alife.org', //
-// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
-//////////////////////////////////////////////////////////////////////////////
-
-#include <fstream>
-
-#include "cSpecies.h"
-#include "cGenotype.h"
-#include "cGenebank.h"
-#include "cInjectGenotype.h"
-#include "cInjectGenebank.h"
-#include "cPopulation.h"
-#include "cPopulationCell.h"
-#include "cOrganism.h"
-
-#include "symbol_util.hh"
-#include "text_screen.hh"
-
-
-using namespace std;
-
-
-cViewInfo::cViewInfo(cPopulation & in_population) : population(in_population)
-{
- active_cell = NULL;
- pause_level = PAUSE_OFF;
- saved_inst_set = NULL;
- thread_lock = -1;
- step_organism_id = -1;
- map_mode=0;
-
- // Handle genotype & species managing...
-
- for (int i = 0; i < NUM_SYMBOLS; i++) {
- genotype_chart[i] = NULL;
- species_chart[i] = NULL;
- symbol_chart[i] = (char) (i + 'A');
- }
-}
-
-void cViewInfo::AddGenChart(cGenotype * in_gen)
-{
- for (int i = 0; i < NUM_SYMBOLS; i++) {
- if (genotype_chart[i] == NULL) {
- genotype_chart[i] = in_gen;
- in_gen->SetSymbol(symbol_chart[i]);
- break;
- }
- }
-}
-
-void cViewInfo::AddSpeciesChart(cSpecies * in_species)
-{
- for (int i = 0; i < NUM_SYMBOLS; i++) {
- if (species_chart[i] == NULL) {
- species_chart[i] = in_species;
- in_species->SetSymbol(symbol_chart[i]);
- break;
- }
- }
-}
-
-void cViewInfo::AddInjectGenChart(cInjectGenotype * in_gen)
-{
- for (int i = 0; i < NUM_SYMBOLS; i++) {
- if (inject_genotype_chart[i] == NULL) {
- inject_genotype_chart[i] = in_gen;
- in_gen->SetSymbol(symbol_chart[i]);
- break;
- }
- }
-}
-
-void cViewInfo::SetupSymbolMaps(int map_mode, bool use_color)
-{
- typedef char (*SymbolMethod)(const cPopulationCell & cell);
- SymbolMethod map_method = NULL;
- SymbolMethod color_method = NULL;
-
- switch (map_mode) {
- case MAP_BASIC:
- if (use_color) color_method = &cSymbolUtil::GetBasicSymbol;
- else map_method = &cSymbolUtil::GetBasicSymbol;
- break;
- case MAP_SPECIES:
- if (use_color) color_method = &cSymbolUtil::GetSpeciesSymbol;
- else map_method = &cSymbolUtil::GetSpeciesSymbol;
- break;
- case MAP_COMBO:
- color_method = &cSymbolUtil::GetBasicSymbol;
- map_method = &cSymbolUtil::GetSpeciesSymbol;
- break;
- case MAP_INJECT:
- if (use_color) color_method = &cSymbolUtil::GetModifiedSymbol;
- else map_method = &cSymbolUtil::GetModifiedSymbol;
- break;
- case MAP_RESOURCE:
- map_method = &cSymbolUtil::GetResourceSymbol;
- break;
- case MAP_AGE:
- map_method = &cSymbolUtil::GetAgeSymbol;
- break;
- case MAP_BREED_TRUE:
- if (use_color) color_method = &cSymbolUtil::GetBreedSymbol;
- else map_method = &cSymbolUtil::GetBreedSymbol;
- break;
- case MAP_PARASITE:
- if (use_color) color_method = &cSymbolUtil::GetParasiteSymbol;
- else map_method = &cSymbolUtil::GetParasiteSymbol;
- break;
- case MAP_MUTATIONS:
- if (use_color) color_method = &cSymbolUtil::GetMutSymbol;
- else map_method = &cSymbolUtil::GetMutSymbol;
- break;
- case MAP_THREAD:
- //if (use_color) color_method = &cSymbolUtil::GetThreadSymbol;
- map_method = &cSymbolUtil::GetThreadSymbol;
- break;
- case MAP_LINEAGE:
- if (use_color) color_method = &cSymbolUtil::GetLineageSymbol;
- else map_method = &cSymbolUtil::GetLineageSymbol;
- break;
- }
-
- const int num_cells = population.GetSize();
- map.Resize(num_cells);
- color_map.Resize(num_cells);
-
- for (int i = 0; i < num_cells; i++) {
- if (map_method == 0) map[i] = 0;
- else map[i] = (*map_method)(population.GetCell(i));
-
- if (color_method == 0) color_map[i] = 0;
- else color_map[i] = (*color_method)(population.GetCell(i));
- }
-
-}
-
-
-void cViewInfo::UpdateSymbols()
-{
- // First, clean up the genotype_chart & species_chart.
-
- int i, pos;
- for (i = 0; i < NUM_SYMBOLS; i++) {
- if (genotype_chart[i]) {
- pos = GetGenebank().FindPos(*(genotype_chart[i]));
- if (pos < 0) genotype_chart[i] = NULL;
- if (pos >= NUM_SYMBOLS) {
- if (genotype_chart[i]->GetThreshold())
- genotype_chart[i]->SetSymbol('+');
- else genotype_chart[i]->SetSymbol('.');
- genotype_chart[i] = NULL;
- }
- }
- if (species_chart[i]) {
- pos = GetGenebank().FindPos(*(species_chart[i]));
- if (pos < 0) species_chart[i] = NULL;
- if (pos >= NUM_SYMBOLS) {
- species_chart[i]->SetSymbol('+');
- species_chart[i] = NULL;
- }
- }
- }
-
- // Now, fill in any missing spaces...
-
- cGenotype * temp_gen = GetGenebank().GetBestGenotype();
- cSpecies * temp_species = GetGenebank().GetFirstSpecies();
- for (i = 0; i < SYMBOL_THRESHOLD; i++) {
- if (temp_gen) {
- if (!InGenChart(temp_gen)) AddGenChart(temp_gen);
- temp_gen = temp_gen->GetNext();
- }
- if (temp_species) {
- if (!InSpeciesChart(temp_species)) AddSpeciesChart(temp_species);
- temp_species = temp_species->GetNext();
- }
- }
-}
-
-
-void cViewInfo::EngageStepMode()
-{
- // Steps can only be taken through the execution of a cpu when avida is
- // paused, and focued on an active cpu.
- if ( pause_level == PAUSE_ON && active_cell != NULL ) {
- pause_level = PAUSE_ADVANCE_STEP;
- SetStepOrganism( active_cell->GetID() );
- }
-}
-
-void cViewInfo::DisEngageStepMode()
-{
- SetStepOrganism(-1);
-}
-
-cGenebank & cViewInfo::GetGenebank()
-{
- return population.GetGenebank();
-}
-
-cGenotype * cViewInfo::GetActiveGenotype()
-{
- if (active_cell != NULL && active_cell->IsOccupied()) {
- return active_cell->GetOrganism()->GetGenotype();
- }
-
- return NULL;
-}
-
-
-cSpecies * cViewInfo::GetActiveSpecies()
-{
- if (GetActiveGenotype() == NULL) return NULL;
- return GetActiveGenotype()->GetSpecies();
-}
-
-
-cString cViewInfo::GetActiveName()
-{
- if (GetActiveGenotype() == NULL) return cString("");
- return GetActiveGenotype()->GetName();
-}
-
-int cViewInfo::GetActiveID()
-{
- if (active_cell) return active_cell->GetID();
- return -1;
-}
-
-int cViewInfo::GetActiveGenotypeID()
-{
- return GetActiveGenotype() ? GetActiveGenotype()->GetID() : -1;
-}
-
-int cViewInfo::GetActiveSpeciesID()
-{
- return GetActiveSpecies() ? GetActiveSpecies()->GetID() : -1;
-}
-
Deleted: branches/brysonda/source/viewer/text_screen.hh
===================================================================
--- branches/brysonda/source/viewer/text_screen.hh 2005-10-23 04:16:36 UTC (rev 359)
+++ branches/brysonda/source/viewer/text_screen.hh 2005-10-23 04:43:06 UTC (rev 360)
@@ -1,266 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2001 California Institute of Technology //
-// //
-// Read the COPYING and README files, or contact 'avida at alife.org', //
-// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
-//////////////////////////////////////////////////////////////////////////////
-
-#ifndef VIEW_TEXT_SCREEN_HH
-#define VIEW_TEXT_SCREEN_HH
-
-
-#include "cMerit.h"
-#include "cInstSet.h"
-#include "defs.h"
-
-#include "ncurses.hh"
-#include "ansi.hh"
-
-class cEnvironment;
-class cSpecies;
-class cGenotype;
-class cPopulation;
-class cPopulationCell;
-class cOrganism;
-class cGenebank;
-class cInjectGenotype;
-class cInjectGenebank;
-
-#define NUM_SYMBOLS 12
-#define SYMBOL_THRESHOLD 10
-
-#define PAUSE_OFF 0
-#define PAUSE_ON 1
-#define PAUSE_ADVANCE_STEP 2
-#define PAUSE_ADVANCE_UPDATE 3
-#define PAUSE_ADVANCE_GESTATION 4
-
-
-#define MAP_BASIC 0
-#define MAP_SPECIES 1
-#define MAP_BREED_TRUE 2
-#define MAP_PARASITE 3
-#define MAP_MUTATIONS 4
-#define MAP_THREAD 5
-#define MAP_INJECT 6
-#define MAP_LINEAGE 7
-#define NUM_MAPS 8
-
-// Other map modes currently inactive...
-#define MAP_COMBO 9
-#define MAP_RESOURCE 10
-#define MAP_AGE 11
-#define NUM_MAP_MODES 12
-
-
-class cViewInfo {
-private:
- cPopulation & population;
- cPopulationCell * active_cell;
-
- int pause_level;
- int thread_lock;
- int step_organism_id;
- int map_mode;
-
- // Instruction Libraries.
- cInstSet const * saved_inst_set;
- cInstSet alt_inst_set;
-
- // Symbol information
- cGenotype * genotype_chart[NUM_SYMBOLS];
- cSpecies * species_chart[NUM_SYMBOLS];
- cInjectGenotype * inject_genotype_chart[NUM_SYMBOLS];
- char symbol_chart[NUM_SYMBOLS];
-
- tArray<char> map;
- tArray<char> color_map;
-
- inline bool InGenChart(cGenotype * in_gen);
- inline bool InSpeciesChart(cSpecies * in_species);
- inline bool InInjectGenChart(cInjectGenotype * in_gen);
- void AddGenChart(cGenotype * in_gen);
- void AddSpeciesChart(cSpecies * in_species);
- void AddInjectGenChart(cInjectGenotype * in_gen);
-public:
- cViewInfo(cPopulation & in_population);
- ~cViewInfo() { ; }
-
- void UpdateSymbols();
- void SetupSymbolMaps(int map_mode, bool use_color);
- tArray<char> & GetMap() { return map; }
- tArray<char> & GetColorMap() { return color_map; }
- char & MapSymbol(int pos) { return map[pos]; }
- char & ColorSymbol(int pos) { return color_map[pos]; }
- int GetMapMode() { return map_mode; }
- void IncMapMode() { ++map_mode%=NUM_MAPS; }
- void DecMapMode();
-
- void EngageStepMode();
- void DisEngageStepMode();
-
- cGenebank & GetGenebank();
- cPopulation & GetPopulation() { return population; }
-
- int GetNumSymbols() { return NUM_SYMBOLS; }
- cGenotype * GetGenotype(int index) { return genotype_chart[index]; }
- cSpecies * GetSpecies(int index) { return species_chart[index]; }
- cInjectGenotype * GetInjectGenotype(int index) { return inject_genotype_chart[index]; }
-
- cPopulationCell * GetActiveCell() { return active_cell; }
-
- cGenotype * GetActiveGenotype();
- cSpecies * GetActiveSpecies();
- cString GetActiveName();
-
- int GetActiveID();
- int GetActiveGenotypeID();
- int GetActiveSpeciesID();
-
- void SetActiveCell(cPopulationCell * in_cell) { active_cell = in_cell; }
-
- int GetPauseLevel() { return pause_level; }
- int GetThreadLock() { return thread_lock; }
- int GetStepOrganism() { return step_organism_id; }
-
- void SetPauseLevel(int in_level) { pause_level = in_level; }
- void SetThreadLock(int in_lock) { thread_lock = in_lock; }
- void SetStepOrganism(int in_id) { step_organism_id = in_id; }
-};
-
-class cScreen : public cTextWindow {
-protected:
- cViewInfo & info;
-
- inline void SetSymbolColor(char color);
- inline void PrintMerit(int in_y, int in_x, cMerit in_merit);
- inline void PrintFitness(int in_y, int in_x, double in_fitness);
-public:
- cScreen(int y_size, int x_size, int y_start, int x_start,
- cViewInfo & in_info) :
- cTextWindow(y_size, x_size, y_start, x_start), info(in_info) { ; }
- virtual ~cScreen() { ; }
-
- virtual void Draw() = 0;
- virtual void Update() = 0;
- virtual void AdvanceUpdate() { ; }
- virtual void DoInput(int in_char) = 0;
- virtual void DoMouseClick(int x, int y) { (void) x; (void) y; }
- virtual void Exit() { ; }
-};
-
-
-
-///////////////
-// cViewInfo
-///////////////
-
-inline void cViewInfo::DecMapMode()
-{
- map_mode+=NUM_MAPS;
- --map_mode %= NUM_MAPS;
-}
-
-inline bool cViewInfo::InGenChart(cGenotype * in_gen)
-{
- for (int i = 0; i < NUM_SYMBOLS; i++) {
- if (genotype_chart[i] == in_gen) return true;
- }
- return false;
-}
-
-inline bool cViewInfo::InSpeciesChart(cSpecies * in_species)
-{
- for (int i = 0; i < NUM_SYMBOLS; i++) {
- if (species_chart[i] == in_species) return true;
- }
- return false;
-}
-
-inline bool cViewInfo::InInjectGenChart(cInjectGenotype * in_gen)
-{
- for (int i = 0; i < NUM_SYMBOLS; i++) {
- if (inject_genotype_chart[i] == in_gen) return true;
- }
- return false;
-}
-
-
-/////////////
-// cScreen
-/////////////
-
-inline void cScreen::SetSymbolColor(char color)
-{
- switch (color) {
- case '.':
- case '-':
- SetColor(COLOR_WHITE);
- break;
- case '*':
- case '+':
- case '1':
- SetBoldColor(COLOR_WHITE);
- break;
- case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F':
- SetBoldColor((int) color - 'A' + 1);
- break;
- case 'G':
- case 'H':
- case 'I':
- case 'J':
- case 'K':
- case 'L':
- SetColor((int) color - 'G' + 1);
- break;
- case ' ':
- SetColor(COLOR_OFF);
- break;
- case '0':
- default:
- SetColor(COLOR_WHITE);
- break;
- }
-}
-
-inline void cScreen::PrintMerit(int in_y, int in_x, cMerit in_merit)
-{
- // if we can print the merit normally, do so.
- //if (in_merit.GetDouble() < 1000000) {
- //Print(in_y, in_x, "%7d", in_merit.GetUInt());
- //}
-
- // otherwise use scientific notation. (or somesuch)
- //else {
- Print(in_y, in_x, "%7.1e", in_merit.GetDouble());
- //}
-}
-
-inline void cScreen::PrintFitness(int in_y, int in_x, double in_fitness)
-{
- // If we can print the fitness, do so!
- if (in_fitness <= 0.0) {
- Print(in_y, in_x, " 0.0000");
- }
- else if (in_fitness < 10)
- Print(in_y, in_x, "%7.4f", in_fitness);
- // else if (in_fitness < 100)
- // Print(in_y, in_x, "%7.3f", in_fitness);
- else if (in_fitness < 1000)
- Print(in_y, in_x, "%7.2f", in_fitness);
- // else if (in_fitness < 10000)
- // Print(in_y, in_x, "%7.1f", in_fitness);
- else if (in_fitness < 100000)
- Print(in_y, in_x, "%7.0f", in_fitness);
-
- // Otherwise use scientific notations.
- else
- Print(in_y, in_x, "%7.1e", in_fitness);
-}
-
-#endif
Deleted: branches/brysonda/source/viewer/text_window.hh
===================================================================
--- branches/brysonda/source/viewer/text_window.hh 2005-10-23 04:16:36 UTC (rev 359)
+++ branches/brysonda/source/viewer/text_window.hh 2005-10-23 04:43:06 UTC (rev 360)
@@ -1,144 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2001 California Institute of Technology //
-// //
-// Read the COPYING and README files, or contact 'avida at alife.org', //
-// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
-//////////////////////////////////////////////////////////////////////////////
-
-#ifndef VIEW_TEXT_WINDOW_HH
-#define VIEW_TEXT_WINDOW_HH
-
-#include <assert.h>
-#include "cTools.h"
-
-// class cTextWindow;
-
-#define MAX_SUB_WINDOWS 4
-
-class cCoords {
-private:
- int x;
- int y;
-public:
- cCoords(int _x, int _y) { x = _x, y = _y; }
- cCoords(const cCoords & _coords) { x = _coords.x, y = _coords.y; }
- ~cCoords() { ; }
-
- void Translate(int _x, int _y) { x += _x, y += _y; }
-
- void operator=(const cCoords & _coords) { x = _coords.x, y = _coords.y; }
- int operator==(const cCoords & _c) { return (x == _c.x && y == _c.y); }
- int operator!=(const cCoords & _c) { return !operator==(_c); }
-
- int GetX() { return x; }
- int GetY() { return y; }
-
- void Set(int _x, int _y) { x = _x; y = _y; }
-};
-
-
-class cBaseTextWindow {
-protected:
- cBaseTextWindow * sub_windows[MAX_SUB_WINDOWS];
-public:
- cBaseTextWindow() {
- for (int i = 0; i < MAX_SUB_WINDOWS; i++) sub_windows[i] = NULL;
- }
- virtual ~cBaseTextWindow() {
- for (int i = 0; i < MAX_SUB_WINDOWS; i++) {
- if (sub_windows[i]) delete sub_windows[i];
- }
- }
-
-
- // Dealing with sub-windows...
- virtual void AddSubWindow(cBaseTextWindow * in_win, int id) {
- assert (sub_windows[id] == NULL);
- sub_windows[id] = in_win;
- }
- virtual void RemoveSubWindow(int id) {
- assert (sub_windows[id] != NULL);
- sub_windows[id] = NULL;
- }
- virtual void CloseSubWindow(int id) {
- assert (sub_windows[id] != NULL);
- delete sub_windows[id];
- sub_windows[id] = NULL;
- }
- virtual cBaseTextWindow * GetSubWindow(int id) { return sub_windows[id]; }
-
-
- // Interface...
- virtual void Construct(int y_size, int x_size,
- int y_start=0, int x_start=0) = 0;
-
- // These function return the number of characters wide or high
- // (respectively) that the screen is.
- virtual int Width() = 0;
- virtual int Height() = 0;
-
- // Clear the screen and redraw all text on it.
- virtual void Redraw() {
- RedrawMain();
- for (int i = 0; i < MAX_SUB_WINDOWS; i++) {
- if (sub_windows[i]) sub_windows[i]->Redraw();
- }
- }
- virtual void RedrawMain() = 0;
-
- // Move the active position of the cursor.
- virtual void Move(int new_y, int new_x) = 0;
-
- // Print all of the changes made onto the screen.
- virtual void Refresh() {
- RefreshMain();
- for (int i = 0; i < MAX_SUB_WINDOWS; i++) {
- if (sub_windows[i]) sub_windows[i]->Refresh();
- }
- }
- virtual void RefreshMain() = 0;
-
- // These functions clear sections of the screen.
- virtual void Clear() {
- ClearMain();
- for (int i = 0; i < MAX_SUB_WINDOWS; i++) {
- if (sub_windows[i]) sub_windows[i]->Clear();
- }
- }
- virtual void ClearMain() = 0;
- virtual void ClearToBot() = 0;
- virtual void ClearToEOL() = 0;
-
- // Various 'graphic' functions. Box() draws a box-frame around the window.
- // With arguments, it draws a box starting at x, y, with size w by h.
- // VLine and HLine draw lines across the screen ending in the appropriate
- // facing T's (hence, they are used to cut boxes in half. With two
- // coords and a length, they only draw the line from the specified start,
- // to the specified distance.
- virtual void Box() = 0;
- virtual void Box(int x, int y, int w, int h) = 0;
- virtual void VLine(int in_x) = 0;
- virtual void HLine(int in_y) = 0;
- virtual void HLine(int in_y, int start_x, int length) = 0;
-
- // The following functions print characters onto the screen. If they
- // begin with an y, x then they first move to those coords.
-
- virtual void Print(chtype ch) = 0;
- virtual void Print(int in_y, int in_x, chtype ch) = 0;
- virtual void Print(const char * fmt, ...) = 0;
- virtual void Print(int in_y, int in_x, const char * fmt, ...) = 0;
- inline void PrintBinary(int in_y, int in_x, UINT value) {
- for (int i = 0; i < 32; i++) {
- if ((value >> i) & 1) Print(in_y, in_x+31-i, '1');
- else Print(in_y, in_x+31-i, '0');
- }
- }
-
- // These functions check or set the screen colors (BG is always black)
- virtual int HasColors() = 0;
- virtual void SetColor(int color) = 0;
- virtual void SetBoldColor(int color) = 0;
-};
-
-#endif
Deleted: branches/brysonda/source/viewer/view.cc
===================================================================
--- branches/brysonda/source/viewer/view.cc 2005-10-23 04:16:36 UTC (rev 359)
+++ branches/brysonda/source/viewer/view.cc 2005-10-23 04:43:06 UTC (rev 360)
@@ -1,499 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2001 California Institute of Technology //
-// //
-// Read the COPYING and README files, or contact 'avida at alife.org', //
-// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
-//////////////////////////////////////////////////////////////////////////////
-
-#include <fstream>
-
-#ifndef ENVIRONMENT_HH
-#include "cEnvironment.h"
-#endif
-#include "cGenotype.h"
-#include "cOrganism.h"
-#include "cPhenotype.h"
-#include "cPopulation.h"
-#include "cPopulationCell.h"
-#include "cStats.h"
-
-#include "cTestUtil.h"
-#include "cHardwareBase.h"
-
-#include "view.hh"
-#include "menu.hh"
-
-#include "ncurses.hh"
-#include "ansi.hh"
-
-#include "bar_screen.hh"
-#include "map_screen.hh"
-#include "stats_screen.hh"
-#include "hist_screen.hh"
-#include "options_screen.hh"
-#include "zoom_screen.hh"
-#include "environment_screen.hh"
-
-
-using namespace std;
-
-
-cTextWindow * cView::base_window = NULL;
-cScreen * cView::cur_screen = NULL;
-cBarScreen * cView::bar_screen = NULL;
-
-//////////////////
-// cView
-//////////////////
-
-cView::cView(cPopulation & in_population) :
- info( in_population )
-{
- Setup("Avida");
-
- map_screen = new cMapScreen (0,0,3,0,info, in_population);
- stats_screen = new cStatsScreen (0,0,3,0,info, in_population);
- hist_screen = new cHistScreen (0,0,3,0,info, in_population);
- options_screen = new cOptionsScreen (0,0,3,0,info);
- zoom_screen = new cZoomScreen (0,0,3,0,info, in_population);
- environment_screen = new cEnvironmentScreen (0,0,3,0,info, in_population);
-
- info.SetActiveCell( &( in_population.GetCell(0) ) );
-}
-
-cView::~cView()
-{
- if (map_screen) delete map_screen;
- if (stats_screen) delete stats_screen;
- if (hist_screen) delete hist_screen;
- if (options_screen) delete options_screen;
- if (zoom_screen) delete zoom_screen;
- if (environment_screen) delete environment_screen;
-
- EndProg(0);
-}
-
-void cView::Setup(const cString & in_name)
-{
- cur_screen = NULL;
-
- // Setup text-interface
-
- StartProg();
-
- bar_screen = new cBarScreen(3, 0, 0, 0, info, in_name, info.GetPopulation());
- base_window = new cTextWindow(0,0,3,0);
- bar_screen->Draw();
-}
-
-void cView::SetViewMode(int in_mode)
-{
- if (in_mode == MODE_BLANK) {
- cur_screen = NULL;
- } else if (in_mode == MODE_MAP) {
- cur_screen = map_screen;
- } else if (in_mode == MODE_STATS) {
- cur_screen = stats_screen;
- } else if (in_mode == MODE_HIST) {
- cur_screen = hist_screen;
- } else if (in_mode == MODE_OPTIONS) {
- cur_screen = options_screen;
- } else if (in_mode == MODE_ZOOM) {
- cur_screen = zoom_screen;
- } else if (in_mode == MODE_ENVIRONMENT) {
- cur_screen = environment_screen;
- }
-}
-
-void cView::Refresh()
-{
- ChangeCurScreen(cur_screen); bar_screen->Redraw();
-}
-
-void cView::Redraw()
-{
- bar_screen->Redraw();
- if (cur_screen) cur_screen->Redraw();
- else base_window->Redraw();
-}
-
-void cView::NewUpdate()
-{
- if (info.GetPauseLevel() == PAUSE_ADVANCE_STEP){
- return;
- }
- NotifyUpdate();
-}
-
-void cView::NotifyUpdate()
-{
- // If we're locked onto a specific thread, only stop for it.
- /*if (info.GetPauseLevel() == PAUSE_ADVANCE_STEP &&
- info.GetThreadLock() != -1 &&
- info.GetThreadLock() != info.GetActiveCell()->GetOrganism()->GetHardware().ViewerLock()){
- return;
- }*/
-
-
- bar_screen->Update();
- info.UpdateSymbols();
-
- if (cur_screen) cur_screen->Update();
- DoInputs();
-}
-
-void cView::NotifyError(const cString & in_string)
-{
- cString out_string(in_string);
- out_string.Insert("Error: ");
- Notify(out_string);
- EndProg(1);
-}
-
-void cView::NotifyWarning(const cString & in_string)
-{
- cString out_string(in_string);
- out_string.Insert("Warning: ");
- Notify(out_string);
-}
-
-void cView::NotifyComment(const cString & in_string)
-{
- cString out_string(in_string);
- Notify(out_string);
-}
-
-void cView::DoBreakpoint()
-{
- if (info.GetPauseLevel() == PAUSE_OFF ||
- info.GetPauseLevel() == PAUSE_ADVANCE_UPDATE) {
- Pause();
- NotifyUpdate();
- }
-}
-
-void cView::DoInputs()
-{
- // If we are in step-wise mode, "finish" this step!
-
- if (info.GetPauseLevel() == PAUSE_ADVANCE_STEP) {
- info.DisEngageStepMode();
- info.SetPauseLevel(PAUSE_ON);
- }
-
- int cur_char = ERR;
- // int cur_char = 0; // *** If GetBlockingInput works, use this ***
-
- // If there is any input in the buffer, process all of it.
-
- while ((cur_char = GetInput()) != ERR || info.GetPauseLevel() == PAUSE_ON) {
-
- // *** If GetBlockingInput works, use this ***
- // while( cur_char != ERR ){
- // if paused, block on input
- // if( info.GetPauseLevel() == PAUSE_ON ){
- // cur_char = GetBlockingInput();
- // }else{
- // cur_char = GetInput();
- // }
-
- switch (cur_char) {
- // Note: Capital 'Q' quits w/o confirming.
- case 'q':
- if (!Confirm("Are you sure you want to quit?")) break;
- case 'Q':
- // clear the windows before we go. Do bar window last to end at top.
- base_window->Redraw();
- bar_screen->Clear();
- bar_screen->Refresh();
- EndProg(0); // This implementation calls exit(), blowing us clean away
- break;
- case 'b':
- case 'B':
- ChangeCurScreen(NULL);
- break;
- case 'C':
- case 'c':
- NavigateMapWindow();
- // Now we need to restore the proper window mode (already cleared)
- ChangeCurScreen(cur_screen);
- break;
- case 'h':
- case 'H':
- ChangeCurScreen(hist_screen);
- break;
- case 'm':
- case 'M':
- ChangeCurScreen(map_screen);
- break;
- case 'n':
- case 'N':
- if (info.GetPauseLevel() == PAUSE_ON) {
- info.SetPauseLevel(PAUSE_ADVANCE_UPDATE);
- // parasite_zoom = false; // if executing, show code that is running
- info.GetActiveCell()->GetOrganism()->GetPhenotype().SetFault("");
- }
- if (cur_screen) cur_screen->AdvanceUpdate();
- break;
- case 'o':
- case 'O':
- ChangeCurScreen(options_screen);
- break;
- case 'p':
- case 'P':
- TogglePause();
- break;
- case 'e':
- case 'E':
- if(info.GetPopulation().GetEnvironment().GetResourceLib().GetSize() > 0)
- ChangeCurScreen(environment_screen);
- break;
- case 's':
- case 'S':
- ChangeCurScreen(stats_screen);
- break;
- case 'W':
- case 'w':
- CloneSoup();
- break;
- case 'X':
- case 'x':
- ExtractCreature();
- break;
- case 'z':
- case 'Z':
- ChangeCurScreen(zoom_screen);
- break;
- case 12: // Ideally this is CTRL-L...
- Refresh();
- break;
-
- case '*': // Test Key!!!
- if (true) {
- Confirm("Starting Tests.");
- cMenuWindow menu(50);
- char message[40];
- for (int j = 0; j < 50; j++) {
- sprintf(message, "Line %d", j);
- menu.AddOption(j, message);
- }
- menu.SetActive(3);
- menu.Activate();
- Redraw();
- }
- break;
- case ERR:
- break;
- default:
- if (cur_screen) cur_screen->DoInput(cur_char);
- break;
- }
- }
-
- if (info.GetPauseLevel() == PAUSE_ADVANCE_UPDATE) {
- info.SetPauseLevel(PAUSE_ON);
- }
-}
-
-void cView::TogglePause()
-{
- // If the run is already paused, un-pause it!
- if (info.GetPauseLevel() != PAUSE_OFF) {
- info.DisEngageStepMode();
- info.SetPauseLevel(PAUSE_OFF);
- info.GetActiveCell()->GetOrganism()->GetPhenotype().SetFault("");
- }
-
- // Otherwise, turn on the pause.
- else {
- info.SetPauseLevel(PAUSE_ON);
- }
-
- // Redraw the screen to account for the toggled pause.
- if (cur_screen) cur_screen->Draw();
-}
-
-void cView::CloneSoup()
-{
- cString filename;
- filename.Set("clone.%d", info.GetPopulation().GetUpdate());
- ofstream fp(filename());
- info.GetPopulation().SaveClone(fp);
- cString message;
- message.Set("Saved clone to file: %s", filename());
- Notify(message);
-}
-
-void cView::ExtractCreature()
-{
- cGenotype * cur_gen = info.GetActiveGenotype();
- cString gen_name = cur_gen->GetName();
-
- if (gen_name == "(no name)")
- gen_name.Set("%03d-unnamed", cur_gen->GetLength());
-
- if (cur_screen) cur_screen->Print(20, 0, "Extracting %s...", gen_name());
-
- cTestUtil::PrintGenome(cur_gen->GetGenome(), gen_name);
-
- if (cur_screen) {
- cur_screen->Print(20, 24, "Done.");
- cur_screen->Refresh();
- }
-}
-
-
-void cView::ChangeCurScreen(cScreen * new_screen)
-{
- if (cur_screen) cur_screen->Exit();
-
- cur_screen = new_screen;
- base_window->Redraw();
- bar_screen->Redraw();
- if (cur_screen) {
- cur_screen->Clear();
- cur_screen->Draw();
- }
-}
-
-void cView::PrintMerit(int in_y, int in_x, cMerit in_merit)
-{
- // if we can print the merit normally, do so.
- //if (in_merit.GetDouble() < 1000000) {
- //if (cur_screen) cur_screen->Print(in_y, in_x, "%7d", in_merit.GetUInt());
- //}
-
- // otherwise use scientific notation. (or somesuch)
- //else {
- if (cur_screen) cur_screen->Print(in_y, in_x, "%7.1e", in_merit.GetDouble());
- //}
-}
-
-void cView::PrintFitness(int in_y, int in_x, double in_fitness)
-{
- if (!cur_screen) return;
-
- // If we can print the fitness, do so!
- if (in_fitness <= 0.0) {
- cur_screen->Print(in_y, in_x, " 0.0000");
- }
- else if (in_fitness < 10)
- cur_screen->Print(in_y, in_x, "%7.4f", in_fitness);
- // else if (in_fitness < 100)
- // cur_screen->Print(in_y, in_x, "%7.3f", in_fitness);
- else if (in_fitness < 1000)
- cur_screen->Print(in_y, in_x, "%7.2f", in_fitness);
- // else if (in_fitness < 10000)
- // cur_screen->Print(in_y, in_x, "%7.1f", in_fitness);
- else if (in_fitness < 100000)
- cur_screen->Print(in_y, in_x, "%7.0f", in_fitness);
-
- // Otherwise use scientific notations.
- else
- cur_screen->Print(in_y, in_x, "%7.1e", in_fitness);
-}
-
-void cView::NavigateMapWindow()
-{
- map_screen->Navigate();
-}
-
-
-int cView::Confirm(const cString & message)
-{
- int mess_length = message.GetSize();
-
- // Create a confirm window, and draw it on the screen.
-
- cTextWindow * conf_win
- = new cTextWindow(3, mess_length + 10, 10, (70 - mess_length) / 2);
- conf_win->Box();
- conf_win->SetBoldColor(COLOR_WHITE);
- conf_win->Print(1, 2, "%s (y/n)", message());
- conf_win->SetBoldColor(COLOR_CYAN);
- conf_win->Print(1, mess_length + 4, 'y');
- conf_win->Print(1, mess_length + 6, 'n');
- conf_win->SetColor(COLOR_WHITE);
- conf_win->Refresh();
-
- // Wait for the results.
- bool finished = false;
- bool result = false;
- int cur_char;
-
- while (finished == false) {
- cur_char = GetInput();
- switch (cur_char) {
- case 'q':
- case 'Q':
- case 'n':
- case 'N':
- case ' ':
- case '\n':
- case '\r':
- finished = true;
- result = false;
- break;
- case 'y':
- case 'Y':
- finished = true;
- result = true;
- break;
- }
- }
-
- // Delete the window, redraw the screen, and return the results.
- delete conf_win;
- Redraw();
- return result;
-}
-
-void cView::Notify(const cString & message)
-{
- cString mess_copy(message);
-
- // Setup all of the individual lines.
- int num_lines = message.CountNumLines();
- cString * line_array = new cString[num_lines];
- int max_width = 0;
- for (int i = 0; i < num_lines; i++) {
- line_array[i] = mess_copy.PopLine();
- if (line_array[i].GetSize() > max_width)
- max_width = line_array[i].GetSize();
- }
-
- // Create a window and draw it on the screen.
-
- cTextWindow * notify_win
- = new cTextWindow(2 + num_lines, max_width + 4, (24 - num_lines - 3) / 2,
- (70 - max_width) / 2);
- notify_win->Box();
- notify_win->SetBoldColor(COLOR_WHITE);
- for (int j = 0; j < num_lines; j++) {
- notify_win->Print(1 + j, 2, "%s", line_array[j]());
- }
- notify_win->Refresh();
-
- // Wait for the results.
- bool finished = false;
- int cur_char;
-
- while (!finished) {
- cur_char = GetInput();
- switch (cur_char) {
- case 'q':
- case 'Q':
- case ' ':
- case '\n':
- case '\r':
- finished = true;
- break;
- }
- }
-
- // Delete the window and redraw the screen.
- delete notify_win;
- delete [] line_array;
- Redraw();
-}
-
Deleted: branches/brysonda/source/viewer/view.hh
===================================================================
--- branches/brysonda/source/viewer/view.hh 2005-10-23 04:16:36 UTC (rev 359)
+++ branches/brysonda/source/viewer/view.hh 2005-10-23 04:43:06 UTC (rev 360)
@@ -1,89 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2001 California Institute of Technology //
-// //
-// Read the COPYING and README files, or contact 'avida at alife.org', //
-// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
-//////////////////////////////////////////////////////////////////////////////
-
-#ifndef VIEW_HH
-#define VIEW_HH
-
-
-#define MODE_BLANK 0
-#define MODE_MAP 1
-#define MODE_STATS 2
-#define MODE_HIST 3
-#define MODE_OPTIONS 4
-#define MODE_ZOOM 5
-#define MODE_ENVIRONMENT 6
-
-#include "text_screen.hh"
-
-class cTextWindow;
-class cBarScreen;
-class cMapScreen;
-class cStatsScreen;
-class cHistScreen;
-class cOptionsScreen;
-class cZoomScreen;
-class cEnvironmentScreen;
-
-class cView {
-private:
- cViewInfo info;
-
- // Window information...
- static cTextWindow * base_window;
- static cScreen * cur_screen;
- static cBarScreen * bar_screen;
- cMapScreen * map_screen;
- cStatsScreen * stats_screen;
- cHistScreen * hist_screen;
- cOptionsScreen * options_screen;
- cZoomScreen * zoom_screen;
- cEnvironmentScreen * environment_screen;
-
- // Window managing functions...
-
- void TogglePause();
- void CloneSoup();
- void ExtractCreature();
-
- // Input function
- void DoInputs();
-
- // Screen helpers
- void ChangeCurScreen(cScreen * new_screen);
- void PrintMerit(int in_y, int in_x, cMerit in_merit);
- void PrintFitness(int in_y, int in_x, double in_fitness);
-
- // Map navigation
- void NavigateMapWindow();
-public:
- cView(cPopulation & in_population);
- virtual ~cView();
-
- void Setup(const cString & in_name);
- void SetViewMode(int in_mode);
-
- void NewUpdate();
- void NotifyUpdate();
- void NotifyError(const cString & in_string);
- void NotifyWarning(const cString & in_string);
- void NotifyComment(const cString & in_string);
- inline void Pause() { info.SetPauseLevel(PAUSE_ON); }
- void DoBreakpoint();
-
- static int Confirm(const cString & message);
- static void Notify(const cString & message);
-
- int GetStepOrganism() { return info.GetStepOrganism(); }
- void SetStepOrganism(int in_id) { info.SetStepOrganism(in_id); }
-
- void Refresh();
-
- // Methods called by sub-windows.
- static void Redraw();
-};
-
-#endif
Deleted: branches/brysonda/source/viewer/viewer.hh
===================================================================
--- branches/brysonda/source/viewer/viewer.hh 2005-10-23 04:16:36 UTC (rev 359)
+++ branches/brysonda/source/viewer/viewer.hh 2005-10-23 04:43:06 UTC (rev 360)
@@ -1,44 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2001 California Institute of Technology //
-// //
-// Read the COPYING and README files, or contact 'avida at alife.org', //
-// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
-//////////////////////////////////////////////////////////////////////////////
-
-#ifndef VIEWERS_HH
-#define VIEWERS_HH
-
-#ifndef avida_h
-#include "avida.h"
-#endif
-
-#ifndef AVIDA_DRIVER_ANALYZE_HH
-#include "cAvidaDriver_Analyze.h"
-#endif
-#ifndef AVIDA_DRIVER_BASE_HH
-#include "cAvidaDriver_Base.h"
-#endif
-#ifndef AVIDA_DRIVER_POPULATION_HH
-#include "cAvidaDriver_Population.h"
-#endif
-
-class cView;
-
-class cAvidaDriver_TextPopViewer : public cAvidaDriver_Population {
-protected:
- cView * viewer;
-public:
- cAvidaDriver_TextPopViewer(cEnvironment & environment);
- ~cAvidaDriver_TextPopViewer();
-
- virtual void ProcessOrganisms();
-
- virtual void NotifyComment(const cString & in_string);
- virtual void NotifyWarning(const cString & in_string);
- virtual void NotifyError(const cString & in_string);
- virtual void NotifyUpdate();
-
- virtual void SignalBreakpoint();
-};
-
-#endif
Deleted: branches/brysonda/source/viewer/zoom_screen.cc
===================================================================
--- branches/brysonda/source/viewer/zoom_screen.cc 2005-10-23 04:16:36 UTC (rev 359)
+++ branches/brysonda/source/viewer/zoom_screen.cc 2005-10-23 04:43:06 UTC (rev 360)
@@ -1,1871 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2001 California Institute of Technology //
-// //
-// Read the COPYING and README files, or contact 'avida at alife.org', //
-// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
-//////////////////////////////////////////////////////////////////////////////
-
-#ifndef ENVIRONMENT_HH
-#include "cEnvironment.h"
-#endif
-#include "functions.h"
-
-#include "cConfig.h"
-#include "cGenebank.h"
-#include "cGenotype.h"
-#include "cOrganism.h"
-#include "cPhenotype.h"
-#include "cPopulation.h"
-#include "cPopulationCell.h"
-#ifndef STRING_UTIL_HH
-#include "cStringUtil.h"
-#endif
-#ifndef TASK_ENTRY_HH
-#include "cTaskEntry.h"
-#endif
-
-#include "cHardwareCPU.h"
-#include "cHardware4Stack.h"
-
-#include "zoom_screen.hh"
-
-#include "view.hh"
-#include "menu.hh"
-
-
-using namespace std;
-
-
-/////////////////////
-// The Zoom Screen
-/////////////////////
-
-cZoomScreen::cZoomScreen(int y_size, int x_size, int y_start, int x_start,
- cViewInfo & in_info, cPopulation & in_pop)
- : cScreen(y_size, x_size, y_start, x_start, in_info), population(in_pop)
-{
- memory_offset = 0;
- parasite_zoom = false;
- mode = ZOOM_MODE_STATS;
- //map_mode = MAP_BASIC;
- inst_view_mode = true;
- active_section = ZOOM_SECTION_MEMORY;
- task_offset = 0;
- //hardware_type = info.GetActiveCell()->GetOrganism()->GetHardware().GetType();
- cur_stack=0;
- cur_mem_space=0;
- cur_view_thread=0;
-
- //map_mode = MAP_BASIC;
- mini_center_id = 0;
- map_x_size = population.GetWorldX();
- map_y_size = population.GetWorldY();
-}
-
-
-
-
-void cZoomScreen::Draw()
-{
- // Draw the options block which is on all screens.
-
- SetBoldColor(COLOR_WHITE);
- Print(OPTIONS_Y, OPTIONS_X, "[<] [>]");
- if (info.GetPauseLevel()) {
- Print(OPTIONS_Y+2, OPTIONS_X+2, "Un-[P]ause");
- Print(OPTIONS_Y+3, OPTIONS_X+2, "[N]ext Update");
- Print(OPTIONS_Y+4, OPTIONS_X+2, "[Space] Next Inst");
- } else {
- Print(OPTIONS_Y+2, OPTIONS_X+2, "[P]ause ");
- Print(OPTIONS_Y+3, OPTIONS_X+2, " ");
- Print(OPTIONS_Y+4, OPTIONS_X+2, " ");
- }
-
- SetBoldColor(COLOR_CYAN);
- Print(OPTIONS_Y, OPTIONS_X+1, "<");
- Print(OPTIONS_Y, OPTIONS_X+20, ">");
- if (info.GetPauseLevel()) {
- Print(OPTIONS_Y+2, OPTIONS_X+6, "P");
- Print(OPTIONS_Y+3, OPTIONS_X+3, "N");
- //Print(OPTIONS_Y+4, OPTIONS_X+3, "Space");
- } else {
- Print(OPTIONS_Y+2, OPTIONS_X+3, "P");
- }
-
- // Redirect to the proper Draw() method.
-
- if (mode == ZOOM_MODE_CPU)
- {
- if(cConfig::GetHardwareType()==HARDWARE_TYPE_CPU_ORIGINAL)
- DrawCPU_Original();
- if(cConfig::GetHardwareType()==HARDWARE_TYPE_CPU_4STACK)
- DrawCPU_4Stack();
- }
- else if (mode == ZOOM_MODE_STATS) DrawStats();
- else if (mode == ZOOM_MODE_GENOTYPE) DrawGenotype();
-
- Update();
- Refresh();
-}
-
-void cZoomScreen::DrawStats()
-{
- // Creature Status
-
- SetBoldColor(COLOR_WHITE);
-
- Print(1, 0, "GenotypeID:");
- Print(2, 0, "Geno Name.:");
- Print(3, 0, "Species.ID:");
-
- Print(5, 0, "Fitness...:");
- Print(6, 0, "Gestation.:");
- Print(7, 0, "CPU Speed.:");
- Print(8, 0, "Cur Merit.:");
- Print(9, 0, "GenomeSize:");
- Print(10, 0, "Mem Size..:");
- Print(11, 0, "Faults....:");
-
- Print(1, 27, "Location..:");
-
- Print(4, 27, "Generation:");
- Print(5, 27, "Age.......:");
- Print(6, 27, "Executed..:");
- Print(7, 27, "LastDivide:");
- Print(8, 27, "Offspring.:");
-
- Print(10, 27, "Thread:");
- Print(11, 27, "IP....:");
-
- if(cConfig::GetHardwareType() == HARDWARE_TYPE_CPU_ORIGINAL)
- {
- Print(12, 27, "AX....:");
- Print(13, 27, "BX....:");
- Print(14, 27, "CX....:");
- Print(15, 27, "Stack.:");
- Print(16, 27, "---- Memory ----");
- }
- else if(cConfig::GetHardwareType() == HARDWARE_TYPE_CPU_4STACK)
- {
- Print(12, 27, "Stack AX:");
- Print(13, 27, "Stack BX:");
- Print(14, 27, "Stack CX:");
- Print(15, 27, "Stack DX:");
- Print(16, 27, "---- Memory ----");
- }
-
- Print(CPU_FLAGS_Y, CPU_FLAGS_X, "---- Flags ----");
-
- // --== Options ==--
- SetBoldColor(COLOR_YELLOW);
- Print(OPTIONS_Y, OPTIONS_X+4, "CPU Stats Zoom");
-
- // --== Tasks ==--
- SetColor(COLOR_WHITE);
- Box(TASK_X, TASK_Y, 30, Height()-TASK_Y);
-
-
- int task_num = task_offset;
- int col_num = 0;
- const cTaskLib & task_lib = population.GetEnvironment().GetTaskLib();
- for (int cur_col = TASK_X + 2;
- task_num < cConfig::GetNumTasks();
- cur_col += 14) {
- for (int cur_row = TASK_Y + 1;
- cur_row < Height() - 1 && task_num < cConfig::GetNumTasks();
- cur_row++) {
- Print(cur_row, cur_col, "........:");
- Print(cur_row, cur_col, "%s", task_lib.GetTask(task_num).GetName()());
- task_num++;
- }
- col_num++;
- if (col_num == 2) break;
- }
-
- if (task_num < cConfig::GetNumTasks() || task_offset != 0) {
- SetBoldColor(COLOR_WHITE);
- Print(Height()-1, Width() - 23, " [<-] More [->] ");
- SetBoldColor(COLOR_CYAN);
- Print(Height()-1, Width() - 21, "<-");
- Print(Height()-1, Width() - 11, "->");
- }
-}
-
-void cZoomScreen::DrawCPU_Original()
-{
- SetColor(COLOR_WHITE);
-
- // --== Registers ==--
- Box(REG_X, REG_Y, 19, 7);
- Print(REG_Y + 1, REG_X + 2, "Registers");
- HLine(REG_Y + 2, REG_X, 19);
-
- SetBoldColor(COLOR_WHITE);
- Print(REG_Y + 3, REG_X + 2, "AX:");
- Print(REG_Y + 4, REG_X + 2, "BX:");
- Print(REG_Y + 5, REG_X + 2, "CX:");
- SetColor(COLOR_WHITE);
-
- // --== Inputs ==--
- Box(INPUT_X, INPUT_Y, 16, 7);
- Print(INPUT_Y + 1, INPUT_X + 2, "Inputs");
- HLine(INPUT_Y + 2, INPUT_X, 16);
-
- // --== Mini-Map ==--
- Box(MINI_MAP_X, MINI_MAP_Y, 17, 3);
- Print(MINI_MAP_Y + 1, MINI_MAP_X + 2, "Mini-Map");
- // HLine(MINI_MAP_Y + 2, MINI_MAP_X, 19);
-
- SetBoldColor(COLOR_WHITE);
- Print(MINI_MAP_Y + 11, MINI_MAP_X, "[-] [+]");
- SetBoldColor(COLOR_CYAN);
- Print(MINI_MAP_Y + 11, MINI_MAP_X + 1, '-');
- Print(MINI_MAP_Y + 11, MINI_MAP_X + 15, '+');
- SetColor(COLOR_WHITE);
-
- // --== Memory ==--
- Box(MEMORY_X, MEMORY_Y, 36, 5 + MEMORY_PRE_SIZE + MEMORY_POST_SIZE);
- Print(MEMORY_Y + 1, MEMORY_X + 2, "Memory:");
- HLine(MEMORY_Y + 2, MEMORY_X, 36);
-
- // --== Stack ==--
- Box(STACK_X, STACK_Y, 15, 7);
- HLine(STACK_Y + 2, STACK_X, 15);
-
- // --== Options ==--
- SetBoldColor(COLOR_YELLOW);
- Print(OPTIONS_Y, OPTIONS_X+4, "Component Zoom");
- SetBoldColor(COLOR_WHITE);
-
- Print(OPTIONS_Y+6, OPTIONS_X+2, "[E]dit Component");
- Print(OPTIONS_Y+7, OPTIONS_X+2, "[V]iew Component");
- if(cConfig::GetMaxCPUThreads() >1)
- Print(OPTIONS_Y+8, OPTIONS_X+2, "Next [T]hread");
- Print(OPTIONS_Y+9, OPTIONS_X+2, "[TAB] Shift Active");
-
- if (info.GetPauseLevel()) {
- Print(OPTIONS_Y+10, OPTIONS_X+2, "[Arrows] Scroll");
- } else {
- Print(OPTIONS_Y+10, OPTIONS_X+2, " ");
- }
-
-
- SetBoldColor(COLOR_CYAN);
- Print(OPTIONS_Y+6, OPTIONS_X+3, "E");
- Print(OPTIONS_Y+7, OPTIONS_X+3, "V");
- if(cConfig::GetMaxCPUThreads() >1)
- Print(OPTIONS_Y+8, OPTIONS_X+8, "T");
- Print(OPTIONS_Y+9, OPTIONS_X+3, "TAB");
-
- if (info.GetPauseLevel()) {
- Print(OPTIONS_Y+10, OPTIONS_X+3, "Arrows");
- }
-
- // Highlight the active section...
- SetActiveSection(active_section);
-
- // Add on a bunch of special characters to smooth the view out...
- Print(INPUT_Y, INPUT_X, CHAR_TTEE);
- Print(INPUT_Y + 2, INPUT_X, CHAR_PLUS);
- Print(INPUT_Y + 6, INPUT_X, CHAR_BTEE);
-
- Print(STACK_Y, STACK_X, CHAR_TTEE);
- Print(STACK_Y + 2, STACK_X, CHAR_PLUS);
- Print(STACK_Y + 6, STACK_X, CHAR_BTEE);
-
-
- // A few stats on this screen...
-
- SetBoldColor(COLOR_WHITE);
-
- Print(13, 52, "Location.....:");
- Print(14, 52, "Genotype ID..:");
- Print(15, 52, "Genotype Name:");
-
- Print(17, 52, "Faults.......:");
- Print(18, 52, "Offspring....:");
- Print(19, 52, "Thread.......:");
-}
-
-void cZoomScreen::DrawCPU_4Stack()
-{
- SetColor(COLOR_WHITE);
-
- // --== Registers ==--
- Box(REG_X, REG_Y-1, 19, 8);
- Print(REG_Y, REG_X + 2, "Stacks:");
- HLine(REG_Y + 1, REG_X, 19);
-
- SetBoldColor(COLOR_WHITE);
- Print(REG_Y + 2, REG_X + 2, "AX:");
- Print(REG_Y + 3, REG_X + 2, "BX:");
- Print(REG_Y + 4, REG_X + 2, "CX:");
- Print(REG_Y + 5, REG_X + 2, "DX:");
- SetColor(COLOR_WHITE);
-
- // --== Inputs ==--
- Box(INPUT_X, INPUT_Y-1, 16, 8);
- Print(INPUT_Y, INPUT_X + 2, "Inputs:");
- HLine(INPUT_Y+1, INPUT_X, 16);
-
- // --== Mini-Map ==--
- Box(MINI_MAP_X, MINI_MAP_Y, 17, 3);
- Print(MINI_MAP_Y + 1, MINI_MAP_X + 2, "Mini-Map");
- //HLine(MINI_MAP_Y + 2, MINI_MAP_X, 19);
-
- SetBoldColor(COLOR_WHITE);
- Print(MINI_MAP_Y + 11, MINI_MAP_X, "[ ] [ ]");
- SetBoldColor(COLOR_CYAN);
- Print(MINI_MAP_Y + 11, MINI_MAP_X + 1, '-');
- Print(MINI_MAP_Y + 11, MINI_MAP_X + 15, '+');
- SetColor(COLOR_WHITE);
-
- // --== Memory ==--
- Box(MEMORY_X, MEMORY_Y, 36, 5 + MEMORY_PRE_SIZE + MEMORY_POST_SIZE);
- Print(MEMORY_Y + 1, MEMORY_X + 2, "Memory Space");
- HLine(MEMORY_Y + 2, MEMORY_X, 36);
-
- // --== Stack ==--
- Box(STACK_X, STACK_Y-1, 15, 8);
- HLine(STACK_Y + 1, STACK_X, 15);
-
- // --== Options ==--
- SetBoldColor(COLOR_YELLOW);
- Print(OPTIONS_Y, OPTIONS_X+4, "Component Zoom");
- SetBoldColor(COLOR_WHITE);
-
- //Print(OPTIONS_Y+6, OPTIONS_X+2, "[E]dit Component");
- //Print(OPTIONS_Y+7, OPTIONS_X+2, "[V]iew Component");
- Print(OPTIONS_Y+5, OPTIONS_X+2, "Next Stac[K]");
- if(cConfig::GetMaxCPUThreads() >1)
- Print(OPTIONS_Y+6, OPTIONS_X+2, "Next [T]hread");
- //Print(OPTIONS_Y+9, OPTIONS_X+2, "[TAB] Shift Active");
-
- if (info.GetPauseLevel()) {
- Print(OPTIONS_Y+7, OPTIONS_X+2, "[UP, DOWN]");
- Print(OPTIONS_Y+8, OPTIONS_X+2, "Scroll Instruction");
- Print(OPTIONS_Y+9, OPTIONS_X+2, "[LEFT, RIGHT]");
- Print(OPTIONS_Y+10, OPTIONS_X+2, "Change Mem Space");
- } else {
- Print(OPTIONS_Y+7, OPTIONS_X+2, " ");
- Print(OPTIONS_Y+8, OPTIONS_X+2, " ");
- Print(OPTIONS_Y+9, OPTIONS_X+2, " ");
- Print(OPTIONS_Y+10, OPTIONS_X+2, " ");
- }
-
-
- SetBoldColor(COLOR_CYAN);
- Print(OPTIONS_Y+5, OPTIONS_X+12, "K");
- if(cConfig::GetMaxCPUThreads() >1)
- Print(OPTIONS_Y+6, OPTIONS_X+8, "T");
-
- if (info.GetPauseLevel()) {
- Print(OPTIONS_Y+7, OPTIONS_X+3, "UP, DOWN");
- Print(OPTIONS_Y+9, OPTIONS_X+3, "LEFT, RIGHT");
- }
-
- // Highlight the active section...
- SetActiveSection(active_section);
-
- // Add on a bunch of special characters to smooth the view out...
- Print(INPUT_Y - 1, INPUT_X, CHAR_TTEE);
- Print(INPUT_Y + 1, INPUT_X, CHAR_PLUS);
- Print(INPUT_Y + 6, INPUT_X, CHAR_BTEE);
-
- Print(STACK_Y - 1, STACK_X, CHAR_TTEE);
- Print(STACK_Y + 1, STACK_X, CHAR_PLUS);
- Print(STACK_Y + 6, STACK_X, CHAR_BTEE);
-
-
- // A few stats on this screen...
-
- SetBoldColor(COLOR_WHITE);
-
- Print(13, 52, "Location.....:");
- Print(14, 52, "Genotype ID..:");
- Print(15, 52, "Genotype Name:");
-
- Print(17, 52, "Faults.......:");
- Print(18, 52, "Offspring....:");
- Print(19, 52, "Thread.......:");
-}
-
-void cZoomScreen::DrawGenotype()
-{
- SetBoldColor(COLOR_YELLOW);
- Print(OPTIONS_Y, OPTIONS_X + 4, "Genotype Zoom");
-
- // Genotype status.
-
- SetBoldColor(COLOR_WHITE);
-
- Print(1, 0, "GenotypeID:");
- Print(2, 0, "Geno Name.:");
- Print(3, 0, "Species ID:");
-
- Print(5, 0, "Abundance.:");
- Print(6, 0, "Length....:");
- Print(7, 0, "CopyLength:");
- Print(8, 0, "Exe Length:");
-
- Print(10, 0, "Fitness...:");
- Print(11, 0, "Gestation.:");
- Print(12, 0, "Merit.....:");
- Print(13, 0, "ReproRate.:");
-
- Print(1, 27, "Update Born:");
- Print(2, 27, "Parent ID..:");
- Print(3, 27, "Parent Dist:");
- Print(4, 27, "Gene Depth.:");
-
- Print(6, 27, "-- This Update --");
- Print(7, 27, "Deaths.....:");
- Print(8, 27, "Divides....:");
- Print(9, 27, "Breed True.:");
- Print(10, 27, "Breed In...:");
- Print(11, 27, "Breed Out..:");
-
- Print(13, 27, "-- Totals --");
- Print(14, 27, "Abundance..:");
- Print(15, 27, "Divides....:");
- Print(16, 27, "Breed True.:");
- Print(17, 27, "Breed In...:");
- Print(18, 27, "Breed Out..:");
-}
-
-void cZoomScreen::Update()
-{
- if (info.GetActiveCell() == NULL ||
- info.GetActiveCell()->IsOccupied() == false) return;
-
- cHardwareBase & hardware = info.GetActiveCell()->GetOrganism()->GetHardware();
- if(mode == ZOOM_MODE_CPU) UpdateCPU(hardware);
- else if (mode == ZOOM_MODE_STATS) UpdateStats(hardware);
- else if (mode == ZOOM_MODE_GENOTYPE) UpdateGenotype();
-
- Refresh();
-}
-
-void cZoomScreen::UpdateStats(cHardwareBase & hardware)
-{
- if (info.GetActiveCell() == NULL ||
- info.GetActiveCell()->IsOccupied() == false) return;
-
- cGenotype * genotype = info.GetActiveGenotype();
- cPhenotype & phenotype = info.GetActiveCell()->GetOrganism()->GetPhenotype();
-
- //cHardwareBase & hardware =
- // info.GetActiveCell()->GetOrganism()->GetHardware();
-
- SetBoldColor(COLOR_CYAN);
-
- // if there is an Active Genotype name AND it is not empty, show it
- Print(1, 12, "%9d", info.GetActiveGenotypeID());
- Print(2, 12, "%s", info.GetActiveName()());
-
- if (info.GetActiveSpecies())
- Print(3, 12, "%9d", info.GetActiveSpeciesID());
- else
- Print(3, 15, "(none) ");
-
- const cMerit cur_merit(phenotype.GetCurBonus());
-
- PrintFitness(5, 14, phenotype.GetFitness());
- Print(6, 15, "%6d ", phenotype.GetGestationTime());
- PrintMerit(7, 14, phenotype.GetMerit());
- PrintMerit(8, 14, cur_merit);
- Print(9, 15, "%6d ", genotype ? genotype->GetLength() : 0);
- Print(10, 15, "%6d ", hardware.GetMemory().GetSize());
-
- Print(11, 15, "%6d ", phenotype.GetCurNumErrors());
-
- Print(4, 39, "%9d ", phenotype.GetGeneration());
- Print(5, 39, "%9d ", phenotype.GetAge());
- Print(6, 39, "%9d ", phenotype.GetTimeUsed());
- Print(7, 39, "%9d ", phenotype.GetGestationStart());
- Print(8, 39, "%9d ", phenotype.GetNumDivides());
-
- if (info.GetThreadLock() != -1) Print(10, 36, "LOCKED");
- else Print(10, 36, " ");
-
- if(cConfig::GetHardwareType() == HARDWARE_TYPE_CPU_ORIGINAL)
- UpdateStats_CPU(hardware);
-
- if(cConfig::GetHardwareType() == HARDWARE_TYPE_CPU_4STACK)
- UpdateStats_4Stack(hardware);
-
- if (phenotype.ParentTrue()) SetBoldColor(COLOR_CYAN);
- else SetColor(COLOR_CYAN);
- Print(CPU_FLAGS_Y + 2, CPU_FLAGS_X + 1, "Parent True");
-
- if (phenotype.IsInjected()) SetBoldColor(COLOR_CYAN);
- else SetColor(COLOR_CYAN);
- Print(CPU_FLAGS_Y + 3, CPU_FLAGS_X + 1, "Injected");
-
- if (phenotype.IsParasite()) SetBoldColor(COLOR_CYAN);
- else SetColor(COLOR_CYAN);
- Print(CPU_FLAGS_Y + 4, CPU_FLAGS_X + 1, "Parasite");
-
- if (phenotype.IsMutated()) SetBoldColor(COLOR_CYAN);
- else SetColor(COLOR_CYAN);
- Print(CPU_FLAGS_Y + 5, CPU_FLAGS_X + 1, "Mutated");
-
- if (phenotype.IsModified()) SetBoldColor(COLOR_CYAN);
- else SetColor(COLOR_CYAN);
- Print(CPU_FLAGS_Y + 6, CPU_FLAGS_X + 1, "Modified");
-
- SetColor(COLOR_WHITE);
-
- if (info.GetPauseLevel() && info.GetActiveCell() && phenotype.IsParasite()) {
- if (parasite_zoom == true) Print(17, 12, "[X] Host Code ");
- else Print(17, 12, "[X] Parasite Code");
- }
-
- // Place the task information onto the screen.
- SetColor(COLOR_CYAN);
-
- int task_num = task_offset;
- int col_num = 0;
- for (int cur_col = TASK_X + 12;
- task_num < cConfig::GetNumTasks();
- cur_col += 14) {
- for (int cur_row = TASK_Y + 1;
- cur_row <= Height() - 2 && task_num < cConfig::GetNumTasks();
- cur_row++) {
- if (col_num < 2) {
- Print(cur_row, cur_col, "%2d", phenotype.GetCurTaskCount()[task_num]);
- }
- task_num++;
- }
- col_num++;
- }
-
-
-
- if (info.GetActiveCell() == NULL) {
- info.SetActiveCell( &(population.GetCell(0)) );
- }
- SetBoldColor(COLOR_WHITE);
-
- // Figure out which CPU we're pointing at (useful for watching parasites)
- Print(2, 27, "Facing....:");
-
- // Show the location of the CPU we are looking at.
- SetBoldColor(COLOR_CYAN);
- Print(1, 40, "[%2d, %2d] ",
- info.GetActiveID() % population.GetWorldX(),
- info.GetActiveID() / population.GetWorldY());
-
- // Now show the location of the CPU we are facing.
- int id = info.GetActiveCell()->ConnectionList().GetFirst()->GetID();
- Print(2, 40, "[%2d, %2d] ",
- id % population.GetWorldX(), id / population.GetWorldY());
-
-
-
-}
-
-void cZoomScreen::UpdateStats_CPU(cHardwareBase & hardware)
-{
- cHardwareCPU & hardwareCPU = (cHardwareCPU &) hardware;
-
- Print(10, 43, "%2d/%2d", hardwareCPU.GetCurThread() + 1,
- hardwareCPU.GetNumThreads());
-
- Print(12, 34, "%14d", hardwareCPU.Register(0));
- Print(13, 34, "%14d", hardwareCPU.Register(1));
- Print(14, 34, "%14d", hardwareCPU.Register(2));
- Print(15, 34, "%14d", hardwareCPU.GetStack(0));
-
- cHeadCPU inst_ptr(hardwareCPU.IP());
- const cInstSet & inst_set = hardwareCPU.GetInstSet();
-
- for (int pos = 0; pos < 3; pos++) {
- // Clear the line
- Print(17+pos, 29, " ");
- if (inst_ptr.InMemory() == false) continue;
- if (pos == 1) SetColor(COLOR_CYAN);
-
- // Draw the current instruction.
- Print(17+pos, 29, "%s", inst_set.GetName(inst_ptr.GetInst())());
- inst_ptr.Advance();
- }
-
- // Flags...
- if (hardwareCPU.GetMalActive()) SetBoldColor(COLOR_CYAN);
- else SetColor(COLOR_CYAN);
- Print(CPU_FLAGS_Y + 1, CPU_FLAGS_X + 1, "Mem Allocated");
-
- // And print the IP.
- const cHeadCPU & active_inst_ptr = hardwareCPU.IP();
- // @CAO assume no parasites for now.
- int cur_id = info.GetActiveCell()->GetID();
- //active_inst_ptr.GetCurHardware()->GetOrganism()->GetEnvironment()->GetID();
- Print(11, 36, "%12s", cStringUtil::Stringf("[%2d,%2d] : %2d",
- cur_id % population.GetWorldX(), cur_id / population.GetWorldX(),
- active_inst_ptr.GetPosition())() );
-}
-
-void cZoomScreen::UpdateStats_4Stack(cHardwareBase & hardware)
-{
- cHardware4Stack & hardware4Stack = (cHardware4Stack &) hardware;
-
- Print(10, 43, "%2d/%2d", hardware4Stack.GetCurThread() + 1,
- hardware4Stack.GetNumThreads());
-
- Print(12, 34, "%14d", hardware4Stack.Stack(0).Top());
- Print(13, 34, "%14d", hardware4Stack.Stack(1).Top());
- Print(14, 34, "%14d", hardware4Stack.Stack(2).Top());
- Print(15, 34, "%14d", hardware4Stack.Stack(3).Top());
-
- cHeadMultiMem inst_ptr(hardware4Stack.IP());
- const cInstSet & inst_set = hardware4Stack.GetInstSet();
-
- for (int pos = 0; pos < 3; pos++) {
- // Clear the line
- Print(17+pos, 29, " ");
- if (inst_ptr.InMemory() == false) continue;
- if (pos == 1) SetColor(COLOR_CYAN);
-
- // Draw the current instruction.
- Print(17+pos, 29, "%s", inst_set.GetName(inst_ptr.GetInst())());
- inst_ptr.Advance();
- }
-
- // Flags...
- //if (hardwareCPU.GetMalActive()) SetBoldColor(COLOR_CYAN);
- //else SetColor(COLOR_CYAN);
- //Print(CPU_FLAGS_Y + 1, CPU_FLAGS_X + 1, "Mem Allocated");
-
- // And print the IP.
- const cHeadMultiMem & active_inst_ptr = hardware4Stack.IP();
- // @CAO assume no parasites for now.
- //int cur_id = info.GetActiveCell()->GetID();
- //active_inst_ptr.GetCurHardware()->GetOrganism()->GetEnvironment()->GetID();
- Print(11, 36, "%12s", cStringUtil::Stringf("(%2d, %2d)",
- active_inst_ptr.GetMemSpace(),
- active_inst_ptr.GetPosition())() );
-}
-
-void cZoomScreen::UpdateCPU(cHardwareBase & hardware)
-{
- // Place the visible section of the current memory onto the screen.
-
- SetBoldColor(COLOR_WHITE);
- if (info.GetPauseLevel() == PAUSE_OFF) {
- // If not paused, then set user desired offset to zero AND always show
- // the code that is executing (ie. do not show original Parasite code if
- // host is executing)
- memory_offset = 0;
- parasite_zoom = false;
- }
-
- Print(14, 69, "%10d", info.GetActiveGenotypeID());
- Print(15, 69, "%10s", info.GetActiveName()());
-
- cPhenotype & phenotype = info.GetActiveCell()->GetOrganism()->GetPhenotype();
- Print(17, 69, "%10d", phenotype.GetCurNumErrors());
- Print(18, 69, "%10d", phenotype.GetNumDivides());
- if (info.GetThreadLock() != -1) Print(19, 67, "LOCKED");
- else Print(19, 67, " ");
-
- if(cConfig::GetHardwareType()==HARDWARE_TYPE_CPU_ORIGINAL)
- UpdateCPU_Original(hardware);
- else if(cConfig::GetHardwareType()==HARDWARE_TYPE_CPU_4STACK)
- UpdateCPU_4Stack(hardware);
-
- // Place the input buffer on the screen.
-
- SetBoldColor(COLOR_CYAN);
- Print(INPUT_Y+3, INPUT_X+2, "%12d", info.GetActiveCell()->GetInput(0));
-
- SetColor(COLOR_CYAN);
- for (int i = 1; i < nHardware::IO_SIZE; i++) {
- Print(INPUT_Y+3+i, INPUT_X+2, "%12d", info.GetActiveCell()->GetInput(i));
- }
-
- const cString & cur_fault = phenotype.GetFault();
- if (cur_fault.GetSize() > 0) {
- SetBoldColor(COLOR_RED);
- Print(FAULT_Y, FAULT_X, "Fault:");
- SetBoldColor(COLOR_CYAN);
- Print(FAULT_Y, FAULT_X + 7, cur_fault());
- } else {
- Print(FAULT_Y, FAULT_X, " ");
- }
-
- SetBoldColor(COLOR_WHITE);
-
- Print(13, 70, "[%3d,%3d] ",
- info.GetActiveID() % population.GetWorldX(),
- info.GetActiveID() / population.GetWorldY());
-
- SetBoldColor(COLOR_CYAN);
- Refresh();
-}
-
-void cZoomScreen::UpdateCPU_Original(cHardwareBase & hardware)
-{
- cHardwareCPU & hardwareCPU = (cHardwareCPU &) hardware;
- //hardwareCPU.SetThread(cur_view_thread);
-
- // Place the registers onto the screen.
- SetBoldColor(COLOR_CYAN);
- for (int i = 0; i < nHardwareCPU::NUM_REGISTERS; i++) {
- Print(REG_Y+3 + i, REG_X+6, "%11d", hardwareCPU.Register(i));
- }
-
- // Place the active stack onto the screen.
-
- // Stack A
- // SetBoldColor(COLOR_CYAN); // -Redundant
- SetColor(COLOR_WHITE);
- char stack_letter = 'A' + hardwareCPU.GetActiveStackID();
- Print(STACK_Y + 1, STACK_X + 2, "Stack %c", stack_letter);
-
- SetBoldColor(COLOR_CYAN);
- Print(STACK_Y+3, STACK_X + 2, "%11d", hardwareCPU.GetStack(0));
- SetColor(COLOR_CYAN);
- for (int i = 1; i <= 2; i++) {
- Print(STACK_Y+3 + i, STACK_X+2, "%11d", hardwareCPU.GetStack(i));
- }
-
- // Place the input buffer on the screen.
-
- SetBoldColor(COLOR_CYAN);
- Print(INPUT_Y+3, INPUT_X+2, "%12d", info.GetActiveCell()->GetInput(0));
-
- SetColor(COLOR_CYAN);
- for (int i = 1; i < nHardware::IO_SIZE; i++) {
- Print(INPUT_Y+3+i, INPUT_X+2, "%12d", info.GetActiveCell()->GetInput(i));
- }
-
- Print(19, 74, "%2d/%2d", hardwareCPU.GetCurThread() + 1,
- hardwareCPU.GetNumThreads());
-
- // This line gets the creature that is currently executing. Usually the
- // creature we are viewing, but can also be a different one (if this is a
- // parasite).
-
- const cCPUMemory & memory = (parasite_zoom) ?
- hardware.GetMemory() : hardwareCPU.IP().GetMemory();
- SetColor(COLOR_WHITE);
- Print(MEMORY_Y + 1, MEMORY_X + 9, "%4d", memory.GetSize());
-
-
-
- // Nothing past this point gets executed for empty creatures....
- if (memory.GetSize() == 0) {
- for (int i = -MEMORY_PRE_SIZE; i <= MEMORY_POST_SIZE; i++) {
- HLine(MEMORY_Y + MEMORY_PRE_SIZE + 3 + i, MEMORY_X, 36);
- }
- return;
- }
-
- int adj_inst_ptr = 0;
- int base_inst_ptr = hardwareCPU.IP().GetPosition();
- if (base_inst_ptr < 0 || parasite_zoom == true) base_inst_ptr = 0;
-
- const cInstSet & inst_set = hardwareCPU.GetInstSet();
-
- // Determine the center (must be between 0 and size - 1)
- int center_pos = (base_inst_ptr + memory_offset) % memory.GetSize();
- if (center_pos < 0) center_pos += memory.GetSize();
-
- for (int i = -MEMORY_PRE_SIZE; i <= MEMORY_POST_SIZE; i++) {
- adj_inst_ptr = (center_pos + i) % (memory.GetSize() + 1);
- if (adj_inst_ptr < 0) adj_inst_ptr += memory.GetSize() + 1;
-
- if (adj_inst_ptr == memory.GetSize()) {
- HLine(MEMORY_Y + MEMORY_PRE_SIZE + 3 + i, MEMORY_X, 36);
- } else {
- Print(MEMORY_Y + MEMORY_PRE_SIZE + 3 + i, MEMORY_X, CHAR_VLINE);
- Print(MEMORY_Y + MEMORY_PRE_SIZE + 3 + i, MEMORY_X + 35, CHAR_VLINE);
-
- // If we are on the instruction about to be executed by the CPU,
- // hilight it...
- if (adj_inst_ptr == base_inst_ptr) {
- SetBoldColor(COLOR_WHITE);
- Print(MEMORY_Y + MEMORY_PRE_SIZE + 3 + i, MEMORY_X + 1, "%3d: ",
- adj_inst_ptr);
- SetBoldColor(COLOR_CYAN);
- } else {
- if (i == 0) SetBoldColor(COLOR_YELLOW);
- Print(MEMORY_Y + MEMORY_PRE_SIZE + 3 + i, MEMORY_X + 1, "%3d: ",
- adj_inst_ptr);
- // If we are scrolling through memory, make the current position
- // yellow.
- if (i == 0) SetColor(COLOR_YELLOW);
- else SetColor(COLOR_CYAN);
- }
-
- // Print the instruction...
- Print(MEMORY_Y + MEMORY_PRE_SIZE + 3 + i, MEMORY_X + 6, "%8s ",
- inst_set.GetName( memory[adj_inst_ptr] )());
-
- Print(MEMORY_Y + MEMORY_PRE_SIZE + 3 + i, MEMORY_X + 15,
- " ");
-
- // Only list the "Cpy" flag or the "Inj" flag...
- if (memory.FlagCopied(adj_inst_ptr) == true) {
- Print(MEMORY_Y + MEMORY_PRE_SIZE + 3 + i, MEMORY_X + 15, "Cpy");
- }
- if (memory.FlagInjected(adj_inst_ptr) == true) {
- Print(MEMORY_Y + MEMORY_PRE_SIZE + 3 + i, MEMORY_X + 15, "Inj");
- }
-
- // Other flags we're interested in...
- if (memory.FlagMutated(adj_inst_ptr) == true) {
- Print(MEMORY_Y + MEMORY_PRE_SIZE + 3 + i, MEMORY_X + 19, "Mut");
- }
- if (memory.FlagExecuted(adj_inst_ptr) == true) {
- Print(MEMORY_Y + MEMORY_PRE_SIZE + 3 + i, MEMORY_X + 23, "Exe");
- }
- if (memory.FlagBreakpoint(adj_inst_ptr) == true) {
- Print(MEMORY_Y + MEMORY_PRE_SIZE + 3 + i, MEMORY_X + 27, "Bp");
- }
-
- if (adj_inst_ptr == hardwareCPU.GetHead(nHardware::HEAD_READ).GetPosition()) {
- Print(MEMORY_Y + MEMORY_PRE_SIZE + 3 + i, MEMORY_X + 30, "R");
- }
- if (adj_inst_ptr == hardwareCPU.GetHead(nHardware::HEAD_WRITE).GetPosition()) {
- Print(MEMORY_Y + MEMORY_PRE_SIZE + 3 + i, MEMORY_X + 31, "W");
- }
- if (adj_inst_ptr == hardwareCPU.GetHead(nHardware::HEAD_FLOW).GetPosition()) {
- Print(MEMORY_Y + MEMORY_PRE_SIZE + 3 + i, MEMORY_X + 32, "F");
- }
- }
- SetColor(COLOR_WHITE);
- }
-
- DrawMiniMap();
-}
-
-void cZoomScreen::UpdateCPU_4Stack(cHardwareBase & hardware)
-{
- cHardware4Stack & hardware4Stack = (cHardware4Stack &) hardware;
-
- if(cur_view_thread>=hardware4Stack.GetNumThreads())
- {
- cur_view_thread=0;
- cur_mem_space = hardware4Stack.IP(cur_view_thread).GetMemSpace();
- }
- //hardware4Stack.SetThread(cur_view_thread);
- cHeadMultiMem & cur_ip = hardware4Stack.IP(cur_view_thread);
-
- // Place the stacks onto the screen.
- SetBoldColor(COLOR_CYAN);
- for (int i = 0; i < 4; i++) {
- Print(REG_Y+2 + i, REG_X+6, "%11d", hardware4Stack.Stack(i, cur_view_thread).Top());
- }
-
- // Place the active stack onto the screen.
-
- // Stack AX
- //SetBoldColor(COLOR_CYAN); // -Redundant
- SetColor(COLOR_WHITE);
-
- Print(STACK_Y, STACK_X + 2, "Stack :");
- Print(STACK_Y, STACK_X + 8, "%s" , hardware4Stack.GetActiveStackID(cur_stack)());
-
- //SetBoldColor(COLOR_CYAN);
- //Print(STACK_Y+2, STACK_X + 2, "%11d", hardware4Stack.GetStack(0, cur_stack));
- SetColor(COLOR_CYAN);
- for (int i = 0; i <= 3; i++) {
- Print(STACK_Y+2 + i, STACK_X+2, "%11d", hardware4Stack.GetStack(i, cur_stack, cur_view_thread));
- }
-
- Print(19, 74, "%2d/%2d", cur_view_thread + 1,
- hardware4Stack.GetNumThreads());
-
- // This line gets the creature that is currently executing. Usually the
- // creature we are viewing, but can also be a different one (if this is a
- // parasite).
-
- const cCPUMemory & memory = hardware4Stack.GetMemory(cur_mem_space);
- SetBoldColor(COLOR_BLUE);
- Print(MEMORY_Y + 1, MEMORY_X + 8, " Space ");
- SetColor(COLOR_WHITE);
- Print(MEMORY_Y + 1, MEMORY_X + 15, "%2d", cur_mem_space);
-
- Print(MEMORY_Y + 1, MEMORY_X + 17, ":");
- Print(MEMORY_Y + 1, MEMORY_X + 18, "%4d", memory.GetSize());
-
-
-
- // Nothing past this point gets executed for empty creatures....
- if (memory.GetSize() == 0) {
- for (int i = -MEMORY_PRE_SIZE; i <= MEMORY_POST_SIZE; i++) {
- HLine(MEMORY_Y + MEMORY_PRE_SIZE + 3 + i, MEMORY_X, 36);
- }
- return;
- }
-
- int adj_inst_ptr = 0;
- int base_inst_ptr = cur_ip.GetPosition();
- if (base_inst_ptr < 0 || parasite_zoom == true) base_inst_ptr = 0;
-
- const cInstSet & inst_set = hardware4Stack.GetInstSet();
-
- // Determine the center (must be between 0 and size - 1)
- int center_pos = (base_inst_ptr + memory_offset) % memory.GetSize();
- if (center_pos < 0) center_pos += memory.GetSize();
-
- for (int i = -MEMORY_PRE_SIZE; i <= MEMORY_POST_SIZE; i++) {
- adj_inst_ptr = (center_pos + i) % (memory.GetSize() + 1);
- if (adj_inst_ptr < 0) adj_inst_ptr += memory.GetSize() + 1;
-
- if (adj_inst_ptr == memory.GetSize()) {
- HLine(MEMORY_Y + MEMORY_PRE_SIZE + 3 + i, MEMORY_X, 36);
- } else {
- Print(MEMORY_Y + MEMORY_PRE_SIZE + 3 + i, MEMORY_X, CHAR_VLINE);
- Print(MEMORY_Y + MEMORY_PRE_SIZE + 3 + i, MEMORY_X + 35, CHAR_VLINE);
-
- // If we are on the instruction about to be executed by the CPU,
- // hilight it...
- if (adj_inst_ptr == base_inst_ptr &&
- hardware4Stack.IP(cur_view_thread).GetMemSpace() == cur_mem_space) {
- SetBoldColor(COLOR_WHITE);
- Print(MEMORY_Y + MEMORY_PRE_SIZE + 3 + i, MEMORY_X + 1, "%3d: ",
- adj_inst_ptr);
- SetBoldColor(COLOR_CYAN);
- } else {
- if (i == 0) SetBoldColor(COLOR_YELLOW);
- Print(MEMORY_Y + MEMORY_PRE_SIZE + 3 + i, MEMORY_X + 1, "%3d: ",
- adj_inst_ptr);
- // If we are scrolling through memory, make the current position
- // yellow.
- if (i == 0) SetColor(COLOR_YELLOW);
- else SetColor(COLOR_CYAN);
- }
-
- // Print the instruction...
- Print(MEMORY_Y + MEMORY_PRE_SIZE + 3 + i, MEMORY_X + 6, "%8s ",
- inst_set.GetName( memory[adj_inst_ptr] )());
-
- Print(MEMORY_Y + MEMORY_PRE_SIZE + 3 + i, MEMORY_X + 15,
- " ");
-
- // Only list the "Cpy" flag or the "Inj" flag...
- if (memory.FlagCopied(adj_inst_ptr) == true) {
- Print(MEMORY_Y + MEMORY_PRE_SIZE + 3 + i, MEMORY_X + 16, "Cpy");
- }
- if (memory.FlagInjected(adj_inst_ptr) == true) {
- Print(MEMORY_Y + MEMORY_PRE_SIZE + 3 + i, MEMORY_X + 16, "Inj");
- }
-
- // Other flags we're interested in...
- if (memory.FlagMutated(adj_inst_ptr) == true) {
- Print(MEMORY_Y + MEMORY_PRE_SIZE + 3 + i, MEMORY_X + 20, "Mut");
- }
- if (memory.FlagExecuted(adj_inst_ptr) == true) {
- Print(MEMORY_Y + MEMORY_PRE_SIZE + 3 + i, MEMORY_X + 24, "Exe");
- }
- if (memory.FlagBreakpoint(adj_inst_ptr) == true) {
- Print(MEMORY_Y + MEMORY_PRE_SIZE + 3 + i, MEMORY_X + 28, "Bp");
- }
-
- if (adj_inst_ptr == hardware4Stack.GetHead(nHardware::HEAD_READ, cur_view_thread).GetPosition() &&
- cur_mem_space == hardware4Stack.GetHead(nHardware::HEAD_READ, cur_view_thread).GetMemSpace()) {
- Print(MEMORY_Y + MEMORY_PRE_SIZE + 3 + i, MEMORY_X + 31, "R");
- }
- if (adj_inst_ptr == hardware4Stack.GetHead(nHardware::HEAD_WRITE, cur_view_thread).GetPosition() &&
- cur_mem_space == hardware4Stack.GetHead(nHardware::HEAD_WRITE, cur_view_thread).GetMemSpace()) {
- Print(MEMORY_Y + MEMORY_PRE_SIZE + 3 + i, MEMORY_X + 32, "W");
- }
- if (adj_inst_ptr == hardware4Stack.GetHead(nHardware::HEAD_FLOW, cur_view_thread).GetPosition() &&
- cur_mem_space == hardware4Stack.GetHead(nHardware::HEAD_FLOW, cur_view_thread).GetMemSpace()) {
- Print(MEMORY_Y + MEMORY_PRE_SIZE + 3 + i, MEMORY_X + 33, "F");
- }
- }
- SetColor(COLOR_WHITE);
- }
-
- DrawMiniMap();
-}
-
-void cZoomScreen::UpdateGenotype()
-{
- SetBoldColor(COLOR_CYAN);
-
- Print(1, 12, "%9d", info.GetActiveGenotypeID());
- Print(2, 12, "%9s", info.GetActiveName()());
- Print(3, 12, "%9d", info.GetActiveSpeciesID());
-
- if (info.GetActiveGenotype() != NULL) {
- cGenotype & genotype = *(info.GetActiveGenotype());
- Print(5, 12, "%9d", genotype.GetNumOrganisms());
- Print(6, 12, "%9d", genotype.GetLength());
- Print(7, 12, "%9d", genotype.GetCopiedSize());
- Print(8, 12, "%9d", genotype.GetExecutedSize());
-
- PrintFitness(10, 14, genotype.GetFitness());
- Print(11, 12, "%9f", genotype.GetGestationTime());
- Print(12, 14, "%9f", genotype.GetMerit());
- Print(13, 12, "%9f", genotype.GetReproRate());
-
- // Column 2
- Print(1, 40, "%9d", genotype.GetUpdateBorn());
- Print(2, 40, "%9d", genotype.GetParentID());
- Print(3, 40, "%9d", genotype.GetParentDistance());
- Print(4, 40, "%9d", genotype.GetDepth());
-
- Print(7, 40, "%9d", genotype.GetThisDeaths());
- Print(8, 40, "%9d", genotype.GetThisBirths());
- Print(9, 40, "%9d", genotype.GetThisBreedTrue());
- Print(10, 40, "%9d", genotype.GetThisBreedIn());
- Print(11, 40, "%9d", genotype.GetThisBirths() - genotype.GetThisBreedTrue());
-
- Print(14, 40, "%9d", genotype.GetTotalOrganisms());
- Print(15, 40, "%9d", genotype.GetBirths());
- Print(16, 40, "%9d", genotype.GetBreedTrue());
- Print(17, 40, "%9d", genotype.GetBreedIn());
- Print(18, 40, "%9d", genotype.GetBirths() - genotype.GetBreedTrue());
- }
- else {
- Print(5, 12, " -------");
- Print(6, 12, " -------");
- Print(7, 12, " -------");
- Print(8, 12, " -------");
-
- Print(10, 12, " -------");
- Print(11, 12, " -------");
- Print(12, 12, " -------");
- Print(13, 12, " -------");
-
- // Column 2
- Print(1, 40, " -------");
- Print(2, 40, " -------");
- Print(3, 40, " -------");
- Print(4, 40, " -------");
-
- Print(7, 40, " -------");
- Print(8, 40, " -------");
- Print(9, 40, " -------");
- Print(10, 40, " -------");
- Print(11, 40, " -------");
-
- Print(14, 40, " -------");
- Print(15, 40, " -------");
- Print(16, 40, " -------");
- Print(17, 40, " -------");
- Print(18, 40, " -------");
- }
-}
-
-void cZoomScreen::EditMemory()
-{
- // Collect all of the needed variables.
- cHardwareCPU & hardware =
- (cHardwareCPU &) info.GetActiveCell()->GetOrganism()->GetHardware();
- const cInstSet & inst_set = hardware.GetInstSet();
- cHeadCPU edit_head( hardware.IP() );
- if (parasite_zoom == true) {
- edit_head.Set(0, &(info.GetActiveCell()->GetOrganism()->GetHardware()) );
- }
- edit_head.LoopJump(memory_offset);
-
- // Assemble first choice window.
- cMenuWindow menu1(NUM_INST_EDITS);
- menu1.SetTitle("Choose Edit method:");
- menu1.AddOption(INST_EDIT_BREAKPOINT, "Toggle [B]reakpoint");
- menu1.AddOption(INST_EDIT_JUMP_IP, "[J]ump IP");
- menu1.AddOption(INST_EDIT_CHANGE, "[E]dit Instruction");
- menu1.AddOption(INST_EDIT_INSERT, "[I]nsert Instruction");
- menu1.AddOption(INST_EDIT_REMOVE, "[D]elete Instruction");
- menu1.SetActive(INST_EDIT_CHANGE);
- int edit_method = menu1.Activate();
- cView::Redraw();
-
- // If we need to choose a new instruction, bring up a window for it.
-
- int new_inst = 0;
- if (edit_method == INST_EDIT_CHANGE || edit_method == INST_EDIT_INSERT) {
- cMenuWindow inst_menu(inst_set.GetSize());
- inst_menu.SetTitle("Choose new instruction: ");
- for (int j = 0; j < inst_set.GetSize(); j++) {
- inst_menu.AddOption(j, inst_set.GetName(j)());
- }
- inst_menu.SetActive(edit_head.GetInst().GetOp());
- new_inst = inst_menu.Activate();
-
- cView::Redraw();
- if (new_inst == -1) {
- // cView::Notify("Aborted!");
- return;
- }
- }
-
- // Finally, act on the edit method!
- switch (edit_method) {
- case INST_EDIT_BREAKPOINT:
- ToggleBool( edit_head.FlagBreakpoint() );
- break;
- case INST_EDIT_JUMP_IP:
- hardware.IP() = edit_head;
- memory_offset = 0;
- break;
- case INST_EDIT_CHANGE:
- edit_head.SetInst(cInstruction(new_inst));
- break;
- case INST_EDIT_INSERT:
- edit_head.InsertInst(cInstruction(new_inst));
- break;
- case INST_EDIT_REMOVE:
- edit_head.RemoveInst();
- break;
- default:
- // cView::Notify("Aborted!");
- break;
- }
-
- Update();
-}
-
-void cZoomScreen::ViewMemory()
-{
- // Collect all of the needed variables.
- cHardwareCPU & hardware =
- (cHardwareCPU &) info.GetActiveCell()->GetOrganism()->GetHardware();
- // cosnt cInstSet & inst_set = hardware.GetInstSet();
- cHeadCPU view_head( hardware.IP() );
- if (parasite_zoom == true) {
- view_head.Set(0, &(info.GetActiveCell()->GetOrganism()->GetHardware()) );
- }
- view_head.LoopJump(memory_offset);
-
- // Act on the view method!
- if (inst_view_mode == true) inst_view_mode = false;
- else inst_view_mode = true;
-
- Update();
-}
-
-void cZoomScreen::ThreadOptions()
-{
- int thread_method = THREAD_OPTIONS_VIEW;
-
- // Assemble first choice window.
- cMenuWindow menu1(NUM_THREAD_OPTIONS);
- menu1.SetTitle("Choose threading option:");
- menu1.AddOption(THREAD_OPTIONS_VIEW, "[V]iew Thread Info");
- menu1.AddOption(THREAD_OPTIONS_LOCK, "[T]oggle Thread Lock");
- menu1.SetActive(THREAD_OPTIONS_VIEW);
- thread_method = menu1.Activate();
- cView::Redraw();
-
- // Act on the view method!
- switch (thread_method) {
- case THREAD_OPTIONS_VIEW:
- ViewThreads();
- break;
- case THREAD_OPTIONS_LOCK:
- if (info.GetThreadLock() != -1) info.SetThreadLock(-1);
- else {
- cHardwareCPU & hardware =
- (cHardwareCPU &) info.GetActiveCell()->GetOrganism()->GetHardware();
- info.SetThreadLock( hardware.GetCurThread() );
- }
-
- break;
- default:
- break;
- }
-
- Update();
-}
-
-void cZoomScreen::ViewInstruction()
-{
- cTextWindow * window = new cTextWindow(10, 40, 7, 20);
- window->SetBoldColor(COLOR_WHITE);
- window->Box();
-
- // Place the data.
-
- cHardwareCPU & hardware =
- (cHardwareCPU &) info.GetActiveCell()->GetOrganism()->GetHardware();
- cHeadCPU inst_ptr( hardware.IP() );
- if (parasite_zoom == true) {
- inst_ptr.Set(0, &(info.GetActiveCell()->GetOrganism()->GetHardware()) );
- }
- inst_ptr.LoopJump(memory_offset);
-
- const cInstSet & inst_set = hardware.GetInstSet();
-
- window->SetBoldColor(COLOR_YELLOW);
- window->Print(2, 16, "%s", inst_set.GetName(inst_ptr.GetInst())());
-
- window->SetBoldColor(COLOR_WHITE);
-
- window->Print(2, 2, "Instruction: ");
- window->Print(4, 2, "Line Num...: ");
- window->Print(6, 2, "Redundancy.: ");
- window->Print(7, 2, "Cost.......: ");
-
- window->SetBoldColor(COLOR_CYAN);
-
- const int inst_id = inst_ptr.GetInst().GetOp();
-
- window->Print(4, 14, "%3d", inst_ptr.GetPosition());
- window->Print(6, 14, "%3d", inst_set.GetRedundancy(cInstruction(inst_id)) );
- window->Print(7, 14, "%3d", inst_set.GetCost(cInstruction(inst_id)) );
-
- if (inst_ptr.FlagCopied() == true) window->SetBoldColor(COLOR_CYAN);
- else window->SetColor(COLOR_CYAN);
- window->Print(4, 25, "Copied");
-
- if (inst_ptr.FlagMutated() == true) window->SetBoldColor(COLOR_CYAN);
- else window->SetColor(COLOR_CYAN);
- window->Print(5, 25, "Mutated");
-
- if (inst_ptr.FlagExecuted() == true) window->SetBoldColor(COLOR_CYAN);
- else window->SetColor(COLOR_CYAN);
- window->Print(6, 25, "Executed");
-
- if (inst_ptr.FlagBreakpoint() == true) window->SetBoldColor(COLOR_CYAN);
- else window->SetColor(COLOR_CYAN);
- window->Print(7, 25, "Breakpoint");
-
-
- // Print it!
- window->Refresh();
-
- // Wait for the results.
- bool finished = false;
- int cur_char;
-
- while (finished == false) {
- cur_char = GetInput();
- switch (cur_char) {
- case 'q':
- case 'Q':
- case ' ':
- case '\n':
- case '\r':
- finished = true;
- break;
- }
- }
-
- delete window;
- cView::Redraw();
-}
-
-void cZoomScreen::ViewRegisters()
-{
- cTextWindow * window = new cTextWindow(9, 54, 4, 13);
- cHardwareCPU & hardware =
- (cHardwareCPU &) info.GetActiveCell()->GetOrganism()->GetHardware();
-
- window->SetBoldColor(COLOR_WHITE);
- window->Box();
-
- window->Print(2, 2, "Registers");
-
- for (int i = 0; i < 3; i++) {
- const char reg_letter = 'A' + i;
- const int reg_value = hardware.Register(i);
- window->SetBoldColor(COLOR_WHITE);
- window->Print(4+i, 2, "%cX:", reg_letter);
- window->Print(4+i, 17, '[');
- window->Print(4+i, 50, ']');
- window->SetBoldColor(COLOR_CYAN);
- window->Print(4+i, 6, "%10d", reg_value);
- window->PrintBinary(4+i, 18, reg_value);
- }
-
- // Print it!
- window->Refresh();
-
- // Wait for the results.
- bool finished = false;
- while (!finished) {
- int cur_char = GetInput();
- switch (cur_char) {
- case 'q':
- case 'Q':
- case ' ':
- case '\n':
- case '\r':
- finished = true;
- break;
- }
- }
-
- delete window;
- cView::Redraw();
-}
-
-
-void cZoomScreen::ViewStack()
-{
- cTextWindow * window = new cTextWindow(16, 50, 4, 15);
- cHardwareCPU & hardware =
- (cHardwareCPU &) info.GetActiveCell()->GetOrganism()->GetHardware();
-
- bool finished = false;
- int active_stack = hardware.GetActiveStackID();
-
-
- while (finished == false) {
- window->SetBoldColor(COLOR_WHITE);
- window->Box();
-
- char stack_letter = 'A' + active_stack;
- window->Print(2, 5, "[<] Stack %c [>]", stack_letter);
- window->SetBoldColor(COLOR_CYAN);
- window->Print(2, 6, '<');
- window->Print(2, 18, '>');
-
- window->SetBoldColor(COLOR_WHITE);
- for (int i = 0; i < 10; i++) {
- const int stack_value = hardware.GetStack(i,active_stack);
- window->Print(4+i, 2, "%10d : ", stack_value);
- window->PrintBinary(4+i, 15, stack_value);
- }
-
- // Print it!
- window->Refresh();
-
- // Wait for the results.
- bool legal_keypress = false;
- while (!legal_keypress) {
- int cur_char = GetInput();
- switch (cur_char) {
- case ',':
- case '<':
- case '.':
- case '>':
- active_stack = 1 - active_stack;
- legal_keypress = true;
- break;
- case 'q':
- case 'Q':
- case ' ':
- case '\n':
- case '\r':
- finished = true;
- legal_keypress = true;
- break;
- }
- }
-
- }
-
- delete window;
- cView::Redraw();
-}
-
-
-void cZoomScreen::ViewInputs()
-{
- cTextWindow * window = new cTextWindow(9, 54, 4, 13);
-
- window->SetBoldColor(COLOR_WHITE);
- window->Box();
-
- window->Print(2, 2, "Inputs");
-
- for (int i = 0; i < 3; i++) {
- const int input_value = info.GetActiveCell()->GetInput(i);
- window->SetBoldColor(COLOR_WHITE);
- window->Print(4+i, 2, "%d:", i);
- window->Print(4+i, 17, '[');
- window->Print(4+i, 50, ']');
- window->SetBoldColor(COLOR_CYAN);
- window->Print(4+i, 6, "%10d", input_value);
- window->PrintBinary(4+i, 18, input_value);
- }
-
- // Print it!
- window->Refresh();
-
- // Wait for the results.
- bool finished = false;
- while (finished == false) {
- int cur_char = GetInput();
- switch (cur_char) {
- case 'q':
- case 'Q':
- case ' ':
- case '\n':
- case '\r':
- finished = true;
- break;
- }
- }
-
- delete window;
- cView::Redraw();
-}
-
-
-void cZoomScreen::ViewThreads()
-{
-}
-
-cCoords cZoomScreen::GetSectionCoords(int in_section)
-{
- switch (in_section) {
- case ZOOM_SECTION_MEMORY:
- return cCoords(MEMORY_X, MEMORY_Y);
- break;
-
- case ZOOM_SECTION_REGISTERS:
- if(cConfig::GetHardwareType()==HARDWARE_TYPE_CPU_ORIGINAL)
- {
- return cCoords(REG_X, REG_Y);
- }
- else if(cConfig::GetHardwareType()==HARDWARE_TYPE_CPU_4STACK)
- {
- return cCoords(REG_X, REG_Y-1);
- }
- break;
-
- case ZOOM_SECTION_STACK:
- if(cConfig::GetHardwareType()==HARDWARE_TYPE_CPU_ORIGINAL)
- {
- return cCoords(STACK_X, STACK_Y);
- }
- else if(cConfig::GetHardwareType()==HARDWARE_TYPE_CPU_4STACK)
- {
- return cCoords(STACK_X, STACK_Y-1);
- }
- break;
-
- case ZOOM_SECTION_INPUTS:
- if(cConfig::GetHardwareType()==HARDWARE_TYPE_CPU_ORIGINAL)
- {
- return cCoords(INPUT_X, INPUT_Y);
- }
- else if(cConfig::GetHardwareType()==HARDWARE_TYPE_CPU_4STACK)
- {
- return cCoords(INPUT_X, INPUT_Y-1);
- }
- break;
-
- case ZOOM_SECTION_MAP:
- return cCoords(MINI_MAP_X, MINI_MAP_Y);
- break;
- }
-
- return cCoords(0,0);
-}
-
-/*
-cString cZoomScreen::GetSectionName(int in_section)
-{
- switch (in_section) {
- case ZOOM_SECTION_MEMORY:
- if(cConfig::GetHardwareType()==HARDWARE_TYPE_CPU_ORIGINAL)
- {
- return cString("Memory");
- }
- else if(cConfig::GetHardwareType()==HARDWARE_TYPE_CPU_4STACK)
- {
- return cString("Memory Space");
- }
- break;
-
- case ZOOM_SECTION_REGISTERS:
- if(cConfig::GetHardwareType()==HARDWARE_TYPE_CPU_ORIGINAL)
- {
- return cString("Registers:");
- }
- else if(cConfig::GetHardwareType()==HARDWARE_TYPE_CPU_4STACK)
- {
- return cString("Stacks:");
- }
- break;
-
- case ZOOM_SECTION_STACK:
- return cString("Stack ");
- break;
-
- case ZOOM_SECTION_INPUTS:
- return cString("Inputs:");
- break;
-
- case ZOOM_SECTION_MAP:
- return cString("Mini-Map");
- break;
- }
-
- return cString("Unknown!");
-}*/
-
-char* cZoomScreen::GetSectionName(int in_section)
-{
- switch (in_section) {
- case ZOOM_SECTION_MEMORY:
- if(cConfig::GetHardwareType()==HARDWARE_TYPE_CPU_ORIGINAL)
- {
- return "Memory";
- }
- else if(cConfig::GetHardwareType()==HARDWARE_TYPE_CPU_4STACK)
- {
- return "Memory Space";
- }
- break;
-
- case ZOOM_SECTION_REGISTERS:
- if(cConfig::GetHardwareType()==HARDWARE_TYPE_CPU_ORIGINAL)
- {
- return "Registers:";
- }
- else if(cConfig::GetHardwareType()==HARDWARE_TYPE_CPU_4STACK)
- {
- return "Stacks:";
- }
- break;
-
- case ZOOM_SECTION_STACK:
- return "Stack ";
- break;
-
- case ZOOM_SECTION_INPUTS:
- return "Inputs:";
- break;
-
- case ZOOM_SECTION_MAP:
- return "Mini-Map";
- break;
- }
-
- return "Unknown!";
-}
-
-void cZoomScreen::SetActiveSection(int in_section)
-{
- if (in_section != active_section) {
- // Set the old section to be normal white
- cCoords sect_coords(GetSectionCoords(active_section));
- sect_coords.Translate(2, 1);
- SetColor(COLOR_WHITE);
- Print(sect_coords.GetY(), sect_coords.GetX(), "%s",
- GetSectionName(active_section));
- active_section = in_section;
- }
-
- cCoords sect_coords(GetSectionCoords(active_section));
- sect_coords.Translate(2, 1);
- SetBoldColor(COLOR_BLUE);
- Print(sect_coords.GetY(), sect_coords.GetX(), "%s",
- GetSectionName(active_section));
- SetColor(COLOR_WHITE);
-}
-
-void cZoomScreen::DoInput(int in_char)
-{
- // First do the Mode specific io...
-
- if (mode == ZOOM_MODE_CPU && DoInputCPU(in_char)) return;
- if (mode == ZOOM_MODE_STATS && DoInputStats(in_char)) return;
- if (mode == ZOOM_MODE_GENOTYPE && DoInputGenotype(in_char)) return;
-
- int num_threads;
- if(cConfig::GetHardwareType()==HARDWARE_TYPE_CPU_ORIGINAL)
- {
- cHardwareCPU & hardwareCPU =
- (cHardwareCPU &) info.GetActiveCell()->GetOrganism()->GetHardware();
- num_threads = hardwareCPU.GetNumThreads();
- }
- else if(cConfig::GetHardwareType()==HARDWARE_TYPE_CPU_4STACK)
- {
- cHardware4Stack & hardware4Stack =
- (cHardware4Stack &) info.GetActiveCell()->GetOrganism()->GetHardware();
- num_threads = hardware4Stack.GetNumThreads();
- }
- switch(in_char) {
- case 't':
- case 'T':
- if(num_threads>1)
- {
- memory_offset=0;
- ++cur_view_thread%=num_threads;
- if(cConfig::GetHardwareType()==HARDWARE_TYPE_CPU_4STACK)
- {
- cHardware4Stack & hardware4Stack =
- (cHardware4Stack &) info.GetActiveCell()->GetOrganism()->GetHardware();
- cur_mem_space=hardware4Stack.IP(cur_view_thread).GetMemSpace();
- }
- //ThreadOptions();
- Update();
- }
- break;
- /*
- case 'x':
- case 'X':
- // Toggle the parasite_zoom flag IF we are on a parasite
- if (info.GetPauseLevel() && info.GetActiveCell() &&
- info.GetActiveCell()->IsParasite()) {
- parasite_zoom = !parasite_zoom;
- Update();
- }
- break;
- */
- case ' ':
- memory_offset = 0;
- parasite_zoom = false;
- info.GetActiveCell()->GetOrganism()->GetPhenotype().SetFault("");
- info.EngageStepMode();
- break;
- case '>':
- case '.':
- mode++;
- if (mode == NUM_ZOOM_MODES) mode = 0;
- Clear();
- Draw();
- break;
- case '<':
- case ',':
- mode--;
- if (mode == -1) mode = NUM_ZOOM_MODES - 1;
-
- Clear();
- Draw();
- break;
-
- default:
- cerr << "Unknown Command (#"
- << (int) in_char << "): [" << in_char << "]" << endl;
- break;
- }
-}
-
-
-bool cZoomScreen::DoInputCPU(int in_char)
-{
- switch(in_char) {
- case '2':
- case KEY_DOWN:
- if (active_section == ZOOM_SECTION_MAP) {
- mini_center_id += map_x_size;
- mini_center_id %= population.GetSize();
- cur_view_thread=0;
- if (population.GetCell(mini_center_id).IsOccupied()) {
- memory_offset = 0;
- info.SetActiveCell( &(population.GetCell(mini_center_id)));
- }
- Update();
- } else if (active_section == ZOOM_SECTION_MEMORY) {
- memory_offset++;
- Update();
- }
- break;
- case '8':
- case KEY_UP:
- if (active_section == ZOOM_SECTION_MAP) {
- mini_center_id -= map_x_size;
- cur_view_thread=0;
- if (mini_center_id < 0) mini_center_id += population.GetSize();
- if (population.GetCell(mini_center_id).IsOccupied()) {
- memory_offset = 0;
- info.SetActiveCell( &(population.GetCell(mini_center_id)));
- }
- Update();
- } else if (active_section == ZOOM_SECTION_MEMORY) {
- memory_offset--;
- Update();
- }
- break;
- case '6':
- case KEY_RIGHT:
- if (active_section == ZOOM_SECTION_MAP) {
- mini_center_id++;
- if (mini_center_id == population.GetSize()) mini_center_id = 0;
- if (population.GetCell(mini_center_id).IsOccupied()) {
- memory_offset = 0;
- info.SetActiveCell( &(population.GetCell(mini_center_id)));
- }
- }
- else if (active_section == ZOOM_SECTION_MEMORY) {
- if(cConfig::GetHardwareType() == HARDWARE_TYPE_CPU_4STACK)
- {
- cur_mem_space++;
- cur_mem_space %= nHardware4Stack::NUM_MEMORY_SPACES;
- }
- }
- Update();
- break;
- case '4':
- case KEY_LEFT:
- if (active_section == ZOOM_SECTION_MAP) {
- mini_center_id--;
- if (mini_center_id < 0) mini_center_id += population.GetSize();
- if (population.GetCell(mini_center_id).IsOccupied()) {
- memory_offset = 0;
- info.SetActiveCell( &(population.GetCell(mini_center_id)));
- }
- }
- else if (active_section == ZOOM_SECTION_MEMORY) {
- if(cConfig::GetHardwareType()==HARDWARE_TYPE_CPU_4STACK) {
- cur_mem_space--;
- if (cur_mem_space < 0) cur_mem_space = nHardware4Stack::NUM_MEMORY_SPACES - 1;
- }
- }
- Update();
- break;
- case 'K':
- case 'k':
- if(cConfig::GetHardwareType()==HARDWARE_TYPE_CPU_4STACK) {
- ++cur_stack%=4;
- }
- Update();
- break;
- //case '<':
- // if(hardware_type==HARDWARE_TYPE_CPU_4STACK)
- // {
- //cur_stack=(cur_stack-1);
- //if(cur_stack<0) cur_stack=3;
- //}
- //Update();
- //break;
- case '+':
- case '=':
- info.IncMapMode();
- Update();
- break;
- case '-':
- case '_':
- info.DecMapMode();
- Update();
- break;
- case '\n':
- case '\r':
- if (active_section == ZOOM_SECTION_MAP) {
- memory_offset = 0;
- info.SetActiveCell( &(population.GetCell(mini_center_id)));
- }
- Update();
- break;
- case '\t':
- {
- int next_section = active_section + 1;
- if (next_section == NUM_ZOOM_SECTIONS) next_section = 0;
- SetActiveSection(next_section);
- }
- Refresh();
- break;
-
- case 'e':
- case 'E':
- if( active_section == ZOOM_SECTION_MEMORY) {
- EditMemory();
- }
- break;
-
- case 'v':
- case 'V':
- switch (active_section) {
- case ZOOM_SECTION_MEMORY:
- ViewMemory();
- break;
- case ZOOM_SECTION_REGISTERS:
- ViewRegisters();
- break;
- case ZOOM_SECTION_STACK:
- ViewStack();
- break;
- case ZOOM_SECTION_INPUTS:
- ViewInputs();
- break;
- }
- break;
-
-
- default:
- return false;
- };
-
- return true;
-}
-
-bool cZoomScreen::DoInputStats(int in_char)
-{
- switch(in_char) {
- case '6':
- case KEY_RIGHT:
- {
- const int new_task_offset = task_offset + Height() - TASK_Y - 2;
- if (new_task_offset < cConfig::GetNumTasks()) {
- task_offset = new_task_offset;
- Draw();
- }
- }
- break;
- case '4':
- case KEY_LEFT:
- {
- const int new_task_offset = task_offset - Height() + TASK_Y + 2;
- if (new_task_offset >= 0) {
- task_offset = new_task_offset;
- Draw();
- }
- }
- break;
-
- default:
- return false;
- }
-
- return true;
-}
-
-bool cZoomScreen::DoInputGenotype(int in_char)
-{
- return false;
-}
-
-void cZoomScreen::DrawMiniMap()
-{
- // if (GetSubWindow(0) == NULL) AddSubWindow(map_screen, 0);
- // map_screen->Update();
-
- // Setup the start color for the map...
- SetColor(COLOR_WHITE);
- mini_center_id = info.GetActiveCell()->GetID();
-
- const int name_x = MINI_MAP_X + 4;
- const int name_y = MINI_MAP_Y + 11;
- if (info.GetMapMode() == MAP_BASIC) Print(name_y, name_x, "Genotypes");
- else if (info.GetMapMode() == MAP_SPECIES) Print(name_y, name_x, " Species ");
- else if (info.GetMapMode() == MAP_COMBO) Print(name_y, name_x, " Combo ");
- else if (info.GetMapMode() == MAP_INJECT) Print(name_y, name_x, "Modified ");
- else if (info.GetMapMode() == MAP_RESOURCE) Print(name_y, name_x, "Resources");
- else if (info.GetMapMode() == MAP_AGE) Print(name_y, name_x, " Age ");
- else if (info.GetMapMode() == MAP_BREED_TRUE) Print(name_y, name_x, "BreedTrue");
- else if (info.GetMapMode() == MAP_PARASITE) Print(name_y, name_x, "Parasites");
- else if (info.GetMapMode() == MAP_MUTATIONS) Print(name_y, name_x, "Mutations");
- else if (info.GetMapMode() == MAP_THREAD) Print(name_y, name_x, " Threads ");
- else if (info.GetMapMode() == MAP_LINEAGE) Print(name_y, name_x, " Lineage ");
-
-
- int virtual_x = (mini_center_id % map_x_size) + map_x_size;
- int virtual_y = (mini_center_id / map_x_size) + map_y_size;
-
- info.SetupSymbolMaps(info.GetMapMode(), HasColors());
-
- for (int y = -3; y <= 3 && y < map_y_size - 3; y++) {
- Move(MINI_MAP_Y + 6 + y, MINI_MAP_X + 2);
- int cur_y = (y + virtual_y) % map_y_size;
- for (int x = -3; x <= 3 && x < map_x_size - 3; x++) {
- int cur_x = (x + virtual_x) % map_x_size;
- int index = cur_y * map_x_size + cur_x;
-
- SetSymbolColor(info.ColorSymbol(index));
- if (info.MapSymbol(index) > 0) Print(info.MapSymbol(index));
- else Print(CHAR_BULLET);
-
- // Space between columns
- for (int i = 0; i < AVIDA_MAP_X_SPACING - 1; i++) Print(' ');
- }
- }
- SetColor(COLOR_WHITE);
- Print(MINI_MAP_Y + 6, MINI_MAP_X + 7, '[');
- Print(MINI_MAP_Y + 6, MINI_MAP_X + 9, ']');
-
- Refresh();
-}
-
Deleted: branches/brysonda/source/viewer/zoom_screen.hh
===================================================================
--- branches/brysonda/source/viewer/zoom_screen.hh 2005-10-23 04:16:36 UTC (rev 359)
+++ branches/brysonda/source/viewer/zoom_screen.hh 2005-10-23 04:43:06 UTC (rev 360)
@@ -1,128 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2001 California Institute of Technology //
-// //
-// Read the COPYING and README files, or contact 'avida at alife.org', //
-// before continuing. SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE. //
-//////////////////////////////////////////////////////////////////////////////
-
-#ifndef VIEW_ZOOM_SCREEN_HH
-#define VIEW_ZOOM_SCREEN_HH
-
-#include "text_screen.hh"
-#include "map_screen.hh"
-
-#define ZOOM_MODE_STATS 0
-#define ZOOM_MODE_CPU 1
-#define ZOOM_MODE_GENOTYPE 2
-#define NUM_ZOOM_MODES 3
-
-#define ZOOM_SECTION_MEMORY 0
-#define ZOOM_SECTION_MAP 1
-#define ZOOM_SECTION_REGISTERS 2
-#define ZOOM_SECTION_STACK 3
-#define ZOOM_SECTION_INPUTS 4
-#define NUM_ZOOM_SECTIONS 5
-
-
-#define MEMORY_X 0
-#define MEMORY_Y 0
-#define MEMORY_PRE_SIZE 4
-#define MEMORY_POST_SIZE 4
-
-#define CPU_FLAGS_X 0
-#define CPU_FLAGS_Y 13
-
-#define STACK_X 18
-#define STACK_Y 14
-#define REG_X 0
-#define REG_Y 14
-#define INPUT_X 32
-#define INPUT_Y 14
-#define TASK_X 50
-#define TASK_Y 7
-#define MINI_MAP_X 38
-#define MINI_MAP_Y 0
-#define OPTIONS_X 57
-#define OPTIONS_Y 1
-#define FAULT_X 2
-#define FAULT_Y 13
-
-#define INST_EDIT_BREAKPOINT 0
-#define INST_EDIT_JUMP_IP 1
-#define INST_EDIT_CHANGE 2
-#define INST_EDIT_INSERT 3
-#define INST_EDIT_REMOVE 4
-#define NUM_INST_EDITS 5
-
-#define THREAD_OPTIONS_VIEW 0
-#define THREAD_OPTIONS_LOCK 1
-#define NUM_THREAD_OPTIONS 2
-
-class cZoomScreen : public cScreen {
-private:
- cPopulation & population;
- int mini_center_id;
- int map_x_size;
- int map_y_size;
-
- int mode;
- //int map_mode;
- bool inst_view_mode;
- int memory_offset;
- bool parasite_zoom; // If true, then view original parasite code, not host
- int active_section;
- int task_offset;
- //int hardware_type;
- int cur_stack;
- int cur_mem_space;
- int cur_view_thread;
-
-private:
- void DrawCPU_Original();
- void DrawCPU_4Stack();
- void DrawStats();
- void DrawGenotype();
- void UpdateCPU(cHardwareBase & hardware);
- void UpdateCPU_Original(cHardwareBase & hardware);
- void UpdateCPU_4Stack(cHardwareBase & hardware);
- void UpdateStats(cHardwareBase & hardware);
- void UpdateStats_CPU(cHardwareBase & hardware);
- void UpdateStats_4Stack(cHardwareBase & hardware);
- void UpdateGenotype();
-
- void EditMemory();
- void ViewMemory();
-
- void ThreadOptions();
-
- void ViewInstruction();
- void ViewRegisters();
- void ViewStack();
- void ViewInputs();
- void ViewThreads();
-
- cCoords GetSectionCoords(int in_section);
- //cString GetSectionName(int in_section);
- char* GetSectionName(int in_section);
- void SetActiveSection(int in_section);
-
- void DrawMiniMap();
-
-public:
- cZoomScreen(int y_size, int x_size, int y_start, int x_start,
- cViewInfo & in_info, cPopulation & in_pop);
- virtual ~cZoomScreen() { ; }
-
- // Virtual in base screen...
- void Draw();
- virtual void Update();
- virtual void DoInput(int in_char);
- bool DoInputCPU(int in_char);
- bool DoInputStats(int in_char);
- bool DoInputGenotype(int in_char);
-
- // Other misc functions...
- void AdvanceUpdate() { memory_offset = 0; }
-};
-
-#endif
More information about the Avida-cvs
mailing list