DataTranslation: Style fixes

This commit is contained in:
John Scipione
2016-03-30 14:41:51 -07:00
parent abfb31b6d0
commit 571cffc10e
@@ -52,9 +52,10 @@ const uint32 kMsgSelectedTranslator = 'trsl';
DataTranslationsWindow::DataTranslationsWindow() DataTranslationsWindow::DataTranslationsWindow()
: :
BWindow(BRect(0, 0, 550, 350), B_TRANSLATE_SYSTEM_NAME("DataTranslations"), BWindow(BRect(0.0f, 0.0f, 550.0f, 350.0f),
B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE B_TRANSLATE_SYSTEM_NAME("DataTranslations"),
| B_NOT_RESIZABLE | B_AUTO_UPDATE_SIZE_LIMITS), B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS | B_NOT_RESIZABLE
| B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS),
fRelease(NULL) fRelease(NULL)
{ {
MoveTo(DataTranslationsSettings::Instance()->WindowCorner()); MoveTo(DataTranslationsSettings::Instance()->WindowCorner());
@@ -149,7 +150,7 @@ DataTranslationsWindow::_ShowConfigView(int32 id)
BTranslatorRoster* roster = BTranslatorRoster::Default(); BTranslatorRoster* roster = BTranslatorRoster::Default();
if (fConfigView) { if (fConfigView != NULL) {
fRightBox->RemoveChild(fConfigView); fRightBox->RemoveChild(fConfigView);
delete fConfigView; delete fConfigView;
fConfigView = NULL; fConfigView = NULL;
@@ -159,13 +160,13 @@ DataTranslationsWindow::_ShowConfigView(int32 id)
} }
} }
BMessage emptyMsg; BMessage emptyMessage;
BRect rect(0, 0, 200, 233); BRect rect(0.0f, 0.0f, 200.0f, 233.0f);
status_t ret = roster->MakeConfigurationView(id, &emptyMsg, status_t result = roster->MakeConfigurationView(id, &emptyMessage,
&fConfigView, &rect); &fConfigView, &rect);
if (ret != B_OK) if (result != B_OK)
return ret; return result;
fConfigView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR); fConfigView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
// force config views to all have the same color // force config views to all have the same color
@@ -182,7 +183,7 @@ DataTranslationsWindow::_ShowConfigView(int32 id)
void void
DataTranslationsWindow::_ShowInfoView() DataTranslationsWindow::_ShowInfoView()
{ {
if (fConfigView) { if (fConfigView != NULL) {
fRightBox->RemoveChild(fConfigView); fRightBox->RemoveChild(fConfigView);
delete fConfigView; delete fConfigView;
fConfigView = NULL; fConfigView = NULL;
@@ -190,7 +191,6 @@ DataTranslationsWindow::_ShowInfoView()
fRelease->Release(); fRelease->Release();
fRelease = NULL; fRelease = NULL;
} }
} }
fInfoText = new BTextView("info text"); fInfoText = new BTextView("info text");
@@ -232,7 +232,7 @@ DataTranslationsWindow::_SetupViews()
// Box around the config and info panels // Box around the config and info panels
fRightBox = new BBox("Right_Side"); fRightBox = new BBox("Right_Side");
fRightBox->SetExplicitAlignment(BAlignment(B_ALIGN_USE_FULL_WIDTH, fRightBox->SetExplicitAlignment(BAlignment(B_ALIGN_USE_FULL_WIDTH,
B_ALIGN_USE_FULL_HEIGHT)); B_ALIGN_USE_FULL_HEIGHT));
// Add the translator icon view // Add the translator icon view
fIconView = new IconView(); fIconView = new IconView();
@@ -361,19 +361,21 @@ DataTranslationsWindow::MessageReceived(BMessage* message)
case B_COLORS_UPDATED: case B_COLORS_UPDATED:
{ {
if (fInfoText == NULL if (fInfoText == NULL || fInfoText->Parent() == NULL)
|| fInfoText->Parent() == NULL)
break; break;
rgb_color color; rgb_color color;
if (message->FindColor(ui_color_name(B_PANEL_TEXT_COLOR), &color) == B_OK) if (message->FindColor(ui_color_name(B_PANEL_TEXT_COLOR), &color)
== B_OK) {
fInfoText->SetFontAndColor(be_plain_font, B_FONT_ALL, &color); fInfoText->SetFontAndColor(be_plain_font, B_FONT_ALL, &color);
}
break; break;
} }
case B_TRANSLATOR_ADDED: case B_TRANSLATOR_ADDED:
{ {
int32 index = 0, id; int32 index = 0;
int32 id;
while (message->FindInt32("translator_id", index++, &id) == B_OK) { while (message->FindInt32("translator_id", index++, &id) == B_OK) {
const char* name; const char* name;
const char* info; const char* info;
@@ -389,7 +391,8 @@ DataTranslationsWindow::MessageReceived(BMessage* message)
case B_TRANSLATOR_REMOVED: case B_TRANSLATOR_REMOVED:
{ {
int32 index = 0, id; int32 index = 0;
int32 id;
while (message->FindInt32("translator_id", index++, &id) == B_OK) { while (message->FindInt32("translator_id", index++, &id) == B_OK) {
for (int32 i = 0; i < fTranslatorListView->CountItems(); i++) { for (int32 i = 0; i < fTranslatorListView->CountItems(); i++) {
TranslatorItem* item = fTranslatorListView->TranslatorAt(i); TranslatorItem* item = fTranslatorListView->TranslatorAt(i);