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
f07494b6
Commit
f07494b6
authored
Jan 10, 2009
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
check for duplicate pack names
don't allow a new pack to be 'removed'
parent
e49204da
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
7 deletions
+34
-7
data/en.mse-locale/locale
data/en.mse-locale/locale
+5
-0
src/gui/set/random_pack_panel.cpp
src/gui/set/random_pack_panel.cpp
+27
-6
src/resource/common/expected_locale_keys
src/resource/common/expected_locale_keys
+2
-1
No files found.
data/en.mse-locale/locale
View file @
f07494b6
...
...
@@ -779,6 +779,11 @@ error:
#
Stats
panel
dimension
not
found
:
There
is
no
statistics
dimension
'%s'
#
Random
packs
pack
type
duplicate
name
:
There
is
already
a
pack
type
named
'%s'
.
Please
choose
a
different
name
.
#
Package
update
window
#
checking
updates
:
Checking
for
updates
.
can
't download installer:
...
...
src/gui/set/random_pack_panel.cpp
View file @
f07494b6
...
...
@@ -297,7 +297,7 @@ void PackAmountPicker::destroy(wxFlexGridSizer* sizer) {
class
CustomPackDialog
:
public
wxDialog
{
public:
CustomPackDialog
(
Window
*
parent
,
const
SetP
&
set
,
const
PackTypeP
&
edited_pack
);
CustomPackDialog
(
Window
*
parent
,
const
SetP
&
set
,
const
PackTypeP
&
edited_pack
,
bool
can_remove
);
PackTypeP
get
()
const
{
return
edited_pack
;
}
private:
DECLARE_EVENT_TABLE
();
...
...
@@ -314,16 +314,19 @@ class CustomPackDialog : public wxDialog {
void
onAmountChange
(
wxSpinEvent
&
);
void
onOk
(
wxCommandEvent
&
);
void
onRemove
(
wxCommandEvent
&
);
bool
isDuplicateName
(
const
String
&
name
);
};
CustomPackDialog
::
CustomPackDialog
(
Window
*
parent
,
const
SetP
&
set
,
const
PackTypeP
&
edited_pack
)
CustomPackDialog
::
CustomPackDialog
(
Window
*
parent
,
const
SetP
&
set
,
const
PackTypeP
&
edited_pack
,
bool
can_remove
)
:
wxDialog
(
parent
,
wxID_ANY
,
_TITLE_
(
"custom pack"
),
wxDefaultPosition
,
wxSize
(
500
,
500
))
,
set
(
set
),
edited_pack
(
edited_pack
)
{
// init ui
totals
=
new
PackTotalsPanel
(
this
,
wxID_ANY
,
generator
,
true
);
name
=
new
wxTextCtrl
(
this
,
wxID_ANY
,
edited_pack
?
edited_pack
->
name
:
_
(
"custom pack"
));
wxButton
*
remove
=
new
wxButton
(
this
,
ID_REMOVE_ITEM
,
_BUTTON_
(
"remove item"
));
wxButton
*
remove
=
can_remove
?
new
wxButton
(
this
,
ID_REMOVE_ITEM
,
_BUTTON_
(
"remove item"
))
:
nullptr
;
// init sizer
wxSizer
*
s
=
new
wxBoxSizer
(
wxVERTICAL
);
wxSizer
*
s2
=
new
wxStaticBoxSizer
(
wxHORIZONTAL
,
this
,
_LABEL_
(
"pack name"
));
...
...
@@ -341,7 +344,9 @@ CustomPackDialog::CustomPackDialog(Window* parent, const SetP& set, const PackTy
s3
->
Add
(
s5
,
1
,
wxEXPAND
|
wxLEFT
,
8
);
s
->
Add
(
s3
,
0
,
wxEXPAND
|
wxALL
&
~
wxTOP
,
8
);
wxSizer
*
s6
=
new
wxBoxSizer
(
wxHORIZONTAL
);
s6
->
Add
(
remove
,
0
,
wxALL
&
~
wxTOP
&
~
wxRIGHT
,
8
);
if
(
can_remove
)
{
s6
->
Add
(
remove
,
0
,
wxALL
&
~
wxTOP
&
~
wxRIGHT
,
8
);
}
s6
->
Add
(
CreateButtonSizer
(
wxOK
|
wxCANCEL
),
1
,
wxALL
&
~
wxTOP
,
8
);
s
->
Add
(
s6
,
0
,
wxEXPAND
);
// add spin controls
...
...
@@ -393,7 +398,23 @@ void CustomPackDialog::storePack() {
}
}
bool
CustomPackDialog
::
isDuplicateName
(
const
String
&
name
)
{
FOR_EACH_CONST
(
pack
,
set
->
game
->
pack_types
)
{
if
(
pack
->
name
==
name
)
return
true
;
}
FOR_EACH_CONST
(
pack
,
set
->
pack_types
)
{
if
(
pack
->
name
==
name
)
return
true
;
}
return
false
;
}
void
CustomPackDialog
::
onOk
(
wxCommandEvent
&
)
{
// check for duplicates
if
(
isDuplicateName
(
name
->
GetValue
()))
{
wxMessageBox
(
_ERROR_1_
(
"pack type duplicate name"
,
name
->
GetValue
()),
_TITLE_
(
"custom pack"
),
wxOK
|
wxICON_EXCLAMATION
);
return
;
}
// done
storePack
();
EndModal
(
wxID_OK
);
}
...
...
@@ -579,7 +600,7 @@ void RandomPackPanel::onCommand(int id) {
break
;
}
case
ID_CUSTOM_PACK
:
{
CustomPackDialog
dlg
(
this
,
set
,
PackTypeP
());
CustomPackDialog
dlg
(
this
,
set
,
PackTypeP
()
,
false
);
if
(
dlg
.
ShowModal
()
==
wxID_OK
)
{
set
->
actions
.
addAction
(
new
AddPackAction
(
ADD
,
*
set
,
dlg
.
get
())
);
}
...
...
@@ -591,7 +612,7 @@ void RandomPackPanel::onPackTypeClick(wxCommandEvent& ev) {
FOR_EACH
(
pick
,
pickers
)
{
if
(
pick
.
label
==
ev
.
GetEventObject
())
{
// edit this pack type
CustomPackDialog
dlg
(
this
,
set
,
pick
.
pack
);
CustomPackDialog
dlg
(
this
,
set
,
pick
.
pack
,
true
);
if
(
dlg
.
ShowModal
()
==
wxID_OK
)
{
if
(
dlg
.
get
())
{
// update pack
...
...
src/resource/common/expected_locale_keys
View file @
f07494b6
#
This
file
contains
the
keys
expected
to
be
in
MSE
locales
#
It
was
automatically
generated
by
tools
/
locale
/
locale
.
pl
#
Generated
on
Sat
Jan
10
02
:
30
:
34
2009
#
Generated
on
Sat
Jan
10
02
:
51
:
15
2009
action
:
add
control
point
:
0
...
...
@@ -124,6 +124,7 @@ error:
no
stylesheet
specified
for
the
set
:
0
no
updates
:
0
pack
item
not
found
:
1
pack
type
duplicate
name
:
1
pack
type
not
found
:
1
package
not
found
:
1
package
out
of
date
:
3
...
...
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