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
4722cdb2
Commit
4722cdb2
authored
Dec 25, 2006
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
separate short_name for packages, moved full_name,short_name and icon_filename to Packaged
parent
faeb0888
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
41 additions
and
63 deletions
+41
-63
src/data/game.cpp
src/data/game.cpp
+3
-14
src/data/game.hpp
src/data/game.hpp
+0
-4
src/data/locale.cpp
src/data/locale.cpp
+1
-1
src/data/locale.hpp
src/data/locale.hpp
+0
-2
src/data/stylesheet.cpp
src/data/stylesheet.cpp
+1
-16
src/data/stylesheet.hpp
src/data/stylesheet.hpp
+0
-5
src/gui/control/package_list.cpp
src/gui/control/package_list.cpp
+5
-5
src/gui/control/package_list.hpp
src/gui/control/package_list.hpp
+4
-4
src/mse.vcproj
src/mse.vcproj
+1
-1
src/util/io/package.cpp
src/util/io/package.cpp
+15
-4
src/util/io/package.hpp
src/util/io/package.hpp
+9
-5
src/util/io/package_manager.cpp
src/util/io/package_manager.cpp
+2
-2
No files found.
src/data/game.cpp
View file @
4722cdb2
...
...
@@ -36,18 +36,8 @@ bool Game::isMagic() const {
String
Game
::
typeNameStatic
()
{
return
_
(
"game"
);
}
String
Game
::
typeName
()
const
{
return
_
(
"game"
);
}
String
Game
::
fullName
()
const
{
return
full_name
;
}
InputStreamP
Game
::
openIconFile
()
{
if
(
!
icon_filename
.
empty
())
{
return
openIn
(
icon_filename
);
}
else
{
return
InputStreamP
();
}
}
IMPLEMENT_REFLECTION
(
Game
)
{
REFLECT
(
full_name
);
REFLECT_N
(
"icon"
,
icon_filename
);
REFLECT_BASE
(
Packaged
);
REFLECT
(
init_script
);
REFLECT
(
set_fields
);
REFLECT
(
card_fields
);
...
...
@@ -59,9 +49,8 @@ IMPLEMENT_REFLECTION(Game) {
// REFLECT(word_lists);
}
void
Game
::
validate
(
Version
)
{
// a default for the full name
if
(
full_name
.
empty
())
full_name
=
name
();
void
Game
::
validate
(
Version
v
)
{
Packaged
::
validate
(
v
);
// automatic statistics dimensions
{
vector
<
StatsDimensionP
>
dims
;
...
...
src/data/game.hpp
View file @
4722cdb2
...
...
@@ -33,8 +33,6 @@ class Game : public Packaged {
public:
Game
();
String
full_name
;
///< Name of this game, for menus etc.
String
icon_filename
;
///< Filename of icon to use in NewWindow
OptionalScript
init_script
;
///< Script of variables available to other scripts in this game
vector
<
FieldP
>
set_fields
;
///< Fields for set information
vector
<
FieldP
>
card_fields
;
///< Fields on each card
...
...
@@ -57,8 +55,6 @@ class Game : public Packaged {
static
String
typeNameStatic
();
virtual
String
typeName
()
const
;
virtual
String
fullName
()
const
;
virtual
InputStreamP
openIconFile
();
protected:
virtual
void
validate
(
Version
);
...
...
src/data/locale.cpp
View file @
4722cdb2
...
...
@@ -21,7 +21,7 @@ LocaleP Locale::byName(const String& name) {
}
IMPLEMENT_REFLECTION
(
Locale
)
{
REFLECT
(
full_name
);
REFLECT
_BASE
(
Packaged
);
REFLECT_N
(
"menu"
,
translations
[
LOCALE_CAT_MENU
]);
REFLECT_N
(
"help"
,
translations
[
LOCALE_CAT_HELP
]);
REFLECT_N
(
"tool"
,
translations
[
LOCALE_CAT_TOOL
]);
...
...
src/data/locale.hpp
View file @
4722cdb2
...
...
@@ -29,8 +29,6 @@ class GameLocale {
/// A collection of translations of messages
class
Locale
:
public
Packaged
{
public:
/// Name of this locale
String
full_name
;
/// Translations of UI strings in each category
map
<
String
,
String
>
translations
[
LOCALE_CAT_MAX
];
/// Translations of game specific texts, by game name
...
...
src/data/stylesheet.cpp
View file @
4722cdb2
...
...
@@ -36,15 +36,6 @@ String StyleSheet::stylesheetName() const {
String
StyleSheet
::
typeNameStatic
()
{
return
_
(
"style"
);
}
String
StyleSheet
::
typeName
()
const
{
return
_
(
"style"
);
}
String
StyleSheet
::
fullName
()
const
{
return
full_name
;
}
InputStreamP
StyleSheet
::
openIconFile
()
{
if
(
!
icon_filename
.
empty
())
{
return
openIn
(
icon_filename
);
}
else
{
return
game
->
openIconFile
();
// use game icon by default
}
}
StyleP
StyleSheet
::
styleFor
(
const
FieldP
&
field
)
{
if
(
card_style
.
containsKey
(
field
))
{
return
card_style
[
field
];
...
...
@@ -70,8 +61,7 @@ IMPLEMENT_REFLECTION(StyleSheet) {
tag
.
addAlias
(
300
,
_
(
"extra style"
),
_
(
"styling style"
));
REFLECT
(
game
);
REFLECT
(
full_name
);
REFLECT_N
(
"icon"
,
icon_filename
);
REFLECT_BASE
(
Packaged
);
REFLECT
(
init_script
);
REFLECT
(
card_width
);
REFLECT
(
card_height
);
...
...
@@ -90,11 +80,6 @@ IMPLEMENT_REFLECTION(StyleSheet) {
REFLECT
(
styling_style
);
}
void
StyleSheet
::
validate
(
Version
)
{
// a default for the full name
if
(
full_name
.
empty
())
full_name
=
name
();
}
// special behaviour of reading/writing StyleSheetPs: only read/write the name
...
...
src/data/stylesheet.hpp
View file @
4722cdb2
...
...
@@ -27,8 +27,6 @@ class StyleSheet : public Packaged {
StyleSheet
();
GameP
game
;
///< The game this stylesheet is made for
String
full_name
;
///< Name of this game, for menus etc.
String
icon_filename
;
///< Filename of icon to use in NewWindow
OptionalScript
init_script
;
///< Script of variables available to other scripts in this stylesheet
double
card_width
;
///< The width of a card in pixels
double
card_height
;
///< The height of a card in pixels
...
...
@@ -60,11 +58,8 @@ class StyleSheet : public Packaged {
static
String
typeNameStatic
();
virtual
String
typeName
()
const
;
virtual
String
fullName
()
const
;
virtual
InputStreamP
openIconFile
();
protected:
virtual
void
validate
(
Version
);
DECLARE_REFLECTION
();
};
...
...
src/gui/control/package_list.cpp
View file @
4722cdb2
...
...
@@ -33,14 +33,14 @@ void PackageList::drawItem(DC& dc, int x, int y, size_t item, bool selected) {
}
// draw short name
dc
.
SetFont
(
wxFont
(
12
,
wxSWISS
,
wxNORMAL
,
wxBOLD
,
false
,
_
(
"Arial"
)));
dc
.
GetTextExtent
(
capitalize
(
d
.
package
->
name
()
),
&
w
,
&
h
);
dc
.
GetTextExtent
(
capitalize
(
d
.
package
->
short_name
),
&
w
,
&
h
);
pos
=
align_in_rect
(
ALIGN_CENTER
,
RealSize
(
w
,
h
),
rect
);
dc
.
DrawText
(
capitalize
(
d
.
package
->
name
()
),
pos
.
x
,
pos
.
y
+
110
);
dc
.
DrawText
(
capitalize
(
d
.
package
->
short_name
),
pos
.
x
,
pos
.
y
+
110
);
// draw name
dc
.
SetFont
(
wxSystemSettings
::
GetFont
(
wxSYS_DEFAULT_GUI_FONT
));
dc
.
GetTextExtent
(
d
.
package
->
full
Name
()
,
&
w
,
&
h
);
dc
.
GetTextExtent
(
d
.
package
->
full
_name
,
&
w
,
&
h
);
RealPoint
text_pos
=
align_in_rect
(
ALIGN_CENTER
,
RealSize
(
w
,
h
),
rect
);
dc
.
DrawText
(
d
.
package
->
full
Name
()
,
text_pos
.
x
,
text_pos
.
y
+
130
);
dc
.
DrawText
(
d
.
package
->
full
_name
,
text_pos
.
x
,
text_pos
.
y
+
130
);
}
void
PackageList
::
showData
(
const
String
&
pattern
)
{
...
...
@@ -51,7 +51,7 @@ void PackageList::showData(const String& pattern) {
while
(
!
f
.
empty
())
{
// try to open the package
// try {
PackageP
package
=
::
packages
.
openAny
(
f
);
Package
d
P
package
=
::
packages
.
openAny
(
f
);
// open image
InputStreamP
stream
=
package
->
openIconFile
();
Image
img
;
...
...
src/gui/control/package_list.hpp
View file @
4722cdb2
...
...
@@ -12,7 +12,7 @@
#include <util/prec.hpp>
#include <gui/control/gallery_list.hpp>
DECLARE_POINTER_TYPE
(
Package
);
DECLARE_POINTER_TYPE
(
Package
d
);
// ----------------------------------------------------------------------------- : PackageList
...
...
@@ -59,9 +59,9 @@ class PackageList : public GalleryList {
// Information about a package
struct
PackageData
{
PackageData
()
{}
PackageData
(
const
PackageP
&
package
,
const
Bitmap
&
image
)
:
package
(
package
),
image
(
image
)
{}
PackageP
package
;
Bitmap
image
;
PackageData
(
const
Package
d
P
&
package
,
const
Bitmap
&
image
)
:
package
(
package
),
image
(
image
)
{}
Package
d
P
package
;
Bitmap
image
;
};
/// The displayed packages
vector
<
PackageData
>
packages
;
...
...
src/mse.vcproj
View file @
4722cdb2
...
...
@@ -97,7 +97,7 @@
BufferSecurityCheck=
"FALSE"
EnableFunctionLevelLinking=
"TRUE"
RuntimeTypeInfo=
"TRUE"
UsePrecompiledHeader=
"
2
"
UsePrecompiledHeader=
"
0
"
PrecompiledHeaderThrough=
"util/prec.hpp"
PrecompiledHeaderFile=
""
AssemblerListingLocation=
"$(OutDir)"
...
...
src/util/io/package.cpp
View file @
4722cdb2
...
...
@@ -60,9 +60,6 @@ String Package::fullName() const {
const
String
&
Package
::
absoluteFilename
()
const
{
return
filename
;
}
InputStreamP
Package
::
openIconFile
()
{
return
InputStreamP
();
}
void
Package
::
open
(
const
String
&
n
)
{
...
...
@@ -408,12 +405,21 @@ String Package::toStandardName(const String& name) {
// note: reflection must be declared before it is used
IMPLEMENT_REFLECTION
(
Packaged
)
{
// default does nothing
REFLECT
(
short_name
);
REFLECT
(
full_name
);
REFLECT_N
(
"icon"
,
icon_filename
);
}
Packaged
::
Packaged
()
{
}
InputStreamP
Packaged
::
openIconFile
()
{
if
(
!
icon_filename
.
empty
())
{
return
openIn
(
icon_filename
);
}
else
{
return
InputStreamP
();
}
}
void
Packaged
::
open
(
const
String
&
package
)
{
Package
::
open
(
package
);
Reader
reader
(
openIn
(
typeName
()),
absoluteFilename
()
+
_
(
"/"
)
+
typeName
());
...
...
@@ -436,3 +442,8 @@ void Packaged::saveAs(const String& package) {
referenceFile
(
typeName
());
Package
::
saveAs
(
package
);
}
void
Packaged
::
validate
(
Version
)
{
// a default for the short name
if
(
short_name
.
empty
())
short_name
=
name
();
}
\ No newline at end of file
src/util/io/package.hpp
View file @
4722cdb2
...
...
@@ -64,10 +64,7 @@ class Package {
const
String
&
absoluteFilename
()
const
;
/// The time this package was last modified
inline
wxDateTime
lastModified
()
const
{
return
modified
;
}
/// Get an input stream for the package icon, if there is any
virtual
InputStreamP
openIconFile
();
/// Open a package, should only be called when the package is constructed using the default constructor!
/// @pre open not called before [TODO]
void
open
(
const
String
&
package
);
...
...
@@ -187,6 +184,13 @@ class Packaged : public Package {
Packaged
();
virtual
~
Packaged
()
{}
String
short_name
;
///< Short name of this package
String
full_name
;
///< Name of this package, for menus etc.
String
icon_filename
;
///< Filename of icon to use in package lists
/// Get an input stream for the package icon, if there is any
InputStreamP
openIconFile
();
/// Open a package, and read the data
void
open
(
const
String
&
package
);
void
save
();
...
...
@@ -196,7 +200,7 @@ class Packaged : public Package {
/// filename of the data file, and extension of the package file
virtual
String
typeName
()
const
=
0
;
/// Can be overloaded to do validation after loading
virtual
void
validate
(
Version
file_app_version
)
{}
virtual
void
validate
(
Version
file_app_version
)
;
DECLARE_REFLECTION_VIRTUAL
();
};
...
...
src/util/io/package_manager.cpp
View file @
4722cdb2
...
...
@@ -26,10 +26,10 @@ class IncludePackage : public Packaged {
String
IncludePackage
::
typeName
()
const
{
return
_
(
"include"
);
}
IMPLEMENT_REFLECTION
(
IncludePackage
)
{
REFLECT_BASE
(
Packaged
);
if
(
tag
.
reading
())
{
// ingore
String
full_name
,
version
;
REFLECT
(
full_name
);
String
version
;
REFLECT
(
version
);
}
}
...
...
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