Updated to use B_TRANSLATE* macros. relates to #5408.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36669 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Matt Madia
2010-05-06 21:04:34 +00:00
parent 8c9c8c0e1f
commit b25cb34a47
3 changed files with 93 additions and 91 deletions
+16 -16
View File
@@ -1,22 +1,22 @@
/* /*
* Copyright (c) 2004 Matthijs Hollemans * Copyright (c) 2004 Matthijs Hollemans
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation * to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the * and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions: * Software is furnished to do so, subject to the following conditions:
* *
* The above copyright notice and this permission notice shall be included in * The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software. * all copies or substantial portions of the Software.
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE. * DEALINGS IN THE SOFTWARE.
*/ */
@@ -51,7 +51,7 @@ MidiPlayerApp::AboutRequested()
{ {
(new BAlert( (new BAlert(
NULL, NULL,
TR_CMT("Haiku MIDI Player 1.0.0 beta\n\n" B_TRANSLATE_COMMENT("Haiku MIDI Player 1.0.0 beta\n\n"
"This tiny program\n" "This tiny program\n"
"Knows how to play thousands of\n" "Knows how to play thousands of\n"
"Cheesy sounding songs", "This is a haiku. First line has five syllables, second has seven and last has five again. Create your own."), "Cheesy sounding songs", "This is a haiku. First line has five syllables, second has seven and last has five again. Create your own."),
+57 -55
View File
@@ -1,22 +1,22 @@
/* /*
* Copyright (c) 2004 Matthijs Hollemans * Copyright (c) 2004 Matthijs Hollemans
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation * to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the * and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions: * Software is furnished to do so, subject to the following conditions:
* *
* The above copyright notice and this permission notice shall be included in * The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software. * all copies or substantial portions of the Software.
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE. * DEALINGS IN THE SOFTWARE.
*/ */
@@ -44,7 +44,7 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
MidiPlayerWindow::MidiPlayerWindow() MidiPlayerWindow::MidiPlayerWindow()
: BWindow(BRect(0, 0, 1, 1), TR("MidiPlayer"), B_TITLED_WINDOW, : BWindow(BRect(0, 0, 1, 1), B_TRANSLATE("MidiPlayer"), B_TITLED_WINDOW,
B_ASYNCHRONOUS_CONTROLS | B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS) B_ASYNCHRONOUS_CONTROLS | B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS)
{ {
playing = false; playing = false;
@@ -71,7 +71,7 @@ MidiPlayerWindow::MidiPlayerWindow()
MidiPlayerWindow::~MidiPlayerWindow() MidiPlayerWindow::~MidiPlayerWindow()
{ {
StopSynth(); StopSynth();
//bridge->Unregister(); //bridge->Unregister();
bridge->Release(); bridge->Release();
} }
@@ -101,31 +101,31 @@ void MidiPlayerWindow::MessageReceived(BMessage* msg)
case MSG_INPUT_CHANGED: case MSG_INPUT_CHANGED:
OnInputChanged(msg); OnInputChanged(msg);
break; break;
case MSG_REVERB_NONE: case MSG_REVERB_NONE:
OnReverb(B_REVERB_NONE); OnReverb(B_REVERB_NONE);
break; break;
case MSG_REVERB_CLOSET: case MSG_REVERB_CLOSET:
OnReverb(B_REVERB_CLOSET); OnReverb(B_REVERB_CLOSET);
break; break;
case MSG_REVERB_GARAGE: case MSG_REVERB_GARAGE:
OnReverb(B_REVERB_GARAGE); OnReverb(B_REVERB_GARAGE);
break; break;
case MSG_REVERB_IGOR: case MSG_REVERB_IGOR:
OnReverb(B_REVERB_BALLROOM); OnReverb(B_REVERB_BALLROOM);
break; break;
case MSG_REVERB_CAVERN: case MSG_REVERB_CAVERN:
OnReverb(B_REVERB_CAVERN); OnReverb(B_REVERB_CAVERN);
break; break;
case MSG_REVERB_DUNGEON: case MSG_REVERB_DUNGEON:
OnReverb(B_REVERB_DUNGEON); OnReverb(B_REVERB_DUNGEON);
break; break;
case MSG_VOLUME: case MSG_VOLUME:
OnVolume(); OnVolume();
break; break;
@@ -163,7 +163,7 @@ void MidiPlayerWindow::MenusBeginning()
// marked. However, we won't disconnect it until you choose another one. // marked. However, we won't disconnect it until you choose another one.
inputOff->SetMarked(inputId == -1); inputOff->SetMarked(inputId == -1);
int32 id = 0; int32 id = 0;
BMidiEndpoint* endp; BMidiEndpoint* endp;
while ((endp = BMidiRoster::NextEndpoint(&id)) != NULL) while ((endp = BMidiRoster::NextEndpoint(&id)) != NULL)
@@ -178,7 +178,7 @@ void MidiPlayerWindow::MenusBeginning()
inputPopUp->AddItem(item); inputPopUp->AddItem(item);
item->SetMarked(inputId == id); item->SetMarked(inputId == id);
} }
endp->Release(); endp->Release();
} }
} }
@@ -193,11 +193,11 @@ void MidiPlayerWindow::CreateInputMenu()
msg->what = MSG_INPUT_CHANGED; msg->what = MSG_INPUT_CHANGED;
msg->AddInt32("id", -1); msg->AddInt32("id", -1);
inputOff = new BMenuItem(TR("Off"), msg); inputOff = new BMenuItem(B_TRANSLATE("Off"), msg);
inputPopUp->AddItem(inputOff); inputPopUp->AddItem(inputOff);
inputMenu = new BMenuField(TR("Live input:"), inputPopUp, NULL); inputMenu = new BMenuField(B_TRANSLATE("Live input:"), inputPopUp, NULL);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
@@ -207,22 +207,22 @@ void MidiPlayerWindow::CreateReverbMenu()
BPopUpMenu* reverbPopUp = new BPopUpMenu("reverbPopUp"); BPopUpMenu* reverbPopUp = new BPopUpMenu("reverbPopUp");
reverbNone = new BMenuItem( reverbNone = new BMenuItem(
TR("None"), new BMessage(MSG_REVERB_NONE)); B_TRANSLATE("None"), new BMessage(MSG_REVERB_NONE));
reverbCloset = new BMenuItem( reverbCloset = new BMenuItem(
TR("Closet"), new BMessage(MSG_REVERB_CLOSET)); B_TRANSLATE("Closet"), new BMessage(MSG_REVERB_CLOSET));
reverbGarage = new BMenuItem( reverbGarage = new BMenuItem(
TR("Garage"), new BMessage(MSG_REVERB_GARAGE)); B_TRANSLATE("Garage"), new BMessage(MSG_REVERB_GARAGE));
reverbIgor = new BMenuItem( reverbIgor = new BMenuItem(
TR("Igor's lab"), new BMessage(MSG_REVERB_IGOR)); B_TRANSLATE("Igor's lab"), new BMessage(MSG_REVERB_IGOR));
reverbCavern = new BMenuItem( reverbCavern = new BMenuItem(
TR("Cavern"), new BMessage(MSG_REVERB_CAVERN)); B_TRANSLATE("Cavern"), new BMessage(MSG_REVERB_CAVERN));
reverbDungeon = new BMenuItem( reverbDungeon = new BMenuItem(
TR("Dungeon"), new BMessage(MSG_REVERB_DUNGEON)); B_TRANSLATE("Dungeon"), new BMessage(MSG_REVERB_DUNGEON));
reverbPopUp->AddItem(reverbNone); reverbPopUp->AddItem(reverbNone);
reverbPopUp->AddItem(reverbCloset); reverbPopUp->AddItem(reverbCloset);
@@ -231,7 +231,7 @@ void MidiPlayerWindow::CreateReverbMenu()
reverbPopUp->AddItem(reverbCavern); reverbPopUp->AddItem(reverbCavern);
reverbPopUp->AddItem(reverbDungeon); reverbPopUp->AddItem(reverbDungeon);
reverbMenu = new BMenuField(TR("Reverb:"), reverbPopUp, NULL); reverbMenu = new BMenuField(B_TRANSLATE("Reverb:"), reverbPopUp, NULL);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
@@ -241,28 +241,29 @@ void MidiPlayerWindow::CreateViews()
// Set up needed views // Set up needed views
scopeView = new ScopeView; scopeView = new ScopeView;
showScope = new BCheckBox("showScope", TR("Scope"), showScope = new BCheckBox("showScope", B_TRANSLATE("Scope"),
new BMessage(MSG_SHOW_SCOPE)); new BMessage(MSG_SHOW_SCOPE));
showScope->SetValue(B_CONTROL_ON); showScope->SetValue(B_CONTROL_ON);
CreateInputMenu(); CreateInputMenu();
CreateReverbMenu(); CreateReverbMenu();
volumeSlider = new BSlider("volumeSlider", NULL, NULL, 0, 100, volumeSlider = new BSlider("volumeSlider", NULL, NULL, 0, 100,
B_HORIZONTAL); B_HORIZONTAL);
rgb_color col = { 152, 152, 255 }; rgb_color col = { 152, 152, 255 };
volumeSlider->UseFillColor(true, &col); volumeSlider->UseFillColor(true, &col);
volumeSlider->SetModificationMessage(new BMessage(MSG_VOLUME)); volumeSlider->SetModificationMessage(new BMessage(MSG_VOLUME));
playButton = new BButton("playButton", TR("Play"), new BMessage(MSG_PLAY_STOP)); playButton = new BButton("playButton", B_TRANSLATE("Play"),
new BMessage(MSG_PLAY_STOP));
playButton->SetEnabled(false); playButton->SetEnabled(false);
BBox* divider = new BBox(B_EMPTY_STRING, B_WILL_DRAW | B_FRAME_EVENTS, BBox* divider = new BBox(B_EMPTY_STRING, B_WILL_DRAW | B_FRAME_EVENTS,
B_FANCY_BORDER); B_FANCY_BORDER);
divider->SetExplicitMaxSize( divider->SetExplicitMaxSize(
BSize(B_SIZE_UNLIMITED, 1)); BSize(B_SIZE_UNLIMITED, 1));
BStringView* volumeLabel = new BStringView(NULL, TR("Volume:")); BStringView* volumeLabel = new BStringView(NULL, B_TRANSLATE("Volume:"));
volumeLabel->SetAlignment(B_ALIGN_LEFT); volumeLabel->SetAlignment(B_ALIGN_LEFT);
volumeLabel->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET)); volumeLabel->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET));
@@ -322,7 +323,7 @@ void MidiPlayerWindow::InitControls()
{ {
CenterOnScreen(); CenterOnScreen();
} }
Unlock(); Unlock();
} }
@@ -372,21 +373,21 @@ void MidiPlayerWindow::LoadFile(entry_ref* ref)
scopeView->SetPlaying(false); scopeView->SetPlaying(false);
scopeView->Invalidate(); scopeView->Invalidate();
UpdateIfNeeded(); UpdateIfNeeded();
StopSynth(); StopSynth();
} }
synth.UnloadFile(); synth.UnloadFile();
if (synth.LoadFile(ref) == B_OK) if (synth.LoadFile(ref) == B_OK)
{ {
// Ideally, we would call SetVolume() in InitControls(), // Ideally, we would call SetVolume() in InitControls(),
// but for some reason that doesn't work: BMidiSynthFile // but for some reason that doesn't work: BMidiSynthFile
// will use the default volume instead. So we do it here. // will use the default volume instead. So we do it here.
synth.SetVolume(volume / 100.0f); synth.SetVolume(volume / 100.0f);
playButton->SetEnabled(true); playButton->SetEnabled(true);
playButton->SetLabel(TR("Stop")); playButton->SetLabel(B_TRANSLATE("Stop"));
scopeView->SetHaveFile(true); scopeView->SetHaveFile(true);
scopeView->SetPlaying(true); scopeView->SetPlaying(true);
scopeView->Invalidate(); scopeView->Invalidate();
@@ -396,13 +397,14 @@ void MidiPlayerWindow::LoadFile(entry_ref* ref)
else else
{ {
playButton->SetEnabled(false); playButton->SetEnabled(false);
playButton->SetLabel(TR("Play")); playButton->SetLabel(B_TRANSLATE("Play"));
scopeView->SetHaveFile(false); scopeView->SetHaveFile(false);
scopeView->SetPlaying(false); scopeView->SetPlaying(false);
scopeView->Invalidate(); scopeView->Invalidate();
(new BAlert( (new BAlert(NULL,
NULL, TR("Could not load song"), TR("OK"), NULL, NULL, B_TRANSLATE("Could not load song"),
B_TRANSLATE("OK"), NULL, NULL,
B_WIDTH_AS_USUAL, B_STOP_ALERT))->Go(); B_WIDTH_AS_USUAL, B_STOP_ALERT))->Go();
} }
} }
@@ -446,8 +448,8 @@ void MidiPlayerWindow::StopHook()
scopeView->SetPlaying(false); scopeView->SetPlaying(false);
scopeView->Invalidate(); scopeView->Invalidate();
playButton->SetEnabled(true); playButton->SetEnabled(true);
playButton->SetLabel(TR("Play")); playButton->SetLabel(B_TRANSLATE("Play"));
Unlock(); Unlock();
} }
@@ -461,12 +463,12 @@ void MidiPlayerWindow::OnPlayStop()
scopeView->SetPlaying(false); scopeView->SetPlaying(false);
scopeView->Invalidate(); scopeView->Invalidate();
UpdateIfNeeded(); UpdateIfNeeded();
StopSynth(); StopSynth();
} }
else else
{ {
playButton->SetLabel(TR("Stop")); playButton->SetLabel(B_TRANSLATE("Stop"));
scopeView->SetPlaying(true); scopeView->SetPlaying(true);
scopeView->Invalidate(); scopeView->Invalidate();
@@ -492,7 +494,7 @@ void MidiPlayerWindow::OnInputChanged(BMessage* msg)
if (msg->FindInt32("id", &newId) == B_OK) if (msg->FindInt32("id", &newId) == B_OK)
{ {
BMidiProducer* endp; BMidiProducer* endp;
endp = BMidiRoster::FindProducer(inputId); endp = BMidiRoster::FindProducer(inputId);
if (endp != NULL) if (endp != NULL)
{ {
@@ -510,10 +512,10 @@ void MidiPlayerWindow::OnInputChanged(BMessage* msg)
scopeView->SetLoading(true); scopeView->SetLoading(true);
scopeView->Invalidate(); scopeView->Invalidate();
UpdateIfNeeded(); UpdateIfNeeded();
bridge->Init(B_BIG_SYNTH); bridge->Init(B_BIG_SYNTH);
instrLoaded = true; instrLoaded = true;
scopeView->SetLoading(false); scopeView->SetLoading(false);
scopeView->Invalidate(); scopeView->Invalidate();
} }
+20 -20
View File
@@ -1,22 +1,22 @@
/* /*
* Copyright (c) 2004 Matthijs Hollemans * Copyright (c) 2004 Matthijs Hollemans
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation * to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the * and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions: * Software is furnished to do so, subject to the following conditions:
* *
* The above copyright notice and this permission notice shall be included in * The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software. * all copies or substantial portions of the Software.
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE. * DEALINGS IN THE SOFTWARE.
*/ */
@@ -156,7 +156,7 @@ int32 ScopeView::_Thread(void* data)
int32 ScopeView::Thread() int32 ScopeView::Thread()
{ {
// Because Pulse() was too slow, I created a thread that tells the // Because Pulse() was too slow, I created a thread that tells the
// ScopeView to repaint itself. Note that we need to call LockLooper // ScopeView to repaint itself. Note that we need to call LockLooper
// with a timeout, otherwise we'll deadlock in DetachedFromWindow(). // with a timeout, otherwise we'll deadlock in DetachedFromWindow().
@@ -186,7 +186,7 @@ void ScopeView::DrawLoading()
void ScopeView::DrawNoFile() void ScopeView::DrawNoFile()
{ {
DrawText(TR("Drop MIDI file here")); DrawText(B_TRANSLATE("Drop MIDI file here"));
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
@@ -196,7 +196,7 @@ void ScopeView::DrawDisabled()
SetHighColor(64, 64, 64); SetHighColor(64, 64, 64);
StrokeLine( StrokeLine(
BPoint(0, Bounds().Height() / 2), BPoint(0, Bounds().Height() / 2),
BPoint(Bounds().Width(), Bounds().Height() / 2)); BPoint(Bounds().Width(), Bounds().Height() / 2));
} }
@@ -207,7 +207,7 @@ void ScopeView::DrawStopped()
SetHighColor(0, 130, 0); SetHighColor(0, 130, 0);
StrokeLine( StrokeLine(
BPoint(0, Bounds().Height() / 2), BPoint(0, Bounds().Height() / 2),
BPoint(Bounds().Width(), Bounds().Height() / 2)); BPoint(Bounds().Width(), Bounds().Height() / 2));
} }
@@ -219,7 +219,7 @@ void ScopeView::DrawPlaying()
int32 height = (int32) Bounds().Height(); int32 height = (int32) Bounds().Height();
// Scope drawing magic based on code by Michael Pfeiffer. // Scope drawing magic based on code by Michael Pfeiffer.
int32 size = be_synth->GetAudio(leftSamples, rightSamples, sampleCount); int32 size = be_synth->GetAudio(leftSamples, rightSamples, sampleCount);
if (size > 0) if (size > 0)
{ {