Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
d2f7f8a6
Commit
d2f7f8a6
authored
Oct 27, 2010
by
Rafaël Carré
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Redraw(): if/else if/else if -> switch/case
parent
83926167
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
120 additions
and
134 deletions
+120
-134
modules/gui/ncurses.c
modules/gui/ncurses.c
+120
-134
No files found.
modules/gui/ncurses.c
View file @
d2f7f8a6
...
...
@@ -819,10 +819,10 @@ static void Redraw(intf_thread_t *p_intf, time_t *t_last_refresh)
h
=
LINES
-
y
;
y_end
=
y
+
h
-
1
;
if
(
p_sys
->
i_box_type
==
BOX_HELP
)
{
/* Help box */
int
l
=
0
;
switch
(
p_sys
->
i_box_type
)
{
case
BOX_HELP
:
DrawBox
(
p_sys
->
w
,
y
++
,
0
,
h
,
COLS
,
_
(
" Help "
),
p_sys
->
b_color
);
if
(
p_sys
->
b_color
)
...
...
@@ -919,11 +919,10 @@ static void Redraw(intf_thread_t *p_intf, time_t *t_last_refresh)
y
+=
l
-
p_sys
->
i_box_start
;
else
y
+=
p_sys
->
i_box_lines
;
}
else
if
(
p_sys
->
i_box_type
==
BOX_INFO
)
{
/* Info box */
int
l
=
0
;
break
;
case
BOX_INFO
:
DrawBox
(
p_sys
->
w
,
y
++
,
0
,
h
,
COLS
,
_
(
" Information "
),
p_sys
->
b_color
);
if
(
p_input
)
...
...
@@ -959,12 +958,9 @@ static void Redraw(intf_thread_t *p_intf, time_t *t_last_refresh)
y
+=
l
-
p_sys
->
i_box_start
;
else
y
+=
p_sys
->
i_box_lines
;
}
else
if
(
p_sys
->
i_box_type
==
BOX_META
)
{
/* Meta data box */
int
l
=
0
;
break
;
case
BOX_META
:
DrawBox
(
p_sys
->
w
,
y
++
,
0
,
h
,
COLS
,
_
(
"Meta-information"
),
p_sys
->
b_color
);
...
...
@@ -994,9 +990,11 @@ static void Redraw(intf_thread_t *p_intf, time_t *t_last_refresh)
p_sys
->
i_box_start
=
p_sys
->
i_box_lines_total
-
1
;
y
+=
__MIN
(
l
-
p_sys
->
i_box_start
,
p_sys
->
i_box_lines
);
}
break
;
#if 0 /* Deprecated API */
else if (p_sys->i_box_type == BOX_LOG)
case BOX_LOG:
{
int i_line = 0;
int i_stop;
...
...
@@ -1041,10 +1039,10 @@ static void Redraw(intf_thread_t *p_intf, time_t *t_last_refresh)
vlc_mutex_unlock(p_intf->p_sys->p_sub->p_lock);
y = y_end;
}
break;
#endif
else
if
(
p_sys
->
i_box_type
==
BOX_BROWSE
)
case
BOX_BROWSE
:
{
/* Filebrowser box */
int
i_start
,
i_stop
;
int
i_item
;
DrawBox
(
p_sys
->
w
,
y
++
,
0
,
h
,
COLS
,
_
(
" Browse "
),
p_sys
->
b_color
);
...
...
@@ -1091,9 +1089,9 @@ static void Redraw(intf_thread_t *p_intf, time_t *t_last_refresh)
}
}
else
if
(
p_sys
->
i_box_type
==
BOX_OBJECTS
)
{
int
l
=
0
;
break
;
case
BOX_OBJECTS
:
DrawBox
(
p_sys
->
w
,
y
++
,
0
,
h
,
COLS
,
_
(
" Objects "
),
p_sys
->
b_color
);
DumpObject
(
p_intf
,
&
l
,
VLC_OBJECT
(
p_intf
->
p_libvlc
),
0
);
...
...
@@ -1105,13 +1103,14 @@ static void Redraw(intf_thread_t *p_intf, time_t *t_last_refresh)
y
+=
l
-
p_sys
->
i_box_start
;
else
y
+=
p_sys
->
i_box_lines
;
}
else
if
(
p_sys
->
i_box_type
==
BOX_STATS
)
{
break
;
case
BOX_STATS
:
DrawBox
(
p_sys
->
w
,
y
++
,
0
,
h
,
COLS
,
_
(
" Stats "
),
p_sys
->
b_color
);
if
(
!
p_input
)
break
;
if
(
p_input
)
{
input_item_t
*
p_item
=
input_GetItem
(
p_input
);
assert
(
p_item
);
vlc_mutex_lock
(
&
p_item
->
lock
);
...
...
@@ -1133,7 +1132,7 @@ static void Redraw(intf_thread_t *p_intf, time_t *t_last_refresh)
int
l
=
0
;
#define SHOW_ACS(x,c) \
if (l >= p_sys->i_box_start && l - p_sys->i_box_start < p_sys->i_box_lines) \
if (l >= p_sys->i_box_start && l - p_sys->i_box_start < p_sys->i_box_lines) \
mvaddch(p_sys->i_box_y - p_sys->i_box_start + l, x, c)
/* Input */
...
...
@@ -1221,31 +1220,21 @@ static void Redraw(intf_thread_t *p_intf, time_t *t_last_refresh)
vlc_mutex_unlock
(
&
p_item
->
p_stats
->
lock
);
vlc_mutex_unlock
(
&
p_item
->
lock
);
break
;
}
}
else
if
(
p_sys
->
i_box_type
==
BOX_PLAYLIST
||
p_sys
->
i_box_type
==
BOX_SEARCH
||
p_sys
->
i_box_type
==
BOX_OPEN
)
{
/* Playlist box */
int
i_start
,
i_stop
,
i_max
=
p_sys
->
i_plist_entries
;
int
i_item
;
char
*
psz_title
;
if
(
p_sys
->
category_view
)
psz_title
=
strdup
(
_
(
" Playlist (By category) "
));
else
psz_title
=
strdup
(
_
(
" Playlist (All, one level) "
));
DrawBox
(
p_sys
->
w
,
y
++
,
0
,
h
,
COLS
,
psz_title
,
p_sys
->
b_color
);
free
(
psz_title
);
case
BOX_NONE
:
y
++
;
break
;
default:
/* Playlist box */
DrawBox
(
p_sys
->
w
,
y
++
,
0
,
h
,
COLS
,
_
(
" Playlist "
),
p_sys
->
b_color
);
if
(
p_sys
->
b_need_update
||
!
p_sys
->
pp_plist
)
PlaylistRebuild
(
p_intf
);
if
(
p_sys
->
b_box_plidx_follow
)
FindIndex
(
p_sys
,
p_playlist
,
false
);
int
i_start
,
i_stop
,
i_max
=
p_sys
->
i_plist_entries
;
if
(
p_sys
->
i_box_plidx
<
0
)
p_sys
->
i_box_plidx
=
0
;
if
(
p_sys
->
i_box_plidx
>=
i_max
)
p_sys
->
i_box_plidx
=
i_max
-
1
;
...
...
@@ -1269,7 +1258,7 @@ static void Redraw(intf_thread_t *p_intf, time_t *t_last_refresh)
if
(
i_stop
>
i_max
)
i_stop
=
i_max
;
for
(
i_item
=
i_start
;
i_item
<
i_stop
;
i_item
++
)
for
(
i
nt
i
_item
=
i_start
;
i_item
<
i_stop
;
i_item
++
)
{
bool
b_selected
=
(
p_sys
->
i_box_plidx
==
i_item
);
playlist_item_t
*
p_item
=
p_sys
->
pp_plist
[
i_item
]
->
p_item
;
...
...
@@ -1304,10 +1293,7 @@ static void Redraw(intf_thread_t *p_intf, time_t *t_last_refresh)
if
(
b_selected
)
attroff
(
A_REVERSE
);
}
}
else
y
++
;
if
(
p_sys
->
i_box_type
==
BOX_SEARCH
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment