DiskUsage: Style fixes

This commit is contained in:
John Scipione 2015-03-06 13:33:25 -05:00
parent 91bf7d51f0
commit 58f4a50b33

View File

@ -155,21 +155,20 @@ ControlsView::VolumeTabView::TabFrame(int32 index) const
float x = 0.0f;
float width = 0.0f;
float minStringWidth = StringWidth("Haiku");
int countTabs = CountTabs();
int countTabs = CountTabs();
// calculate the total width if no truncation is made at all
float averageWidth = Frame().Width() / countTabs;
// margins are the deltas with the average widths
// margins are the deltas with the average widths
float* margins = new float[countTabs];
for (int32 i = 0; i < countTabs; i++) {
float tabLabelWidth = StringWidth(TabAt(i)->Label());
if (tabLabelWidth < minStringWidth)
tabLabelWidth = minStringWidth;
float tabWidth = tabLabelWidth + 3.0f * kSmallHMargin
+ ((VolumeTab*)TabAt(i))->IconWidth();
+ ((VolumeTab*)TabAt(i))->IconWidth();
margins[i] = tabWidth - averageWidth;
width += tabWidth;
}
@ -184,7 +183,7 @@ ControlsView::VolumeTabView::TabFrame(int32 index) const
float averageToShave;
float oldToShave;
/*
/*
we might have to do multiple passes because of the minimum
tab width we are imposing.
we could also fail to totally fit all tabs.
@ -198,7 +197,7 @@ ControlsView::VolumeTabView::TabFrame(int32 index) const
float iconWidth = ((VolumeTab*)TabAt(i))->IconWidth();
float newMargin = max_c(margins[i] - averageToShave,
minimumMargin + iconWidth);
toShave -= margins[i] - newMargin;
toShave -= margins[i] - newMargin;
margins[i] = newMargin;
}
} while (toShave > 0 && oldToShave != toShave);
@ -224,7 +223,7 @@ ControlsView::VolumeTabView::AttachedToWindow()
while (fVolumeRoster->GetNextVolume(&tempVolume) == B_OK) {
if (tempVolume.IsPersistent()) {
BVolume* volume = new BVolume(tempVolume);
VolumeTab *item = new VolumeTab(volume);
VolumeTab* item = new VolumeTab(volume);
char name[B_PATH_NAME_LENGTH];
volume->GetName(name);
AddTab(new VolumeView(name, volume), item);