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
9d759fed
Commit
9d759fed
authored
Nov 28, 2011
by
Rafaël Carré
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ncurses: don't erase search box content
split out open box function
parent
e982db92
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
49 deletions
+43
-49
modules/gui/ncurses.c
modules/gui/ncurses.c
+43
-49
No files found.
modules/gui/ncurses.c
View file @
9d759fed
...
...
@@ -206,7 +206,6 @@ struct intf_sys_t
/* Search Box context */
char
search_chain
[
20
];
char
*
old_search
;
int
before_search
;
/* Open Box Context */
...
...
@@ -1132,13 +1131,12 @@ static int DrawStatus(intf_thread_t *intf)
static
void
FillTextBox
(
intf_sys_t
*
sys
)
{
int
width
=
COLS
-
2
;
const
char
*
title
=
sys
->
box_type
==
BOX_OPEN
?
"Open: %s"
:
"Find: %s"
;
char
*
chain
=
sys
->
box_type
==
BOX_OPEN
?
sys
->
open_chain
:
sys
->
old_search
?
sys
->
old_search
:
sys
->
search_chain
;
DrawEmptyLine
(
7
,
1
,
width
);
mvnprintw
(
7
,
1
,
width
,
_
(
title
),
chain
);
if
(
sys
->
box_type
==
BOX_OPEN
)
mvnprintw
(
7
,
1
,
width
,
_
(
"Open: %s"
),
sys
->
open_chain
);
else
mvnprintw
(
7
,
1
,
width
,
_
(
"Find: %s"
),
sys
->
search_chain
);
}
static
void
FillBox
(
intf_thread_t
*
intf
)
...
...
@@ -1441,6 +1439,40 @@ static bool HandleBrowseKey(intf_thread_t *intf, int key)
return
false
;
}
static
void
OpenSelection
(
intf_thread_t
*
intf
)
{
intf_sys_t
*
sys
=
intf
->
p_sys
;
char
*
uri
=
make_URI
(
sys
->
open_chain
,
NULL
);
if
(
uri
==
NULL
)
return
;
playlist_t
*
p_playlist
=
pl_Get
(
intf
);
vlc_mutex_lock
(
&
sys
->
pl_lock
);
playlist_item_t
*
p_parent
=
sys
->
node
;
vlc_mutex_unlock
(
&
sys
->
pl_lock
);
PL_LOCK
;
if
(
!
p_parent
)
{
playlist_item_t
*
current
;
current
=
playlist_CurrentPlayingItem
(
p_playlist
);
p_parent
=
current
?
current
->
p_parent
:
NULL
;
if
(
!
p_parent
)
p_parent
=
p_playlist
->
p_local_onelevel
;
}
while
(
p_parent
->
p_parent
&&
p_parent
->
p_parent
->
p_parent
)
p_parent
=
p_parent
->
p_parent
;
PL_UNLOCK
;
playlist_Add
(
p_playlist
,
uri
,
NULL
,
PLAYLIST_APPEND
|
PLAYLIST_GO
,
PLAYLIST_END
,
p_parent
->
p_input
==
p_playlist
->
p_local_onelevel
->
p_input
,
false
);
sys
->
plidx_follow
=
true
;
free
(
uri
);
}
static
void
HandleEditBoxKey
(
intf_thread_t
*
intf
,
int
key
,
int
box
)
{
intf_sys_t
*
sys
=
intf
->
p_sys
;
...
...
@@ -1458,44 +1490,11 @@ static void HandleEditBoxKey(intf_thread_t *intf, int key, int box)
case
KEY_ENTER
:
case
'\r'
:
case
'\n'
:
if
(
search
)
{
if
(
len
)
sys
->
old_search
=
strdup
(
sys
->
search_chain
);
else
if
(
sys
->
old_search
)
SearchPlaylist
(
sys
,
sys
->
old_search
);
}
else
if
(
len
)
{
char
*
uri
=
make_URI
(
sys
->
open_chain
,
NULL
);
if
(
uri
==
NULL
)
{
sys
->
box_type
=
BOX_PLAYLIST
;
return
;
}
playlist_t
*
p_playlist
=
pl_Get
(
intf
);
vlc_mutex_lock
(
&
sys
->
pl_lock
);
playlist_item_t
*
p_parent
=
sys
->
node
;
vlc_mutex_unlock
(
&
sys
->
pl_lock
);
PL_LOCK
;
if
(
!
p_parent
)
{
playlist_item_t
*
current
;
current
=
playlist_CurrentPlayingItem
(
p_playlist
);
p_parent
=
current
?
current
->
p_parent
:
NULL
;
if
(
!
p_parent
)
p_parent
=
p_playlist
->
p_local_onelevel
;
}
while
(
p_parent
->
p_parent
&&
p_parent
->
p_parent
->
p_parent
)
p_parent
=
p_parent
->
p_parent
;
PL_UNLOCK
;
playlist_Add
(
p_playlist
,
uri
,
NULL
,
PLAYLIST_APPEND
|
PLAYLIST_GO
,
PLAYLIST_END
,
p_parent
->
p_input
==
p_playlist
->
p_local_onelevel
->
p_input
,
false
);
if
(
search
)
SearchPlaylist
(
sys
,
sys
->
search_chain
);
else
OpenSelection
(
intf
);
free
(
uri
);
sys
->
plidx_follow
=
true
;
}
sys
->
box_type
=
BOX_PLAYLIST
;
return
;
...
...
@@ -1534,11 +1533,8 @@ static void HandleEditBoxKey(intf_thread_t *intf, int key, int box)
}
}
if
(
search
)
{
free
(
sys
->
old_search
);
sys
->
old_search
=
NULL
;
if
(
search
)
SearchPlaylist
(
sys
,
str
);
}
}
static
void
InputNavigate
(
input_thread_t
*
p_input
,
const
char
*
var
)
...
...
@@ -1575,7 +1571,6 @@ static void HandleCommonKey(intf_thread_t *intf, int key)
case
'S'
:
BoxSwitch
(
sys
,
BOX_STATS
);
return
;
case
'/'
:
/* Search */
sys
->
search_chain
[
0
]
=
'\0'
;
sys
->
plidx_follow
=
false
;
if
(
sys
->
box_type
==
BOX_PLAYLIST
)
{
sys
->
before_search
=
sys
->
box_idx
;
...
...
@@ -1853,7 +1848,6 @@ static void Close(vlc_object_t *p_this)
DirsDestroy
(
sys
);
free
(
sys
->
current_dir
);
free
(
sys
->
old_search
);
if
(
sys
->
p_input
)
vlc_object_release
(
sys
->
p_input
);
...
...
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