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
f43c76d4
Commit
f43c76d4
authored
Jan 10, 2003
by
Olivier Teulière
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* ./modules/gui/win32: fixed a bug in the preferences (closes #60)
parent
920f7a10
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
67 deletions
+42
-67
modules/gui/win32/preferences.cpp
modules/gui/win32/preferences.cpp
+26
-55
modules/gui/win32/preferences.h
modules/gui/win32/preferences.h
+16
-12
No files found.
modules/gui/win32/preferences.cpp
View file @
f43c76d4
/*****************************************************************************
* preferences.cpp: the "Preferences" dialog box
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* Copyright (C) 2002
-2003
VideoLAN
*
* Authors: Olivier Teuliere <ipkiss@via.ecp.fr>
* Boris Dores <babal@via.ecp.fr>
...
...
@@ -85,9 +85,10 @@ __fastcall TCleanCheckListBox::~TCleanCheckListBox()
* Functions to help components creation
****************************************************************************/
__fastcall
TPanelPref
::
TPanelPref
(
TComponent
*
Owner
,
module_config_t
*
p_config_arg
)
:
TPanel
(
Owner
)
module_config_t
*
_p_config
,
intf_thread_t
*
_p_intf
)
:
TPanel
(
Owner
)
{
p_config
=
p_config_arg
;
p_intf
=
_p_intf
;
p_config
=
_p_config
;
BevelInner
=
bvNone
;
BevelOuter
=
bvNone
;
BorderStyle
=
bsNone
;
...
...
@@ -175,9 +176,6 @@ TCSpinEdit * __fastcall TPanelPref::CreateSpinEdit( TWinControl *Parent,
return
SpinEdit
;
}
//---------------------------------------------------------------------------
void
__fastcall
TPanelPref
::
UpdateChanges
()
{
}
#define LIBWIN32_PREFSIZE_VPAD 4
#define LIBWIN32_PREFSIZE_HPAD 4
...
...
@@ -200,10 +198,8 @@ void __fastcall TPanelPref::UpdateChanges()
****************************************************************************/
__fastcall
TPanelPlugin
::
TPanelPlugin
(
TComponent
*
Owner
,
module_config_t
*
p_config
,
intf_thread_t
*
_p_intf
)
:
TPanelPref
(
Owner
,
p_config
)
:
TPanelPref
(
Owner
,
p_config
,
_p_intf
)
{
p_intf
=
_p_intf
;
/* init configure button */
ButtonConfig
=
CreateButton
(
this
,
LIBWIN32_PREFSIZE_RIGHT
-
LIBWIN32_PREFSIZE_BUTTON_WIDTH
,
...
...
@@ -312,15 +308,13 @@ void __fastcall TPanelPlugin::UpdateChanges()
if
(
CleanCheckListBox
->
Checked
[
item
]
)
{
Name
=
((
TObjectString
*
)
CleanCheckListBox
->
Items
->
Objects
[
item
])
->
String
()
.
c_str
()
;
->
String
();
break
;
}
}
/* XXX: Necessary, since c_str() returns only a temporary pointer... */
free
(
p_config
->
psz_value
);
p_config
->
psz_value
=
(
char
*
)
malloc
(
Name
.
Length
()
+
1
);
strcpy
(
p_config
->
psz_value
,
Name
.
c_str
()
);
config_PutPsz
(
p_intf
,
p_config
->
psz_name
,
Name
.
Length
()
?
Name
.
c_str
()
:
NULL
);
}
...
...
@@ -328,7 +322,8 @@ void __fastcall TPanelPlugin::UpdateChanges()
* Panel for string management
****************************************************************************/
__fastcall
TPanelString
::
TPanelString
(
TComponent
*
Owner
,
module_config_t
*
p_config
)
:
TPanelPref
(
Owner
,
p_config
)
module_config_t
*
p_config
,
intf_thread_t
*
_p_intf
)
:
TPanelPref
(
Owner
,
p_config
,
_p_intf
)
{
/* init description label */
AnsiString
Text
=
AnsiString
(
p_config
->
psz_text
)
+
":"
;
...
...
@@ -358,10 +353,8 @@ __fastcall TPanelString::TPanelString( TComponent* Owner,
//---------------------------------------------------------------------------
void
__fastcall
TPanelString
::
UpdateChanges
()
{
/* XXX: Necessary, since c_str() returns only a temporary pointer... */
free
(
p_config
->
psz_value
);
p_config
->
psz_value
=
(
char
*
)
malloc
(
Edit
->
Text
.
Length
()
+
1
);
strcpy
(
p_config
->
psz_value
,
Edit
->
Text
.
c_str
()
);
config_PutPsz
(
p_intf
,
p_config
->
psz_name
,
Edit
->
Text
.
Length
()
?
Edit
->
Text
.
c_str
()
:
NULL
);
}
...
...
@@ -369,7 +362,8 @@ void __fastcall TPanelString::UpdateChanges()
* Panel for integer management
****************************************************************************/
__fastcall
TPanelInteger
::
TPanelInteger
(
TComponent
*
Owner
,
module_config_t
*
p_config
)
:
TPanelPref
(
Owner
,
p_config
)
module_config_t
*
p_config
,
intf_thread_t
*
_p_intf
)
:
TPanelPref
(
Owner
,
p_config
,
_p_intf
)
{
/* init description label */
AnsiString
Text
=
AnsiString
(
p_config
->
psz_text
)
+
":"
;
...
...
@@ -406,7 +400,7 @@ __fastcall TPanelInteger::TPanelInteger( TComponent* Owner,
void
__fastcall
TPanelInteger
::
UpdateChanges
()
{
/* Warning: we're casting from long to int */
p_config
->
i_value
=
(
int
)
SpinEdit
->
Value
;
config_PutInt
(
p_intf
,
p_config
->
psz_name
,
(
int
)
SpinEdit
->
Value
)
;
}
...
...
@@ -414,7 +408,8 @@ void __fastcall TPanelInteger::UpdateChanges()
* Panel for float management
****************************************************************************/
__fastcall
TPanelFloat
::
TPanelFloat
(
TComponent
*
Owner
,
module_config_t
*
p_config
)
:
TPanelPref
(
Owner
,
p_config
)
module_config_t
*
p_config
,
intf_thread_t
*
_p_intf
)
:
TPanelPref
(
Owner
,
p_config
,
_p_intf
)
{
#define MAX_FLOAT_CHARS 20
/* init description label */
...
...
@@ -458,7 +453,7 @@ __fastcall TPanelFloat::TPanelFloat( TComponent* Owner,
void
__fastcall
TPanelFloat
::
UpdateChanges
()
{
/* Warning: we're casting from double to float */
p_config
->
f_value
=
atof
(
Edit
->
Text
.
c_str
(
)
);
config_PutFloat
(
p_intf
,
p_config
->
psz_name
,
atof
(
Edit
->
Text
.
c_str
()
)
);
}
...
...
@@ -466,7 +461,8 @@ void __fastcall TPanelFloat::UpdateChanges()
* Panel for boolean management
****************************************************************************/
__fastcall
TPanelBool
::
TPanelBool
(
TComponent
*
Owner
,
module_config_t
*
p_config
)
:
TPanelPref
(
Owner
,
p_config
)
module_config_t
*
p_config
,
intf_thread_t
*
_p_intf
)
:
TPanelPref
(
Owner
,
p_config
,
_p_intf
)
{
/* init checkbox */
CheckBox
=
CreateCheckBox
(
this
,
...
...
@@ -484,7 +480,7 @@ __fastcall TPanelBool::TPanelBool( TComponent* Owner,
//---------------------------------------------------------------------------
void
__fastcall
TPanelBool
::
UpdateChanges
()
{
p_config
->
i_value
=
CheckBox
->
Checked
?
1
:
0
;
config_PutInt
(
p_intf
,
p_config
->
psz_name
,
CheckBox
->
Checked
?
1
:
0
)
;
}
...
...
@@ -634,7 +630,7 @@ void __fastcall TPreferencesDlg::CreateConfigDialog( char *psz_module_name )
case
CONFIG_ITEM_STRING
:
/* add new panel for the config option */
PanelString
=
new
TPanelString
(
this
,
p_item
);
PanelString
=
new
TPanelString
(
this
,
p_item
,
p_intf
);
PanelString
->
Parent
=
ScrollBox
;
break
;
...
...
@@ -642,7 +638,7 @@ void __fastcall TPreferencesDlg::CreateConfigDialog( char *psz_module_name )
case
CONFIG_ITEM_INTEGER
:
/* add new panel for the config option */
PanelInteger
=
new
TPanelInteger
(
this
,
p_item
);
PanelInteger
=
new
TPanelInteger
(
this
,
p_item
,
p_intf
);
PanelInteger
->
Parent
=
ScrollBox
;
break
;
...
...
@@ -650,7 +646,7 @@ void __fastcall TPreferencesDlg::CreateConfigDialog( char *psz_module_name )
case
CONFIG_ITEM_FLOAT
:
/* add new panel for the config option */
PanelFloat
=
new
TPanelFloat
(
this
,
p_item
);
PanelFloat
=
new
TPanelFloat
(
this
,
p_item
,
p_intf
);
PanelFloat
->
Parent
=
ScrollBox
;
break
;
...
...
@@ -658,7 +654,7 @@ void __fastcall TPreferencesDlg::CreateConfigDialog( char *psz_module_name )
case
CONFIG_ITEM_BOOL
:
/* add new panel for the config option */
PanelBool
=
new
TPanelBool
(
this
,
p_item
);
PanelBool
=
new
TPanelBool
(
this
,
p_item
,
p_intf
);
PanelBool
->
Parent
=
ScrollBox
;
break
;
...
...
@@ -719,7 +715,6 @@ void __fastcall TPreferencesDlg::ButtonApplyClick( TObject *Sender )
{
Panel
=
(
TPanelPref
*
)
ScrollBox
->
Controls
[
j
];
Panel
->
UpdateChanges
();
SaveValue
(
Panel
->
p_config
);
}
}
}
...
...
@@ -736,27 +731,3 @@ void __fastcall TPreferencesDlg::ButtonCancelClick( TObject *Sender )
Hide
();
}
//---------------------------------------------------------------------------
void
__fastcall
TPreferencesDlg
::
SaveValue
(
module_config_t
*
p_config
)
{
switch
(
p_config
->
i_type
)
{
case
CONFIG_ITEM_STRING
:
case
CONFIG_ITEM_FILE
:
case
CONFIG_ITEM_MODULE
:
config_PutPsz
(
p_intf
,
p_config
->
psz_name
,
*
p_config
->
psz_value
?
p_config
->
psz_value
:
NULL
);
break
;
case
CONFIG_ITEM_INTEGER
:
case
CONFIG_ITEM_BOOL
:
config_PutInt
(
p_intf
,
p_config
->
psz_name
,
p_config
->
i_value
);
break
;
case
CONFIG_ITEM_FLOAT
:
config_PutFloat
(
p_intf
,
p_config
->
psz_name
,
p_config
->
f_value
);
break
;
default:
msg_Warn
(
p_intf
,
"unknown config type"
);
break
;
}
}
//---------------------------------------------------------------------------
modules/gui/win32/preferences.h
View file @
f43c76d4
/*****************************************************************************
* preferences.h: the "Preferences" dialog box
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* Copyright (C) 2002
-2003
VideoLAN
*
* Authors: Olivier Teuliere <ipkiss@via.ecp.fr>
* Boris Dores <babal@via.ecp.fr>
...
...
@@ -65,10 +65,13 @@ public:
class
TPanelPref
:
public
TPanel
{
public:
__fastcall
TPanelPref
(
TComponent
*
Owner
,
module_config_t
*
p_config_arg
);
module_config_t
*
p_config
;
__fastcall
TPanelPref
(
TComponent
*
Owner
,
module_config_t
*
_p_config
,
intf_thread_t
*
_p_intf
)
;
virtual
void
__fastcall
UpdateChanges
()
=
0
;
TCleanCheckListBox
*
__fastcall
CreateCleanCheckListBox
(
TWinControl
*
Parent
,
protected:
module_config_t
*
p_config
;
intf_thread_t
*
p_intf
;
TCleanCheckListBox
*
__fastcall
CreateCleanCheckListBox
(
TWinControl
*
Parent
,
int
Left
,
int
Width
,
int
Top
,
int
Height
);
TButton
*
__fastcall
CreateButton
(
TWinControl
*
Parent
,
int
Left
,
int
Width
,
int
Top
,
int
Height
,
AnsiString
Caption
);
...
...
@@ -97,14 +100,13 @@ public:
void
__fastcall
CheckListBoxClick
(
TObject
*
Sender
);
void
__fastcall
CheckListBoxClickCheck
(
TObject
*
Sender
);
void
__fastcall
ButtonConfigClick
(
TObject
*
Sender
);
private:
intf_thread_t
*
p_intf
;
};
//---------------------------------------------------------------------------
class
TPanelString
:
public
TPanelPref
{
public:
__fastcall
TPanelString
(
TComponent
*
Owner
,
module_config_t
*
p_config
);
__fastcall
TPanelString
(
TComponent
*
Owner
,
module_config_t
*
p_config
,
intf_thread_t
*
_p_intf
);
TLabel
*
Label
;
TEdit
*
Edit
;
virtual
void
__fastcall
UpdateChanges
();
...
...
@@ -113,7 +115,8 @@ public:
class
TPanelInteger
:
public
TPanelPref
{
public:
__fastcall
TPanelInteger
(
TComponent
*
Owner
,
module_config_t
*
p_config
);
__fastcall
TPanelInteger
(
TComponent
*
Owner
,
module_config_t
*
p_config
,
intf_thread_t
*
_p_intf
);
TLabel
*
Label
;
TCSpinEdit
*
SpinEdit
;
virtual
void
__fastcall
UpdateChanges
();
...
...
@@ -122,7 +125,8 @@ public:
class
TPanelFloat
:
public
TPanelPref
{
public:
__fastcall
TPanelFloat
(
TComponent
*
Owner
,
module_config_t
*
p_config
);
__fastcall
TPanelFloat
(
TComponent
*
Owner
,
module_config_t
*
p_config
,
intf_thread_t
*
_p_intf
);
TLabel
*
Label
;
TEdit
*
Edit
;
virtual
void
__fastcall
UpdateChanges
();
...
...
@@ -131,7 +135,8 @@ public:
class
TPanelBool
:
public
TPanelPref
{
public:
__fastcall
TPanelBool
(
TComponent
*
Owner
,
module_config_t
*
p_config
);
__fastcall
TPanelBool
(
TComponent
*
Owner
,
module_config_t
*
p_config
,
intf_thread_t
*
_p_intf
);
TCheckBox
*
CheckBox
;
virtual
void
__fastcall
UpdateChanges
();
};
...
...
@@ -154,7 +159,6 @@ private: // User declarations
public:
// User declarations
__fastcall
TPreferencesDlg
(
TComponent
*
Owner
,
intf_thread_t
*
_p_intf
);
void
__fastcall
CreateConfigDialog
(
char
*
psz_module_name
);
void
__fastcall
SaveValue
(
module_config_t
*
p_config
);
};
//---------------------------------------------------------------------------
#endif
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