-1->wxID_ANY, TRUE->true, FALSE->false, wxDefaultPosition replacements
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27471 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -81,8 +81,8 @@ bool LifeCellBox::IsAlive(int dx, int dy) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// SetCell:
|
// SetCell:
|
||||||
// Sets cell dx, dy in this box to 'alive', returns TRUE if
|
// Sets cell dx, dy in this box to 'alive', returns true if
|
||||||
// the previous value was different, FALSE if it was the same.
|
// the previous value was different, false if it was the same.
|
||||||
//
|
//
|
||||||
bool LifeCellBox::SetCell(int dx, int dy, bool alive)
|
bool LifeCellBox::SetCell(int dx, int dy, bool alive)
|
||||||
{
|
{
|
||||||
@@ -96,10 +96,10 @@ bool LifeCellBox::SetCell(int dx, int dy, bool alive)
|
|||||||
// reset this here to avoid updating problems
|
// reset this here to avoid updating problems
|
||||||
m_dead = 0;
|
m_dead = 0;
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -129,8 +129,8 @@ Life::Life()
|
|||||||
// state vars for BeginFind & FindMore
|
// state vars for BeginFind & FindMore
|
||||||
m_cells = new LifeCell[ARRAYSIZE];
|
m_cells = new LifeCell[ARRAYSIZE];
|
||||||
m_ncells = 0;
|
m_ncells = 0;
|
||||||
m_findmore = FALSE;
|
m_findmore = false;
|
||||||
m_changed = FALSE;
|
m_changed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Life::~Life()
|
Life::~Life()
|
||||||
@@ -188,7 +188,7 @@ void Life::Clear()
|
|||||||
//
|
//
|
||||||
bool Life::IsAlive(wxInt32 x, wxInt32 y)
|
bool Life::IsAlive(wxInt32 x, wxInt32 y)
|
||||||
{
|
{
|
||||||
LifeCellBox *c = LinkBox(x, y, FALSE);
|
LifeCellBox *c = LinkBox(x, y, false);
|
||||||
|
|
||||||
return (c && c->IsAlive( x - c->m_x, y - c->m_y ));
|
return (c && c->IsAlive( x - c->m_x, y - c->m_y ));
|
||||||
}
|
}
|
||||||
@@ -320,7 +320,7 @@ LifeCellBox* Life::LinkBox(wxInt32 x, wxInt32 y, bool create)
|
|||||||
for (c = m_boxes[hv]; c; c = c->m_hnext)
|
for (c = m_boxes[hv]; c; c = c->m_hnext)
|
||||||
if ((c->m_x == x) && (c->m_y == y)) return c;
|
if ((c->m_x == x) && (c->m_y == y)) return c;
|
||||||
|
|
||||||
// if not found, and (create == TRUE), create a new one
|
// if not found, and (create == true), create a new one
|
||||||
return create? CreateBox(x, y, hv) : (LifeCellBox*) NULL;
|
return create? CreateBox(x, y, hv) : (LifeCellBox*) NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -393,7 +393,7 @@ LifeCell Life::FindCenter()
|
|||||||
LifeCell Life::FindNorth()
|
LifeCell Life::FindNorth()
|
||||||
{
|
{
|
||||||
wxInt32 x = 0, y = 0;
|
wxInt32 x = 0, y = 0;
|
||||||
bool first = TRUE;
|
bool first = true;
|
||||||
|
|
||||||
LifeCellBox *c;
|
LifeCellBox *c;
|
||||||
for (c = m_head; c; c = c->m_next)
|
for (c = m_head; c; c = c->m_next)
|
||||||
@@ -401,7 +401,7 @@ LifeCell Life::FindNorth()
|
|||||||
{
|
{
|
||||||
x = c->m_x;
|
x = c->m_x;
|
||||||
y = c->m_y;
|
y = c->m_y;
|
||||||
first = FALSE;
|
first = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
LifeCell cell;
|
LifeCell cell;
|
||||||
@@ -413,7 +413,7 @@ LifeCell Life::FindNorth()
|
|||||||
LifeCell Life::FindSouth()
|
LifeCell Life::FindSouth()
|
||||||
{
|
{
|
||||||
wxInt32 x = 0, y = 0;
|
wxInt32 x = 0, y = 0;
|
||||||
bool first = TRUE;
|
bool first = true;
|
||||||
|
|
||||||
LifeCellBox *c;
|
LifeCellBox *c;
|
||||||
for (c = m_head; c; c = c->m_next)
|
for (c = m_head; c; c = c->m_next)
|
||||||
@@ -421,7 +421,7 @@ LifeCell Life::FindSouth()
|
|||||||
{
|
{
|
||||||
x = c->m_x;
|
x = c->m_x;
|
||||||
y = c->m_y;
|
y = c->m_y;
|
||||||
first = FALSE;
|
first = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
LifeCell cell;
|
LifeCell cell;
|
||||||
@@ -433,7 +433,7 @@ LifeCell Life::FindSouth()
|
|||||||
LifeCell Life::FindWest()
|
LifeCell Life::FindWest()
|
||||||
{
|
{
|
||||||
wxInt32 x = 0, y = 0;
|
wxInt32 x = 0, y = 0;
|
||||||
bool first = TRUE;
|
bool first = true;
|
||||||
|
|
||||||
LifeCellBox *c;
|
LifeCellBox *c;
|
||||||
for (c = m_head; c; c = c->m_next)
|
for (c = m_head; c; c = c->m_next)
|
||||||
@@ -441,7 +441,7 @@ LifeCell Life::FindWest()
|
|||||||
{
|
{
|
||||||
x = c->m_x;
|
x = c->m_x;
|
||||||
y = c->m_y;
|
y = c->m_y;
|
||||||
first = FALSE;
|
first = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
LifeCell cell;
|
LifeCell cell;
|
||||||
@@ -453,7 +453,7 @@ LifeCell Life::FindWest()
|
|||||||
LifeCell Life::FindEast()
|
LifeCell Life::FindEast()
|
||||||
{
|
{
|
||||||
wxInt32 x = 0, y = 0;
|
wxInt32 x = 0, y = 0;
|
||||||
bool first = TRUE;
|
bool first = true;
|
||||||
|
|
||||||
LifeCellBox *c;
|
LifeCellBox *c;
|
||||||
for (c = m_head; c; c = c->m_next)
|
for (c = m_head; c; c = c->m_next)
|
||||||
@@ -461,7 +461,7 @@ LifeCell Life::FindEast()
|
|||||||
{
|
{
|
||||||
x = c->m_x;
|
x = c->m_x;
|
||||||
y = c->m_y;
|
y = c->m_y;
|
||||||
first = FALSE;
|
first = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
LifeCell cell;
|
LifeCell cell;
|
||||||
@@ -509,7 +509,7 @@ void Life::BeginFind(wxInt32 x0, wxInt32 y0, wxInt32 x1, wxInt32 y1, bool change
|
|||||||
m_x1 = (x1 + 7) & 0xfffffff8;
|
m_x1 = (x1 + 7) & 0xfffffff8;
|
||||||
m_y1 = (y1 + 7) & 0xfffffff8;
|
m_y1 = (y1 + 7) & 0xfffffff8;
|
||||||
|
|
||||||
m_findmore = TRUE;
|
m_findmore = true;
|
||||||
m_changed = changed;
|
m_changed = changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -524,14 +524,14 @@ bool Life::FindMore(LifeCell *cells[], size_t *ncells)
|
|||||||
for ( ; m_y <= m_y1; m_y += 8, m_x = m_x0)
|
for ( ; m_y <= m_y1; m_y += 8, m_x = m_x0)
|
||||||
for ( ; m_x <= m_x1; m_x += 8)
|
for ( ; m_x <= m_x1; m_x += 8)
|
||||||
{
|
{
|
||||||
if ((c = LinkBox(m_x, m_y, FALSE)) == NULL)
|
if ((c = LinkBox(m_x, m_y, false)) == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// check whether there is enough space left in the array
|
// check whether there is enough space left in the array
|
||||||
if (m_ncells > (ARRAYSIZE - 64))
|
if (m_ncells > (ARRAYSIZE - 64))
|
||||||
{
|
{
|
||||||
*ncells = m_ncells;
|
*ncells = m_ncells;
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
DoLine(m_x, m_y , c->m_live1, c->m_old1 );
|
DoLine(m_x, m_y , c->m_live1, c->m_old1 );
|
||||||
@@ -549,14 +549,14 @@ bool Life::FindMore(LifeCell *cells[], size_t *ncells)
|
|||||||
for ( ; m_y <= m_y1; m_y += 8, m_x = m_x0)
|
for ( ; m_y <= m_y1; m_y += 8, m_x = m_x0)
|
||||||
for ( ; m_x <= m_x1; m_x += 8)
|
for ( ; m_x <= m_x1; m_x += 8)
|
||||||
{
|
{
|
||||||
if ((c = LinkBox(m_x, m_y, FALSE)) == NULL)
|
if ((c = LinkBox(m_x, m_y, false)) == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// check whether there is enough space left in the array
|
// check whether there is enough space left in the array
|
||||||
if (m_ncells > (ARRAYSIZE - 64))
|
if (m_ncells > (ARRAYSIZE - 64))
|
||||||
{
|
{
|
||||||
*ncells = m_ncells;
|
*ncells = m_ncells;
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
DoLine(m_x, m_y , c->m_live1 );
|
DoLine(m_x, m_y , c->m_live1 );
|
||||||
@@ -571,8 +571,8 @@ bool Life::FindMore(LifeCell *cells[], size_t *ncells)
|
|||||||
}
|
}
|
||||||
|
|
||||||
*ncells = m_ncells;
|
*ncells = m_ncells;
|
||||||
m_findmore = FALSE;
|
m_findmore = false;
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
@@ -590,7 +590,7 @@ bool Life::NextTic()
|
|||||||
{
|
{
|
||||||
LifeCellBox *c, *up, *dn, *lf, *rt;
|
LifeCellBox *c, *up, *dn, *lf, *rt;
|
||||||
wxUint32 t1, t2, t3, t4;
|
wxUint32 t1, t2, t3, t4;
|
||||||
bool changed = FALSE;
|
bool changed = false;
|
||||||
|
|
||||||
m_numcells = 0;
|
m_numcells = 0;
|
||||||
|
|
||||||
@@ -942,7 +942,7 @@ bool LifeModule::OnInit()
|
|||||||
// see below
|
// see below
|
||||||
g_tab = new unsigned char [0xfffff];
|
g_tab = new unsigned char [0xfffff];
|
||||||
|
|
||||||
if (!g_tab) return FALSE;
|
if (!g_tab) return false;
|
||||||
|
|
||||||
for (wxUint32 i = 0; i < 0xfffff; i++)
|
for (wxUint32 i = 0; i < 0xfffff; i++)
|
||||||
{
|
{
|
||||||
@@ -964,7 +964,7 @@ bool LifeModule::OnInit()
|
|||||||
g_tab[i] = (unsigned char) live;
|
g_tab[i] = (unsigned char) live;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LifeModule::OnExit()
|
void LifeModule::OnExit()
|
||||||
|
@@ -106,7 +106,7 @@ public:
|
|||||||
inline wxString GetRules() const { return m_rules; };
|
inline wxString GetRules() const { return m_rules; };
|
||||||
inline wxString GetDescription() const { return m_description; };
|
inline wxString GetDescription() const { return m_description; };
|
||||||
bool IsAlive(wxInt32 x, wxInt32 y);
|
bool IsAlive(wxInt32 x, wxInt32 y);
|
||||||
void SetCell(wxInt32 x, wxInt32 y, bool alive = TRUE);
|
void SetCell(wxInt32 x, wxInt32 y, bool alive = true);
|
||||||
void SetPattern(const LifePattern &pattern);
|
void SetPattern(const LifePattern &pattern);
|
||||||
|
|
||||||
// game control
|
// game control
|
||||||
@@ -123,7 +123,7 @@ public:
|
|||||||
// The following functions find cells within a given viewport; either
|
// The following functions find cells within a given viewport; either
|
||||||
// all alive cells, or only those cells which have changed since last
|
// all alive cells, or only those cells which have changed since last
|
||||||
// generation. You first call BeginFind() to specify the viewport,
|
// generation. You first call BeginFind() to specify the viewport,
|
||||||
// then keep calling FindMore() until it returns TRUE.
|
// then keep calling FindMore() until it returns true.
|
||||||
//
|
//
|
||||||
// BeginFind:
|
// BeginFind:
|
||||||
// Specify the viewport and whether to look for alive cells or for
|
// Specify the viewport and whether to look for alive cells or for
|
||||||
@@ -135,7 +135,7 @@ public:
|
|||||||
// Fills an array with cells that match the specification given with
|
// Fills an array with cells that match the specification given with
|
||||||
// BeginFind(). The array itself belongs to the Life object and must
|
// BeginFind(). The array itself belongs to the Life object and must
|
||||||
// not be modified or freed by the caller. If this function returns
|
// not be modified or freed by the caller. If this function returns
|
||||||
// FALSE, then the operation is not complete: just process all cells
|
// false, then the operation is not complete: just process all cells
|
||||||
// and call FillMore() again.
|
// and call FillMore() again.
|
||||||
//
|
//
|
||||||
void BeginFind(wxInt32 x0, wxInt32 y0,
|
void BeginFind(wxInt32 x0, wxInt32 y0,
|
||||||
@@ -146,7 +146,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
// cellbox-related
|
// cellbox-related
|
||||||
LifeCellBox *CreateBox(wxInt32 x, wxInt32 y, wxUint32 hv);
|
LifeCellBox *CreateBox(wxInt32 x, wxInt32 y, wxUint32 hv);
|
||||||
LifeCellBox *LinkBox(wxInt32 x, wxInt32 y, bool create = TRUE);
|
LifeCellBox *LinkBox(wxInt32 x, wxInt32 y, bool create = true);
|
||||||
void KillBox(LifeCellBox *c);
|
void KillBox(LifeCellBox *c);
|
||||||
|
|
||||||
// helper for BeginFind & FindMore
|
// helper for BeginFind & FindMore
|
||||||
|
@@ -154,7 +154,7 @@ IMPLEMENT_APP(LifeApp)
|
|||||||
|
|
||||||
// some shortcuts
|
// some shortcuts
|
||||||
#define ADD_TOOL(id, bmp, tooltip, help) \
|
#define ADD_TOOL(id, bmp, tooltip, help) \
|
||||||
toolBar->AddTool(id, bmp, wxNullBitmap, false, -1, -1, (wxObject *)0, tooltip, help)
|
toolBar->AddTool(id, bmp, wxNullBitmap, false, wxDefaultPosition.x, wxDefaultPosition.y, (wxObject *)NULL, tooltip, help)
|
||||||
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
@@ -294,7 +294,7 @@ LifeFrame::LifeFrame() : wxFrame( (wxFrame *) NULL, wxID_ANY,
|
|||||||
wxSlider *slider = new wxSlider(panel2, ID_SLIDER,
|
wxSlider *slider = new wxSlider(panel2, ID_SLIDER,
|
||||||
5, 1, 10,
|
5, 1, 10,
|
||||||
wxDefaultPosition,
|
wxDefaultPosition,
|
||||||
wxSize(200, -1),
|
wxSize(200, wxDefaultSize.y),
|
||||||
wxSL_HORIZONTAL | wxSL_AUTOTICKS);
|
wxSL_HORIZONTAL | wxSL_AUTOTICKS);
|
||||||
|
|
||||||
UpdateInfoText();
|
UpdateInfoText();
|
||||||
|
@@ -62,7 +62,7 @@ LifeReader::LifeReader(wxInputStream& is)
|
|||||||
line = text_is.ReadLine();
|
line = text_is.ReadLine();
|
||||||
while (buff_is.IsOk() && line.StartsWith(wxT("#D"), &rest))
|
while (buff_is.IsOk() && line.StartsWith(wxT("#D"), &rest))
|
||||||
{
|
{
|
||||||
m_description += rest.Trim(FALSE);
|
m_description += rest.Trim(false);
|
||||||
m_description += wxT("\n");
|
m_description += wxT("\n");
|
||||||
line = text_is.ReadLine();
|
line = text_is.ReadLine();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user