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