Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
9b08202a
Commit
9b08202a
authored
Dec 12, 2002
by
Olivier Teulière
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* ./modules/gui/win32: added management for "float" config options
(thanks Garf)
parent
707dbe3c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
85 additions
and
7 deletions
+85
-7
modules/gui/win32/preferences.cpp
modules/gui/win32/preferences.cpp
+71
-2
modules/gui/win32/preferences.h
modules/gui/win32/preferences.h
+14
-5
No files found.
modules/gui/win32/preferences.cpp
View file @
9b08202a
...
...
@@ -408,6 +408,58 @@ void __fastcall TPanelInteger::UpdateChanges()
}
/****************************************************************************
* Panel for float management
****************************************************************************/
__fastcall
TPanelFloat
::
TPanelFloat
(
TComponent
*
Owner
,
module_config_t
*
p_config
)
:
TPanelPref
(
Owner
,
p_config
)
{
#define MAX_FLOAT_CHARS 20
/* init description label */
AnsiString
Text
=
AnsiString
(
p_config
->
psz_text
)
+
":"
;
Label
=
CreateLabel
(
this
,
LIBWIN32_PREFSIZE_LEFT
,
LIBWIN32_PREFSIZE_WIDTH
,
LIBWIN32_PREFSIZE_VPAD
,
LIBWIN32_PREFSIZE_LABEL_HEIGHT
,
Text
.
c_str
(),
true
);
/* init edit */
char
*
psz_value
=
(
char
*
)
malloc
(
MAX_FLOAT_CHARS
);
snprintf
(
psz_value
,
MAX_FLOAT_CHARS
,
"%f"
,
p_config
->
f_value
);
/* we use the spinedit size, to be similar with the integers */
Edit
=
CreateEdit
(
this
,
LIBWIN32_PREFSIZE_RIGHT
-
LIBWIN32_PREFSIZE_SPINEDIT_WIDTH
,
LIBWIN32_PREFSIZE_SPINEDIT_WIDTH
,
LIBWIN32_PREFSIZE_VPAD
,
LIBWIN32_PREFSIZE_SPINEDIT_HEIGHT
,
psz_value
);
free
(
psz_value
);
Edit
->
Hint
=
p_config
->
psz_longtext
;
Edit
->
ShowHint
=
true
;
/* vertical alignement and panel height */
if
(
Edit
->
Height
>
Label
->
Height
)
{
Label
->
Top
+=
(
Edit
->
Height
-
Label
->
Height
)
/
2
;
Height
=
Edit
->
Top
+
Edit
->
Height
+
LIBWIN32_PREFSIZE_VPAD
;
}
else
{
Edit
->
Top
+=
(
Label
->
Height
-
Edit
->
Height
)
/
2
;
Height
=
Label
->
Top
+
Label
->
Height
+
LIBWIN32_PREFSIZE_VPAD
;
}
#undef MAX_FLOAT_CHARS
};
//---------------------------------------------------------------------------
void
__fastcall
TPanelFloat
::
UpdateChanges
()
{
/* Warning: we're casting from double to float */
p_config
->
f_value
=
atof
(
Edit
->
Text
.
c_str
()
);
}
/****************************************************************************
* Panel for boolean management
****************************************************************************/
...
...
@@ -483,6 +535,7 @@ void __fastcall TPreferencesDlg::CreateConfigDialog( char *psz_module_name )
TPanelPlugin
*
PanelPlugin
;
TPanelString
*
PanelString
;
TPanelInteger
*
PanelInteger
;
TPanelFloat
*
PanelFloat
;
TPanelBool
*
PanelBool
;
/* Look for the selected module */
...
...
@@ -591,12 +644,23 @@ void __fastcall TPreferencesDlg::CreateConfigDialog( char *psz_module_name )
break
;
case
CONFIG_ITEM_FLOAT
:
/* add new panel for the config option */
PanelFloat
=
new
TPanelFloat
(
this
,
p_item
);
PanelFloat
->
Parent
=
ScrollBox
;
break
;
case
CONFIG_ITEM_BOOL
:
/* add new panel for the config option */
PanelBool
=
new
TPanelBool
(
this
,
p_item
);
PanelBool
->
Parent
=
ScrollBox
;
break
;
default:
msg_Warn
(
p_intf
,
"unknown config type"
);
break
;
}
...
...
@@ -681,8 +745,13 @@ void __fastcall TPreferencesDlg::SaveValue( module_config_t *p_config )
break
;
case
CONFIG_ITEM_INTEGER
:
case
CONFIG_ITEM_BOOL
:
config_PutInt
(
p_intf
,
p_config
->
psz_name
,
p_config
->
i_value
);
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 @
9b08202a
...
...
@@ -67,7 +67,7 @@ class TPanelPref : public TPanel
public:
__fastcall
TPanelPref
(
TComponent
*
Owner
,
module_config_t
*
p_config_arg
);
module_config_t
*
p_config
;
virtual
void
__fastcall
UpdateChanges
();
virtual
void
__fastcall
UpdateChanges
()
=
0
;
TCleanCheckListBox
*
__fastcall
CreateCleanCheckListBox
(
TWinControl
*
Parent
,
int
Left
,
int
Width
,
int
Top
,
int
Height
);
TButton
*
__fastcall
CreateButton
(
TWinControl
*
Parent
,
...
...
@@ -93,7 +93,7 @@ public:
TButton
*
ButtonConfig
;
TLabel
*
Label
;
module_t
*
ModuleSelected
;
void
__fastcall
UpdateChanges
();
v
irtual
v
oid
__fastcall
UpdateChanges
();
void
__fastcall
CheckListBoxClick
(
TObject
*
Sender
);
void
__fastcall
CheckListBoxClickCheck
(
TObject
*
Sender
);
void
__fastcall
ButtonConfigClick
(
TObject
*
Sender
);
...
...
@@ -107,7 +107,7 @@ public:
__fastcall
TPanelString
(
TComponent
*
Owner
,
module_config_t
*
p_config
);
TLabel
*
Label
;
TEdit
*
Edit
;
void
__fastcall
UpdateChanges
();
v
irtual
v
oid
__fastcall
UpdateChanges
();
};
//---------------------------------------------------------------------------
class
TPanelInteger
:
public
TPanelPref
...
...
@@ -116,7 +116,16 @@ public:
__fastcall
TPanelInteger
(
TComponent
*
Owner
,
module_config_t
*
p_config
);
TLabel
*
Label
;
TCSpinEdit
*
SpinEdit
;
void
__fastcall
UpdateChanges
();
virtual
void
__fastcall
UpdateChanges
();
};
//---------------------------------------------------------------------------
class
TPanelFloat
:
public
TPanelPref
{
public:
__fastcall
TPanelFloat
(
TComponent
*
Owner
,
module_config_t
*
p_config
);
TLabel
*
Label
;
TEdit
*
Edit
;
virtual
void
__fastcall
UpdateChanges
();
};
//---------------------------------------------------------------------------
class
TPanelBool
:
public
TPanelPref
...
...
@@ -124,7 +133,7 @@ class TPanelBool : public TPanelPref
public:
__fastcall
TPanelBool
(
TComponent
*
Owner
,
module_config_t
*
p_config
);
TCheckBox
*
CheckBox
;
void
__fastcall
UpdateChanges
();
v
irtual
v
oid
__fastcall
UpdateChanges
();
};
//---------------------------------------------------------------------------
class
TPreferencesDlg
:
public
TForm
...
...
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