Style fixes from #4146 comment:11.

This commit is contained in:
Matt Madia
2013-02-17 21:32:04 -05:00
parent e92b40188a
commit 936ad11520
2 changed files with 12 additions and 18 deletions
+10 -16
View File
@@ -662,8 +662,8 @@ TWindow::UpdateInfoBarOnResize()
float infoWidth, infoHeight; float infoWidth, infoHeight;
fInfo->GetPreferredSize(&infoWidth, &infoHeight); fInfo->GetPreferredSize(&infoWidth, &infoHeight);
if (infoWidth > Bounds().Width() || if (infoWidth > Bounds().Width()
infoHeight > Bounds().Height()) { || infoHeight > Bounds().Height()) {
ShowInfo(false); ShowInfo(false);
} else { } else {
ShowInfo(true); ShowInfo(true);
@@ -844,9 +844,8 @@ TInfoView::Draw(BRect updateRect)
FillRect(invalRect); FillRect(invalRect);
SetHighColor(ui_color(B_PANEL_TEXT_COLOR)); SetHighColor(ui_color(B_PANEL_TEXT_COLOR));
strcpy(fInfoStr, dimensionsInfo); strcpy(fInfoStr, dimensionsInfo);
if (fInfoTextVisible) { if (fInfoTextVisible)
DrawString(fInfoStr); DrawString(fInfoStr);
}
rgb_color color = { 0, 0, 0, 255 }; rgb_color color = { 0, 0, 0, 255 };
if (fMagView) if (fMagView)
@@ -861,9 +860,8 @@ TInfoView::Draw(BRect updateRect)
FillRect(invalRect); FillRect(invalRect);
SetHighColor(ui_color(B_PANEL_TEXT_COLOR)); SetHighColor(ui_color(B_PANEL_TEXT_COLOR));
strcpy(fRGBStr,str); strcpy(fRGBStr,str);
if (fInfoTextVisible) { if (fInfoTextVisible)
DrawString(fRGBStr); DrawString(fRGBStr);
}
bool ch1Showing, ch2Showing; bool ch1Showing, ch2Showing;
dynamic_cast<TWindow*>(Window())->CrossHairsShowing(&ch1Showing, &ch2Showing); dynamic_cast<TWindow*>(Window())->CrossHairsShowing(&ch1Showing, &ch2Showing);
@@ -882,9 +880,8 @@ TInfoView::Draw(BRect updateRect)
FillRect(invalRect); FillRect(invalRect);
SetHighColor(ui_color(B_PANEL_TEXT_COLOR)); SetHighColor(ui_color(B_PANEL_TEXT_COLOR));
strcpy(fCH2Str,str); strcpy(fCH2Str,str);
if (fInfoTextVisible) { if (fInfoTextVisible)
DrawString(fCH2Str); DrawString(fCH2Str);
}
} }
if (ch1Showing && ch2Showing) { if (ch1Showing && ch2Showing) {
@@ -896,9 +893,8 @@ TInfoView::Draw(BRect updateRect)
FillRect(invalRect); FillRect(invalRect);
SetHighColor(ui_color(B_PANEL_TEXT_COLOR)); SetHighColor(ui_color(B_PANEL_TEXT_COLOR));
strcpy(fCH1Str,str); strcpy(fCH1Str,str);
if (fInfoTextVisible) { if (fInfoTextVisible)
DrawString(fCH1Str); DrawString(fCH1Str);
}
} else if (ch1Showing) { } else if (ch1Showing) {
MovePenTo(10, h-10); MovePenTo(10, h-10);
sprintf(str, "x: %li y: %li", (int32)pt1.x, (int32)pt1.y); sprintf(str, "x: %li y: %li", (int32)pt1.x, (int32)pt1.y);
@@ -907,9 +903,8 @@ TInfoView::Draw(BRect updateRect)
FillRect(invalRect); FillRect(invalRect);
SetHighColor(ui_color(B_PANEL_TEXT_COLOR)); SetHighColor(ui_color(B_PANEL_TEXT_COLOR));
strcpy(fCH1Str,str); strcpy(fCH1Str,str);
if (fInfoTextVisible) { if (fInfoTextVisible)
DrawString(fCH1Str); DrawString(fCH1Str);
}
} }
} }
@@ -1001,7 +996,7 @@ TMenu::AttachedToWindow()
void void
TInfoView::GetPreferredSize(float* _width, float* _height) TInfoView::GetPreferredSize(float* _width, float* _height)
{ {
if(_width) { if (_width) {
float str1Width = StringWidth(fCH1Str) float str1Width = StringWidth(fCH1Str)
+ StringWidth(fCH2Str) + StringWidth(fCH2Str)
+ StringWidth(fRGBStr) + StringWidth(fRGBStr)
@@ -1010,14 +1005,13 @@ TInfoView::GetPreferredSize(float* _width, float* _height)
*_width = str1Width > str2Width ? str1Width : str2Width; *_width = str1Width > str2Width ? str1Width : str2Width;
} }
if(_height) { if (_height)
*_height = fFontHeight * 2 + 10; *_height = fFontHeight * 2 + 10;
}
} }
bool bool
TInfoView::isInfoTextVisible() TInfoView::IsInfoTextVisible()
{ {
return fInfoTextVisible; return fInfoTextVisible;
} }
+2 -2
View File
@@ -165,12 +165,12 @@ class TInfoView : public BBox {
virtual void AttachedToWindow(); virtual void AttachedToWindow();
virtual void Draw(BRect updateRect); virtual void Draw(BRect updateRect);
virtual void FrameResized(float width, float height); virtual void FrameResized(float width, float height);
virtual void GetPreferredSize(float* _width, float* height); virtual void GetPreferredSize(float* _width, float* _height);
void AddMenu(); void AddMenu();
void SetMagView(TMagnify* magView); void SetMagView(TMagnify* magView);
void SetInfoTextVisible(bool visible); void SetInfoTextVisible(bool visible);
bool isInfoTextVisible(); bool IsInfoTextVisible();
private: private:
float fFontHeight; float fFontHeight;