style cleanup

whitespace => tab


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23505 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval
2008-01-13 23:05:30 +00:00
parent 69666c9199
commit 269fdeefff
35 changed files with 382 additions and 385 deletions
+1 -1
View File
@@ -13,7 +13,7 @@ resource app_version {
internal = 0,
short_info = "Appearance",
long_info = "Appearance ©2002-2007 Haiku"
long_info = "Appearance ©2002-2007 Haiku"
};
resource app_flags B_SINGLE_LAUNCH;
@@ -313,8 +313,8 @@ BackgroundImage::Show(BackgroundImageInfo *info, BView *view)
followFlags, tile);
view->Invalidate();
/*if(fShowingBitmap != info) {
if(fShowingBitmap)
/*if (fShowingBitmap != info) {
if (fShowingBitmap)
fShowingBitmap->UnloadBitmap(fCacheMode);
fShowingBitmap = info;
}*/
@@ -484,8 +484,8 @@ BackgroundImage::Refresh(BackgroundImage *oldBackgroundImage,
void
BackgroundImage::ChangeImageSet(BPoseView *poseView)
{
if(fRandomChange) {
if(fImageSetCount > 1) {
if (fRandomChange) {
if (fImageSetCount > 1) {
uint32 oldShowingImageSet = fShowingImageSet;
while(oldShowingImageSet == fShowingImageSet)
fShowingImageSet = random()%fImageSetCount;
@@ -493,7 +493,7 @@ BackgroundImage::ChangeImageSet(BPoseView *poseView)
fShowingImageSet = 0;
} else {
fShowingImageSet++;
if(fShowingImageSet > fImageSetCount - 1)
if (fShowingImageSet > fImageSetCount - 1)
fShowingImageSet = 0;
}
+1 -1
View File
@@ -13,7 +13,7 @@ resource app_version {
internal = 0,
short_info = "Backgrounds",
long_info = "Backgrounds ©2002-2006 Haiku"
long_info = "Backgrounds ©2002-2006 Haiku"
};
resource app_flags B_SINGLE_LAUNCH;
@@ -83,7 +83,6 @@ RangeConfItem::DrawItem(BView *owner, BRect itemRect, bool complete)
owner->SetLowColor(color);
owner->FillRect(itemRect);
owner->SetHighColor(kBlack);
} else {
owner->SetLowColor(owner->ViewColor());
}
@@ -173,12 +172,12 @@ ConfigurationWindow::InitWindow(void)
BRect rtab = Bounds();
BRect rlist = Bounds();
rtab.top += 10;
rlist.top += 11;
rlist.left += 13;
rlist.right -= 13;
rlist.bottom -= 44;
rlist.top += 11;
rlist.left += 13;
rlist.right -= 13;
rlist.bottom -= 44;
// Create the TabView and Tabs
// Create the TabView and Tabs
BTabView *tabView = new BTabView(rtab,"resource_usage_tabview");
tabView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
@@ -266,9 +265,9 @@ ConfigurationWindow::InitWindow(void)
BRect boxRect = resources->Bounds();
boxRect.top = 74;
boxRect.left += 13;
boxRect.right -= 11;
boxRect.bottom = boxRect.top + 141;
boxRect.left += 13;
boxRect.right -= 11;
boxRect.bottom = boxRect.top + 141;
BBox *ioPortBox = new BBox(boxRect, "ioPort",
B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW);
ioPortBox->SetLabel(new BStringView(BRect(0,0,150,15), "ioPortLabel", " IO Port Ranges "));
@@ -624,7 +623,7 @@ bool
ConfigurationWindow::QuitRequested()
{
fItem->SetWindow(NULL);
return true;
return true;
}
// ---------------------------------------------------------------------------------------------------------- //
+11 -10
View File
@@ -24,8 +24,8 @@
class Devices : public BApplication
{
public:
Devices();
virtual void MessageReceived(BMessage *message);
Devices();
virtual void MessageReceived(BMessage *message);
private:
@@ -47,20 +47,21 @@ void Devices::MessageReceived (BMessage *message)
{
switch(message->what)
{
default:
BApplication::MessageReceived(message); // pass it along ...
break;
}
default:
BApplication::MessageReceived(message); // pass it along ...
break;
}
}
// ---------------------------------------------------------------------------------------------------------- //
// Devices Main
int main(void)
int
main(void)
{
Devices theApp;
theApp.Run();
return 0;
Devices theApp;
theApp.Run();
return 0;
}
// end ------------------------------------------------------------------------------------------------------ //
+1 -1
View File
@@ -14,7 +14,7 @@ resource app_version
internal = 0,
short_info = "Devices",
long_info = "Devices ©2002-2007 Haiku"
long_info = "Devices ©2002-2007 Haiku"
};
resource app_flags B_SINGLE_LAUNCH;
+1 -1
View File
@@ -202,7 +202,7 @@ DeviceItem::DrawItem(BView *owner, BRect itemRect, bool complete)
owner->MovePenTo(point);
owner->DrawString(fName);
if(fInfo) {
if (fInfo) {
point += BPoint(222, 0);
BString string = "enabled";
if (!(fInfo->GetInfo()->flags & B_DEVICE_INFO_ENABLED))
+4 -4
View File
@@ -23,10 +23,10 @@
class DevicesInfo
{
public:
DevicesInfo(struct device_info *info,
struct device_configuration *current,
struct possible_device_configurations *possible);
~DevicesInfo();
DevicesInfo(struct device_info *info,
struct device_configuration *current,
struct possible_device_configurations *possible);
~DevicesInfo();
struct device_info * GetInfo() { return fInfo;}
char * GetDeviceName() const { return fDeviceName; }
char * GetCardName() const { return fCardName; }
+17 -17
View File
@@ -69,25 +69,25 @@ DevicesWindow::DevicesWindow(BRect frame) : BWindow (frame, "Devices", B_TITLED_
CenterWindowOnScreen(this);
// Load User Settings
BPath path;
find_directory(B_USER_SETTINGS_DIRECTORY,&path);
path.Append("Devices_Settings",true);
BFile file(path.Path(),B_READ_ONLY);
BMessage msg;
msg.Unflatten(&file);
LoadSettings (&msg);
BPath path;
find_directory(B_USER_SETTINGS_DIRECTORY,&path);
path.Append("Devices_Settings",true);
BFile file(path.Path(),B_READ_ONLY);
BMessage msg;
msg.Unflatten(&file);
LoadSettings (&msg);
status_t error;
status_t error;
if ((error = init_cm_wrapper()) < 0) {
printf("Error initializing configuration manager (%s)\n", strerror(error));
exit(1);
}
InitDevices(B_ISA_BUS);
InitDevices(B_PCI_BUS);
InitDevices(B_ISA_BUS);
InitDevices(B_PCI_BUS);
for (int32 i=fList.CountItems()-1; i>=0; i--) {
for (int32 i=fList.CountItems()-1; i>=0; i--) {
DevicesInfo *deviceInfo = (DevicesInfo *) fList.ItemAt(i);
struct device_info *info = deviceInfo->GetInfo();
BListItem *item = systemMenu;
@@ -253,7 +253,7 @@ bool DevicesWindow::QuitRequested()
{
SaveSettings();
be_app->PostMessage(B_QUIT_REQUESTED);
return true;
return true;
}
// ---------------------------------------------------------------------------------------------------------- //
@@ -277,12 +277,12 @@ void DevicesWindow::SaveSettings(void)
BMessage msg;
msg.AddRect("windowframe",Frame());
BPath path;
status_t result = find_directory(B_USER_SETTINGS_DIRECTORY,&path);
if (result == B_OK)
{
BPath path;
status_t result = find_directory(B_USER_SETTINGS_DIRECTORY,&path);
if (result == B_OK)
{
path.Append("Devices_Settings",true);
BFile file(path.Path(),B_READ_WRITE | B_CREATE_FILE | B_ERASE_FILE);
BFile file(path.Path(),B_READ_WRITE | B_CREATE_FILE | B_ERASE_FILE);
msg.Flatten(&file);
}
}
+19 -19
View File
@@ -35,9 +35,9 @@ void CenterWindowOnScreen(BWindow* w);
class ResourceUsageWindow : public BWindow {
public:
ResourceUsageWindow(BRect frame, BList &);
~ResourceUsageWindow();
virtual void MessageReceived(BMessage *message);
ResourceUsageWindow(BRect frame, BList &);
~ResourceUsageWindow();
virtual void MessageReceived(BMessage *message);
private:
void InitWindow(BList &);
@@ -46,19 +46,19 @@ class ResourceUsageWindow : public BWindow {
class ModemWindow : public BWindow {
public:
ModemWindow(BRect frame, BMessenger);
~ModemWindow();
virtual void MessageReceived(BMessage *message);
ModemWindow(BRect frame, BMessenger);
~ModemWindow();
virtual void MessageReceived(BMessage *message);
private:
void InitWindow(void);
BMessenger fMessenger;
BMessenger fMessenger;
};
class ConfigurationWindow : public BWindow {
public:
ConfigurationWindow(BRect frame, DeviceItem *item);
~ConfigurationWindow();
virtual bool QuitRequested();
~ConfigurationWindow();
virtual bool QuitRequested();
virtual void MessageReceived(BMessage *message);
private:
void InitWindow(void);
@@ -74,9 +74,9 @@ class ConfigurationWindow : public BWindow {
class DevicesWindow : public BWindow {
public:
DevicesWindow(BRect frame);
~DevicesWindow();
virtual bool QuitRequested();
DevicesWindow(BRect frame);
~DevicesWindow();
virtual bool QuitRequested();
virtual void MessageReceived(BMessage *message);
private:
void InitWindow(void);
@@ -89,15 +89,15 @@ class DevicesWindow : public BWindow {
ResourceUsageWindow* ptrResourceUsageWindow;
ModemWindow* ptrModemWindow;
BStringView *stvDeviceName;
BStringView *stvCurrentState;
BMenuBar *menubar;
BStringView *stvDeviceName;
BStringView *stvCurrentState;
BMenuBar *menubar;
BList fList;
BList fList;
BListItem *systemMenu, *isaMenu, *pciMenu, *jumperedMenu;
BOutlineListView *outline;
BStringView *stvIRQ;
BListItem *systemMenu, *isaMenu, *pciMenu, *jumperedMenu;
BOutlineListView *outline;
BStringView *stvIRQ;
BStringView *stvDMA;
BStringView *stvIORanges;
BStringView *stvMemoryRanges;
@@ -208,12 +208,12 @@ void ResourceUsageWindow::InitWindow(BList &list)
BRect rtab = Bounds();
BRect rlist = Bounds();
rtab.top += 10;
rlist.top += 10;
rlist.left += 12;
rlist.right -= 15 + B_V_SCROLL_BAR_WIDTH;
rlist.bottom -= 47;
rlist.top += 10;
rlist.left += 12;
rlist.right -= 15 + B_V_SCROLL_BAR_WIDTH;
rlist.bottom -= 47;
// Create the TabView and Tabs
// Create the TabView and Tabs
BTabView *tabView = new BTabView(rtab,"resource_usage_tabview");
tabView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
+1 -1
View File
@@ -104,7 +104,7 @@ status_t get_possible_configurations_for(uint64 id,
status_t count_resource_descriptors_of_type(
struct device_configuration *c, resource_type type)
struct device_configuration *c, resource_type type)
{
struct cm_ioctl_data params;
+1 -1
View File
@@ -13,7 +13,7 @@ resource app_version {
internal = 0,
short_info = "DriveSetup",
long_info = "DriveSetup ©2002-2007 Haiku"
long_info = "DriveSetup ©2002-2007 Haiku"
};
resource app_flags B_SINGLE_LAUNCH;
+2 -2
View File
@@ -179,8 +179,8 @@ bool
MainWindow::QuitRequested()
{
// TODO: ask about any unsaved changes
be_app->PostMessage(B_QUIT_REQUESTED);
Hide();
be_app->PostMessage(B_QUIT_REQUESTED);
Hide();
return false;
}
+1 -1
View File
@@ -15,7 +15,7 @@ resource app_version {
internal = 0,
short_info = "Keyboard",
long_info = "Keyboard ©2004-2007 Haiku"
long_info = "Keyboard ©2004-2007 Haiku"
};
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
@@ -36,12 +36,12 @@ KeyboardSettings::KeyboardSettings()
fCorner.y = 100;
status_t status = find_directory(B_USER_SETTINGS_DIRECTORY, &path);
if(status == B_OK) {
if (status == B_OK) {
status = path.Append(kb_settings_file);
if(status == B_OK) {
if (status == B_OK) {
status = file.SetTo(path.Path(), B_READ_ONLY);
if (status == B_OK) {
if(file.ReadAt(sizeof(kb_settings), &fCorner, sizeof(fCorner)) != sizeof(fCorner)) {
if (file.ReadAt(sizeof(kb_settings), &fCorner, sizeof(fCorner)) != sizeof(fCorner)) {
fCorner.x = 150;
fCorner.y = 100;
}
+5 -5
View File
@@ -119,7 +119,7 @@ KeyboardWindow::MessageReceived(BMessage* message)
if (button !=NULL)
button->SetEnabled(false);
break;
}
}
case SLIDER_REPEAT_RATE:
{
int32 rate;
@@ -133,7 +133,7 @@ KeyboardWindow::MessageReceived(BMessage* message)
button = (BButton *)FindView("keyboard_revert");
if (button !=NULL)
button->SetEnabled(true);
button->SetEnabled(true);
break;
}
case SLIDER_DELAY_RATE:
@@ -165,10 +165,10 @@ KeyboardWindow::MessageReceived(BMessage* message)
button->SetEnabled(fSettings.IsDefaultable());
button = (BButton *)FindView("keyboard_revert");
if (button !=NULL)
button->SetEnabled(true);
if (button !=NULL)
button->SetEnabled(true);
break;
}
}
default:
BWindow::MessageReceived(message);
+21 -21
View File
@@ -21,34 +21,34 @@
#include <input_globals.h>
static void
print_key( char *chars, int32 offset )
print_key(char *chars, int32 offset)
{
int size = chars[offset++];
switch( size ) {
switch(size) {
case 0:
// Not mapped
printf( "N/A" );
printf("N/A");
break;
case 1:
// 1-byte UTF-8/ASCII character
printf( "%c", chars[offset] );
printf("%c", chars[offset]);
break;
default:
// 2-, 3-, or 4-byte UTF-8 character
{
char *str = new char[size + 1];
strncpy( str, &(chars[offset]), size );
strncpy(str, &(chars[offset]), size);
str[size] = 0;
printf( "%s", str );
printf("%s", str);
delete [] str;
}
break;
}
printf( "\t" );
printf("\t");
}
@@ -57,19 +57,19 @@ Keymap::DumpKeymap()
{
// Print a chart of the normal, shift, option, and option+shift
// keys.
printf( "Key #\tNormal\tShift\tCaps\tC+S\tOption\tO+S\tO+C\tO+C+S\tControl\n" );
for( int idx = 0; idx < 128; idx++ ) {
printf( " 0x%x\t", idx );
print_key( fChars, fKeys.normal_map[idx] );
print_key( fChars, fKeys.shift_map[idx] );
print_key( fChars, fKeys.caps_map[idx] );
print_key( fChars, fKeys.caps_shift_map[idx] );
print_key( fChars, fKeys.option_map[idx] );
print_key( fChars, fKeys.option_shift_map[idx] );
print_key( fChars, fKeys.option_caps_map[idx] );
print_key( fChars, fKeys.option_caps_shift_map[idx] );
print_key( fChars, fKeys.control_map[idx] );
printf( "\n" );
printf("Key #\tNormal\tShift\tCaps\tC+S\tOption\tO+S\tO+C\tO+C+S\tControl\n");
for (int idx = 0; idx < 128; idx++) {
printf(" 0x%x\t", idx );
print_key(fChars, fKeys.normal_map[idx]);
print_key(fChars, fKeys.shift_map[idx]);
print_key(fChars, fKeys.caps_map[idx]);
print_key(fChars, fKeys.caps_shift_map[idx]);
print_key(fChars, fKeys.option_map[idx]);
print_key(fChars, fKeys.option_shift_map[idx]);
print_key(fChars, fKeys.option_caps_map[idx]);
print_key(fChars, fKeys.option_caps_shift_map[idx]);
print_key(fChars, fKeys.control_map[idx]);
printf("\n");
}
}
@@ -371,7 +371,7 @@ Keymap::GetChars(uint32 keyCode, uint32 modifiers, uint8 activeDeadKey, char** c
if (strncmp(&(fChars[offset+1]), &(fChars[dead_key[i]+1]), *numBytes ) == 0) {
*numBytes = fChars[dead_key[i+1]];
switch( *numBytes ) {
switch(*numBytes) {
case 0:
// Not mapped
*chars = NULL;
+1 -1
View File
@@ -13,7 +13,7 @@ resource app_version {
internal = 0,
short_info = "Keymap",
long_info = "Keymap ©2004-2006 Haiku"
long_info = "Keymap ©2004-2006 Haiku"
};
resource app_flags B_SINGLE_LAUNCH;
+8 -9
View File
@@ -156,7 +156,7 @@ KeymapWindow::AddMenuBar()
menubar->AddItem( menu );
// Create the Font menu
fFontMenu = new BMenu( "Font" );
fFontMenu = new BMenu("Font");
fFontMenu->SetRadioMode(true);
int32 numFamilies = count_font_families();
font_family family, current_family;
@@ -166,14 +166,14 @@ KeymapWindow::AddMenuBar()
be_plain_font->GetFamilyAndStyle(&current_family, &current_style);
for (int32 i = 0; i < numFamilies; i++ )
if ( get_font_family(i, &family, &flags) == B_OK ) {
if (get_font_family(i, &family, &flags) == B_OK) {
BMenuItem *item =
new BMenuItem(family, new BMessage( MENU_FONT_CHANGED));
fFontMenu->AddItem(item);
if(strcmp(family, current_family) == 0)
if (strcmp(family, current_family) == 0)
item->SetMarked(true);
}
menubar->AddItem( fFontMenu );
menubar->AddItem(fFontMenu);
return menubar;
}
@@ -207,7 +207,7 @@ KeymapWindow::AddMaps(BView *placeholderView)
fUserListView = new BListView( bounds, "userList" );
// '(Current)'
KeymapListItem *currentKeymapItem = (KeymapListItem*)fUserListView->FirstItem();
if( currentKeymapItem != NULL )
if (currentKeymapItem != NULL)
fUserListView->AddItem( currentKeymapItem );
// Saved keymaps
mapsBox->AddChild( new BScrollView( "userScrollList", fUserListView,
@@ -422,7 +422,7 @@ MapView::MapView(BRect rect, const char *name, Keymap* keymap)
// TODO: Properly handle font sensitivity in drawing the keys.
// This at least prevents the app from looking horrible until the font sensitivity for this app
// can be done the Right Way.
if(fCurrentFont.Size() > 14)
if (fCurrentFont.Size() > 14)
fCurrentFont.SetSize(14);
SetViewColor(B_TRANSPARENT_COLOR);
@@ -1170,7 +1170,7 @@ MapView::DrawKey(uint32 keyCode)
if (!vertical) {
int32 w1 = 4;
int32 w2 = 3;
if(fKeysRect[keyCode].Width() > 20) {
if (fKeysRect[keyCode].Width() > 20) {
w1 = 6;
w2 = 6;
}
@@ -1348,7 +1348,6 @@ MapView::MessageReceived(BMessage *msg)
keyCode = i*8 + j;
DrawKey(keyCode);
}
}
if (keyCode<0)
@@ -1417,7 +1416,7 @@ MapView::MouseDown(BPoint point)
{
uint32 buttons;
GetMouse(&point, &buttons);
if(buttons & B_PRIMARY_MOUSE_BUTTON) {
if (buttons & B_PRIMARY_MOUSE_BUTTON) {
fCurrentMouseKey = 0;
for (int32 i=0; i<128; i++) {
if (fKeysRect[i].IsValid() && fKeysRect[i].Contains(point)) {
+5 -5
View File
@@ -81,10 +81,10 @@ Media::MessageReceived(BMessage *message)
fWindow->PostMessage(message);
break;
default:
BApplication::MessageReceived(message);
break;
}
default:
BApplication::MessageReceived(message);
break;
}
}
@@ -98,6 +98,6 @@ main(int, char**)
if (app.InitCheck() == B_OK)
app.Run();
return 0;
return 0;
}
+12 -12
View File
@@ -86,26 +86,26 @@ MediaListItem::DrawItem(BView *owner, BRect frame, bool complete)
BRect iconFrame(frame);
iconFrame.Set(iconFrame.left, iconFrame.top+1, iconFrame.left+15, iconFrame.top+16);
uint32 index = 0;
if(OutlineLevel()==0 || (fIsDefaultInput && fIsDefaultOutput)) {
if(fIsDefaultInput && fIsVideo)
if (OutlineLevel()==0 || (fIsDefaultInput && fIsDefaultOutput)) {
if (fIsDefaultInput && fIsVideo)
index = 4;
else if(fIsDefaultInput && !fIsVideo)
else if (fIsDefaultInput && !fIsVideo)
index = 2;
owner->SetDrawingMode(B_OP_OVER);
owner->DrawBitmap(static_cast<BBitmap*>(fIcons->ItemAt(index)), iconFrame);
owner->SetDrawingMode(B_OP_COPY);
}
iconFrame.OffsetBy(16, 0);
if(fIsDefaultInput || fIsDefaultOutput || fIsAudioMixer) {
if(fIsAudioMixer)
if (fIsDefaultInput || fIsDefaultOutput || fIsAudioMixer) {
if (fIsAudioMixer)
index = 1;
else if(fIsDefaultOutput) {
if(fIsVideo)
else if (fIsDefaultOutput) {
if (fIsVideo)
index = 5;
else
index = 3;
} else {
if(fIsVideo)
if (fIsVideo)
index = 4;
else
index = 2;
@@ -131,7 +131,7 @@ MediaListItem::DrawItem(BView *owner, BRect frame, bool complete)
void
MediaListItem::SetDefault(bool isDefault, bool isInput)
{
if(isInput)
if (isInput)
fIsDefaultInput = isDefault;
else
fIsDefaultOutput = isDefault;
@@ -159,11 +159,11 @@ MediaListItem::Compare(const void *firstArg, const void *secondArg)
{
const MediaListItem *item1 = *static_cast<const MediaListItem * const *>(firstArg);
const MediaListItem *item2 = *static_cast<const MediaListItem * const *>(secondArg);
if(item1->fIsVideo != item2->fIsVideo)
if (item1->fIsVideo != item2->fIsVideo)
return item1->fIsVideo ? 1 : -1;
if(item1->OutlineLevel()!=item2->OutlineLevel())
if (item1->OutlineLevel()!=item2->OutlineLevel())
return item1->OutlineLevel()>item2->OutlineLevel() ? 1 : -1;
if(item1->fIsAudioMixer!=item2->fIsAudioMixer)
if (item1->fIsAudioMixer!=item2->fIsAudioMixer)
return item2->fIsAudioMixer ? 1 : -1;
return strcmp(item1->fLabel, item2->fLabel);
}
+7 -7
View File
@@ -39,7 +39,7 @@ BarView::Draw(BRect updateRect)
{
BRect r = Bounds();
if(fDisplay) {
if (fDisplay) {
// Display the 3D Look Divider Bar
SetHighColor(140,140,140,0);
StrokeLine(BPoint(r.left,r.top),BPoint(r.right,r.top));
@@ -84,7 +84,7 @@ SettingsView::SettingsView (BRect frame, bool isVideo)
defaultsBox->AddChild(menuField2);
menuField2->SetDivider(divider);
if(!fIsVideo) {
if (!fIsVideo) {
defaultRect.OffsetBy(186, 0);
defaultRect.right -= 30;
fMenu3 = new BPopUpMenu("<none>");
@@ -121,7 +121,7 @@ SettingsView::SettingsView (BRect frame, bool isVideo)
uint32 flags;
BMediaRoster::Roster()->GetRealtimeFlags(&flags);
if(flags & (fIsVideo ? B_MEDIA_REALTIME_VIDEO : B_MEDIA_REALTIME_AUDIO))
if (flags & (fIsVideo ? B_MEDIA_REALTIME_VIDEO : B_MEDIA_REALTIME_AUDIO))
fRealtimeCheckBox->SetValue(B_CONTROL_ON);
rect2.top += 26;
@@ -145,7 +145,7 @@ SettingsView::SettingsView (BRect frame, bool isVideo)
"Restart Media Services", new BMessage(ML_RESTART_MEDIA_SERVER));
AddChild(restartButton);
if(!fIsVideo) {
if (!fIsVideo) {
rect.right = rect.left - 10;
rect.top += 4;
rect.left = frame.left + 33;
@@ -156,7 +156,7 @@ SettingsView::SettingsView (BRect frame, bool isVideo)
"Show Volume Control on Deskbar", new BMessage(ML_SHOW_VOLUME_CONTROL));
AddChild(fVolumeCheckBox);
if(BDeskbar().HasItem("MediaReplicant"))
if (BDeskbar().HasItem("MediaReplicant"))
fVolumeCheckBox->SetValue(B_CONTROL_ON);
}
}
@@ -186,7 +186,7 @@ SettingsView::SetDefault(dormant_node_info &info, bool isInput, int32 outputID)
for (int32 i = 0; i < menu->CountItems(); i++) {
SettingsItem *item = static_cast<SettingsItem *>(menu->ItemAt(i));
if(item->fInfo && item->fInfo->addon == info.addon && item->fInfo->flavor_id == info.flavor_id) {
if (item->fInfo && item->fInfo->addon == info.addon && item->fInfo->flavor_id == info.flavor_id) {
item->SetMarked(true);
break;
}
@@ -215,7 +215,7 @@ SettingsView::SetDefault(dormant_node_info &info, bool isInput, int32 outputID)
media_input *input = new media_input();
memcpy(input, &inputs[i], sizeof(*input));
fMenu3->AddItem(item = new Settings2Item(&info, input, new BMessage(message)));
if(inputs[i].destination.id == outputID)
if (inputs[i].destination.id == outputID)
item->SetMarked(true);
}
}
+14 -14
View File
@@ -30,9 +30,9 @@ const uint32 ML_DEFAULTOUTPUT_CHANGE = 'doch';
class BarView : public BView
{
public:
BarView(BRect frame);
virtual void Draw(BRect updateRect);
bool fDisplay;
BarView(BRect frame);
virtual void Draw(BRect updateRect);
bool fDisplay;
};
class SettingsItem : public BMenuItem
@@ -58,18 +58,18 @@ class Settings2Item : public BMenuItem
class SettingsView : public BView
{
public:
SettingsView(BRect frame, bool isVideo);
void AddNodes(BList &list, bool isInput);
void SetDefault(dormant_node_info &info, bool isInput, int32 outputID = -1);
BCheckBox *fRealtimeCheckBox;
BCheckBox *fVolumeCheckBox;
BMenu *fMenu1;
BMenu *fMenu2;
BMenu *fMenu3;
BStringView *fRestartView;
SettingsView(BRect frame, bool isVideo);
void AddNodes(BList &list, bool isInput);
void SetDefault(dormant_node_info &info, bool isInput, int32 outputID = -1);
BCheckBox *fRealtimeCheckBox;
BCheckBox *fVolumeCheckBox;
BMenu *fMenu1;
BMenu *fMenu2;
BMenu *fMenu3;
BStringView *fRestartView;
private:
bool fIsVideo;
private:
bool fIsVideo;
};
#endif
+82 -83
View File
@@ -53,17 +53,17 @@ MediaWindow::InitCheck()
// MediaWindow - Destructor
MediaWindow::~MediaWindow()
{
for(int i=0; i<fAudioOutputs.CountItems(); i++)
for (int i=0; i<fAudioOutputs.CountItems(); i++)
delete static_cast<dormant_node_info *>(fAudioOutputs.ItemAt(i));
for(int i=0; i<fAudioInputs.CountItems(); i++)
for (int i=0; i<fAudioInputs.CountItems(); i++)
delete static_cast<dormant_node_info *>(fAudioInputs.ItemAt(i));
for(int i=0; i<fVideoOutputs.CountItems(); i++)
for (int i=0; i<fVideoOutputs.CountItems(); i++)
delete static_cast<dormant_node_info *>(fVideoOutputs.ItemAt(i));
for(int i=0; i<fVideoInputs.CountItems(); i++)
for (int i=0; i<fVideoInputs.CountItems(); i++)
delete static_cast<dormant_node_info *>(fVideoInputs.ItemAt(i));
BMediaRoster *roster = BMediaRoster::Roster();
if(roster && fCurrentNode)
if (roster && fCurrentNode)
roster->ReleaseNode(*fCurrentNode);
char buffer[512];
@@ -72,10 +72,10 @@ MediaWindow::~MediaWindow()
sprintf(buffer, "# MediaPrefs Settings\n rect = %i,%i,%i,%i\n", int(rect.left), int(rect.top), int(rect.right), int(rect.bottom));
BPath path;
if(find_directory(B_USER_SETTINGS_DIRECTORY, &path) == B_OK) {
if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) == B_OK) {
path.Append(SETTINGS_FILE);
BFile file(path.Path(),B_READ_WRITE|B_CREATE_FILE|B_ERASE_FILE);
if(file.InitCheck()==B_OK) {
BFile file(path.Path(), B_READ_WRITE|B_CREATE_FILE|B_ERASE_FILE);
if (file.InitCheck()==B_OK) {
file.Write(buffer, strlen(buffer));
}
}
@@ -92,19 +92,19 @@ MediaWindow::FindNodes(media_type type, uint64 kind, BList &list)
BMediaRoster *roster = BMediaRoster::Roster();
format.type = type;
if(kind & B_PHYSICAL_OUTPUT)
if (kind & B_PHYSICAL_OUTPUT)
format1 = &format;
else if(kind & B_PHYSICAL_INPUT)
else if (kind & B_PHYSICAL_INPUT)
format2 = &format;
else
return;
if(roster->GetDormantNodes(node_info, &node_info_count, format1, format2, NULL, kind)!=B_OK) {
if (roster->GetDormantNodes(node_info, &node_info_count, format1, format2, NULL, kind)!=B_OK) {
fprintf(stderr, "error\n");
return;
}
for(int32 i=0; i<node_info_count; i++) {
for (int32 i=0; i<node_info_count; i++) {
PRINT(("node : %s, media_addon %i, flavor_id %i\n",
node_info[i].name, node_info[i].addon, node_info[i].flavor_id));
dormant_node_info *info = new dormant_node_info();
@@ -119,9 +119,9 @@ MediaWindow::FindNodes(media_type type, uint64 kind, BList &list)
MediaListItem *
MediaWindow::FindMediaListItem(dormant_node_info *info)
{
for(int32 j=0; j<fListView->CountItems(); j++) {
for (int32 j=0; j<fListView->CountItems(); j++) {
MediaListItem *item = static_cast<MediaListItem *>(fListView->ItemAt(j));
if(item->fInfo && item->fInfo->addon == info->addon && item->fInfo->flavor_id == info->flavor_id) {
if (item->fInfo && item->fInfo->addon == info->addon && item->fInfo->flavor_id == info->flavor_id) {
return item;
break;
}
@@ -133,9 +133,9 @@ MediaWindow::FindMediaListItem(dormant_node_info *info)
void
MediaWindow::AddNodes(BList &list, bool isVideo)
{
for(int32 i=0; i<list.CountItems(); i++) {
for (int32 i=0; i<list.CountItems(); i++) {
dormant_node_info *info = static_cast<dormant_node_info *>(list.ItemAt(i));
if(!FindMediaListItem(info))
if (!FindMediaListItem(info))
fListView->AddItem(new MediaListItem(info, 1, isVideo, &fIcons));
}
}
@@ -146,10 +146,10 @@ void
MediaWindow::InitWindow(void)
{
// Bitmaps
BRect iconRect(0,0,15,15);
BBitmap *icon = new BBitmap(iconRect, B_CMAP8);
icon->SetBits(kDevicesBits, kDevicesWidth*kDevicesHeight, 0, kDevicesColorSpace);
fIcons.AddItem(icon);
BRect iconRect(0, 0, 15, 15);
BBitmap *icon = new BBitmap(iconRect, B_CMAP8);
icon->SetBits(kDevicesBits, kDevicesWidth*kDevicesHeight, 0, kDevicesColorSpace);
fIcons.AddItem(icon);
icon = new BBitmap(iconRect, B_CMAP8);
icon->SetBits(kMixerBits, kMixerWidth*kMixerHeight, 0, kMixerColorSpace);
fIcons.AddItem(icon);
@@ -170,10 +170,10 @@ MediaWindow::InitWindow(void)
BRect bounds = Bounds(); // the whole view
// Create the OutlineView
BRect menuRect(bounds.left+14,bounds.top+14,bounds.left+146,bounds.bottom-14);
BRect titleRect(menuRect.right+14,menuRect.top,bounds.right-10,menuRect.top+16);
BRect availableRect(menuRect.right+15,titleRect.bottom+12,bounds.right-14,bounds.bottom-4);
BRect barRect(titleRect.left,titleRect.bottom+10,titleRect.right-2,titleRect.bottom+11);
BRect menuRect(bounds.left+14, bounds.top+14, bounds.left+146, bounds.bottom-14);
BRect titleRect(menuRect.right+14, menuRect.top, bounds.right-10, menuRect.top+16);
BRect availableRect(menuRect.right+15, titleRect.bottom+12, bounds.right-14, bounds.bottom-4);
BRect barRect(titleRect.left, titleRect.bottom+10, titleRect.right-2, titleRect.bottom+11);
fListView = new BListView(menuRect, "media_list_view", B_SINGLE_SELECTION_LIST, B_FOLLOW_ALL_SIDES);
fListView->SetSelectionMessage(new BMessage(ML_SELECTED_NODE));
@@ -223,15 +223,15 @@ MediaWindow::InitMedia(bool first)
status_t err = B_OK;
BMediaRoster *roster = BMediaRoster::Roster(&err);
if(first && err != B_OK) {
if (first && err != B_OK) {
BAlert *alert = new BAlert("start_media_server",
"Could not connect to the Media Server.\n"
"Would you like to start it ?", "Quit", "Start Media Server", NULL,
B_WIDTH_AS_USUAL, B_WARNING_ALERT);
if(alert->Go()==0)
if (alert->Go()==0)
return B_ERROR;
fAlert = new MediaAlert(BRect(0,0,300,60),
fAlert = new MediaAlert(BRect(0, 0, 300, 60),
"restart_alert", "Restarting Media Services\nStarting Media Server...\n");
fAlert->Show();
@@ -243,28 +243,28 @@ MediaWindow::InitMedia(bool first)
Lock();
bool isVideoSelected = true;
if(!first && fListView->ItemAt(0) && fListView->ItemAt(0)->IsSelected())
if (!first && fListView->ItemAt(0) && fListView->ItemAt(0)->IsSelected())
isVideoSelected = false;
if((!first || (first && err) ) && fAlert) {
if ((!first || (first && err) ) && fAlert) {
BAutolock locker(fAlert);
if(locker.IsLocked())
if (locker.IsLocked())
fAlert->TextView()->SetText("Ready For Use...");
}
void *listItem;
while((listItem = fListView->RemoveItem((int32)0)))
while ((listItem = fListView->RemoveItem((int32)0)))
delete static_cast<MediaListItem *>(listItem);
while((listItem = fAudioOutputs.RemoveItem((int32)0)))
while ((listItem = fAudioOutputs.RemoveItem((int32)0)))
delete static_cast<dormant_node_info *>(listItem);
while((listItem = fAudioInputs.RemoveItem((int32)0)))
while ((listItem = fAudioInputs.RemoveItem((int32)0)))
delete static_cast<dormant_node_info *>(listItem);
while((listItem = fVideoOutputs.RemoveItem((int32)0)))
while ((listItem = fVideoOutputs.RemoveItem((int32)0)))
delete static_cast<dormant_node_info *>(listItem);
while((listItem = fVideoInputs.RemoveItem((int32)0)))
while ((listItem = fVideoInputs.RemoveItem((int32)0)))
delete static_cast<dormant_node_info *>(listItem);
MediaListItem *item, *mixer, *audio, *video;
MediaListItem *item, *mixer, *audio, *video;
// Grab Media Info
FindNodes(B_MEDIA_RAW_AUDIO, B_PHYSICAL_OUTPUT, fAudioOutputs);
@@ -301,53 +301,53 @@ MediaWindow::InitMedia(bool first)
int32 outputID;
BString outputName;
if(roster->GetAudioInput(&default_node)==B_OK) {
if (roster->GetAudioInput(&default_node)==B_OK) {
roster->GetDormantNodeFor(default_node, &node_info);
item = FindMediaListItem(&node_info);
if(item)
if (item)
item->SetDefault(true, true);
fAudioView->SetDefault(node_info, true);
}
if(roster->GetAudioOutput(&default_node, &outputID, &outputName)==B_OK) {
if (roster->GetAudioOutput(&default_node, &outputID, &outputName)==B_OK) {
roster->GetDormantNodeFor(default_node, &node_info);
item = FindMediaListItem(&node_info);
if(item)
if (item)
item->SetDefault(true, false);
fAudioView->SetDefault(node_info, false, outputID);
}
if(roster->GetVideoInput(&default_node)==B_OK) {
if (roster->GetVideoInput(&default_node)==B_OK) {
roster->GetDormantNodeFor(default_node, &node_info);
item = FindMediaListItem(&node_info);
if(item)
if (item)
item->SetDefault(true, true);
fVideoView->SetDefault(node_info, true);
}
if(roster->GetVideoOutput(&default_node)==B_OK) {
if (roster->GetVideoOutput(&default_node)==B_OK) {
roster->GetDormantNodeFor(default_node, &node_info);
item = FindMediaListItem(&node_info);
if(item)
if (item)
item->SetDefault(true, false);
fVideoView->SetDefault(node_info, false);
}
if(first) {
if (first) {
fListView->Select(fListView->IndexOf(mixer));
} else {
if(!fAudioView->fRestartView->IsHidden())
if (!fAudioView->fRestartView->IsHidden())
fAudioView->fRestartView->Hide();
if(!fVideoView->fRestartView->IsHidden())
if (!fVideoView->fRestartView->IsHidden())
fVideoView->fRestartView->Hide();
if(isVideoSelected)
if (isVideoSelected)
fListView->Select(fListView->IndexOf(video));
else
fListView->Select(fListView->IndexOf(audio));
}
if(fAlert) {
if (fAlert) {
snooze(800000);
fAlert->PostMessage(B_QUIT_REQUESTED);
}
@@ -407,15 +407,15 @@ MediaWindow::MessageReceived (BMessage *message)
case ML_DEFAULTOUTPUT_CHANGE:
{
int32 index;
if(message->FindInt32("index", &index)!=B_OK)
if (message->FindInt32("index", &index)!=B_OK)
break;
Settings2Item *item = static_cast<Settings2Item *>(fAudioView->fMenu3->ItemAt(index));
if(item) {
if (item) {
BMediaRoster *roster = BMediaRoster::Roster();
roster->SetAudioOutput(*item->fInput);
if(fAudioView->fRestartView->IsHidden())
if (fAudioView->fRestartView->IsHidden())
fAudioView->fRestartView->Show();
} else
fprintf(stderr, "Settings2Item not found\n");
@@ -425,27 +425,27 @@ MediaWindow::MessageReceived (BMessage *message)
{
bool isVideo = true;
bool isInput = true;
if(message->FindBool("isVideo", &isVideo)!=B_OK)
if (message->FindBool("isVideo", &isVideo)!=B_OK)
break;
if(message->FindBool("isInput", &isInput)!=B_OK)
if (message->FindBool("isInput", &isInput)!=B_OK)
break;
int32 index;
if(message->FindInt32("index", &index)!=B_OK)
if (message->FindInt32("index", &index)!=B_OK)
break;
SettingsView *settingsView = isVideo ? fVideoView : fAudioView;
BMenu *menu = isInput ? settingsView->fMenu1 : settingsView->fMenu2;
SettingsItem *item = static_cast<SettingsItem *>(menu->ItemAt(index));
if(item) {
if (item) {
PRINT(("isVideo %i isInput %i\n", isVideo, isInput));
BMediaRoster *roster = BMediaRoster::Roster();
if(isVideo) {
if(isInput)
if (isVideo) {
if (isInput)
roster->SetVideoInput(*item->fInfo);
else
roster->SetVideoOutput(*item->fInfo);
} else {
if(isInput)
if (isInput)
roster->SetAudioInput(*item->fInfo);
else {
roster->SetAudioOutput(*item->fInfo);
@@ -454,25 +454,25 @@ MediaWindow::MessageReceived (BMessage *message)
}
MediaListItem *oldListItem = NULL;
for(int32 j=0; j<fListView->CountItems(); j++) {
for (int32 j=0; j<fListView->CountItems(); j++) {
oldListItem = static_cast<MediaListItem *>(fListView->ItemAt(j));
if(oldListItem->fInfo && oldListItem->IsVideo() == isVideo
if (oldListItem->fInfo && oldListItem->IsVideo() == isVideo
&& oldListItem->IsDefault(isInput))
break;
}
if(oldListItem)
if (oldListItem)
oldListItem->SetDefault(false, isInput);
else
fprintf(stderr, "oldListItem not found\n");
MediaListItem *listItem = FindMediaListItem(item->fInfo);
if(listItem) {
if (listItem) {
listItem->SetDefault(true, isInput);
} else
fprintf(stderr, "MediaListItem not found\n");
fListView->Invalidate();
if(settingsView->fRestartView->IsHidden())
if (settingsView->fRestartView->IsHidden())
settingsView->fRestartView->Show();
} else
fprintf(stderr, "SettingsItem not found\n");
@@ -515,14 +515,14 @@ MediaWindow::MessageReceived (BMessage *message)
case ML_ENABLE_REAL_TIME:
{
bool isVideo = true;
if(message->FindBool("isVideo", &isVideo)!=B_OK)
if (message->FindBool("isVideo", &isVideo)!=B_OK)
break;
SettingsView *settingsView = isVideo ? fVideoView : fAudioView;
uint32 flags;
uint32 realtimeFlag = isVideo ? B_MEDIA_REALTIME_VIDEO : B_MEDIA_REALTIME_AUDIO;
BMediaRoster *roster = BMediaRoster::Roster();
roster->GetRealtimeFlags(&flags);
if(settingsView->fRealtimeCheckBox->Value()==B_CONTROL_ON)
if (settingsView->fRealtimeCheckBox->Value()==B_CONTROL_ON)
flags |= realtimeFlag;
else
flags &= ~realtimeFlag;
@@ -535,44 +535,43 @@ MediaWindow::MessageReceived (BMessage *message)
PRINT_OBJECT(*message);
MediaListItem *item = static_cast<MediaListItem *>(fListView->ItemAt(fListView->CurrentSelection()));
if(!item)
if (!item)
break;
BMediaRoster* roster = BMediaRoster::Roster();
if(fCurrentNode) {
if (fCurrentNode) {
// stop watching the MediaRoster
roster->StopWatching(this, *fCurrentNode, B_MEDIA_WILDCARD);
roster->ReleaseNode(*fCurrentNode);
}
fCurrentNode = NULL;
BView *paramView = fContentView->ChildAt(0);
if(paramView!=NULL) {
if (paramView!=NULL) {
fContentView->RemoveChild(paramView);
}
paramView = NULL;
if(fParamWeb)
if (fParamWeb)
delete fParamWeb;
fParamWeb = NULL;
fTitleView->SetText(item->GetLabel());
if(item->OutlineLevel() == 0) {
if(item->IsVideo())
if (item->OutlineLevel() == 0) {
if (item->IsVideo())
fContentView->AddChild(fVideoView);
else
fContentView->AddChild(fAudioView);
} else {
if(!fCurrentNode)
if (!fCurrentNode)
fCurrentNode = new media_node();
media_node_id node_id;
if(item->IsAudioMixer())
if (item->IsAudioMixer())
roster->GetAudioMixer(fCurrentNode);
else if(roster->GetInstancesFor(item->fInfo->addon, item->fInfo->flavor_id, &node_id)!=B_OK)
else if (roster->GetInstancesFor(item->fInfo->addon, item->fInfo->flavor_id, &node_id)!=B_OK)
roster->InstantiateDormantNode(*(item->fInfo), fCurrentNode, B_FLAVOR_IS_GLOBAL);
else
roster->GetNodeFor(node_id, fCurrentNode);
if (roster->GetParameterWebFor(*fCurrentNode, &fParamWeb)==B_OK
&& (paramView = BMediaTheme::PreferredTheme()->ViewFor(fParamWeb)) != NULL) {
fContentView->AddChild(paramView);
@@ -594,7 +593,7 @@ MediaWindow::MessageReceived (BMessage *message)
}
bool barChanged = (item->OutlineLevel() == 0 || fParamWeb == NULL || fParamWeb->CountGroups()<2);
if(barChanged != fBar->fDisplay) {
if (barChanged != fBar->fDisplay) {
fBar->fDisplay = barChanged;
fBar->Invalidate();
}
@@ -604,7 +603,7 @@ MediaWindow::MessageReceived (BMessage *message)
{
PRINT_OBJECT(*message);
const char *mimeSig;
if(fAlert && message->FindString("be:signature", &mimeSig)==B_OK
if (fAlert && message->FindString("be:signature", &mimeSig)==B_OK
&& (strcmp(mimeSig, "application/x-vnd.Be.addon-host")==0
|| strcmp(mimeSig, "application/x-vnd.Be.media-server")==0)) {
fAlert->Lock();
@@ -617,11 +616,11 @@ MediaWindow::MessageReceived (BMessage *message)
{
PRINT_OBJECT(*message);
const char *mimeSig;
if(message->FindString("be:signature", &mimeSig)==B_OK) {
if(strcmp(mimeSig, "application/x-vnd.Be.addon-host")==0
if (message->FindString("be:signature", &mimeSig)==B_OK) {
if (strcmp(mimeSig, "application/x-vnd.Be.addon-host")==0
|| strcmp(mimeSig, "application/x-vnd.Be.media-server")==0) {
BMediaRoster* roster = BMediaRoster::CurrentRoster();
if(roster&&roster->Lock())
if (roster&&roster->Lock())
roster->Quit();
}
}
@@ -638,7 +637,7 @@ status_t
MediaWindow::RestartMediaServices(void *data)
{
MediaWindow *window = (MediaWindow *)data;
window->fAlert = new MediaAlert(BRect(0,0,300,60),
window->fAlert = new MediaAlert(BRect(0, 0, 300, 60),
"restart_alert", "Restarting Media Services\nShutting down Media Server\n");
window->fAlert->Show();
@@ -647,7 +646,7 @@ MediaWindow::RestartMediaServices(void *data)
{
BAutolock locker(window->fAlert);
if(locker.IsLocked())
if (locker.IsLocked())
window->fAlert->TextView()->SetText("Starting Media Server...");
}
launch_media_server();
+6 -6
View File
@@ -32,7 +32,7 @@
class MediaWindow : public BWindow
{
public:
MediaWindow(BRect frame);
MediaWindow(BRect frame);
~MediaWindow();
virtual bool QuitRequested();
virtual void MessageReceived(BMessage *message);
@@ -49,14 +49,14 @@ class MediaWindow : public BWindow
BBox * fBox;
BListView* fListView;
BStringView* fTitleView;
BStringView* fTitleView;
BView* fContentView;
SettingsView* fAudioView;
SettingsView* fVideoView;
SettingsView* fAudioView;
SettingsView* fVideoView;
BarView* fBar;
media_node* fCurrentNode;
BParameterWeb* fParamWeb;
media_node* fCurrentNode;
BParameterWeb* fParamWeb;
BList fAudioInputs;
BList fAudioOutputs;
+1 -1
View File
@@ -13,7 +13,7 @@ resource app_version {
internal = 0,
short_info = "Media",
long_info = "Media ©2003-2006 Haiku"
long_info = "Media ©2003-2006 Haiku"
};
resource app_flags B_SINGLE_LAUNCH;
+1 -1
View File
@@ -15,7 +15,7 @@ resource app_version {
internal = 0,
short_info = "Menu",
long_info = "Menu ©2002-2007 Haiku"
long_info = "Menu ©2002-2007 Haiku"
};
resource(1, "BEOS:FILE_TYPES") message;
+1 -1
View File
@@ -15,7 +15,7 @@ resource app_version {
internal = 0,
short_info = "Screen",
long_info = "Screen ©2001-2006 Haiku"
long_info = "Screen ©2001-2006 Haiku"
};
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
@@ -32,8 +32,8 @@ class ScreenSaverApp : public BApplication {
ScreenSaverApp::ScreenSaverApp()
: BApplication("application/x-vnd.Haiku-ScreenSaver")
{
fScreenSaverWindow = new ScreenSaverWindow();
fScreenSaverWindow->Show();
fScreenSaverWindow = new ScreenSaverWindow();
fScreenSaverWindow->Show();
}
@@ -488,7 +488,7 @@ ModulesView::_OpenSaver()
{
// create new screen saver preview & config
BView* view = fPreviewView->AddPreview();
BView* view = fPreviewView->AddPreview();
fCurrentName = fSettings.ModuleName();
fSaverRunner = new ScreenSaverRunner(Window(), view, true, fSettings);
BScreenSaver* saver = _ScreenSaver();
@@ -890,7 +890,7 @@ ScreenSaverWindow::MessageReceived(BMessage *msg)
default:
BWindow::MessageReceived(msg);
break;
}
}
}
+7 -8
View File
@@ -64,7 +64,7 @@ HEventList::SetType(const char* type)
BString name;
entry_ref ref;
while(mfiles.GetNextRef(&name,&ref) == B_OK) {
while (mfiles.GetNextRef(&name,&ref) == B_OK) {
BPath path(&ref);
AddItem(new HEventItem(name.String(), path.Path()));
}
@@ -77,7 +77,7 @@ void
HEventList::RemoveAll()
{
BListItem *item;
while((item = RemoveItem((int32)0))!=NULL)
while ((item = RemoveItem((int32)0))!=NULL)
delete item;
MakeEmpty();
}
@@ -92,17 +92,16 @@ HEventList::SelectionChanged()
BListView::SelectionChanged();
int32 sel = CurrentSelection();
if(sel >= 0)
{
if (sel >= 0) {
HEventItem *item = cast_as(ItemAt(sel),HEventItem);
if(!item)
if (!item)
return;
entry_ref ref;
BMediaFiles().GetRefFor(fType, item->Name(), &ref);
BPath path(&ref);
if((path.InitCheck()==B_OK) || (ref.name == NULL) || (strcmp(ref.name, "")==0)) {
if ((path.InitCheck()==B_OK) || (ref.name == NULL) || (strcmp(ref.name, "")==0)) {
item->SetPath(path.Path());
InvalidateItem(sel);
} else {
@@ -126,9 +125,9 @@ void
HEventList::SetPath(const char* path)
{
int32 sel = CurrentSelection();
if(sel >= 0) {
if (sel >= 0) {
HEventItem *item = cast_as(ItemAt(sel),HEventItem);
if(!item)
if (!item)
return;
entry_ref ref;
+24 -24
View File
@@ -182,16 +182,16 @@ HWindow::MessageReceived(BMessage *message)
BMenu *menu = menufield->Menu();
int32 sel = fEventList->CurrentSelection();
if(sel >= 0) {
if (sel >= 0) {
HEventItem *item = cast_as(fEventList->ItemAt(sel), HEventItem);
BPath path(item->Path());
if(path.InitCheck() != B_OK) {
if (path.InitCheck() != B_OK) {
BMenuItem *item = menu->FindItem("<none>");
if(item)
if (item)
item->SetMarked(true);
} else{
BMenuItem *item = menu->FindItem(path.Leaf());
if(item)
if (item)
item->SetMarked(true);
}
}
@@ -203,7 +203,7 @@ HWindow::MessageReceived(BMessage *message)
{
entry_ref ref;
int32 sel = fEventList->CurrentSelection();
if(message->FindRef("refs", &ref) == B_OK && sel >= 0) {
if (message->FindRef("refs", &ref) == B_OK && sel >= 0) {
BMenuField *menufield = cast_as(FindView("filemenu"), BMenuField);
BMenu *menu = menufield->Menu();
// check audio file
@@ -225,12 +225,12 @@ HWindow::MessageReceived(BMessage *message)
BPath path(&ref);
msg->AddRef("refs", &ref);
BMenuItem *menuitem = menu->FindItem(path.Leaf());
if(!menuitem)
if (!menuitem)
menu->AddItem(menuitem = new BMenuItem(path.Leaf(), msg), 0);
// refresh item
fEventList->SetPath(BPath(&ref).Path());
// check file menu
if(menuitem)
if (menuitem)
menuitem->SetMarked(true);
}
break;
@@ -238,11 +238,11 @@ HWindow::MessageReceived(BMessage *message)
case M_PLAY_MESSAGE:
{
int32 sel = fEventList->CurrentSelection();
if(sel >= 0)
if (sel >= 0)
{
HEventItem *item = cast_as(fEventList->ItemAt(sel), HEventItem);
const char* path = item->Path();
if(path)
if (path)
{
entry_ref ref;
::get_ref_for_path(path, &ref);
@@ -255,9 +255,9 @@ HWindow::MessageReceived(BMessage *message)
}
case M_STOP_MESSAGE:
{
if(!fPlayer)
if (!fPlayer)
break;
if(fPlayer->IsPlaying())
if (fPlayer->IsPlaying())
{
fPlayer->StopPlaying();
delete fPlayer;
@@ -271,15 +271,15 @@ HWindow::MessageReceived(BMessage *message)
BMenuField *menufield = cast_as(FindView("filemenu"), BMenuField);
BMenu *menu = menufield->Menu();
if(message->FindString("path", &path) == B_OK) {
if (message->FindString("path", &path) == B_OK) {
BPath path(path);
if(path.InitCheck() != B_OK) {
if (path.InitCheck() != B_OK) {
BMenuItem *item = menu->FindItem("<none>");
if(item)
if (item)
item->SetMarked(true);
} else {
BMenuItem *item = menu->FindItem(path.Leaf());
if(item)
if (item)
item->SetMarked(true);
}
}
@@ -288,7 +288,7 @@ HWindow::MessageReceived(BMessage *message)
case M_ITEM_MESSAGE:
{
entry_ref ref;
if(message->FindRef("refs", &ref) == B_OK) {
if (message->FindRef("refs", &ref) == B_OK) {
fEventList->SetPath(BPath(&ref).Path());
}
break;
@@ -314,13 +314,13 @@ HWindow::SetupMenuField()
int32 count = fEventList->CountItems();
for(int32 i = 0; i < count; i++) {
HEventItem *item = cast_as(fEventList->ItemAt(i), HEventItem);
if(!item)
if (!item)
continue;
BPath path(item->Path());
if(path.InitCheck() != B_OK)
if (path.InitCheck() != B_OK)
continue;
if(menu->FindItem(path.Leaf()))
if (menu->FindItem(path.Leaf()))
continue;
BMessage *msg = new BMessage(M_ITEM_MESSAGE);
@@ -408,10 +408,10 @@ HWindow::Pulse()
BButton *button = cast_as(FindView("play"), BButton);
BButton *stop = cast_as(FindView("stop"), BButton);
if(!menufield)
if (!menufield)
return;
if(sel >=0) {
if (sel >=0) {
menufield->SetEnabled(true);
HEventItem *item = cast_as(fEventList->ItemAt(sel), HEventItem);
@@ -424,8 +424,8 @@ HWindow::Pulse()
menufield->SetEnabled(false);
button->SetEnabled(false);
}
if(fPlayer) {
if(fPlayer->IsPlaying())
if (fPlayer) {
if (fPlayer->IsPlaying())
stop->SetEnabled(true);
else
stop->SetEnabled(false);
@@ -440,7 +440,7 @@ HWindow::Pulse()
void
HWindow::DispatchMessage(BMessage *message, BHandler *handler)
{
if(message->what == B_PULSE)
if (message->what == B_PULSE)
Pulse();
BWindow::DispatchMessage(message, handler);
}
+1 -1
View File
@@ -3,7 +3,7 @@ SubDir HAIKU_TOP src preferences sounds ;
SetSubDirSupportedPlatformsBeOSCompatible ;
if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) {
SubDirC++Flags -fmultiple-symbol-spaces ;
SubDirC++Flags -fmultiple-symbol-spaces ;
}
Preference Sounds :
@@ -13,7 +13,7 @@ resource app_version {
internal = 0,
short_info = "VirtualMemory",
long_info = "VirtualMemory ©2005-2007 Haiku"
long_info = "VirtualMemory ©2005-2007 Haiku"
};
resource app_flags B_SINGLE_LAUNCH;