mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-02 11:10:59 +00:00
scroler fixes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@19642 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
45382ff618
commit
b8dc697f8f
1 changed files with 13 additions and 26 deletions
|
@ -696,7 +696,7 @@ static NSTextFieldCell *titleCell;
|
||||||
{
|
{
|
||||||
NSBrowserColumn *bc;
|
NSBrowserColumn *bc;
|
||||||
NSScrollView *sc;
|
NSScrollView *sc;
|
||||||
NSRect rect = {{0, 0}, {100, 100}};
|
NSRect rect = {{-110, -110}, {100, 100}};
|
||||||
|
|
||||||
bc = [[NSBrowserColumn alloc] init];
|
bc = [[NSBrowserColumn alloc] init];
|
||||||
|
|
||||||
|
@ -1376,35 +1376,24 @@ static NSTextFieldCell *titleCell;
|
||||||
/** Updates the horizontal scroller to reflect column positions. */
|
/** Updates the horizontal scroller to reflect column positions. */
|
||||||
- (void) updateScroller
|
- (void) updateScroller
|
||||||
{
|
{
|
||||||
int num;
|
int num = [self numberOfVisibleColumns];
|
||||||
|
float prop = (float)num / (float)(_lastColumnLoaded + 1);
|
||||||
|
int uc = ((_lastColumnLoaded + 1) - num); // Unvisible columns
|
||||||
|
float f_step = 1.0; // Knob moving step
|
||||||
|
float fv = 0.0;
|
||||||
|
|
||||||
num = [self numberOfVisibleColumns];
|
if (uc > 0.0)
|
||||||
|
|
||||||
// If there are not enough columns to scroll with
|
|
||||||
// then the column must be visible
|
|
||||||
if ((_firstVisibleColumn == 0) && (_lastColumnLoaded < num))
|
|
||||||
{
|
{
|
||||||
[_horizontalScroller setEnabled: NO];
|
f_step = 1.0 / (float)uc;
|
||||||
}
|
}
|
||||||
else
|
fv = (float)(_firstVisibleColumn * f_step);
|
||||||
|
|
||||||
|
if (_lastVisibleColumn > _lastColumnLoaded)
|
||||||
{
|
{
|
||||||
if (!_skipUpdateScroller)
|
prop = (float)num / (float)(_lastVisibleColumn + 1);
|
||||||
{
|
|
||||||
float prop = (float)num / (float)(_lastColumnLoaded + 1);
|
|
||||||
float i = _lastColumnLoaded - num + 1;
|
|
||||||
float f = 1 + ((_lastVisibleColumn - _lastColumnLoaded) / i);
|
|
||||||
|
|
||||||
if (_lastVisibleColumn > _lastColumnLoaded)
|
|
||||||
{
|
|
||||||
prop = (float)num / (float)(_lastVisibleColumn + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
[_horizontalScroller setFloatValue: f knobProportion: prop];
|
|
||||||
}
|
|
||||||
[_horizontalScroller setEnabled: YES];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[_horizontalScroller setNeedsDisplay: YES];
|
[_horizontalScroller setFloatValue: fv knobProportion: prop];
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Scrolls columns left or right based on an NSScroller. */
|
/** Scrolls columns left or right based on an NSScroller. */
|
||||||
|
@ -1437,9 +1426,7 @@ static NSTextFieldCell *titleCell;
|
||||||
{
|
{
|
||||||
float f = [sender floatValue];
|
float f = [sender floatValue];
|
||||||
|
|
||||||
_skipUpdateScroller = YES;
|
|
||||||
[self scrollColumnToVisible: rintf(f * _lastColumnLoaded)];
|
[self scrollColumnToVisible: rintf(f * _lastColumnLoaded)];
|
||||||
_skipUpdateScroller = NO;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue