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
8329d144
Commit
8329d144
authored
Jul 07, 2007
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added identifying field to set, show set name in window title.
parent
763d4ed7
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
57 additions
and
5 deletions
+57
-5
data/en.mse-locale/locale
data/en.mse-locale/locale
+9
-0
src/data/set.cpp
src/data/set.cpp
+16
-0
src/data/set.hpp
src/data/set.hpp
+4
-0
src/gui/set/window.cpp
src/gui/set/window.cpp
+26
-5
src/gui/set/window.hpp
src/gui/set/window.hpp
+2
-0
No files found.
data/en.mse-locale/locale
View file @
8329d144
...
...
@@ -354,6 +354,12 @@ label:
#
Open
dialogs
all
files
All
files
#
Other
set
window
dialogs
save
changes
:
The
set
'%s'
has
changed
.
Do
you
want
to
save
the
changes
?
#
New
set
window
game
type
:
&
Game
type
:
style
type
:
&
Card
style
:
...
...
@@ -451,6 +457,8 @@ button:
##############################################################
Titles
in
the
GUI
title
:
magic
set
editor
:
Magic
Set
Editor
%
s
-
magic
set
editor
:
%
s
-
Magic
Set
Editor
untitled
:
Untitled
about
:
About
Magic
Set
Editor
symbol
editor
:
Symbol
Editor
#
dialogs
...
...
@@ -458,6 +466,7 @@ title:
save
set
:
Save
Set
As
save
image
:
Save
Image
updates
availible
:
Updates
Availible
save
changes
:
Save
Changes
?
#
preferences
preferences
:
Preferences
global
:
Global
...
...
src/data/set.cpp
View file @
8329d144
...
...
@@ -99,6 +99,22 @@ IndexMap<FieldP, ValueP>& Set::stylingDataFor(const CardP& card) {
else
return
stylingDataFor
(
stylesheetFor
(
card
));
}
String
Set
::
identification
()
const
{
// an identifying field
FOR_EACH_CONST
(
v
,
data
)
{
if
(
v
->
fieldP
->
identifying
)
{
return
v
->
toString
();
}
}
// otherwise the first field
if
(
!
data
.
empty
())
{
return
data
.
at
(
0
)
->
toString
();
}
else
{
return
wxEmptyString
;
}
}
String
Set
::
typeName
()
const
{
return
_
(
"set"
);
}
// fix values for versions < 0.2.7
...
...
src/data/set.hpp
View file @
8329d144
...
...
@@ -89,6 +89,10 @@ class Set : public Packaged {
/// Styling information for a particular card
IndexMap
<
FieldP
,
ValueP
>&
stylingDataFor
(
const
CardP
&
card
);
/// Get the identification of this set, an identification is something like a name, title, etc.
/** May return "" */
String
identification
()
const
;
/// Find a value in the data by name and type
template
<
typename
T
>
T
&
value
(
const
String
&
name
)
{
for
(
IndexMap
<
FieldP
,
ValueP
>::
iterator
it
=
data
.
begin
()
;
it
!=
data
.
end
()
;
++
it
)
{
...
...
src/gui/set/window.cpp
View file @
8329d144
...
...
@@ -32,6 +32,7 @@
#include <data/card.hpp>
#include <data/settings.hpp>
#include <data/format/formats.hpp>
#include <data/action/value.hpp>
#include <data/action/set.hpp>
DECLARE_TYPEOF_COLLECTION
(
SetWindowPanel
*
);
...
...
@@ -232,6 +233,8 @@ bool SetWindow::isOnlyWithSet() {
// ----------------------------------------------------------------------------- : Set actions
void
SetWindow
::
onChangeSet
()
{
// window title
updateTitle
();
// make sure there is always at least one card
// some things need this
if
(
set
->
cards
.
empty
())
set
->
cards
.
push_back
(
new_intrusive1
<
Card
>
(
*
set
->
game
));
...
...
@@ -247,6 +250,11 @@ void SetWindow::onChangeSet() {
}
void
SetWindow
::
onAction
(
const
Action
&
action
,
bool
undone
)
{
TYPE_CASE
(
action
,
ValueAction
)
{
if
(
set
->
data
.
contains
(
action
.
valueP
)
&&
action
.
valueP
->
fieldP
->
identifying
)
{
updateTitle
();
}
}
/* TYPE_CASE_(action, DisplayChangeAction) {
// The style changed, maybe also the size of card viewers
if (current_panel) current_panel->Layout();
...
...
@@ -254,8 +262,20 @@ void SetWindow::onAction(const Action& action, bool undone) {
}
*/
}
void
SetWindow
::
updateTitle
()
{
if
(
!
set
)
{
SetTitle
(
_TITLE_
(
"magic set editor"
));
}
else
{
String
identification
=
set
->
identification
();
if
(
identification
.
empty
())
identification
=
set
->
name
();
if
(
identification
.
empty
())
identification
=
_TITLE_
(
"untitled"
);
set
->
short_name
=
identification
;
SetTitle
(
format_string
(
_TITLE_
(
"%s - magic set editor"
),
identification
));
}
}
void
SetWindow
::
onCardSelect
(
CardSelectEvent
&
ev
)
{
FOR_EACH
(
p
,
panels
)
{
p
->
selectCard
(
ev
.
card
);
...
...
@@ -297,13 +317,13 @@ void SetWindow::onClose(wxCloseEvent& ev) {
bool
SetWindow
::
askSaveAndContinue
()
{
if
(
set
->
actions
.
atSavePoint
())
return
true
;
// todo : if more then one window has the set selected it's ok to proceed
int
save
=
wxMessageBox
(
_
(
"The set has changed
\n\n
Do you want to save the changes?"
),
_
(
"S
ave changes"
),
wxYES_NO
|
wxCANCEL
|
wxICON_EXCLAMATION
);
int
save
=
wxMessageBox
(
format_string
(
_LABEL_
(
"save changes"
),
set
->
short_name
),
_TITLE_
(
"s
ave changes"
),
wxYES_NO
|
wxCANCEL
|
wxICON_EXCLAMATION
);
if
(
save
==
wxYES
)
{
// save the set
try
{
if
(
set
->
needSaveAs
())
{
// need save as
wxFileDialog
dlg
(
this
,
_
(
"Save a set"
),
_
(
""
),
_
(
""
)
,
export_formats
(
*
set
->
game
),
wxSAVE
|
wxOVERWRITE_PROMPT
);
wxFileDialog
dlg
(
this
,
_
TITLE_
(
"save set"
),
_
(
""
),
set
->
short_name
,
export_formats
(
*
set
->
game
),
wxSAVE
|
wxOVERWRITE_PROMPT
);
if
(
dlg
.
ShowModal
()
==
wxID_OK
)
{
export_set
(
*
set
,
dlg
.
GetPath
(),
dlg
.
GetFilterIndex
());
return
true
;
...
...
@@ -422,9 +442,10 @@ void SetWindow::onFileSave(wxCommandEvent& ev) {
}
void
SetWindow
::
onFileSaveAs
(
wxCommandEvent
&
)
{
wxFileDialog
dlg
(
this
,
_TITLE_
(
"save set"
),
_
(
""
),
_
(
""
)
,
export_formats
(
*
set
->
game
),
wxSAVE
|
wxOVERWRITE_PROMPT
);
wxFileDialog
dlg
(
this
,
_TITLE_
(
"save set"
),
_
(
""
),
set
->
short_name
,
export_formats
(
*
set
->
game
),
wxSAVE
|
wxOVERWRITE_PROMPT
);
if
(
dlg
.
ShowModal
()
==
wxID_OK
)
{
export_set
(
*
set
,
dlg
.
GetPath
(),
dlg
.
GetFilterIndex
());
updateTitle
();
// title may depend on filename
}
}
...
...
src/gui/set/window.hpp
View file @
8329d144
...
...
@@ -80,6 +80,8 @@ class SetWindow : public wxFrame, public SetView {
// minSize = mainSizer->getMinWindowSize(this)
// but wx made that private
void
fixMinWindowSize
();
/// Update the window title based on the set name
void
updateTitle
();
// --------------------------------------------------- : Window events - close
...
...
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