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
ad9f1332
Commit
ad9f1332
authored
Nov 09, 2006
by
Olivier Teulière
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* Backport of [16291] (improvement of --skins2-config)
parent
ad1992ef
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
82 additions
and
39 deletions
+82
-39
modules/gui/skins2/src/theme.cpp
modules/gui/skins2/src/theme.cpp
+82
-39
No files found.
modules/gui/skins2/src/theme.cpp
View file @
ad9f1332
...
@@ -23,6 +23,8 @@
...
@@ -23,6 +23,8 @@
*****************************************************************************/
*****************************************************************************/
#include "theme.hpp"
#include "theme.hpp"
#include "top_window.hpp"
#include <sstream>
Theme
::~
Theme
()
Theme
::~
Theme
()
...
@@ -50,39 +52,77 @@ void Theme::loadConfig()
...
@@ -50,39 +52,77 @@ void Theme::loadConfig()
// Is there an existing config?
// Is there an existing config?
if
(
!
strcmp
(
save
,
""
)
)
if
(
!
strcmp
(
save
,
""
)
)
{
{
// Show the windows
// Show the windows
as indicated by the XML file
m_windowManager
.
showAll
(
true
);
m_windowManager
.
showAll
(
true
);
return
;
return
;
}
}
// Initialization
istringstream
inStream
(
save
);
map
<
string
,
TopWindowPtr
>::
const_iterator
it
;
free
(
save
);
int
i
=
0
;
int
x
,
y
,
visible
,
scan
;
// Get config for each window
char
sep
;
for
(
it
=
m_windows
.
begin
();
it
!=
m_windows
.
end
();
it
++
)
string
winId
,
layId
;
int
x
,
y
,
width
,
height
,
visible
;
bool
somethingVisible
=
false
;
while
(
!
inStream
.
eof
()
)
{
inStream
>>
sep
;
if
(
sep
!=
'['
)
goto
invalid
;
inStream
>>
winId
>>
layId
>>
x
>>
y
>>
width
>>
height
>>
visible
>>
sep
>>
ws
;
if
(
sep
!=
']'
)
goto
invalid
;
// Try to find the window and the layout
map
<
string
,
TopWindowPtr
>::
const_iterator
itWin
;
map
<
string
,
GenericLayoutPtr
>::
const_iterator
itLay
;
itWin
=
m_windows
.
find
(
winId
);
itLay
=
m_layouts
.
find
(
layId
);
if
(
itWin
==
m_windows
.
end
()
||
itLay
==
m_layouts
.
end
()
)
{
{
TopWindow
*
pWin
=
(
*
it
).
second
.
get
();
goto
invalid
;
// Get config
}
scan
=
sscanf
(
&
save
[
i
*
13
],
"(%4d,%4d,%1d)"
,
&
x
,
&
y
,
&
visible
);
TopWindow
*
pWin
=
itWin
->
second
.
get
();
GenericLayout
*
pLayout
=
itLay
->
second
.
get
();
// If config has the correct number of arguments
// Restore the layout
if
(
scan
>
2
)
m_windowManager
.
setActiveLayout
(
*
pWin
,
*
pLayout
);
if
(
pLayout
->
getWidth
()
!=
width
||
pLayout
->
getHeight
()
!=
height
)
{
{
// XXX FIXME XXX: big kludge
// As resizing a hidden window causes some trouble (at least on
// Windows), first show the window off screen, resize it, and
// hide it again.
// This has to be investigated more deeply!
m_windowManager
.
startMove
(
*
pWin
);
m_windowManager
.
move
(
*
pWin
,
-
width
-
pLayout
->
getWidth
(),
0
);
m_windowManager
.
stopMove
();
m_windowManager
.
show
(
*
pWin
);
m_windowManager
.
startResize
(
*
pLayout
,
WindowManager
::
kResizeSE
);
m_windowManager
.
resize
(
*
pLayout
,
width
,
height
);
m_windowManager
.
stopResize
();
m_windowManager
.
hide
(
*
pWin
);
}
// Move the window (which incidentally takes care of the anchoring)
m_windowManager
.
startMove
(
*
pWin
);
m_windowManager
.
startMove
(
*
pWin
);
m_windowManager
.
move
(
*
pWin
,
x
,
y
);
m_windowManager
.
move
(
*
pWin
,
x
,
y
);
m_windowManager
.
stopMove
();
m_windowManager
.
stopMove
();
if
(
visible
)
if
(
visible
)
{
{
somethingVisible
=
true
;
m_windowManager
.
show
(
*
pWin
);
m_windowManager
.
show
(
*
pWin
);
}
}
}
}
// Next window
if
(
!
somethingVisible
)
i
++
;
{
goto
invalid
;
}
}
free
(
save
);
return
;
invalid:
msg_Warn
(
getIntf
(),
"invalid config: %s"
,
inStream
.
str
().
c_str
()
);
// Restore the visibility defined in the theme
m_windowManager
.
showAll
(
true
);
}
}
...
@@ -90,29 +130,32 @@ void Theme::saveConfig()
...
@@ -90,29 +130,32 @@ void Theme::saveConfig()
{
{
msg_Dbg
(
getIntf
(),
"saving theme configuration"
);
msg_Dbg
(
getIntf
(),
"saving theme configuration"
);
// Initialize char where config is stored
map
<
string
,
TopWindowPtr
>::
const_iterator
itWin
;
char
*
save
=
new
char
[
400
];
map
<
string
,
GenericLayoutPtr
>::
const_iterator
itLay
;
map
<
string
,
TopWindowPtr
>::
const_iterator
it
;
ostringstream
outStream
;
int
i
=
0
;
for
(
itWin
=
m_windows
.
begin
();
itWin
!=
m_windows
.
end
();
itWin
++
)
int
x
,
y
;
{
TopWindow
*
pWin
=
itWin
->
second
.
get
();
// Save config of every window
// Find the layout id for this window
for
(
it
=
m_windows
.
begin
();
it
!=
m_windows
.
end
();
it
++
)
string
layoutId
;
const
GenericLayout
*
pLayout
=
&
pWin
->
getActiveLayout
();
for
(
itLay
=
m_layouts
.
begin
();
itLay
!=
m_layouts
.
end
();
itLay
++
)
{
if
(
itLay
->
second
.
get
()
==
pLayout
)
{
{
TopWindow
*
pWin
=
(
*
it
).
second
.
get
();
layoutId
=
itLay
->
first
;
// Print config
}
x
=
pWin
->
getLeft
();
y
=
pWin
->
getTop
();
sprintf
(
&
save
[
i
*
13
],
"(%4d,%4d,%1d)"
,
x
,
y
,
pWin
->
getVisibleVar
().
get
()
);
i
++
;
}
}
// Save config to file
outStream
<<
'['
<<
itWin
->
first
<<
' '
<<
layoutId
<<
' '
config_PutPsz
(
getIntf
(),
"skins2-config"
,
save
);
<<
pWin
->
getLeft
()
<<
' '
<<
pWin
->
getTop
()
<<
' '
<<
pLayout
->
getWidth
()
<<
' '
<<
pLayout
->
getHeight
()
<<
' '
<<
(
pWin
->
getVisibleVar
().
get
()
?
1
:
0
)
<<
']'
;
}
//
Free memory
//
Save config to file
delete
[]
save
;
config_PutPsz
(
getIntf
(),
"skins2-config"
,
outStream
.
str
().
c_str
()
)
;
}
}
...
...
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