New files to add .lif pattern reading capabilities to Life

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7730 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Guillermo Rodriguez Garcia
2000-07-10 05:58:08 +00:00
parent 6b5f146a2b
commit efcc189ef2
25 changed files with 3138 additions and 276 deletions

View File

@@ -93,16 +93,16 @@ LifeSamplesDialog::LifeSamplesDialog(wxWindow *parent)
0, NULL,
wxLB_SINGLE | wxLB_NEEDED_SB | wxLB_HSCROLL );
for (unsigned i = 0; i < (sizeof(g_shapes) / sizeof(LifeShape)); i++)
m_list->Append(g_shapes[i].m_name);
for (unsigned i = 0; i < (sizeof(g_patterns) / sizeof(LifePattern)); i++)
m_list->Append(g_patterns[i].m_name);
// descriptions
wxStaticBox *statbox = new wxStaticBox( this, -1, _("Description"));
m_life = new Life();
m_life->SetShape(g_shapes[0]);
m_life->SetPattern(g_patterns[0]);
m_canvas = new LifeCanvas( this, m_life, FALSE );
m_text = new wxTextCtrl( this, -1,
g_shapes[0].m_desc,
g_patterns[0].m_description,
wxDefaultPosition,
wxSize(300, 60),
wxTE_MULTILINE | wxTE_READONLY);
@@ -136,9 +136,9 @@ LifeSamplesDialog::~LifeSamplesDialog()
m_canvas->Destroy();
}
const LifeShape& LifeSamplesDialog::GetShape()
const LifePattern& LifeSamplesDialog::GetPattern()
{
return g_shapes[m_value];
return g_patterns[m_value];
}
void LifeSamplesDialog::OnListBox(wxCommandEvent& event)
@@ -148,15 +148,14 @@ void LifeSamplesDialog::OnListBox(wxCommandEvent& event)
if (sel != -1)
{
m_value = m_list->GetSelection();
m_text->SetValue(g_shapes[ sel ].m_desc);
m_life->SetShape(g_shapes[ sel ]);
m_text->SetValue(g_patterns[ sel ].m_description);
m_life->SetPattern(g_patterns[ sel ]);
// quick and dirty :-)
if ((g_shapes[ sel ].m_width > 36) ||
(g_shapes[ sel ].m_height > 22))
m_canvas->SetCellSize(2);
else
// these values shouldn't be hardcoded...
if ((size_t)sel < (sizeof(g_patterns) / sizeof(LifePattern)) - 3)
m_canvas->SetCellSize(8);
else
m_canvas->SetCellSize(2);
}
}