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