Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Alchemy Viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
Alchemy Viewer
Alchemy Viewer
Commits
1c121035
Commit
1c121035
authored
14 years ago
by
Oz Linden
Browse files
Options
Downloads
Plain Diff
pull changes back from 2.3 beta
parents
d3f3dd09
04425000
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.hgtags
+1
-0
1 addition, 0 deletions
.hgtags
indra/llui/llmenugl.cpp
+132
-73
132 additions, 73 deletions
indra/llui/llmenugl.cpp
indra/llui/llmenugl.h
+10
-2
10 additions, 2 deletions
indra/llui/llmenugl.h
with
143 additions
and
75 deletions
.hgtags
+
1
−
0
View file @
1c121035
...
...
@@ -29,5 +29,6 @@ c6e6324f5be1401f077ad18a4a0f6b46451c2f7b last_sprint
9822eb3e25f7fe0c28ffd8aba45c507caa383cbc 2.2.0-beta2
b0cd7e150009809a0b5b0a9d5785cd4bb230413a 2.2.0-beta3
00a831292231faad7e44c69f76cb96f175b8dfad 2.2.0-beta4
98e0d6df638429fd2f0476667504bd5a6b298def 2.3.0-beta1
1415e6538d54fd5d568ee88343424d57c6803c2c 2.2.0-release
98e0d6df638429fd2f0476667504bd5a6b298def 2.3.0-start
This diff is collapsed.
Click to expand it.
indra/llui/llmenugl.cpp
+
132
−
73
View file @
1c121035
...
...
@@ -1848,89 +1848,104 @@ BOOL LLMenuGL::isOpen()
}
}
void
LLMenuGL
::
scrollItemsUp
()
bool
LLMenuGL
::
scrollItems
(
EScrollingDirection
direction
)
{
// Slowing down
the
items scrolling when arrow button is held
// Slowing down items scrolling when arrow button is held
if
(
mScrollItemsTimer
.
hasExpired
()
&&
NULL
!=
mFirstVisibleItem
)
{
mScrollItemsTimer
.
setTimerExpirySec
(
.033
f
);
}
else
{
return
;
return
false
;
}
item_list_t
::
iterator
cur_item_iter
;
item_list_t
::
iterator
prev_item_iter
;
for
(
cur_item_iter
=
mItems
.
begin
(),
prev_item_iter
=
mItems
.
begin
();
cur_item_iter
!=
mItems
.
end
();
cur_item_iter
++
)
switch
(
direction
)
{
if
(
(
*
cur_item_iter
)
==
mFirstVisibleItem
)
case
SD_UP
:
{
item_list_t
::
iterator
cur_item_iter
;
item_list_t
::
iterator
prev_item_iter
;
for
(
cur_item_iter
=
mItems
.
begin
(),
prev_item_iter
=
mItems
.
begin
();
cur_item_iter
!=
mItems
.
end
();
cur_item_iter
++
)
{
break
;
if
(
(
*
cur_item_iter
)
==
mFirstVisibleItem
)
{
break
;
}
if
((
*
cur_item_iter
)
->
getVisible
())
{
prev_item_iter
=
cur_item_iter
;
}
}
if
((
*
cur_item_iter
)
->
getVisible
())
if
((
*
prev_item_iter
)
->
getVisible
())
{
prev_item_iter
=
cur
_item_iter
;
mFirstVisibleItem
=
*
prev
_item_iter
;
}
break
;
}
if
((
*
prev_item_iter
)
->
getVisible
())
{
mFirstVisibleItem
=
*
prev_item_iter
;
}
mNeedsArrange
=
TRUE
;
arrangeAndClear
();
}
void
LLMenuGL
::
scrollItemsDown
()
{
// Slowing down the items scrolling when arrow button is held
if
(
mScrollItemsTimer
.
hasExpired
())
{
mScrollItemsTimer
.
setTimerExpirySec
(
.033
f
);
}
else
{
return
;
}
if
(
NULL
==
mFirstVisibleItem
)
{
mFirstVisibleItem
=
*
mItems
.
begin
();
}
item_list_t
::
iterator
cur_item_iter
;
for
(
cur_item_iter
=
mItems
.
begin
();
cur_item_iter
!=
mItems
.
end
();
cur_item_iter
++
)
case
SD_DOWN
:
{
if
(
(
*
cur_item_iter
)
==
mFirstVisibleItem
)
if
(
NULL
==
mFirstVisibleItem
)
{
break
;
mFirstVisibleItem
=
*
mItems
.
begin
()
;
}
}
item_list_t
::
iterator
next
_item_iter
;
item_list_t
::
iterator
cur
_item_iter
;
if
(
cur_item_iter
!=
mItems
.
end
())
{
for
(
next_item_iter
=
++
cur_item_iter
;
next_item_iter
!=
mItems
.
end
();
next_item_iter
++
)
for
(
cur_item_iter
=
mItems
.
begin
();
cur_item_iter
!=
mItems
.
end
();
cur_item_iter
++
)
{
if
(
(
*
next
_item_iter
)
->
ge
tVisible
()
)
if
(
(
*
cur
_item_iter
)
==
mFirs
tVisible
Item
)
{
break
;
}
}
if
(
next_item_iter
!=
mItems
.
end
()
&&
(
*
next_item_iter
)
->
getVisible
())
item_list_t
::
iterator
next_item_iter
;
if
(
cur_item_iter
!=
mItems
.
end
())
{
mFirstVisibleItem
=
*
next_item_iter
;
for
(
next_item_iter
=
++
cur_item_iter
;
next_item_iter
!=
mItems
.
end
();
next_item_iter
++
)
{
if
(
(
*
next_item_iter
)
->
getVisible
())
{
break
;
}
}
if
(
next_item_iter
!=
mItems
.
end
()
&&
(
*
next_item_iter
)
->
getVisible
())
{
mFirstVisibleItem
=
*
next_item_iter
;
}
}
break
;
}
case
SD_BEGIN
:
{
mFirstVisibleItem
=
*
mItems
.
begin
();
break
;
}
case
SD_END
:
{
item_list_t
::
reverse_iterator
first_visible_item_iter
=
mItems
.
rend
();
// Advance by mMaxScrollableItems back from the end of the list
// to make the last item visible.
std
::
advance
(
first_visible_item_iter
,
mMaxScrollableItems
);
mFirstVisibleItem
=
*
first_visible_item_iter
;
break
;
}
default
:
llwarns
<<
"Unknown scrolling direction: "
<<
direction
<<
llendl
;
}
mNeedsArrange
=
TRUE
;
arrangeAndClear
();
return
true
;
}
// rearrange the child rects so they fit the shape of the menu.
...
...
@@ -2162,7 +2177,7 @@ void LLMenuGL::arrange( void )
LLMenuScrollItem
::
Params
item_params
;
item_params
.
name
(
ARROW_UP
);
item_params
.
arrow_type
(
LLMenuScrollItem
::
ARROW_UP
);
item_params
.
scroll_callback
.
function
(
boost
::
bind
(
&
LLMenuGL
::
scrollItems
Up
,
this
));
item_params
.
scroll_callback
.
function
(
boost
::
bind
(
&
LLMenuGL
::
scrollItems
,
this
,
SD_UP
));
mArrowUpItem
=
LLUICtrlFactory
::
create
<
LLMenuScrollItem
>
(
item_params
);
LLUICtrl
::
addChild
(
mArrowUpItem
);
...
...
@@ -2173,7 +2188,7 @@ void LLMenuGL::arrange( void )
LLMenuScrollItem
::
Params
item_params
;
item_params
.
name
(
ARROW_DOWN
);
item_params
.
arrow_type
(
LLMenuScrollItem
::
ARROW_DOWN
);
item_params
.
scroll_callback
.
function
(
boost
::
bind
(
&
LLMenuGL
::
scrollItems
Down
,
this
));
item_params
.
scroll_callback
.
function
(
boost
::
bind
(
&
LLMenuGL
::
scrollItems
,
this
,
SD_DOWN
));
mArrowDownItem
=
LLUICtrlFactory
::
create
<
LLMenuScrollItem
>
(
item_params
);
LLUICtrl
::
addChild
(
mArrowDownItem
);
...
...
@@ -2603,14 +2618,8 @@ LLMenuItemGL* LLMenuGL::highlightNextItem(LLMenuItemGL* cur_item, BOOL skip_disa
((
LLFloater
*
)
getParent
())
->
setFocus
(
TRUE
);
}
item_list_t
::
iterator
cur_item_iter
;
for
(
cur_item_iter
=
mItems
.
begin
();
cur_item_iter
!=
mItems
.
end
();
++
cur_item_iter
)
{
if
(
(
*
cur_item_iter
)
==
cur_item
)
{
break
;
}
}
// Current item position in the items list
item_list_t
::
iterator
cur_item_iter
=
std
::
find
(
mItems
.
begin
(),
mItems
.
end
(),
cur_item
);
item_list_t
::
iterator
next_item_iter
;
if
(
cur_item_iter
==
mItems
.
end
())
...
...
@@ -2621,9 +2630,37 @@ LLMenuItemGL* LLMenuGL::highlightNextItem(LLMenuItemGL* cur_item, BOOL skip_disa
{
next_item_iter
=
cur_item_iter
;
next_item_iter
++
;
// First visible item position in the items list
item_list_t
::
iterator
first_visible_item_iter
=
std
::
find
(
mItems
.
begin
(),
mItems
.
end
(),
mFirstVisibleItem
);
if
(
next_item_iter
==
mItems
.
end
())
{
next_item_iter
=
mItems
.
begin
();
// If current item is the last in the list, the menu is scrolled to the beginning
// and the first item is highlighted.
if
(
mScrollable
&&
!
scrollItems
(
SD_BEGIN
))
{
return
NULL
;
}
}
// If current item is the last visible, the menu is scrolled one item down
// and the next item is highlighted.
else
if
(
mScrollable
&&
(
U32
)
std
::
abs
(
std
::
distance
(
first_visible_item_iter
,
next_item_iter
))
>=
mMaxScrollableItems
)
{
// Call highlightNextItem() recursively only if the menu was successfully scrolled down.
// If scroll timer hasn't expired yet the menu won't be scrolled and calling
// highlightNextItem() will result in an endless recursion.
if
(
scrollItems
(
SD_DOWN
))
{
return
highlightNextItem
(
cur_item
,
skip_disabled
);
}
else
{
return
NULL
;
}
}
}
...
...
@@ -2681,14 +2718,8 @@ LLMenuItemGL* LLMenuGL::highlightPrevItem(LLMenuItemGL* cur_item, BOOL skip_disa
((
LLFloater
*
)
getParent
())
->
setFocus
(
TRUE
);
}
item_list_t
::
reverse_iterator
cur_item_iter
;
for
(
cur_item_iter
=
mItems
.
rbegin
();
cur_item_iter
!=
mItems
.
rend
();
++
cur_item_iter
)
{
if
(
(
*
cur_item_iter
)
==
cur_item
)
{
break
;
}
}
// Current item reverse position from the end of the list
item_list_t
::
reverse_iterator
cur_item_iter
=
std
::
find
(
mItems
.
rbegin
(),
mItems
.
rend
(),
cur_item
);
item_list_t
::
reverse_iterator
prev_item_iter
;
if
(
cur_item_iter
==
mItems
.
rend
())
...
...
@@ -2699,9 +2730,37 @@ LLMenuItemGL* LLMenuGL::highlightPrevItem(LLMenuItemGL* cur_item, BOOL skip_disa
{
prev_item_iter
=
cur_item_iter
;
prev_item_iter
++
;
// First visible item reverse position in the items list
item_list_t
::
reverse_iterator
first_visible_item_iter
=
std
::
find
(
mItems
.
rbegin
(),
mItems
.
rend
(),
mFirstVisibleItem
);
if
(
prev_item_iter
==
mItems
.
rend
())
{
prev_item_iter
=
mItems
.
rbegin
();
// If current item is the first in the list, the menu is scrolled to the end
// and the last item is highlighted.
if
(
mScrollable
&&
!
scrollItems
(
SD_END
))
{
return
NULL
;
}
}
// If current item is the first visible, the menu is scrolled one item up
// and the previous item is highlighted.
else
if
(
mScrollable
&&
std
::
distance
(
first_visible_item_iter
,
cur_item_iter
)
<=
0
)
{
// Call highlightNextItem() only if the menu was successfully scrolled up.
// If scroll timer hasn't expired yet the menu won't be scrolled and calling
// highlightNextItem() will result in an endless recursion.
if
(
scrollItems
(
SD_UP
))
{
return
highlightPrevItem
(
cur_item
,
skip_disabled
);
}
else
{
return
NULL
;
}
}
}
...
...
@@ -2872,12 +2931,12 @@ BOOL LLMenuGL::handleScrollWheel( S32 x, S32 y, S32 clicks )
if
(
clicks
>
0
)
{
while
(
clicks
--
)
scrollItems
Down
(
);
scrollItems
(
SD_DOWN
);
}
else
{
while
(
clicks
++
)
scrollItems
Up
(
);
scrollItems
(
SD_UP
);
}
return
TRUE
;
...
...
This diff is collapsed.
Click to expand it.
indra/llui/llmenugl.h
+
10
−
2
View file @
1c121035
...
...
@@ -397,6 +397,15 @@ class LLMenuGL
static
const
std
::
string
ARROW_UP
;
static
const
std
::
string
ARROW_DOWN
;
// for scrollable menus
typedef
enum
e_scrolling_direction
{
SD_UP
=
0
,
SD_DOWN
=
1
,
SD_BEGIN
=
2
,
SD_END
=
3
}
EScrollingDirection
;
protected
:
LLMenuGL
(
const
LLMenuGL
::
Params
&
p
);
friend
class
LLUICtrlFactory
;
...
...
@@ -503,8 +512,7 @@ class LLMenuGL
S32
getShortcutPad
()
{
return
mShortcutPad
;
}
void
scrollItemsUp
();
void
scrollItemsDown
();
bool
scrollItems
(
EScrollingDirection
direction
);
BOOL
isScrollable
()
const
{
return
mScrollable
;
}
static
class
LLMenuHolderGL
*
sMenuContainer
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment