Ticket #1701: colorControl9.diff

File colorControl9.diff, 2.2 KB (added by aldeck, 14 years ago)

soon i'll commit myself :)

  • src/kits/interface/ColorControl.cpp

     
    6464BColorControl::_InitData(color_control_layout layout, float size,
    6565    bool useOffscreen, BMessage* archive)
    6666{
     67    fPaletteMode = false;
    6768    fColumns = layout;
    6869    fRows = 256 / fColumns;
    6970    fCellSize = ceil(max_c(kMinCellSize, size));
     
    156157void
    157158BColorControl::_LayoutView()
    158159{
    159     fPaletteFrame.Set(2.0f, 2.0f,
    160         float(fColumns) * fCellSize + 2.0,
    161         float(fRows) * fCellSize + 2.0 - 1.0);
    162         //1 pixel adjust so that the inner space
    163         //has exactly rows*cellsize pixels in height
     160    //TODO: set the layout after being attached to a window
     161    //if (fPaletteMode){
     162    //  fPaletteFrame.Set(2.0f, 2.0f,
     163    //      float(fColumns) * fCellSize + 2.0,
     164    //      float(fRows) * fCellSize + 2.0);
     165    //} else {     
     166        fPaletteFrame.Set(2.0f, 2.0f,
     167            float(fColumns) * fCellSize + 2.0,
     168            float(fRows) * fCellSize + 2.0 - 1.0);
     169            //1 pixel adjust so that the inner space
     170            //has exactly rows*cellsize pixels in height
     171    //}
    164172   
    165173    BRect rect = fPaletteFrame.InsetByCopy(-2.0,-2.0);  //bevel
    166174   
     
    551559BRect
    552560BColorControl::_RampFrame(uint8 rampIndex) const
    553561{
    554     float rampHeight = fPaletteFrame.Height() / 4
     562    float rampHeight = float(fRows) * fCellSize / 4.0f;
    555563           
    556     return BRect(fPaletteFrame.left,
     564    return BRect( fPaletteFrame.left,
    557565        fPaletteFrame.top + float(rampIndex) * rampHeight,
    558566        fPaletteFrame.right,
    559567        fPaletteFrame.top + float(rampIndex + 1) * rampHeight);
  • src/preferences/backgrounds/BackgroundsView.cpp

     
    216216    rightbox->AddChild(fIconLabelOutline);
    217217
    218218    rect.top += fIconLabelOutline->Bounds().Height() + 15;
    219     fPicker = new BColorControl(BPoint(10, rect.top), B_CELLS_32x8, 5.0, "Picker",
     219    fPicker = new BColorControl(BPoint(10, rect.top), B_CELLS_32x8, 7.0, "Picker",
    220220        new BMessage(kMsgUpdateColor));
    221221    rightbox->AddChild(fPicker);
    222222