[Avida-SVN] r2294 - in development: . CMakeModules source/main source/targets/viewer-fltk source/viewer-core source/viewer-coreGUI
ofria at myxo.css.msu.edu
ofria at myxo.css.msu.edu
Fri Feb 1 12:32:18 PST 2008
Author: ofria
Date: 2008-02-01 15:32:17 -0500 (Fri, 01 Feb 2008)
New Revision: 2294
Modified:
development/CMakeLists.txt
development/CMakeModules/FindFLTK.cmake
development/source/main/cPopulation.cc
development/source/main/cPopulation.h
development/source/targets/viewer-fltk/cDriver_FLTKViewer.cc
development/source/targets/viewer-fltk/cDriver_FLTKViewer.h
development/source/targets/viewer-fltk/cFLTKGridView.cc
development/source/targets/viewer-fltk/cFLTKGridView.h
development/source/targets/viewer-fltk/cFLTKWidget.h
development/source/targets/viewer-fltk/tFLTKButton.h
development/source/viewer-core/cCoreView_Map.cc
development/source/viewer-core/cCoreView_Map.h
development/source/viewer-coreGUI/cColor.cc
development/source/viewer-coreGUI/cColor.h
development/source/viewer-coreGUI/cGUIWidget.cc
development/source/viewer-coreGUI/cGUIWidget.h
Log:
Updated gui interface (from a while ago; finally checking it in...)
Modified: development/CMakeLists.txt
===================================================================
--- development/CMakeLists.txt 2008-01-31 23:35:41 UTC (rev 2293)
+++ development/CMakeLists.txt 2008-02-01 20:32:17 UTC (rev 2294)
@@ -156,6 +156,7 @@
SET(COREVIEW_DIR ${PROJECT_SOURCE_DIR}/source/viewer-core)
SET(COREVIEW_SOURCES
${COREVIEW_DIR}/cCoreView_Info.cc
+ ${COREVIEW_DIR}/cCoreView_Map.cc
)
SOURCE_GROUP(coreview FILES ${COREVIEW_SOURCES})
LIST(APPEND AVIDA_CORE_SOURCES ${COREVIEW_SOURCES})
@@ -165,6 +166,7 @@
# The core GUI directory
SET(COREGUI_DIR ${PROJECT_SOURCE_DIR}/source/viewer-coreGUI)
SET(COREGUI_SOURCES
+ ${COREGUI_DIR}/cColor.cc
${COREGUI_DIR}/cGUIWidget.cc
)
SOURCE_GROUP(coregui FILES ${COREGUI_SOURCES})
@@ -268,6 +270,7 @@
SET(TOOLS_SOURCES
${TOOLS_DIR}/cArgContainer.cc
${TOOLS_DIR}/cArgSchema.cc
+ ${TOOLS_DIR}/cBitArray.cc
${TOOLS_DIR}/cChangeList.cc
${TOOLS_DIR}/cConstSchedule.cc
${TOOLS_DIR}/cDataEntry.cc
@@ -446,22 +449,15 @@
SET(AVIDA_TEXT_VIEWER_DIR source/targets/viewer-text)
SET(AVIDA_TEXT_VIEWER_SOURCES
# ${AVIDA_TEXT_VIEWER_DIR}/cAnalyzeScreen.cc
-# ${AVIDA_TEXT_VIEWER_DIR}/cAnalyzeView.cc
-# ${AVIDA_TEXT_VIEWER_DIR}/cBarScreen.cc
# ${AVIDA_TEXT_VIEWER_DIR}/cEnvironmentScreen.cc
# ${AVIDA_TEXT_VIEWER_DIR}/cHistScreen.cc
-# ${AVIDA_TEXT_VIEWER_DIR}/cMapScreen.cc
# ${AVIDA_TEXT_VIEWER_DIR}/cMenuWindow.cc
# ${AVIDA_TEXT_VIEWER_DIR}/cOptionsScreen.cc
-# ${AVIDA_TEXT_VIEWER_DIR}/cScreen.cc
# ${AVIDA_TEXT_VIEWER_DIR}/cStatsScreen.cc
-# ${AVIDA_TEXT_VIEWER_DIR}/cSymbolUtil.cc
- ${AVIDA_TEXT_VIEWER_DIR}/cTextWindow.cc
-# ${AVIDA_TEXT_VIEWER_DIR}/cView.cc
-# ${AVIDA_TEXT_VIEWER_DIR}/cViewInfo.cc
# ${AVIDA_TEXT_VIEWER_DIR}/cZoomScreen.cc
+ ${AVIDA_TEXT_VIEWER_DIR}/cScreen_Map.cc
+ ${AVIDA_TEXT_VIEWER_DIR}/cTextWindow.cc
${AVIDA_TEXT_VIEWER_DIR}/cDriver_TextViewer.cc
-# ${AVIDA_TEXT_VIEWER_DIR}/cTextViewerManager.cc
${AVIDA_TEXT_VIEWER_DIR}/viewer-text.cc
)
SOURCE_GROUP(targets\\viewer-text FILES ${AVIDA_TEXT_VIEWER_SOURCES})
@@ -509,11 +505,13 @@
${AVIDA_FLTK_VIEWER_DIR}/cDriver_FLTKViewer.cc
${AVIDA_FLTK_VIEWER_DIR}/viewer-fltk.cc
${AVIDA_FLTK_VIEWER_DIR}/fltk-defs.cc
+ ${AVIDA_FLTK_VIEWER_DIR}/cFLTKGridView.cc
+ ${AVIDA_FLTK_VIEWER_DIR}/cFLTKLegend.cc
)
SOURCE_GROUP(targets\\viewer-fltk FILES ${AVIDA_FLTK_VIEWER_SOURCES})
ADD_EXECUTABLE(avida-fltkview ${AVIDA_FLTK_VIEWER_SOURCES})
- SET(AVIDA_FLTK_VIEWER_LIBS avidacore ${FLTK_BASE_LIBRARY})
+ SET(AVIDA_FLTK_VIEWER_LIBS avidacore ${FLTK_BASE_LIBRARY} ${FLTK_IMAGE_LIBRARY} $(FLTK_JPEG_LIBRARY))
IF(NOT MSVC)
LIST(APPEND AVIDA_FLTK_VIEWER_LIBS pthread)
ENDIF(NOT MSVC)
Modified: development/CMakeModules/FindFLTK.cmake
===================================================================
--- development/CMakeModules/FindFLTK.cmake 2008-01-31 23:35:41 UTC (rev 2293)
+++ development/CMakeModules/FindFLTK.cmake 2008-02-01 20:32:17 UTC (rev 2294)
@@ -57,6 +57,14 @@
NAMES fltk
PATHS /usr/local/lib /usr/lib /lib
)
+FIND_LIBRARY(FLTK_IMAGE_LIBRARY
+ NAMES fltk_images
+ PATHS /usr/local/lib /usr/lib /lib
+ )
+FIND_LIBRARY(FLTK_JPEG_LIBRARY
+ NAMES fltk_jpeg
+ PATHS /usr/local/lib /usr/lib /lib
+ )
FIND_LIBRARY(XEXT_LIBRARY
NAMES Xext
PATHS /usr/local/lib /usr/lib /lib /usr/X11R6/lib
Modified: development/source/main/cPopulation.cc
===================================================================
--- development/source/main/cPopulation.cc 2008-01-31 23:35:41 UTC (rev 2293)
+++ development/source/main/cPopulation.cc 2008-02-01 20:32:17 UTC (rev 2294)
@@ -325,20 +325,22 @@
// If we're not about to kill the parent, do some extra work on it.
if (parent_alive == true) {
-
// Reset inputs and re-calculate merit if required
if (m_world->GetConfig().RESET_INPUTS_ON_DIVIDE.Get() > 0){
environment.SetupInputs(ctx, parent_cell.m_inputs);
+
int pc_phenotype = m_world->GetConfig().PRECALC_PHENOTYPE.Get();
if (pc_phenotype){
cCPUTestInfo test_info;
cTestCPU* test_cpu = m_world->GetHardwareManager().CreateTestCPU();
test_info.UseManualInputs(parent_cell.GetInputs()); // Test using what the environment will be
test_cpu->TestGenome(ctx, test_info, parent_organism.GetHardware().GetMemory()); // Use the true genome
- if (pc_phenotype & 1) // If we must update the merit
+ if (pc_phenotype & 1) { // If we must update the merit
parent_phenotype.SetMerit(test_info.GetTestPhenotype().GetMerit());
- if (pc_phenotype & 2) // If we must update the gestation time
+ }
+ if (pc_phenotype & 2) { // If we must update the gestation time
parent_phenotype.SetGestationTime(test_info.GetTestPhenotype().GetGestationTime());
+ }
parent_phenotype.SetFitness(parent_phenotype.GetMerit().CalcFitness(parent_phenotype.GetGestationTime())); //Update fitness
delete test_cpu;
}
Modified: development/source/main/cPopulation.h
===================================================================
--- development/source/main/cPopulation.h 2008-01-31 23:35:41 UTC (rev 2293)
+++ development/source/main/cPopulation.h 2008-02-01 20:32:17 UTC (rev 2294)
@@ -223,10 +223,10 @@
bool OK();
- int GetSize() { return cell_array.GetSize(); }
- int GetWorldX() { return world_x; }
- int GetWorldY() { return world_y; }
- int GetNumDemes() { return deme_array.GetSize(); }
+ int GetSize() const { return cell_array.GetSize(); }
+ int GetWorldX() const { return world_x; }
+ int GetWorldY() const { return world_y; }
+ int GetNumDemes() const { return deme_array.GetSize(); }
cDeme& GetDeme(int i) { return deme_array[i]; }
cPopulationCell& GetCell(int in_num);
Modified: development/source/targets/viewer-fltk/cDriver_FLTKViewer.cc
===================================================================
--- development/source/targets/viewer-fltk/cDriver_FLTKViewer.cc 2008-01-31 23:35:41 UTC (rev 2293)
+++ development/source/targets/viewer-fltk/cDriver_FLTKViewer.cc 2008-02-01 20:32:17 UTC (rev 2294)
@@ -42,17 +42,27 @@
#include "cFLTKBox.h"
#include "tFLTKButton.h"
+#include "avidalogo.xpm"
+
#include <cstdlib>
#include <FL/Fl.H>
+// #include <FL/Fl_JPEG_Image.H>
using namespace std;
#define FLTK_MAINWIN_WIDTH 800
#define FLTK_MAINWIN_HEIGHT 600
#define FLTK_MENUBAR_HEIGHT 35
-#define FLTK_BODY_HEIGHT (FLTK_MAINWIN_HEIGHT - FLTK_MENUBAR_HEIGHT)
+#define FLTK_SPACING 5
+#define FLTK_GRID_SIDE 502
+#define FLTK_SIDEBAR_WIDTH (FLTK_MAINWIN_WIDTH - FLTK_GRID_SIDE - 3*FLTK_SPACING)
+#define FLTK_SIDEBAR_HEIGHT (FLTK_MAINWIN_HEIGHT - 2*FLTK_SPACING)
+#define FLTK_BODY_HEIGHT (FLTK_MAINWIN_HEIGHT - 2 * FLTK_MENUBAR_HEIGHT - 2 * FLTK_SPACING)
+#define FLTK_MENU1_Y FLTK_BODY_HEIGHT
+#define FLTK_MENU2_Y (FLTK_MENU1_Y + FLTK_MENUBAR_HEIGHT + FLTK_SPACING)
+
#define FLTK_MENU_FONT_SIZE 20
cDriver_FLTKViewer::cDriver_FLTKViewer(cWorld* world)
@@ -60,15 +70,16 @@
, m_info(world, 18)
, m_done(false)
, m_main_window(FLTK_MAINWIN_WIDTH, FLTK_MAINWIN_HEIGHT, "Avida")
- , m_body_box(m_main_window, 0, FLTK_MENUBAR_HEIGHT, FLTK_MAINWIN_WIDTH, FLTK_BODY_HEIGHT)
- , m_update_box(m_main_window, 0, 0, 200, FLTK_MENUBAR_HEIGHT, "Update 0")
- , m_title_box(m_main_window, 600, 0, 200, FLTK_MENUBAR_HEIGHT, "Avida")
- , m_grid_view(m_info, m_main_window, 10, FLTK_MENUBAR_HEIGHT+10, FLTK_MAINWIN_WIDTH-20, FLTK_BODY_HEIGHT-60)
- , m_grid_view_menu(m_main_window, 50, FLTK_MAINWIN_HEIGHT-45, 80, 30, "View:")
- , m_grid_tags_menu(m_main_window, 180, FLTK_MAINWIN_HEIGHT-45, 80, 30, "Tags:")
- , m_grid_symbol_menu(m_main_window, 310, FLTK_MAINWIN_HEIGHT-45, 80, 30, "Shape:")
- , m_pause_button(m_main_window, 600, FLTK_MAINWIN_HEIGHT - 45, 80, 30, "Pause", cGUIButton::BUTTON_LIGHT)
- , m_quit_button(m_main_window, 700, FLTK_MAINWIN_HEIGHT - 45, 80, 30, "&Quit")
+ , m_body_box(m_main_window, 0, 0, FLTK_MAINWIN_WIDTH, FLTK_BODY_HEIGHT)
+ , m_update_box(m_main_window, 100, FLTK_MENU2_Y, 200, FLTK_MENUBAR_HEIGHT, "Update: 0")
+ , m_title_box(m_main_window, 0, FLTK_MENU2_Y, 80, FLTK_MENUBAR_HEIGHT)
+ , m_grid_view(m_info, m_main_window, FLTK_SPACING, FLTK_SPACING, FLTK_GRID_SIDE, FLTK_GRID_SIDE)
+ , m_legend(m_grid_view, m_main_window, FLTK_GRID_SIDE + 2*FLTK_SPACING, FLTK_SPACING, FLTK_SIDEBAR_WIDTH, FLTK_SIDEBAR_HEIGHT)
+ , m_grid_view_menu(m_main_window, 140, FLTK_MENU1_Y, 80, 30, "View:")
+ , m_grid_tags_menu(m_main_window, 270, FLTK_MENU1_Y, 80, 30, "Tags:")
+ , m_grid_symbol_menu(m_main_window, 400, FLTK_MENU1_Y, 80, 30, "Mark:")
+ , m_pause_button(m_main_window, 400, FLTK_MENU2_Y, 30, 30, "@||")
+ , m_quit_button(m_main_window, 440, FLTK_MENU2_Y, 30, 30, "@square")
{
// Setup the initial view mode (loaded from avida.cfg)
m_info.SetViewMode(world->GetConfig().VIEW_MODE.Get());
@@ -82,10 +93,18 @@
m_update_box.SetType(cGUIBox::BOX_NONE);
m_update_box.SetFontSize(FLTK_MENU_FONT_SIZE);
+ m_update_box.SetFontAlign(FL_ALIGN_INSIDE | FL_ALIGN_LEFT);
+ m_update_box.SetTooltip("Updates are the natural timescale in Avida");
m_update_box.Refresh();
m_title_box.SetType(cGUIBox::BOX_NONE);
+ m_title_box.SetFont(FL_HELVETICA_BOLD);
m_title_box.SetFontSize(FLTK_MENU_FONT_SIZE);
+ m_title_box.SetFontColor(cColor::DARK_MAGENTA);
+ cString title_tooltip;
+ title_tooltip.Set("Avida Version %s\nby Charles Ofria", VERSION);
+ m_title_box.SetTooltip(title_tooltip);
+ m_title_box.SetImage_XPM(avidalogo);
m_title_box.Refresh();
cCoreView_Map & map_info = m_grid_view.GetMapInfo();
@@ -106,7 +125,11 @@
m_grid_symbol_menu.SetActive(0);
m_pause_button.SetCallback(this, &cDriver_FLTKViewer::ButtonCallback_Pause);
+ m_pause_button.SetTooltip("Pause");
m_quit_button.SetCallback(this, &cDriver_FLTKViewer::ButtonCallback_Quit);
+ m_quit_button.SetFontColor(cColor::DARK_RED);
+ m_quit_button.SetFontSize(12);
+ m_quit_button.SetTooltip("Quit");
m_main_window.Finalize();
}
@@ -360,6 +383,7 @@
m_update_box.Refresh();
m_grid_view.Redraw();
+ m_legend.Redraw();
const int pause_level = m_info.GetPauseLevel();
@@ -428,7 +452,15 @@
void cDriver_FLTKViewer::ButtonCallback_Pause(double ignore)
{
- m_info.TogglePause();
+ bool paused = m_info.TogglePause();
+ if (paused == true) {
+ m_pause_button.SetLabel("@>");
+ m_pause_button.SetTooltip("Play");
+ }
+ else {
+ m_pause_button.SetLabel("@||");
+ m_pause_button.SetTooltip("Pause");
+ }
}
Modified: development/source/targets/viewer-fltk/cDriver_FLTKViewer.h
===================================================================
--- development/source/targets/viewer-fltk/cDriver_FLTKViewer.h 2008-01-31 23:35:41 UTC (rev 2293)
+++ development/source/targets/viewer-fltk/cDriver_FLTKViewer.h 2008-02-01 20:32:17 UTC (rev 2294)
@@ -39,6 +39,7 @@
#include "cFLTKBox.h"
#include "cFLTKGridView.h"
+#include "cFLTKLegend.h"
#include "cFLTKWindow.h"
#include "tFLTKButton.h"
#include "tFLTKMenu.h"
@@ -69,6 +70,8 @@
cFLTKBox m_title_box;
cFLTKGridView m_grid_view;
+ cFLTKLegend m_legend;
+
tFLTKMenu<cDriver_FLTKViewer> m_grid_view_menu;
tFLTKMenu<cDriver_FLTKViewer> m_grid_tags_menu;
tFLTKMenu<cDriver_FLTKViewer> m_grid_symbol_menu;
Modified: development/source/targets/viewer-fltk/cFLTKGridView.cc
===================================================================
--- development/source/targets/viewer-fltk/cFLTKGridView.cc 2008-01-31 23:35:41 UTC (rev 2293)
+++ development/source/targets/viewer-fltk/cFLTKGridView.cc 2008-02-01 20:32:17 UTC (rev 2294)
@@ -27,6 +27,8 @@
#include "cCoreView_Info.h"
#include "cPopulation.h"
+#include "functions.h"
+
void cFLTKGridView::SetGenotypeColor(int color_id)
{
switch (color_id) {
@@ -64,23 +66,19 @@
const int world_y = m_info.GetPopulation().GetWorldY();
// Determine how large each cell can be and still fit in the window.
- int cell_w = (w() - 2) / world_x;
- int cell_h = (h() - 2) / world_y;
-
- // Make sure the cells are square.
- if (cell_w < cell_h) cell_h = cell_w;
- else cell_w = cell_h;
+ const int cell_side = Min((w() - 2) / world_x, (h() - 2) / world_y);
+ const int grid_x = world_x * cell_side;
+ const int grid_y = world_y * cell_side;
-// const int grid_offset_x = 10;
-// const int grid_offset_y = 10;
+ const int grid_offset_x = (w() - grid_x) / 2 + 1;
+ const int grid_offset_y = (h() - grid_y) / 2 + 1;
-// SetColor(cColor::WHITE);
-// DrawBox(0,0,GetWidth(), GetHeight(), true);
+ SetColor(cColor::WHITE);
+ DrawBox(0, 0, GetWidth(), GetHeight(), true); // White box around map
SetColor(cColor::BLACK);
- // DrawBox(0,0,GetWidth(), GetHeight(), false);
- // DrawBox(grid_offset_x, grid_offset_y, world_x*10+10, world_y*10+10, true);
- DrawBox(0, 0, world_x*cell_w+2, world_y*cell_h+2, true);
+ DrawBox(0, 0, GetWidth(), GetHeight(), false); // Outline
+ DrawBox(grid_offset_x - 2, grid_offset_y - 2, grid_x+2, grid_y+2, true); // Black grid background
m_map_info.UpdateMaps();
const tArray<int> & color_map( m_map_info.GetColors() );
@@ -89,20 +87,22 @@
int id = 0;
for (int y = 0; y < world_y; y++) {
+ const int cur_y = grid_offset_y + y * cell_side;
for (int x = 0; x < world_x; x++) {
if (color_method == cCoreView_Map::COLORS_SCALE) {
if (color_map[id] < 0) SetColor(cColor::BLACK);
- else SetColor(cColor::SET_BRIGHT[color_map[id]]);
+ else SetColor(cColor::SCALE_BRIGHT[color_map[id]]);
} else {
SetGenotypeColor(color_map[id]);
}
+ const int cur_x = grid_offset_x + x * cell_side;
+ DrawBox(cur_x, cur_y, cell_side-2, cell_side-2, true);
// DrawCircle(x*10, y*10, 4);
- DrawBox(x*cell_w+2, y*cell_h+2, cell_w-2, cell_h-2, true);
- //SetTagColor(tag_map[id]);
if (tag_map[id] > 0) {
SetColor(cColor::GREEN);
- DrawBox(x*cell_w+1, y*cell_h+1, cell_w, cell_h, false);
+ // DrawBox(cur_x - 1, cur_y - 1, cell_side, cell_side, false);
+ DrawBox(cur_x, cur_y, cell_side-2, cell_side-2, false);
}
id++;
Modified: development/source/targets/viewer-fltk/cFLTKGridView.h
===================================================================
--- development/source/targets/viewer-fltk/cFLTKGridView.h 2008-01-31 23:35:41 UTC (rev 2293)
+++ development/source/targets/viewer-fltk/cFLTKGridView.h 2008-02-01 20:32:17 UTC (rev 2294)
@@ -40,15 +40,21 @@
cCoreView_Info & m_info;
cCoreView_Map m_map_info;
- void SetGenotypeColor(int color_id);
public:
cFLTKGridView(cCoreView_Info & info, cGUIContainer & parent,
int x, int y, int w, int h, const cString & name="")
- : cFLTKBaseDraw(parent, x, y, w, h, name), m_info(info), m_map_info(info) { ; }
+ : cFLTKBaseDraw(parent, x, y, w, h, name), m_info(info), m_map_info(info)
+ {
+ cColor::Setup();
+ m_map_info.SetScaleMax(cColor::SCALE_BRIGHT.GetSize());
+ }
~cFLTKGridView() { ; }
+ cCoreView_Info & GetInfo() { return m_info; }
cCoreView_Map & GetMapInfo() { return m_map_info; }
+ void SetGenotypeColor(int color_id);
+
void Draw();
int Handle(int event) {
Modified: development/source/targets/viewer-fltk/cFLTKWidget.h
===================================================================
--- development/source/targets/viewer-fltk/cFLTKWidget.h 2008-01-31 23:35:41 UTC (rev 2293)
+++ development/source/targets/viewer-fltk/cFLTKWidget.h 2008-02-01 20:32:17 UTC (rev 2294)
@@ -32,12 +32,15 @@
#include <FL/Fl_Widget.H>
#include <FL/fl_draw.H>
+#include <FL/Fl_Pixmap.H>
class cFLTKWidget {
protected:
Fl_Widget * m_widget;
cGUIWidget * m_gui_widget;
+ cString m_tooltip;
+
public:
cFLTKWidget(cGUIWidget * gui_widget) : m_widget(NULL), m_gui_widget(gui_widget) { ; }
~cFLTKWidget() { ; }
@@ -50,9 +53,44 @@
m_widget->color(fl_color());
}
+ void SetLabel(const cString & name) {
+ assert(m_widget != NULL);
+ m_widget->copy_label(name);
+ m_gui_widget->SetName(name);
+ }
+
+ void SetFont(int id) {
+ m_widget->labelfont(id);
+ }
+
+ void SetFontSize(int size) {
+ m_widget->labelsize(size);
+ }
+
+ void SetFontColor(const cColor & color) {
+ assert(m_widget != NULL);
+ fl_color(color.Red(), color.Green(), color.Blue());
+ m_widget->labelcolor(fl_color());
+ }
+
+ void SetFontAlign(int id) {
+ m_widget->align(id);
+ }
+
+ void SetTooltip(const cString & in_tip) {
+ m_tooltip = in_tip;
+ m_widget->tooltip(m_tooltip);
+ }
+
+ void SetImage_XPM(char *xpm_info[]) {
+ // @CAO Should save the pixmap?
+ Fl_Pixmap * pixmap = new Fl_Pixmap(xpm_info);
+ m_widget->image(pixmap);
+ }
+
void Refresh() {
m_widget->copy_label(m_gui_widget->GetName());
- m_widget->labelsize(m_gui_widget->GetFontSize());
+ // m_widget->labelsize(m_gui_widget->GetFontSize());
m_widget->redraw();
}
Modified: development/source/targets/viewer-fltk/tFLTKButton.h
===================================================================
--- development/source/targets/viewer-fltk/tFLTKButton.h 2008-01-31 23:35:41 UTC (rev 2293)
+++ development/source/targets/viewer-fltk/tFLTKButton.h 2008-02-01 20:32:17 UTC (rev 2294)
@@ -33,7 +33,7 @@
#include "FL/Fl_Button.H"
#include "FL/Fl_Light_Button.H"
-template <class T> class tFLTKButton : public tGUIButton<T> {
+template <class T> class tFLTKButton : public tGUIButton<T>, public cFLTKWidget {
protected:
Fl_Button * m_button;
@@ -41,6 +41,7 @@
tFLTKButton(cGUIContainer & parent, int x, int y, int width, int height, const cString & name="",
cGUIButton::eButtonType type=cGUIButton::BUTTON_NORMAL)
: tGUIButton<T>(parent, x, y, width, height, name, type)
+ , cFLTKWidget(this)
{
if (type == cGUIButton::BUTTON_NORMAL) {
m_button = new Fl_Button(x, y, width, height, name);
@@ -53,6 +54,7 @@
}
m_button->callback((Fl_Callback*) GenericButtonCallback, (void*)(this));
+ SetWidget(m_button);
}
~tFLTKButton() { delete m_button; }
Modified: development/source/viewer-core/cCoreView_Map.cc
===================================================================
--- development/source/viewer-core/cCoreView_Map.cc 2008-01-31 23:35:41 UTC (rev 2293)
+++ development/source/viewer-core/cCoreView_Map.cc 2008-02-01 20:32:17 UTC (rev 2294)
@@ -36,7 +36,7 @@
, m_color_mode(0)
, m_symbol_mode(-1)
, m_tag_mode(-1)
- , scale_max(80)
+ , m_scale_max(0)
{
// Setup the available view modes...
AddViewMode("Genotypes", &cCoreView_Map::SetColors_Genotype, VIEW_COLOR, COLORS_TYPES);
@@ -117,6 +117,10 @@
cPopulation & pop = m_info.GetPopulation();
m_color_grid.Resize(pop.GetSize());
+ // Keep track of how many times each color was assigned.
+ m_color_counts.Resize(m_scale_max);
+ m_color_counts.SetAll(0);
+
// Determine the max and min in the population.
double max_fit = 3;
double min_fit = -2;
@@ -129,6 +133,7 @@
fit = log(fit);
// if (fit < min_fit) min_fit = fit;
if (fit > max_fit) max_fit = fit;
+ if (fit < min_fit) min_fit = fit;
}
double fit_diff = max_fit - min_fit;
if (fit_diff == 0.0) fit_diff = 1.0;
@@ -137,15 +142,19 @@
for (int i = 0; i < pop.GetSize(); i++) {
cOrganism * org = pop.GetCell(i).GetOrganism();
if (org == NULL) {
- m_color_grid[i] = -1;
+ m_color_grid[i] = 0;
+ m_color_counts[0]++;
continue;
}
double fit = org->GetPhenotype().GetFitness();
if (fit == 0.0) {
- m_color_grid[i] = 0;
+ m_color_grid[i] = 1;
+ m_color_counts[1]++;
+ continue;
}
fit = log(fit);
- m_color_grid[i] = 1 + (int) ((scale_max - 2) * ((fit - min_fit) / fit_diff));
+ m_color_grid[i] = 1 + (int) ((m_scale_max - 2) * ((fit - min_fit) / fit_diff));
+ m_color_counts[m_color_grid[i]]++;
}
}
Modified: development/source/viewer-core/cCoreView_Map.h
===================================================================
--- development/source/viewer-core/cCoreView_Map.h 2008-01-31 23:35:41 UTC (rev 2293)
+++ development/source/viewer-core/cCoreView_Map.h 2008-02-01 20:32:17 UTC (rev 2294)
@@ -72,8 +72,11 @@
tArray<int> m_symbol_grid; // Should we have special symbols at each cell?
tArray<int> m_tag_grid; // Track tagged cells.
- int scale_max;
+ tArray<int> m_color_counts; // A count of how many cells are of each color.
+ tArray<cString> m_color_labels; // Labels for each color.
+ int m_scale_max;
+
void SetColors_Genotype(int ignore);
void SetColors_Fitness(int ignore);
void SetColors_Length(int ignore);
@@ -98,10 +101,14 @@
int GetSymbolMode() const { return m_symbol_mode; }
int GetTagMode() const { return m_tag_mode; }
- const tArray<int> & GetColors() { return m_color_grid; }
- const tArray<int> & GetSymbols() { return m_symbol_grid; }
- const tArray<int> & GetTags() { return m_tag_grid; }
+ const tArray<int> & GetColors() const { return m_color_grid; }
+ const tArray<int> & GetSymbols() const { return m_symbol_grid; }
+ const tArray<int> & GetTags() const { return m_tag_grid; }
+ const tArray<int> & GetColorCounts() const { return m_color_counts; }
+
+ int GetColorCount(int i) const { return m_color_counts[i]; }
+
int GetNumModes() const { return m_view_modes.GetSize(); }
const cString & GetModeName(int id) const { return m_view_modes[id]->GetName(); }
int GetModeType(int id) const { return m_view_modes[id]->GetViewType(); }
@@ -110,6 +117,7 @@
void UpdateMaps();
void SetMode(int mode);
+ void SetScaleMax(int in_max) { m_scale_max = in_max; }
};
#endif
Modified: development/source/viewer-coreGUI/cColor.cc
===================================================================
--- development/source/viewer-coreGUI/cColor.cc 2008-01-31 23:35:41 UTC (rev 2293)
+++ development/source/viewer-coreGUI/cColor.cc 2008-02-01 20:32:17 UTC (rev 2294)
@@ -24,145 +24,171 @@
#include "cColor.h"
-#define HEX_COLOR(RED,GREEN,BLUE) (0x ## RED, 0x ## GREEN, 0x ## BLUE)
+const cColor cColor::BLACK (0.0, 0.0, 0.0);
+const cColor cColor::WHITE (1.0, 1.0, 1.0);
+const cColor cColor::RED (1.0, 0.0, 0.0);
+const cColor cColor::GREEN (0.0, 1.0, 0.0);
+const cColor cColor::BLUE (0.0, 0.0, 1.0);
+const cColor cColor::YELLOW (1.0, 1.0, 0.0);
+const cColor cColor::CYAN (0.0, 1.0, 1.0);
+const cColor cColor::MAGENTA (1.0, 0.0, 1.0);
-const cColor cColor::BLACK HEX_COLOR(00, 00, 00);
-const cColor cColor::WHITE HEX_COLOR(FF, FF, FF);
-const cColor cColor::RED HEX_COLOR(FF, 00, 00);
-const cColor cColor::GREEN HEX_COLOR(00, FF, 00);
-const cColor cColor::BLUE HEX_COLOR(00, 00, FF);
-const cColor cColor::YELLOW HEX_COLOR(FF, FF, 00);
-const cColor cColor::CYAN HEX_COLOR(00, FF, FF);
-const cColor cColor::MAGENTA HEX_COLOR(FF, 00, FF);
+const cColor cColor::GRAY (0.7, 0.7, 0.7);
+const cColor cColor::LT_RED (1.0, 0.3, 0.3);
+const cColor cColor::LT_GREEN (0.3, 1.0, 0.3);
+const cColor cColor::LT_BLUE (0.3, 0.3, 1.0);
+const cColor cColor::LT_YELLOW (1.0, 1.0, 0.3);
+const cColor cColor::LT_CYAN (0.3, 1.0, 1.0);
+const cColor cColor::LT_MAGENTA (1.0, 0.3, 1.0);
-const cColor cColor::GRAY HEX_COLOR(A0, A0, A0);
-const cColor cColor::LT_RED HEX_COLOR(FF, 50, 50);
-const cColor cColor::LT_GREEN HEX_COLOR(50, FF, 50);
-const cColor cColor::LT_BLUE HEX_COLOR(50, 50, FF);
-const cColor cColor::LT_YELLOW HEX_COLOR(FF, FF, 50);
-const cColor cColor::LT_CYAN HEX_COLOR(50, FF, FF);
-const cColor cColor::LT_MAGENTA HEX_COLOR(FF, 50, FF);
+const cColor cColor::DARK_GRAY (0.3, 0.3, 0.3);
+const cColor cColor::DARK_RED (0.5, 0.0, 0.0);
+const cColor cColor::DARK_GREEN (0.0, 0.5, 0.0);
+const cColor cColor::DARK_BLUE (0.0, 0.0, 0.5);
+const cColor cColor::DARK_YELLOW (0.3, 0.3, 0.0);
+const cColor cColor::DARK_CYAN (0.0, 0.3, 0.3);
+const cColor cColor::DARK_MAGENTA (0.3, 0.0, 0.3);
-const cColor cColor::DARK_GRAY HEX_COLOR(50, 50, 50);
-const cColor cColor::DARK_RED HEX_COLOR(A0, 00, 00);
-const cColor cColor::DARK_GREEN HEX_COLOR(00, A0, 00);
-const cColor cColor::DARK_BLUE HEX_COLOR(00, 00, A0);
-const cColor cColor::DARK_YELLOW HEX_COLOR(A0, A0, 00);
-const cColor cColor::DARK_CYAN HEX_COLOR(00, A0, A0);
-const cColor cColor::DARK_MAGENTA HEX_COLOR(A0, 00, A0);
+tArray<cColor> cColor::SCALE_FULL(0);
+tArray<cColor> cColor::SCALE_BRIGHT(0);
+tArray<cColor> cColor::SCALE_DARK(0);
+tArray<cColor> cColor::SCALE_PASTEL(0);
+tArray<cColor> cColor::SCALE_HOT(0);
+tArray<cColor> cColor::SCALE_COLD(0);
-tArray<cColor> cColor::SET_BRIGHT(100);
-tArray<cColor> cColor::SET_DARK(100);
-
void cColor::Setup()
{
+ if (SCALE_BRIGHT.GetSize() != 0) return;
+
int index = 0;
- // SET_BRIGHT[index++].Set(0.5 , 0.0 , 0.0 );
- // SET_BRIGHT[index++].Set(0.55, 0.0 , 0.0 );
- SET_BRIGHT[index++].Set(0.2 , 0.2 , 0.2 );
+ SCALE_BRIGHT.Push(cColor(0, 0, 0));
+ // SCALE_BRIGHT.Push(cColor(0.2 , 0.2 , 0.2 ));
- SET_BRIGHT[index++].Set(0.6 , 0.0 , 0.0 );
- SET_BRIGHT[index++].Set(0.65, 0.0 , 0.0 );
- SET_BRIGHT[index++].Set(0.7 , 0.0 , 0.0 );
- SET_BRIGHT[index++].Set(0.75, 0.0 , 0.0 );
- SET_BRIGHT[index++].Set(0.8 , 0.0 , 0.0 );
- SET_BRIGHT[index++].Set(0.85, 0.0 , 0.0 );
- SET_BRIGHT[index++].Set(0.9 , 0.0 , 0.0 );
- SET_BRIGHT[index++].Set(0.95, 0.0 , 0.0 );
+ SCALE_BRIGHT.Push(cColor(1.0 , 1.0 , 0.0 ));
+ SCALE_BRIGHT.Push(cColor(1.0 , 0.95, 0.0 ));
+ SCALE_BRIGHT.Push(cColor(1.0 , 0.9 , 0.0 ));
+ SCALE_BRIGHT.Push(cColor(1.0 , 0.85, 0.0 ));
+ SCALE_BRIGHT.Push(cColor(1.0 , 0.8 , 0.0 ));
+ SCALE_BRIGHT.Push(cColor(1.0 , 0.75, 0.0 ));
+ SCALE_BRIGHT.Push(cColor(1.0 , 0.7 , 0.0 ));
+ SCALE_BRIGHT.Push(cColor(1.0 , 0.65, 0.0 ));
+ SCALE_BRIGHT.Push(cColor(1.0 , 0.6 , 0.0 ));
+ SCALE_BRIGHT.Push(cColor(1.0 , 0.55, 0.0 ));
+ SCALE_BRIGHT.Push(cColor(1.0 , 0.5 , 0.0 ));
+ SCALE_BRIGHT.Push(cColor(1.0 , 0.45, 0.0 ));
+ SCALE_BRIGHT.Push(cColor(1.0 , 0.4 , 0.0 ));
+ SCALE_BRIGHT.Push(cColor(1.0 , 0.35, 0.0 ));
+ SCALE_BRIGHT.Push(cColor(1.0 , 0.3 , 0.0 ));
+ SCALE_BRIGHT.Push(cColor(1.0 , 0.25, 0.0 ));
+ SCALE_BRIGHT.Push(cColor(1.0 , 0.2 , 0.0 ));
+ SCALE_BRIGHT.Push(cColor(1.0 , 0.15, 0.0 ));
+ SCALE_BRIGHT.Push(cColor(1.0 , 0.1 , 0.0 ));
+ SCALE_BRIGHT.Push(cColor(1.0 , 0.05, 0.0 ));
+ SCALE_BRIGHT.Push(cColor(1.0 , 0.0 , 0.0 ));
- SET_BRIGHT[index++].Set(1.0 , 0.0 , 0.0 );
- SET_BRIGHT[index++].Set(1.0 , 0.05, 0.0 );
- SET_BRIGHT[index++].Set(1.0 , 0.1 , 0.0 );
- SET_BRIGHT[index++].Set(1.0 , 0.15, 0.0 );
- SET_BRIGHT[index++].Set(1.0 , 0.2 , 0.0 );
- SET_BRIGHT[index++].Set(1.0 , 0.25, 0.0 );
- SET_BRIGHT[index++].Set(1.0 , 0.3 , 0.0 );
- SET_BRIGHT[index++].Set(1.0 , 0.35, 0.0 );
- SET_BRIGHT[index++].Set(1.0 , 0.4 , 0.0 );
- SET_BRIGHT[index++].Set(1.0 , 0.45, 0.0 );
- SET_BRIGHT[index++].Set(1.0 , 0.5 , 0.0 );
- SET_BRIGHT[index++].Set(1.0 , 0.55, 0.0 );
- SET_BRIGHT[index++].Set(1.0 , 0.6 , 0.0 );
- SET_BRIGHT[index++].Set(1.0 , 0.65, 0.0 );
- SET_BRIGHT[index++].Set(1.0 , 0.7 , 0.0 );
- SET_BRIGHT[index++].Set(1.0 , 0.75, 0.0 );
- SET_BRIGHT[index++].Set(1.0 , 0.8 , 0.0 );
- SET_BRIGHT[index++].Set(1.0 , 0.85, 0.0 );
- SET_BRIGHT[index++].Set(1.0 , 0.9 , 0.0 );
- SET_BRIGHT[index++].Set(1.0 , 0.95, 0.0 );
+// SCALE_BRIGHT.Push(cColor(1.0 , 0.0 , 0.05));
+// SCALE_BRIGHT.Push(cColor(0.95, 0.0 , 0.1 ));
+// SCALE_BRIGHT.Push(cColor(0.9 , 0.0 , 0.15));
+// SCALE_BRIGHT.Push(cColor(0.85, 0.0 , 0.2 ));
+// SCALE_BRIGHT.Push(cColor(0.8 , 0.0 , 0.25));
+// SCALE_BRIGHT.Push(cColor(0.75, 0.0 , 0.3 ));
+// SCALE_BRIGHT.Push(cColor(0.7 , 0.0 , 0.35));
+// SCALE_BRIGHT.Push(cColor(0.65, 0.0 , 0.4 ));
+// SCALE_BRIGHT.Push(cColor(0.6 , 0.0 , 0.45));
+// SCALE_BRIGHT.Push(cColor(0.55, 0.0 , 0.5 ));
+// SCALE_BRIGHT.Push(cColor(0.5 , 0.0 , 0.55));
+// SCALE_BRIGHT.Push(cColor(0.45, 0.0 , 0.6 ));
+// SCALE_BRIGHT.Push(cColor(0.4 , 0.0 , 0.65));
+// SCALE_BRIGHT.Push(cColor(0.35, 0.0 , 0.7 ));
+// SCALE_BRIGHT.Push(cColor(0.3 , 0.0 , 0.75));
+// SCALE_BRIGHT.Push(cColor(0.25, 0.0 , 0.8 ));
+// SCALE_BRIGHT.Push(cColor(0.2 , 0.0 , 0.85));
+// SCALE_BRIGHT.Push(cColor(0.15, 0.0 , 0.9 ));
+// SCALE_BRIGHT.Push(cColor(0.1 , 0.0 , 0.95));
+// SCALE_BRIGHT.Push(cColor(0.05, 0.0 , 1.0 ));
+// SCALE_BRIGHT.Push(cColor(0.0 , 0.0 , 1.0 ));
- SET_BRIGHT[index++].Set(1.0 , 1.0 , 0.0 );
- SET_BRIGHT[index++].Set(1.0 , 1.0 , 0.05);
- SET_BRIGHT[index++].Set(0.95, 1.0 , 0.1 );
- SET_BRIGHT[index++].Set(0.9 , 1.0 , 0.15);
- SET_BRIGHT[index++].Set(0.85, 1.0 , 0.2 );
- SET_BRIGHT[index++].Set(0.8 , 1.0 , 0.25);
- SET_BRIGHT[index++].Set(0.75, 1.0 , 0.3 );
- SET_BRIGHT[index++].Set(0.7 , 1.0 , 0.35);
- SET_BRIGHT[index++].Set(0.65, 1.0 , 0.4 );
- SET_BRIGHT[index++].Set(0.6 , 1.0 , 0.45);
- SET_BRIGHT[index++].Set(0.55, 1.0 , 0.5 );
- SET_BRIGHT[index++].Set(0.5 , 1.0 , 0.55);
- SET_BRIGHT[index++].Set(0.45, 1.0 , 0.6 );
- SET_BRIGHT[index++].Set(0.4 , 1.0 , 0.65);
- SET_BRIGHT[index++].Set(0.35, 1.0 , 0.7 );
- SET_BRIGHT[index++].Set(0.3 , 1.0 , 0.75);
- SET_BRIGHT[index++].Set(0.25, 1.0 , 0.8 );
- SET_BRIGHT[index++].Set(0.2 , 1.0 , 0.85);
- SET_BRIGHT[index++].Set(0.15, 1.0 , 0.9 );
- SET_BRIGHT[index++].Set(0.1 , 1.0 , 0.95);
- SET_BRIGHT[index++].Set(0.05, 1.0 , 1.0 );
+ SCALE_BRIGHT.Push(cColor(1.0 , 0.02 , 0.05));
+ SCALE_BRIGHT.Push(cColor(1.0 , 0.04 , 0.1 ));
+ SCALE_BRIGHT.Push(cColor(1.0 , 0.06 , 0.15));
+ SCALE_BRIGHT.Push(cColor(0.95, 0.08 , 0.2 ));
+ SCALE_BRIGHT.Push(cColor(0.9 , 0.10 , 0.25));
+ SCALE_BRIGHT.Push(cColor(0.85, 0.12 , 0.3 ));
+ SCALE_BRIGHT.Push(cColor(0.8 , 0.14 , 0.35));
+ SCALE_BRIGHT.Push(cColor(0.75, 0.16 , 0.4 ));
+ SCALE_BRIGHT.Push(cColor(0.7 , 0.18 , 0.45));
+ SCALE_BRIGHT.Push(cColor(0.65, 0.20 , 0.5 ));
+ SCALE_BRIGHT.Push(cColor(0.6 , 0.20 , 0.55));
+ SCALE_BRIGHT.Push(cColor(0.55, 0.20 , 0.6 ));
+ SCALE_BRIGHT.Push(cColor(0.5 , 0.20 , 0.65));
+ SCALE_BRIGHT.Push(cColor(0.45, 0.20 , 0.7 ));
+ SCALE_BRIGHT.Push(cColor(0.4 , 0.20 , 0.75));
+ SCALE_BRIGHT.Push(cColor(0.35, 0.20 , 0.8 ));
- SET_BRIGHT[index++].Set(0.0 , 1.0 , 1.0 );
- SET_BRIGHT[index++].Set(0.0 , 1.0 , 0.95);
- SET_BRIGHT[index++].Set(0.0 , 1.0 , 0.9 );
- SET_BRIGHT[index++].Set(0.0 , 1.0 , 0.85);
- SET_BRIGHT[index++].Set(0.0 , 1.0 , 0.8 );
- SET_BRIGHT[index++].Set(0.0 , 1.0 , 0.75);
- SET_BRIGHT[index++].Set(0.0 , 1.0 , 0.7 );
- SET_BRIGHT[index++].Set(0.0 , 1.0 , 0.65);
- SET_BRIGHT[index++].Set(0.0 , 1.0 , 0.6 );
- SET_BRIGHT[index++].Set(0.0 , 1.0 , 0.55);
- SET_BRIGHT[index++].Set(0.0 , 1.0 , 0.5 );
- SET_BRIGHT[index++].Set(0.0 , 1.0 , 0.45);
- SET_BRIGHT[index++].Set(0.0 , 1.0 , 0.4 );
- SET_BRIGHT[index++].Set(0.0 , 1.0 , 0.35);
- SET_BRIGHT[index++].Set(0.0 , 1.0 , 0.3 );
- SET_BRIGHT[index++].Set(0.0 , 1.0 , 0.25);
- SET_BRIGHT[index++].Set(0.0 , 1.0 , 0.2 );
- SET_BRIGHT[index++].Set(0.0 , 1.0 , 0.15);
- SET_BRIGHT[index++].Set(0.0 , 1.0 , 0.1 );
- SET_BRIGHT[index++].Set(0.0 , 1.0 , 0.05);
+ SCALE_BRIGHT.Push(cColor(0.3 , 0.25 , 0.85));
+ SCALE_BRIGHT.Push(cColor(0.25, 0.25 , 0.9 ));
+ SCALE_BRIGHT.Push(cColor(0.2 , 0.20 , 0.95));
- SET_BRIGHT[index++].Set(0.0 , 1.0 , 0.0 );
- SET_BRIGHT[index++].Set(0.0 , 0.95, 0.0 );
- SET_BRIGHT[index++].Set(0.0 , 0.9 , 0.0 );
- SET_BRIGHT[index++].Set(0.0 , 0.85, 0.0 );
- SET_BRIGHT[index++].Set(0.0 , 0.8 , 0.0 );
- SET_BRIGHT[index++].Set(0.0 , 0.75, 0.0 );
- SET_BRIGHT[index++].Set(0.0 , 0.7 , 0.0 );
- SET_BRIGHT[index++].Set(0.0 , 0.65, 0.0 );
- SET_BRIGHT[index++].Set(0.0 , 0.6 , 0.0 );
- SET_BRIGHT[index++].Set(0.0 , 0.55, 0.0 );
-// SET_BRIGHT[index++].Set(0.0 , 0.5 , 0.0 );
+ SCALE_BRIGHT.Push(cColor(0.15, 0.15 , 1.0 ));
+ SCALE_BRIGHT.Push(cColor(0.1 , 0.10 , 1.0 ));
+ SCALE_BRIGHT.Push(cColor(0.05, 0.05 , 1.0 ));
-// SET_BRIGHT[index++].Set(0.0 , 0.5 , 0.0 );
-// SET_BRIGHT[index++].Set(0.0 , 0.5 , 0.0 );
-// SET_BRIGHT[index++].Set(0.0 , 0.5 , 0.0 );
-// SET_BRIGHT[index++].Set(0.0 , 0.5 , 0.0 );
-// SET_BRIGHT[index++].Set(0.0 , 0.5 , 0.0 );
-// SET_BRIGHT[index++].Set(0.0 , 0.5 , 0.0 );
-// SET_BRIGHT[index++].Set(0.0 , 0.5 , 0.0 );
-// SET_BRIGHT[index++].Set(0.0 , 0.5 , 0.0 );
-// SET_BRIGHT[index++].Set(0.0 , 0.5 , 0.0 );
-// SET_BRIGHT[index++].Set(0.0 , 0.5 , 0.0 );
-// SET_BRIGHT[index++].Set(0.0 , 0.5 , 0.0 );
-// SET_BRIGHT[index++].Set(0.0 , 0.5 , 0.0 );
-// SET_BRIGHT[index++].Set(0.0 , 0.5 , 0.0 );
-// SET_BRIGHT[index++].Set(0.0 , 0.5 , 0.0 );
-// SET_BRIGHT[index++].Set(0.0 , 0.5 , 0.0 );
-// SET_BRIGHT[index++].Set(0.0 , 0.5 , 0.0 );
-// SET_BRIGHT[index++].Set(0.0 , 0.5 , 0.0 );
-// SET_BRIGHT[index++].Set(0.0 , 0.5 , 0.0 );
+// SCALE_BRIGHT.Push(cColor(0.0 , 0.0 , 1.0 ));
+// SCALE_BRIGHT.Push(cColor(0.0 , 0.0 , 0.0 ));
+
+// SCALE_BRIGHT.Push(cColor(0.0 , 0.05, 1.0 ));
+ SCALE_BRIGHT.Push(cColor(0.0 , 0.1 , 1.0 ));
+ SCALE_BRIGHT.Push(cColor(0.0 , 0.175, 1.0 ));
+ // SCALE_BRIGHT.Push(cColor(0.0 , 0.2 , 1.0 ));
+ SCALE_BRIGHT.Push(cColor(0.0 , 0.25, 1.0 ));
+ SCALE_BRIGHT.Push(cColor(0.0 , 0.325 , 1.0 ));
+ // SCALE_BRIGHT.Push(cColor(0.0 , 0.35, 1.0 ));
+ SCALE_BRIGHT.Push(cColor(0.0 , 0.4 , 1.0 ));
+ SCALE_BRIGHT.Push(cColor(0.0 , 0.475, 1.0 ));
+ // SCALE_BRIGHT.Push(cColor(0.0 , 0.5 , 1.0 ));
+ SCALE_BRIGHT.Push(cColor(0.0 , 0.55, 1.0 ));
+ SCALE_BRIGHT.Push(cColor(0.0 , 0.625 , 1.0 ));
+ // SCALE_BRIGHT.Push(cColor(0.0 , 0.65, 1.0 ));
+ SCALE_BRIGHT.Push(cColor(0.0 , 0.7 , 1.0 ));
+ SCALE_BRIGHT.Push(cColor(0.0 , 0.775, 1.0 ));
+ // SCALE_BRIGHT.Push(cColor(0.0 , 0.8 , 1.0 ));
+ SCALE_BRIGHT.Push(cColor(0.0 , 0.85, 1.0 ));
+ SCALE_BRIGHT.Push(cColor(0.0 , 0.925 , 1.0 ));
+ // SCALE_BRIGHT.Push(cColor(0.0 , 0.95, 1.0 ));
+
+ SCALE_BRIGHT.Push(cColor(0.0 , 1.0 , 1.0 ));
+ SCALE_BRIGHT.Push(cColor(0.05, 1.0 , 1.0 ));
+ SCALE_BRIGHT.Push(cColor(0.1 , 1.0 , 0.95));
+ SCALE_BRIGHT.Push(cColor(0.15, 1.0 , 0.9 ));
+ SCALE_BRIGHT.Push(cColor(0.2 , 1.0 , 0.85));
+ SCALE_BRIGHT.Push(cColor(0.25, 1.0 , 0.8 ));
+ SCALE_BRIGHT.Push(cColor(0.3 , 1.0 , 0.75));
+ SCALE_BRIGHT.Push(cColor(0.35, 1.0 , 0.7 ));
+ SCALE_BRIGHT.Push(cColor(0.4 , 1.0 , 0.65));
+ SCALE_BRIGHT.Push(cColor(0.45, 1.0 , 0.6 ));
+ SCALE_BRIGHT.Push(cColor(0.5 , 1.0 , 0.55));
+ SCALE_BRIGHT.Push(cColor(0.55, 1.0 , 0.5 ));
+ SCALE_BRIGHT.Push(cColor(0.6 , 1.0 , 0.45));
+ SCALE_BRIGHT.Push(cColor(0.65, 1.0 , 0.4 ));
+ SCALE_BRIGHT.Push(cColor(0.7 , 1.0 , 0.35));
+ SCALE_BRIGHT.Push(cColor(0.75, 1.0 , 0.3 ));
+ SCALE_BRIGHT.Push(cColor(0.8 , 1.0 , 0.25));
+ SCALE_BRIGHT.Push(cColor(0.85, 1.0 , 0.2 ));
+ SCALE_BRIGHT.Push(cColor(0.9 , 1.0 , 0.15));
+ SCALE_BRIGHT.Push(cColor(0.95, 1.0 , 0.1 ));
+ SCALE_BRIGHT.Push(cColor(1.0 , 1.0 , 0.05));
+
+
+// SCALE_BRIGHT.Push(cColor(0.95, 0.0 , 0.0 ));
+// SCALE_BRIGHT.Push(cColor(0.9 , 0.0 , 0.0 ));
+// SCALE_BRIGHT.Push(cColor(0.85, 0.0 , 0.0 ));
+// SCALE_BRIGHT.Push(cColor(0.8 , 0.0 , 0.0 ));
+// SCALE_BRIGHT.Push(cColor(0.75, 0.0 , 0.0 ));
+// SCALE_BRIGHT.Push(cColor(0.7 , 0.0 , 0.0 ));
+// SCALE_BRIGHT.Push(cColor(0.65, 0.0 , 0.0 ));
+// SCALE_BRIGHT.Push(cColor(0.6 , 0.0 , 0.0 ));
+// SCALE_BRIGHT.Push(cColor(0.55, 0.0 , 0.0 ));
+// SCALE_BRIGHT.Push(cColor(0.5 , 0.0 , 0.0 ));
+
}
Modified: development/source/viewer-coreGUI/cColor.h
===================================================================
--- development/source/viewer-coreGUI/cColor.h 2008-01-31 23:35:41 UTC (rev 2293)
+++ development/source/viewer-coreGUI/cColor.h 2008-02-01 20:32:17 UTC (rev 2294)
@@ -39,6 +39,8 @@
public:
cColor(int r=0, int g=0, int b=0) : m_red(r), m_green(g), m_blue(b) { ; }
+ cColor(double r, double g, double b)
+ : m_red((int) (r*255.0)), m_green((int) (g*255.0)), m_blue((int) (b*255.0)) { ; }
cColor(const cColor & _in) : m_red(_in.m_red), m_green(_in.m_green), m_blue(_in.m_blue) { ; }
cColor & operator=(const cColor & _in) { m_red=_in.m_red; m_green=_in.m_green; m_blue=_in.m_blue; }
@@ -75,8 +77,12 @@
static const cColor DARK_CYAN;
static const cColor DARK_MAGENTA;
- static tArray<cColor> SET_BRIGHT;
- static tArray<cColor> SET_DARK;
+ static tArray<cColor> SCALE_FULL;
+ static tArray<cColor> SCALE_BRIGHT;
+ static tArray<cColor> SCALE_DARK;
+ static tArray<cColor> SCALE_PASTEL;
+ static tArray<cColor> SCALE_HOT;
+ static tArray<cColor> SCALE_COLD;
static void Setup();
};
Modified: development/source/viewer-coreGUI/cGUIWidget.cc
===================================================================
--- development/source/viewer-coreGUI/cGUIWidget.cc 2008-01-31 23:35:41 UTC (rev 2293)
+++ development/source/viewer-coreGUI/cGUIWidget.cc 2008-02-01 20:32:17 UTC (rev 2294)
@@ -26,17 +26,17 @@
#include "cGUIContainer.h"
cGUIWidget::cGUIWidget()
- : m_parent(NULL), m_x(0), m_y(0), m_width(0), m_height(0), m_font_size(20)
+ : m_parent(NULL), m_x(0), m_y(0), m_width(0), m_height(0)
{
}
cGUIWidget::cGUIWidget(int x, int y, int width, int height, const cString & name)
- : m_parent(NULL), m_name(name), m_x(x), m_y(y), m_width(width), m_height(height), m_font_size(20)
+ : m_parent(NULL), m_name(name), m_x(x), m_y(y), m_width(width), m_height(height)
{
}
cGUIWidget::cGUIWidget(cGUIContainer & parent, int x, int y, int width, int height, const cString & name)
- : m_parent(&parent), m_name(name), m_x(x), m_y(y), m_width(width), m_height(height), m_font_size(20)
+ : m_parent(&parent), m_name(name), m_x(x), m_y(y), m_width(width), m_height(height)
{
parent.Add(this);
}
Modified: development/source/viewer-coreGUI/cGUIWidget.h
===================================================================
--- development/source/viewer-coreGUI/cGUIWidget.h 2008-01-31 23:35:41 UTC (rev 2293)
+++ development/source/viewer-coreGUI/cGUIWidget.h 2008-02-01 20:32:17 UTC (rev 2294)
@@ -42,7 +42,7 @@
int m_width;
int m_height;
- int m_font_size;
+ // int m_font_size;
public:
cGUIWidget();
cGUIWidget(int x, int y, int width=0, int height=0, const cString & name="");
@@ -61,10 +61,10 @@
int GetY() const { return m_y; }
int GetWidth() const { return m_width; }
int GetHeight() const { return m_height; }
- int GetFontSize() const { return m_font_size; }
+ // int GetFontSize() const { return m_font_size; }
void SetName(const cString & _name) { m_name = _name; }
- void SetFontSize(int _size) { m_font_size = _size; }
+ // void SetFontSize(int _size) { m_font_size = _size; }
void Resize(int new_w, int new_h) { m_width = new_w; m_height = new_h; }
};
More information about the Avida-cvs
mailing list