Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
magicseteditor
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
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
MyCard
magicseteditor
Commits
b51d7fae
Commit
b51d7fae
authored
Nov 25, 2006
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed sub menus
parent
a094c52d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
17 deletions
+21
-17
src/gui/drop_down_list.cpp
src/gui/drop_down_list.cpp
+8
-6
src/gui/value/choice.cpp
src/gui/value/choice.cpp
+6
-4
src/gui/value/choice.hpp
src/gui/value/choice.hpp
+2
-2
src/util/string.cpp
src/util/string.cpp
+5
-5
No files found.
src/gui/drop_down_list.cpp
View file @
b51d7fae
...
@@ -58,19 +58,22 @@ DropDownList::DropDownList(Window* parent, bool is_submenu, ValueViewer* viewer)
...
@@ -58,19 +58,22 @@ DropDownList::DropDownList(Window* parent, bool is_submenu, ValueViewer* viewer)
,
mouse_down
(
false
)
,
mouse_down
(
false
)
,
selected_item
(
NO_SELECTION
)
,
selected_item
(
NO_SELECTION
)
,
open_sub_menu
(
nullptr
)
,
open_sub_menu
(
nullptr
)
,
parent_menu
(
is_submenu
?
static_cast
<
DropDownList
*>
(
GetParent
())
:
nullptr
)
,
parent_menu
(
nullptr
)
,
hider
(
is_submenu
?
nullptr
:
new
DropDownHider
(
*
this
))
,
hider
(
is_submenu
?
nullptr
:
new
DropDownHider
(
*
this
))
,
viewer
(
viewer
)
,
viewer
(
viewer
)
,
item_size
(
100
,
1
)
,
item_size
(
100
,
1
)
,
icon_size
(
0
,
0
)
,
icon_size
(
0
,
0
)
,
text_offset
(
0
)
,
text_offset
(
1
)
{
{
if
(
is_submenu
)
{
parent_menu
=
&
dynamic_cast
<
DropDownList
&>
(
*
GetParent
());
}
// determine item height
// determine item height
wxClientDC
dc
(
this
);
wxClientDC
dc
(
this
);
dc
.
SetFont
(
*
wxNORMAL_FONT
);
dc
.
SetFont
(
*
wxNORMAL_FONT
);
int
h
;
int
h
;
dc
.
GetTextExtent
(
_
(
"X"
),
0
,
&
h
);
dc
.
GetTextExtent
(
_
(
"X"
),
0
,
&
h
);
item_size
.
height
=
h
;
item_size
.
height
=
h
+
2
;
}
}
DropDownList
::~
DropDownList
()
{
DropDownList
::~
DropDownList
()
{
...
@@ -127,7 +130,6 @@ void DropDownList::show(bool in_place, wxPoint pos) {
...
@@ -127,7 +130,6 @@ void DropDownList::show(bool in_place, wxPoint pos) {
parent
->
PushEventHandler
(
hider
);
parent
->
PushEventHandler
(
hider
);
}
}
// show
// show
// oldSelectedItem = selectedItem;
if
(
selected_item
==
NO_SELECTION
&&
itemCount
()
>
0
)
selected_item
=
0
;
// select first item by default
if
(
selected_item
==
NO_SELECTION
&&
itemCount
()
>
0
)
selected_item
=
0
;
// select first item by default
mouse_down
=
false
;
mouse_down
=
false
;
Window
::
Show
();
Window
::
Show
();
...
@@ -152,7 +154,7 @@ void DropDownList::realHide() {
...
@@ -152,7 +154,7 @@ void DropDownList::realHide() {
// onHide();
// onHide();
hideSubMenu
();
hideSubMenu
();
if
(
parent_menu
)
{
if
(
parent_menu
)
{
parent_menu
->
open_sub_menu
=
0
;
parent_menu
->
open_sub_menu
=
nullptr
;
}
else
{
}
else
{
redrawArrowOnParent
();
redrawArrowOnParent
();
// disconnect event handler
// disconnect event handler
...
@@ -254,7 +256,7 @@ void DropDownList::drawItem(DC& dc, int y, size_t item) {
...
@@ -254,7 +256,7 @@ void DropDownList::drawItem(DC& dc, int y, size_t item) {
}
}
// draw text and icon
// draw text and icon
drawIcon
(
dc
,
marginW
,
y
,
item
,
item
==
selected_item
);
drawIcon
(
dc
,
marginW
,
y
,
item
,
item
==
selected_item
);
dc
.
DrawText
(
capitalize
(
itemText
(
item
)),
marginW
+
icon_size
.
width
,
y
+
text_offset
);
dc
.
DrawText
(
capitalize
(
itemText
(
item
)),
marginW
+
icon_size
.
width
+
1
,
y
+
text_offset
);
// draw popup icon
// draw popup icon
if
(
submenu
(
item
))
{
if
(
submenu
(
item
))
{
draw_menu_arrow
(
this
,
dc
,
wxRect
(
marginW
,
y
,
item_size
.
width
,
item_size
.
height
),
item
==
selected_item
);
draw_menu_arrow
(
this
,
dc
,
wxRect
(
marginW
,
y
,
item_size
.
width
,
item_size
.
height
),
item
==
selected_item
);
...
...
src/gui/value/choice.cpp
View file @
b51d7fae
...
@@ -35,6 +35,8 @@ ChoiceField::ChoiceP DropDownChoiceList::getChoice(size_t item) const {
...
@@ -35,6 +35,8 @@ ChoiceField::ChoiceP DropDownChoiceList::getChoice(size_t item) const {
String
DropDownChoiceList
::
itemText
(
size_t
item
)
const
{
String
DropDownChoiceList
::
itemText
(
size_t
item
)
const
{
if
(
isFieldDefault
(
item
))
{
if
(
isFieldDefault
(
item
))
{
return
field
().
default_name
;
return
field
().
default_name
;
}
else
if
(
isGroupDefault
(
item
))
{
return
group
->
default_name
;
}
else
{
}
else
{
ChoiceField
::
ChoiceP
choice
=
getChoice
(
item
);
ChoiceField
::
ChoiceP
choice
=
getChoice
(
item
);
return
choice
->
name
;
return
choice
->
name
;
...
@@ -43,15 +45,15 @@ String DropDownChoiceList::itemText(size_t item) const {
...
@@ -43,15 +45,15 @@ String DropDownChoiceList::itemText(size_t item) const {
bool
DropDownChoiceList
::
lineBelow
(
size_t
item
)
const
{
bool
DropDownChoiceList
::
lineBelow
(
size_t
item
)
const
{
return
isDefault
(
item
);
return
isDefault
(
item
);
}
}
DropDownList
*
DropDownChoiceList
::
submenu
(
size_t
item
)
{
DropDownList
*
DropDownChoiceList
::
submenu
(
size_t
item
)
const
{
if
(
isDefault
(
item
))
return
nullptr
;
if
(
isDefault
(
item
))
return
nullptr
;
item
-=
hasDefault
();
item
-=
hasDefault
();
if
(
item
<
submenus
.
size
())
submenus
.
resize
(
item
+
1
);
if
(
item
>=
submenus
.
size
())
submenus
.
resize
(
item
+
1
);
if
(
submenus
[
item
])
return
submenus
[
item
].
get
();
if
(
submenus
[
item
])
return
submenus
[
item
].
get
();
ChoiceField
::
ChoiceP
choice
=
g
etChoice
(
item
)
;
ChoiceField
::
ChoiceP
choice
=
g
roup
->
choices
[
item
]
;
if
(
choice
->
isGroup
())
{
if
(
choice
->
isGroup
())
{
// create submenu
// create submenu
submenus
[
item
].
reset
(
new
DropDownChoiceList
(
GetParent
(
),
true
,
cve
,
choice
));
submenus
[
item
].
reset
(
new
DropDownChoiceList
(
const_cast
<
DropDownChoiceList
*>
(
this
),
true
,
cve
,
choice
));
}
}
return
submenus
[
item
].
get
();
return
submenus
[
item
].
get
();
}
}
...
...
src/gui/value/choice.hpp
View file @
b51d7fae
...
@@ -50,7 +50,7 @@ class DropDownChoiceList : public DropDownList {
...
@@ -50,7 +50,7 @@ class DropDownChoiceList : public DropDownList {
virtual
bool
lineBelow
(
size_t
item
)
const
;
virtual
bool
lineBelow
(
size_t
item
)
const
;
virtual
String
itemText
(
size_t
item
)
const
;
virtual
String
itemText
(
size_t
item
)
const
;
virtual
void
drawIcon
(
DC
&
dc
,
int
x
,
int
y
,
size_t
item
,
bool
selected
)
const
;
virtual
void
drawIcon
(
DC
&
dc
,
int
x
,
int
y
,
size_t
item
,
bool
selected
)
const
;
virtual
DropDownList
*
submenu
(
size_t
item
);
virtual
DropDownList
*
submenu
(
size_t
item
)
const
;
virtual
void
select
(
size_t
item
);
virtual
void
select
(
size_t
item
);
virtual
size_t
selection
()
const
;
virtual
size_t
selection
()
const
;
...
@@ -58,7 +58,7 @@ class DropDownChoiceList : public DropDownList {
...
@@ -58,7 +58,7 @@ class DropDownChoiceList : public DropDownList {
private:
private:
ChoiceValueEditor
&
cve
;
ChoiceValueEditor
&
cve
;
ChoiceField
::
ChoiceP
group
;
///< Group this menu shows
ChoiceField
::
ChoiceP
group
;
///< Group this menu shows
vector
<
DropDownListP
>
submenus
;
mutable
vector
<
DropDownListP
>
submenus
;
inline
const
ChoiceField
&
field
()
const
{
return
cve
.
field
();
}
inline
const
ChoiceField
&
field
()
const
{
return
cve
.
field
();
}
...
...
src/util/string.cpp
View file @
b51d7fae
...
@@ -98,12 +98,12 @@ bool is_substr(const String& s, String::iterator it, const Char* cmp) {
...
@@ -98,12 +98,12 @@ bool is_substr(const String& s, String::iterator it, const Char* cmp) {
String
capitalize
(
const
String
&
s
)
{
String
capitalize
(
const
String
&
s
)
{
String
result
=
s
;
String
result
=
s
;
bool
after
S
pace
=
true
;
bool
after
_s
pace
=
true
;
FOR_EACH_IT
(
it
,
result
)
{
FOR_EACH_IT
(
it
,
result
)
{
if
(
*
it
==
' '
)
{
if
(
*
it
==
_
(
' '
)
||
*
it
==
_
(
'/'
)
)
{
after
S
pace
=
true
;
after
_s
pace
=
true
;
}
else
if
(
after
S
pace
)
{
}
else
if
(
after
_s
pace
)
{
after
S
pace
=
false
;
after
_s
pace
=
false
;
if
(
it
!=
s
.
begin
()
&&
if
(
it
!=
s
.
begin
()
&&
(
is_substr
(
result
,
it
,
_
(
"is "
))
||
is_substr
(
result
,
it
,
_
(
"the "
))
||
(
is_substr
(
result
,
it
,
_
(
"is "
))
||
is_substr
(
result
,
it
,
_
(
"the "
))
||
is_substr
(
result
,
it
,
_
(
"in "
))
||
is_substr
(
result
,
it
,
_
(
"of "
))
||
is_substr
(
result
,
it
,
_
(
"in "
))
||
is_substr
(
result
,
it
,
_
(
"of "
))
||
...
...
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