Ticket #8440: diskusageinstructions1.diff

File diskusageinstructions1.diff, 1.9 KB (added by devine, 12 years ago)

Adds instructions to the top right hand corner of the main view.

  • src/apps/diskusage/PieView.cpp

    diff --git a/src/apps/diskusage/PieView.cpp b/src/apps/diskusage/PieView.cpp
    index e3ec4e6..743a4d6 100644
    a b PieView::Draw(BRect updateRect)  
    312312                fWindow->SetRescanEnabled(false);
    313313        } else {
    314314            _DrawPieChart(updateRect);
     315            _DrawHelp();
    315316            if (fWindow != NULL)
    316317                fWindow->SetRescanEnabled(true);
    317318        }
    PieView::_DrawPieChart(BRect updateRect)  
    395396
    396397    SetHighColor(kPieBGColor);
    397398    FillRect(updateRect);
     399   
    398400
    399401    // constraint proportions
    400402    if (pieRect.Width() > pieRect.Height()) {
    PieView::_DrawPieChart(BRect updateRect)  
    432434    }
    433435}
    434436
     437void
     438PieView::_DrawHelp()
     439{
     440    BFont font;
     441    GetFont(&font);
     442    font.SetFace(B_REGULAR_FACE);
     443    font.SetSize(ceilf(font.Size() * 0.75));
     444    SetFont(&font);
     445    struct font_height fh;
     446    font.GetHeight(&fh);
     447
     448    SetHighColor(0,0,0);
     449    BString str1 = B_TRANSLATE("Click center area to zoom-out");
     450    BString str2 = B_TRANSLATE("Click outer areas to zoom-in");
     451    float width = StringWidth(str1) + (2 * kSmallVMargin);
     452    float height = ceilf(fh.ascent) + ceilf(fh.descent) + ceilf(fh.leading);
     453    DrawString(str1, BPoint(Bounds().Width() - width, height));
     454    width = StringWidth(str2) + (2 * kSmallVMargin);
     455    height += height + 1;
     456    DrawString(str2, BPoint(Bounds().Width() - width, height));
     457}
    435458
    436459float
    437460PieView::_DrawDirectory(BRect b, FileInfo* info, float parentSpan,
  • src/apps/diskusage/PieView.h

    diff --git a/src/apps/diskusage/PieView.h b/src/apps/diskusage/PieView.h
    index 9e0d5e3..2c8d5a5 100644
    a b private:  
    5050            void                _ShowVolume(BVolume* volume);
    5151            void                _DrawProgressBar(BRect updateRect);
    5252            void                _DrawPieChart(BRect updateRect);
     53            void                _DrawHelp();
    5354            float               _DrawDirectory(BRect b, FileInfo* info,
    5455                                    float parentSpan, float beginAngle,
    5556                                    int colorIdx, int level);