* more cleanup in Sounds preflet, replaced occurences of the deprecated cast_as macro, added missing checks.

* took the opportunity to do the same for all occurences as reported by OpenGrok 


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35600 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Alexandre Deckner
2010-02-24 14:10:17 +00:00
parent c35b7b937b
commit e7f640f25f
3 changed files with 28 additions and 22 deletions
@@ -11,7 +11,6 @@
#include <stdio.h>
#include <string.h>
#include <ClassInfo.h>
#include <Clipboard.h>
#ifdef __HAIKU__
# include <LayoutUtils.h>
@@ -191,8 +190,8 @@ PropertyListView::MessageReceived(BMessage* message)
if (!archivable)
continue;
// see if this is actually a property
Property* property = cast_as(archivable, Property);
if (!property || !propertyObject.AddProperty(property))
Property* property = dynamic_cast<Property*>(archivable);
if (property == NULL || !propertyObject.AddProperty(property))
delete archivable;
}
if (propertyObject.CountProperties() > 0)
+7 -9
View File
@@ -64,7 +64,6 @@ All rights reserved.
*/
#include <Button.h>
#include <ClassInfo.h>
#include <Debug.h>
#include <InterfaceDefs.h>
#include <ListItem.h>
@@ -613,8 +612,7 @@ BComboBox::TextInput::KeyDown(const char *bytes, int32 numBytes)
switch (aKey) {
case B_RETURN:
cb = cast_as(Parent(), BComboBox);
cb = dynamic_cast<BComboBox*>(Parent());
ASSERT(cb);
if (!cb->IsEnabled())
@@ -639,7 +637,7 @@ BComboBox::TextInput::KeyDown(const char *bytes, int32 numBytes)
}
break;
case B_TAB:
// cb = cast_as(Parent(), BComboBox);
// cb = dynamic_cast<BComboBox*>Parent());
// ASSERT(cb);
// if (cb->fAutoComplete && cb->fCompletionIndex >= 0) {
// int32 from, to;
@@ -678,10 +676,10 @@ BComboBox::TextInput::KeyDown(const char *bytes, int32 numBytes)
#if 0
case B_UP_ARROW: // fall through
case B_DOWN_ARROW:
cb = cast_as(Parent(), BComboBox);
cb = dynamic_cast<BComboBox*>(Parent());
ASSERT(cb);
if (cb->fChoiceList) {
cb = cast_as(Parent(), BComboBox);
cb = dynamic_cast<BComboBox*>(Parent());
ASSERT(cb);
if (!(cb->fPopupWindow)) {
cb->fPopupWindow = cb->CreatePopupWindow();
@@ -709,11 +707,11 @@ BComboBox::TextInput::KeyDown(const char *bytes, int32 numBytes)
break;
#endif
case B_ESCAPE:
cb = cast_as(Parent(), BComboBox);
cb = dynamic_cast<BComboBox*>(Parent());
ASSERT(cb);
if (cb->fChoiceList)
{
cb = cast_as(Parent(), BComboBox);
cb = dynamic_cast<BComboBox*>(Parent());
ASSERT(cb);
if (cb->fPopupWindow && cb->fPopupWindow->Lock())
{
@@ -749,7 +747,7 @@ BComboBox::TextInput::MakeFocus(bool state)
if (state == IsFocus())
return;
BComboBox* parent = cast_as(Parent(), BComboBox);
BComboBox* parent = dynamic_cast<BComboBox*>(Parent());
ASSERT(parent);
BTextView::MakeFocus(state);
+19 -10
View File
@@ -19,7 +19,6 @@
#include <Beep.h>
#include <Box.h>
#include <Button.h>
#include <ClassInfo.h>
#include <FindDirectory.h>
#include <fs_attr.h>
#include <MediaFiles.h>
@@ -173,7 +172,10 @@ HWindow::MessageReceived(BMessage* message)
switch (message->what) {
case M_OTHER_MESSAGE:
{
BMenuField* menufield = cast_as(FindView("filemenu"), BMenuField);
BMenuField* menufield
= dynamic_cast<BMenuField*>(FindView("filemenu"));
if (menufield == NULL)
return;
BMenu* menu = menufield->Menu();
HEventRow* row = (HEventRow*)fEventList->CurrentSelection();
@@ -199,8 +201,10 @@ HWindow::MessageReceived(BMessage* message)
entry_ref ref;
HEventRow* row = (HEventRow*)fEventList->CurrentSelection();
if (message->FindRef("refs", &ref) == B_OK && row != NULL) {
BMenuField* menufield = cast_as(FindView("filemenu"),
BMenuField);
BMenuField* menufield
= dynamic_cast<BMenuField*>(FindView("filemenu"));
if (menufield == NULL)
return;
BMenu* menu = menufield->Menu();
// check audio file
@@ -267,7 +271,10 @@ HWindow::MessageReceived(BMessage* message)
case M_EVENT_CHANGED:
{
const char* path;
BMenuField* menufield = cast_as(FindView("filemenu"), BMenuField);
BMenuField* menufield
= dynamic_cast<BMenuField*>(FindView("filemenu"));
if (menufield == NULL)
return;
BMenu* menu = menufield->Menu();
if (message->FindString("path", &path) == B_OK) {
@@ -308,7 +315,9 @@ HWindow::MessageReceived(BMessage* message)
void
HWindow::SetupMenuField()
{
BMenuField* menufield = cast_as(FindView("filemenu"), BMenuField);
BMenuField* menufield = dynamic_cast<BMenuField*>(FindView("filemenu"));
if (menufield == NULL)
return;
BMenu* menu = menufield->Menu();
int32 count = fEventList->CountRows();
for (int32 i = 0; i < count; i++) {
@@ -403,11 +412,11 @@ void
HWindow::Pulse()
{
HEventRow* row = (HEventRow*)fEventList->CurrentSelection();
BMenuField* menufield = cast_as(FindView("filemenu"), BMenuField);
BButton* button = cast_as(FindView("play"), BButton);
BButton* stop = cast_as(FindView("stop"), BButton);
BMenuField* menufield = dynamic_cast<BMenuField*>(FindView("filemenu"));
BButton* button = dynamic_cast<BButton*>(FindView("play"));
BButton* stop = dynamic_cast<BButton*>(FindView("stop"));
if (menufield == NULL)
if (menufield == NULL || button == NULL || stop == NULL)
return;
if (row != NULL) {