Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
3a13976f
Commit
3a13976f
authored
Apr 01, 2005
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* wxwin: at start up, restore last size+position+state of windows.
parent
ca219348
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
285 additions
and
0 deletions
+285
-0
modules/gui/wxwindows/dialogs.cpp
modules/gui/wxwindows/dialogs.cpp
+40
-0
modules/gui/wxwindows/interface.cpp
modules/gui/wxwindows/interface.cpp
+17
-0
modules/gui/wxwindows/wxwindows.cpp
modules/gui/wxwindows/wxwindows.cpp
+189
-0
modules/gui/wxwindows/wxwindows.h
modules/gui/wxwindows/wxwindows.h
+39
-0
No files found.
modules/gui/wxwindows/dialogs.cpp
View file @
3a13976f
...
...
@@ -164,10 +164,50 @@ DialogsProvider::DialogsProvider( intf_thread_t *_p_intf, wxWindow *p_parent )
/* Intercept all menu events in our custom event handler */
PushEventHandler
(
new
MenuEvtHandler
(
p_intf
,
NULL
)
);
WindowSettings
*
ws
=
p_intf
->
p_sys
->
p_window_settings
;
wxPoint
p
;
wxSize
s
;
bool
b_shown
;
#define INIT( id, w, N, S ) \
if( ws->GetSettings( WindowSettings::id, b_shown, p, s ) && b_shown ) \
{ \
if( !w ) \
w = N; \
w->SetSize( s ); \
w->SetPosition( p ); \
w->S( true ); \
}
INIT
(
ID_PLAYLIST
,
p_playlist_dialog
,
new
Playlist
(
p_intf
,
this
),
ShowPlaylist
);
INIT
(
ID_MESSAGES
,
p_messages_dialog
,
new
Messages
(
p_intf
,
this
),
Show
);
INIT
(
ID_FILE_INFO
,
p_fileinfo_dialog
,
new
FileInfo
(
p_intf
,
this
),
Show
);
INIT
(
ID_BOOKMARKS
,
p_bookmarks_dialog
,
BookmarksDialog
(
p_intf
,
this
),
Show
);
#undef INIT
}
DialogsProvider
::~
DialogsProvider
()
{
WindowSettings
*
ws
=
p_intf
->
p_sys
->
p_window_settings
;
#define UPDATE(id,w) \
{ \
if( w && w->IsShown() ) \
ws->SetSettings( WindowSettings::id, true, \
w->GetPosition(), w->GetSize() ); \
else \
ws->SetSettings( WindowSettings::id, false ); \
}
UPDATE
(
ID_PLAYLIST
,
p_playlist_dialog
);
UPDATE
(
ID_MESSAGES
,
p_messages_dialog
);
UPDATE
(
ID_FILE_INFO
,
p_fileinfo_dialog
);
UPDATE
(
ID_BOOKMARKS
,
p_bookmarks_dialog
);
#undef UPDATE
/* Clean up */
if
(
p_open_dialog
)
delete
p_open_dialog
;
if
(
p_prefs_dialog
)
p_prefs_dialog
->
Destroy
();
...
...
modules/gui/wxwindows/interface.cpp
View file @
3a13976f
...
...
@@ -300,10 +300,27 @@ Interface::Interface( intf_thread_t *_p_intf, long style ):
/* Start timer */
timer
=
new
Timer
(
p_intf
,
this
);
/* */
WindowSettings
*
ws
=
p_intf
->
p_sys
->
p_window_settings
;
wxPoint
p
;
wxSize
s
;
bool
b_shown
;
ws
->
SetScreen
(
wxSystemSettings
::
GetMetric
(
wxSYS_SCREEN_X
),
wxSystemSettings
::
GetMetric
(
wxSYS_SCREEN_Y
)
);
if
(
ws
->
GetSettings
(
WindowSettings
::
ID_MAIN
,
b_shown
,
p
,
s
)
)
SetPosition
(
p
);
}
Interface
::~
Interface
()
{
WindowSettings
*
ws
=
p_intf
->
p_sys
->
p_window_settings
;
ws
->
SetSettings
(
WindowSettings
::
ID_MAIN
,
true
,
GetPosition
(),
GetSize
()
);
#ifdef wxHAS_TASK_BAR_ICON
if
(
p_systray
)
{
...
...
modules/gui/wxwindows/wxwindows.cpp
View file @
3a13976f
...
...
@@ -121,6 +121,8 @@ vlc_module_begin();
add_bool
(
"wxwin-systray"
,
0
,
NULL
,
SYSTRAY_TEXT
,
SYSTRAY_LONGTEXT
,
VLC_FALSE
);
#endif
add_string
(
"wxwin-config-last"
,
NULL
,
NULL
,
"last config"
,
"last config"
,
VLC_TRUE
);
add_submodule
();
set_description
(
_
(
"wxWindows dialogs provider"
)
);
...
...
@@ -168,6 +170,9 @@ static int Open( vlc_object_t *p_this )
/* We support play on start */
p_intf
->
b_play
=
VLC_TRUE
;
/* */
p_intf
->
p_sys
->
p_window_settings
=
new
WindowSettings
(
p_intf
);
return
VLC_SUCCESS
;
}
...
...
@@ -202,6 +207,9 @@ static void Close( vlc_object_t *p_this )
msg_Unsubscribe
(
p_intf
,
p_intf
->
p_sys
->
p_sub
);
/* */
delete
p_intf
->
p_sys
->
p_window_settings
;
/* Destroy structure */
free
(
p_intf
->
p_sys
);
}
...
...
@@ -381,3 +389,184 @@ static void ShowDialog( intf_thread_t *p_intf, int i_dialog_event, int i_arg,
p_intf
->
p_sys
->
p_wxwindow
->
AddPendingEvent
(
event
);
}
}
WindowSettings
::
WindowSettings
(
intf_thread_t
*
_p_intf
)
{
char
*
psz_org
=
NULL
;
char
*
psz
;
int
i
;
/* */
p_intf
=
_p_intf
;
/* */
for
(
i
=
0
;
i
<
ID_MAX
;
i
++
)
{
b_valid
[
i
]
=
false
;
b_shown
[
i
]
=
false
;
position
[
i
]
=
wxDefaultPosition
;
size
[
i
]
=
wxDefaultSize
;
}
b_shown
[
ID_MAIN
]
=
true
;
/* Parse the configuration */
psz_org
=
psz
=
config_GetPsz
(
p_intf
,
"wxwin-config-last"
);
if
(
!
psz
||
*
psz
==
'\0'
)
return
;
msg_Dbg
(
p_intf
,
"Using last windows config '%s'"
,
psz
);
i_screen_w
=
0
;
i_screen_h
=
0
;
while
(
psz
&&
*
psz
)
{
int
id
,
v
[
4
];
psz
=
strchr
(
psz
,
'('
);
if
(
!
psz
)
break
;
psz
++
;
id
=
strtol
(
psz
,
&
psz
,
0
);
if
(
*
psz
!=
','
)
/* broken cfg */
goto
invalid
;
psz
++
;
for
(
i
=
0
;
i
<
4
;
i
++
)
{
v
[
i
]
=
strtol
(
psz
,
&
psz
,
0
);
if
(
i
<
3
)
{
if
(
*
psz
!=
','
)
goto
invalid
;
psz
++
;
}
else
{
if
(
*
psz
!=
')'
)
goto
invalid
;
}
}
if
(
id
==
ID_SCREEN
)
{
i_screen_w
=
v
[
2
];
i_screen_h
=
v
[
3
];
}
else
if
(
id
>=
0
&&
id
<
ID_MAX
)
{
b_valid
[
id
]
=
true
;
b_shown
[
id
]
=
true
;
position
[
id
]
=
wxPoint
(
v
[
0
],
v
[
1
]
);
size
[
id
]
=
wxSize
(
v
[
2
],
v
[
3
]
);
msg_Dbg
(
p_intf
,
"id=%d p=(%d,%d) s=(%d,%d)"
,
id
,
position
[
id
].
x
,
position
[
id
].
y
,
size
[
id
].
x
,
size
[
id
].
y
);
}
psz
=
strchr
(
psz
,
')'
);
if
(
psz
)
psz
++
;
}
if
(
i_screen_w
<=
0
||
i_screen_h
<=
0
)
goto
invalid
;
for
(
i
=
0
;
i
<
ID_MAX
;
i
++
)
{
if
(
!
b_valid
[
i
]
)
continue
;
if
(
position
[
i
].
x
<
0
||
position
[
i
].
y
<
0
)
goto
invalid
;
if
(
size
[
i
].
x
<=
0
||
size
[
i
].
y
<=
0
)
goto
invalid
;
}
if
(
psz_org
)
free
(
psz_org
);
return
;
invalid:
msg_Dbg
(
p_intf
,
"last windows config is invalid (ignored)"
);
for
(
i
=
0
;
i
<
ID_MAX
;
i
++
)
{
b_valid
[
i
]
=
false
;
b_shown
[
i
]
=
false
;
position
[
i
]
=
wxDefaultPosition
;
size
[
i
]
=
wxDefaultSize
;
}
if
(
psz_org
)
free
(
psz_org
);
}
WindowSettings
::~
WindowSettings
(
)
{
wxString
sCfg
;
int
i
;
sCfg
=
wxString
::
Format
(
"(%d,0,0,%d,%d)"
,
ID_SCREEN
,
wxSystemSettings
::
GetMetric
(
wxSYS_SCREEN_X
),
wxSystemSettings
::
GetMetric
(
wxSYS_SCREEN_Y
)
);
for
(
i
=
0
;
i
<
ID_MAX
;
i
++
)
{
if
(
!
b_valid
[
i
]
||
!
b_shown
[
i
]
)
continue
;
sCfg
+=
wxString
::
Format
(
"(%d,%d,%d,%d,%d)"
,
i
,
position
[
i
].
x
,
position
[
i
].
y
,
size
[
i
].
x
,
size
[
i
].
y
);
}
config_PutPsz
(
p_intf
,
"wxwin-config-last"
,
sCfg
.
c_str
()
);
config_SaveConfigFile
(
p_intf
,
"wxwindows"
);
}
void
WindowSettings
::
SetScreen
(
int
i_screen_w
,
int
i_screen_h
)
{
int
i
;
for
(
i
=
0
;
i
<
ID_MAX
;
i
++
)
{
if
(
!
b_valid
[
i
]
)
continue
;
if
(
position
[
i
].
x
>=
i_screen_w
||
position
[
i
].
y
>=
i_screen_h
)
goto
invalid
;
}
return
;
invalid:
for
(
i
=
0
;
i
<
ID_MAX
;
i
++
)
{
b_valid
[
i
]
=
false
;
b_shown
[
i
]
=
false
;
position
[
i
]
=
wxDefaultPosition
;
size
[
i
]
=
wxDefaultSize
;
}
}
void
WindowSettings
::
SetSettings
(
int
id
,
bool
_b_shown
,
wxPoint
p
,
wxSize
s
)
{
if
(
id
<
0
||
id
>=
ID_MAX
)
return
;
b_valid
[
id
]
=
true
;
b_shown
[
id
]
=
_b_shown
;
position
[
id
]
=
p
;
size
[
id
]
=
s
;
}
bool
WindowSettings
::
GetSettings
(
int
id
,
bool
&
_b_shown
,
wxPoint
&
p
,
wxSize
&
s
)
{
if
(
id
<
0
||
id
>=
ID_MAX
)
return
false
;
if
(
!
b_valid
[
id
]
)
return
false
;
_b_shown
=
b_shown
[
id
];
p
=
position
[
id
];
s
=
size
[
id
];
return
true
;
}
modules/gui/wxwindows/wxwindows.h
View file @
3a13976f
...
...
@@ -93,6 +93,7 @@ class DialogsProvider;
class
PrefsTreeCtrl
;
class
AutoBuiltPanel
;
class
VideoWindow
;
class
WindowSettings
;
/*****************************************************************************
* intf_sys_t: description and status of wxwindows interface
...
...
@@ -103,6 +104,9 @@ struct intf_sys_t
wxWindow
*
p_wxwindow
;
wxIcon
*
p_icon
;
/* window settings */
WindowSettings
*
p_window_settings
;
/* special actions */
vlc_bool_t
b_playing
;
vlc_bool_t
b_intf_show
;
/* interface to be shown */
...
...
@@ -1017,6 +1021,41 @@ private:
#endif
}
// end of wxvlc namespace
/* */
class
WindowSettings
{
public:
WindowSettings
(
intf_thread_t
*
_p_intf
);
virtual
~
WindowSettings
();
enum
{
ID_SCREEN
=
-
1
,
ID_MAIN
,
ID_PLAYLIST
,
ID_MESSAGES
,
ID_FILE_INFO
,
ID_BOOKMARKS
,
ID_MAX
,
};
void
SetSettings
(
int
id
,
bool
_b_shown
,
wxPoint
p
=
wxDefaultPosition
,
wxSize
s
=
wxDefaultSize
);
bool
GetSettings
(
int
id
,
bool
&
_b_shown
,
wxPoint
&
p
,
wxSize
&
s
);
void
SetScreen
(
int
i_screen_w
,
int
i_screen_h
);
private:
intf_thread_t
*
p_intf
;
int
i_screen_w
;
int
i_screen_h
;
bool
b_valid
[
ID_MAX
];
bool
b_shown
[
ID_MAX
];
wxPoint
position
[
ID_MAX
];
wxSize
size
[
ID_MAX
];
};
/* Menus */
void
PopupMenu
(
intf_thread_t
*
,
wxWindow
*
,
const
wxPoint
&
);
wxMenu
*
SettingsMenu
(
intf_thread_t
*
,
wxWindow
*
,
wxMenu
*
=
NULL
);
...
...
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