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
523f67dd
Commit
523f67dd
authored
Jun 04, 2005
by
Eric Petit
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Backport of [11288]
parent
8803463a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
76 additions
and
74 deletions
+76
-74
modules/gui/beos/PreferencesWindow.cpp
modules/gui/beos/PreferencesWindow.cpp
+71
-72
modules/gui/beos/PreferencesWindow.h
modules/gui/beos/PreferencesWindow.h
+5
-2
No files found.
modules/gui/beos/PreferencesWindow.cpp
View file @
523f67dd
...
...
@@ -185,12 +185,6 @@ PreferencesWindow::PreferencesWindow( intf_thread_t * _p_intf,
if
(
options
<
1
||
category
<
0
||
subcategory
<
0
)
continue
;
#if 0
fprintf( stderr, "cat %d, sub %d, %s\n", category, subcategory,
p_module->psz_shortname ? p_module->psz_shortname :
p_module->psz_object_name );
#endif
catItem
=
NULL
;
for
(
int
j
=
0
;
j
<
fOutline
->
CountItemsUnder
(
NULL
,
true
);
j
++
)
{
...
...
@@ -233,18 +227,15 @@ PreferencesWindow::PreferencesWindow( intf_thread_t * _p_intf,
vlc_list_release
(
p_list
);
/* Collapse the whole tree */
for
(
int
i
=
0
;
i
<
fOutline
->
FullListCountItems
();
i
++
)
{
otherItem
=
(
ConfigItem
*
)
fOutline
->
FullListItemAt
(
i
);
if
(
fOutline
->
Superitem
(
otherItem
)
)
{
otherItem
=
(
ConfigItem
*
)
fOutline
->
FullListItemAt
(
i
);
fOutline
->
Collapse
(
otherItem
);
}
}
/* Set the correct values */
Apply
Changes
(
false
);
Apply
(
false
);
/* Select the first item */
fOutline
->
Select
(
0
);
...
...
@@ -305,15 +296,17 @@ void PreferencesWindow::MessageReceived( BMessage * message )
case
PREFS_DEFAULTS
:
config_ResetAll
(
p_intf
);
ApplyChanges
(
false
);
config_SaveConfigFile
(
p_intf
,
NULL
);
Apply
(
false
);
break
;
case
PREFS_APPLY
:
Apply
Changes
(
true
);
Apply
(
true
);
break
;
case
PREFS_SAVE
:
SaveChanges
();
Apply
(
true
);
config_SaveConfigFile
(
p_intf
,
NULL
);
break
;
default:
...
...
@@ -359,29 +352,20 @@ void PreferencesWindow::Update()
}
/*****************************************************************************
* PreferencesWindow::Apply
Changes
* PreferencesWindow::Apply
* Apply changes if doIt is true, revert them otherwise
*****************************************************************************/
void
PreferencesWindow
::
Apply
Changes
(
bool
doIt
)
void
PreferencesWindow
::
Apply
(
bool
doIt
)
{
ConfigItem
*
item
;
for
(
int
i
=
0
;
i
<
fOutline
->
CountItems
();
i
++
)
for
(
int
i
=
0
;
i
<
fOutline
->
FullList
CountItems
();
i
++
)
{
item
=
(
ConfigItem
*
)
fOutline
->
ItemAt
(
i
);
item
=
(
ConfigItem
*
)
fOutline
->
FullList
ItemAt
(
i
);
item
->
Apply
(
doIt
);
}
}
/*****************************************************************************
* PreferencesWindow::SaveChanges
*****************************************************************************/
void
PreferencesWindow
::
SaveChanges
()
{
ApplyChanges
(
true
);
config_SaveConfigFile
(
p_intf
,
NULL
);
}
/*****************************************************************************
* PreferencesWindow::ReallyQuit
*****************************************************************************/
...
...
@@ -490,6 +474,7 @@ ConfigItem::ConfigItem( intf_thread_t * _p_intf, char * name,
r
=
fView
->
Bounds
();
r
.
InsetBy
(
10
,
10
);
fprintf
(
stderr
,
"start
\n
"
);
ConfigWidget
*
widget
;
for
(
;
p_item
->
i_type
!=
CONFIG_HINT_END
;
p_item
++
)
{
...
...
@@ -508,8 +493,10 @@ ConfigItem::ConfigItem( intf_thread_t * _p_intf, char * name,
continue
;
}
fView
->
AddChild
(
widget
);
fprintf
(
stderr
,
"+ %f
\n
"
,
widget
->
Bounds
().
Height
()
);
r
.
top
+=
widget
->
Bounds
().
Height
();
}
fprintf
(
stderr
,
"stop
\n
"
);
if
(
fType
==
TYPE_MODULE
)
{
...
...
@@ -598,17 +585,13 @@ void ConfigItem::ResetScroll()
**********************************************************************/
void
ConfigItem
::
Apply
(
bool
doIt
)
{
ConfigWidget
*
widget
;
return
;
if
(
!
fView
)
if
(
!
fScroll
)
{
/* This is a category */
return
;
}
/* Call ConfigWidget::Apply for every child of your fView */
ConfigWidget
*
widget
;
for
(
int
i
=
0
;
i
<
fView
->
CountChildren
();
i
++
)
{
widget
=
(
ConfigWidget
*
)
fView
->
ChildAt
(
i
);
...
...
@@ -631,7 +614,6 @@ ConfigWidget::ConfigWidget( intf_thread_t * _p_intf, BRect rect,
{
p_intf
=
_p_intf
;
fInitOK
=
true
;
SetViewColor
(
ui_color
(
B_PANEL_BACKGROUND_COLOR
)
);
BRect
r
;
...
...
@@ -639,10 +621,16 @@ ConfigWidget::ConfigWidget( intf_thread_t * _p_intf, BRect rect,
/* Skip deprecated options */
if
(
p_item
->
psz_current
)
{
fInitOK
=
false
;
return
;
}
switch
(
p_item
->
i_type
)
fInitOK
=
true
;
fType
=
p_item
->
i_type
;
fName
=
strdup
(
p_item
->
psz_name
);
switch
(
fType
)
{
case
CONFIG_ITEM_MODULE
:
case
CONFIG_ITEM_MODULE_CAT
:
...
...
@@ -657,6 +645,8 @@ ConfigWidget::ConfigWidget( intf_thread_t * _p_intf, BRect rect,
p_item
->
psz_text
,
NULL
,
new
BMessage
(),
B_FOLLOW_LEFT_RIGHT
|
B_FOLLOW_TOP
);
AddChild
(
fTextControl
);
fprintf
(
stderr
,
"adding text %s at %f
\n
"
,
p_item
->
psz_text
,
rect
.
top
);
break
;
case
CONFIG_ITEM_KEY
:
ResizeTo
(
Bounds
().
Width
(),
25
);
...
...
@@ -689,12 +679,16 @@ ConfigWidget::ConfigWidget( intf_thread_t * _p_intf, BRect rect,
AddChild
(
fCtrlCheck
);
AddChild
(
fShiftCheck
);
AddChild
(
fMenuField
);
fprintf
(
stderr
,
"adding key %s at %f
\n
"
,
p_item
->
psz_text
,
rect
.
top
);
break
;
case
CONFIG_ITEM_BOOL
:
ResizeTo
(
Bounds
().
Width
(),
25
);
fCheckBox
=
new
BCheckBox
(
Bounds
(),
NULL
,
p_item
->
psz_text
,
new
BMessage
(),
B_FOLLOW_LEFT_RIGHT
|
B_FOLLOW_TOP
);
AddChild
(
fCheckBox
);
fprintf
(
stderr
,
"adding bool %s at %f
\n
"
,
p_item
->
psz_text
,
rect
.
top
);
break
;
case
CONFIG_SECTION
:
fInitOK
=
false
;
...
...
@@ -704,6 +698,11 @@ ConfigWidget::ConfigWidget( intf_thread_t * _p_intf, BRect rect,
}
}
ConfigWidget
::~
ConfigWidget
()
{
free
(
fName
);
}
/***********************************************************************
* ConfigWidget::Apply
***********************************************************************
...
...
@@ -711,34 +710,36 @@ ConfigWidget::ConfigWidget( intf_thread_t * _p_intf, BRect rect,
**********************************************************************/
void
ConfigWidget
::
Apply
(
bool
doIt
)
{
#if 0
BMenuItem
*
menuItem
;
char
string
[
256
];
vlc_value_t
val
;
switch
(
fType
)
{
case
CONFIG_ITEM_STRING
:
case
CONFIG_ITEM_FILE
:
case
CONFIG_ITEM_MODULE
:
case
CONFIG_ITEM_MODULE_CAT
:
case
CONFIG_ITEM_MODULE_LIST_CAT
:
case
CONFIG_ITEM_DIRECTORY
:
if
(
doIt
)
{
config_PutPsz( p_intf, f
Config
Name, fTextControl->Text() );
config_PutPsz
(
p_intf
,
fName
,
fTextControl
->
Text
()
);
}
else
{
fTextControl->SetText( config_GetPsz( p_intf, f
Config
Name ) );
fTextControl
->
SetText
(
config_GetPsz
(
p_intf
,
fName
)
);
}
break
;
case
CONFIG_ITEM_INTEGER
:
if
(
doIt
)
{
config_PutInt( p_intf, fConfigName,
atoi( fTextControl->Text() ) );
config_PutInt
(
p_intf
,
fName
,
atoi
(
fTextControl
->
Text
()
)
);
}
else
{
memset( string, 0, 1024 );
snprintf( string, 1023, "%d",
config_GetInt( p_intf, fConfigName ) );
snprintf
(
string
,
256
,
"%d"
,
config_GetInt
(
p_intf
,
fName
)
);
fTextControl
->
SetText
(
string
);
}
break
;
...
...
@@ -746,63 +747,49 @@ void ConfigWidget::Apply( bool doIt )
case
CONFIG_ITEM_FLOAT
:
if
(
doIt
)
{
config_PutFloat( p_intf, fConfigName,
strtod( fTextControl->Text(), NULL ) );
config_PutFloat
(
p_intf
,
fName
,
atof
(
fTextControl
->
Text
()
)
);
}
else
{
memset( string, 0, 1024 );
snprintf( string, 1023, "%f",
config_GetFloat( p_intf, fConfigName ) );
snprintf
(
string
,
256
,
"%f"
,
config_GetFloat
(
p_intf
,
fName
)
);
fTextControl
->
SetText
(
string
);
}
break
;
case CONFIG_ITEM_BOOL:
if( doIt )
{
config_PutInt( p_intf, fConfigName, fCheckBox->Value() );
}
else
{
fCheckBox->SetValue( config_GetInt( p_intf, fConfigName ) );
}
break;
case
CONFIG_ITEM_KEY
:
if
(
doIt
)
{
menuItem
=
fPopUpMenu
->
FindMarked
();
if
(
menuItem
)
{
int value
= vlc_keys[fPopUpMenu->IndexOf( menuItem )].i_key_code;
val
.
i_int
=
vlc_keys
[
fPopUpMenu
->
IndexOf
(
menuItem
)].
i_key_code
;
if
(
fAltCheck
->
Value
()
)
{
val
ue
|= KEY_MODIFIER_ALT;
val
.
i_int
|=
KEY_MODIFIER_ALT
;
}
if
(
fCtrlCheck
->
Value
()
)
{
val
ue
|= KEY_MODIFIER_CTRL;
val
.
i_int
|=
KEY_MODIFIER_CTRL
;
}
if
(
fShiftCheck
->
Value
()
)
{
val
ue
|= KEY_MODIFIER_SHIFT;
val
.
i_int
|=
KEY_MODIFIER_SHIFT
;
}
config_PutInt( p_intf, fConfigName, value
);
var_Set
(
p_intf
->
p_vlc
,
fName
,
val
);
}
}
else
{
int value = config_GetInt( p_intf, fConfig
Name );
fAltCheck->SetValue( val
ue
& KEY_MODIFIER_ALT );
fCtrlCheck->SetValue( val
ue
& KEY_MODIFIER_CTRL );
fShiftCheck->SetValue( val
ue
& KEY_MODIFIER_SHIFT );
val
.
i_int
=
config_GetInt
(
p_intf
,
f
Name
);
fAltCheck
->
SetValue
(
val
.
i_int
&
KEY_MODIFIER_ALT
);
fCtrlCheck
->
SetValue
(
val
.
i_int
&
KEY_MODIFIER_CTRL
);
fShiftCheck
->
SetValue
(
val
.
i_int
&
KEY_MODIFIER_SHIFT
);
for
(
unsigned
i
=
0
;
i
<
sizeof
(
vlc_keys
)
/
sizeof
(
key_descriptor_t
);
i
++
)
{
if
(
(
unsigned
)
vlc_keys
[
i
].
i_key_code
==
( val
ue
& ~KEY_MODIFIER ) )
(
val
.
i_int
&
~
KEY_MODIFIER
)
)
{
menuItem
=
fPopUpMenu
->
ItemAt
(
i
);
menuItem
->
SetMarked
(
true
);
...
...
@@ -810,10 +797,22 @@ void ConfigWidget::Apply( bool doIt )
}
}
}
break
;
case
CONFIG_ITEM_BOOL
:
if
(
doIt
)
{
config_PutInt
(
p_intf
,
fName
,
fCheckBox
->
Value
()
);
}
else
{
fCheckBox
->
SetValue
(
config_GetInt
(
p_intf
,
fName
)
);
}
break
;
default:
break
;
}
#endif
}
VTextView
::
VTextView
(
BRect
frame
,
const
char
*
name
,
...
...
modules/gui/beos/PreferencesWindow.h
View file @
523f67dd
...
...
@@ -55,6 +55,7 @@ class ConfigWidget : public BView
public:
ConfigWidget
(
intf_thread_t
*
p_intf
,
BRect
rect
,
module_config_t
*
p_item
);
~
ConfigWidget
();
bool
InitCheck
()
{
return
fInitOK
;
}
void
Apply
(
bool
doIt
);
...
...
@@ -62,6 +63,9 @@ class ConfigWidget : public BView
intf_thread_t
*
p_intf
;
bool
fInitOK
;
int
fType
;
char
*
fName
;
VTextControl
*
fTextControl
;
BCheckBox
*
fCheckBox
;
BPopUpMenu
*
fPopUpMenu
;
...
...
@@ -113,8 +117,7 @@ class PreferencesWindow : public BWindow
virtual
void
FrameResized
(
float
,
float
);
void
Update
();
void
ApplyChanges
(
bool
doIt
);
void
SaveChanges
();
void
Apply
(
bool
doIt
);
void
ReallyQuit
();
...
...
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