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
54d7eee5
Commit
54d7eee5
authored
Dec 10, 2006
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed update ui for NewWindow
parent
8b48cbfc
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
39 additions
and
48 deletions
+39
-48
src/data/format/mse1.cpp
src/data/format/mse1.cpp
+1
-3
src/data/format/mse2.cpp
src/data/format/mse2.cpp
+1
-0
src/data/set.cpp
src/data/set.cpp
+6
-2
src/gui/control/gallery_list.hpp
src/gui/control/gallery_list.hpp
+1
-0
src/gui/control/package_list.cpp
src/gui/control/package_list.cpp
+1
-0
src/gui/new_window.cpp
src/gui/new_window.cpp
+22
-31
src/gui/new_window.hpp
src/gui/new_window.hpp
+3
-8
src/main.cpp
src/main.cpp
+4
-4
No files found.
src/data/format/mse1.cpp
View file @
54d7eee5
...
@@ -45,9 +45,7 @@ SetP MSE1FileFormat::importSet(const String& filename) {
...
@@ -45,9 +45,7 @@ SetP MSE1FileFormat::importSet(const String& filename) {
wxTextInputStream
file
(
f
);
wxTextInputStream
file
(
f
);
#endif
#endif
// create set
// create set
SetP
set
(
new
Set
);
SetP
set
(
new
Set
(
Game
::
byName
(
_
(
"magic"
))));
set
->
game
=
Game
::
byName
(
_
(
"magic"
));
set
->
data
.
init
(
set
->
game
->
set_fields
);
// file version check
// file version check
String
format
=
file
.
ReadLine
();
String
format
=
file
.
ReadLine
();
...
...
src/data/format/mse2.cpp
View file @
54d7eee5
...
@@ -26,6 +26,7 @@ class MSE2FileFormat : public FileFormat {
...
@@ -26,6 +26,7 @@ class MSE2FileFormat : public FileFormat {
return
set
;
return
set
;
}
}
virtual
void
exportSet
(
Set
&
set
,
const
String
&
filename
)
{
virtual
void
exportSet
(
Set
&
set
,
const
String
&
filename
)
{
settings
.
addRecentFile
(
filename
);
set
.
saveAs
(
filename
);
set
.
saveAs
(
filename
);
set
.
actions
.
setSavePoint
();;
set
.
actions
.
setSavePoint
();;
}
}
...
...
src/data/set.cpp
View file @
54d7eee5
...
@@ -31,13 +31,17 @@ Set::Set()
...
@@ -31,13 +31,17 @@ Set::Set()
Set
::
Set
(
const
GameP
&
game
)
Set
::
Set
(
const
GameP
&
game
)
:
game
(
game
)
:
game
(
game
)
,
script_manager
(
new
ScriptManager
(
*
this
))
,
script_manager
(
new
ScriptManager
(
*
this
))
{}
{
data
.
init
(
game
->
set_fields
);
}
Set
::
Set
(
const
StyleSheetP
&
stylesheet
)
Set
::
Set
(
const
StyleSheetP
&
stylesheet
)
:
stylesheet
(
stylesheet
)
:
stylesheet
(
stylesheet
)
,
game
(
stylesheet
->
game
)
,
game
(
stylesheet
->
game
)
,
script_manager
(
new
ScriptManager
(
*
this
))
,
script_manager
(
new
ScriptManager
(
*
this
))
{}
{
data
.
init
(
game
->
set_fields
);
}
Set
::~
Set
()
{}
Set
::~
Set
()
{}
...
...
src/gui/control/gallery_list.hpp
View file @
54d7eee5
...
@@ -64,6 +64,7 @@ class GalleryList : public wxScrolledWindow {
...
@@ -64,6 +64,7 @@ class GalleryList : public wxScrolledWindow {
size_t
findItem
(
const
wxMouseEvent
&
)
const
;
size_t
findItem
(
const
wxMouseEvent
&
)
const
;
/// Find the coordinates of an item
/// Find the coordinates of an item
RealPoint
itemPos
(
size_t
item
)
const
;
RealPoint
itemPos
(
size_t
item
)
const
;
protected:
/// Send an event
/// Send an event
void
sendEvent
(
WXTYPE
type
);
void
sendEvent
(
WXTYPE
type
);
};
};
...
...
src/gui/control/package_list.cpp
View file @
54d7eee5
...
@@ -87,6 +87,7 @@ void PackageList::select(const String& name) {
...
@@ -87,6 +87,7 @@ void PackageList::select(const String& name) {
if
(
it
->
package
->
name
()
==
name
)
{
if
(
it
->
package
->
name
()
==
name
)
{
selection
=
it
-
packages
.
begin
();
selection
=
it
-
packages
.
begin
();
update
();
update
();
sendEvent
(
EVENT_GALLERY_SELECT
);
return
;
return
;
}
}
}
}
...
...
src/gui/new_window.cpp
View file @
54d7eee5
...
@@ -30,8 +30,8 @@ NewSetWindow::NewSetWindow(Window* parent)
...
@@ -30,8 +30,8 @@ NewSetWindow::NewSetWindow(Window* parent)
// init controls
// init controls
game_list
=
new
PackageList
(
this
,
ID_GAME_LIST
);
game_list
=
new
PackageList
(
this
,
ID_GAME_LIST
);
stylesheet_list
=
new
PackageList
(
this
,
ID_STYLESHEET_LIST
);
stylesheet_list
=
new
PackageList
(
this
,
ID_STYLESHEET_LIST
);
game_text
=
new
wxStaticText
(
this
,
wxID_ANY
,
_
(
"&Game type:"
));
game_text
=
new
wxStaticText
(
this
,
ID_GAME_LIST
,
_
(
"&Game type:"
));
stylesheet_text
=
new
wxStaticText
(
this
,
wxID_ANY
,
_
(
"&Card style:"
));
stylesheet_text
=
new
wxStaticText
(
this
,
ID_STYLESHEET_LIST
,
_
(
"&Card style:"
));
// init sizer
// init sizer
wxSizer
*
s
=
new
wxBoxSizer
(
wxVERTICAL
);
wxSizer
*
s
=
new
wxBoxSizer
(
wxVERTICAL
);
s
->
Add
(
game_text
,
0
,
wxALL
,
4
);
s
->
Add
(
game_text
,
0
,
wxALL
,
4
);
...
@@ -41,24 +41,12 @@ NewSetWindow::NewSetWindow(Window* parent)
...
@@ -41,24 +41,12 @@ NewSetWindow::NewSetWindow(Window* parent)
s
->
Add
(
CreateButtonSizer
(
wxOK
|
wxCANCEL
)
,
0
,
wxEXPAND
|
wxALL
,
8
);
s
->
Add
(
CreateButtonSizer
(
wxOK
|
wxCANCEL
)
,
0
,
wxEXPAND
|
wxALL
,
8
);
s
->
SetSizeHints
(
this
);
s
->
SetSizeHints
(
this
);
SetSizer
(
s
);
SetSizer
(
s
);
// disable stuff
ok_button
=
FindWindow
(
wxID_OK
);
assert
(
ok_button
);
enableStyle
(
false
);
// force refresh of gameList, otherwise a grey background shows (win XP)
// force refresh of gameList, otherwise a grey background shows (win XP)
SetSize
(
wxSize
(
530
,
320
));
SetSize
(
wxSize
(
530
,
320
));
// init lists
// init lists
game_list
->
showData
<
Game
>
();
game_list
->
showData
<
Game
>
();
game_list
->
select
(
settings
.
default_game
);
game_list
->
select
(
settings
.
default_game
);
}
UpdateWindowUI
(
wxUPDATE_UI_RECURSE
);
void
NewSetWindow
::
enableStyle
(
bool
e
)
{
stylesheet_list
->
Enable
(
e
);
stylesheet_text
->
Enable
(
e
);
if
(
!
e
)
enableOk
(
e
);
}
void
NewSetWindow
::
enableOk
(
bool
e
)
{
ok_button
->
Enable
(
e
);
}
}
void
NewSetWindow
::
onGameSelect
(
wxCommandEvent
&
)
{
void
NewSetWindow
::
onGameSelect
(
wxCommandEvent
&
)
{
...
@@ -67,25 +55,17 @@ void NewSetWindow::onGameSelect(wxCommandEvent&) {
...
@@ -67,25 +55,17 @@ void NewSetWindow::onGameSelect(wxCommandEvent&) {
GameSettings
&
gs
=
settings
.
gameSettingsFor
(
*
game
);
GameSettings
&
gs
=
settings
.
gameSettingsFor
(
*
game
);
stylesheet_list
->
showData
<
StyleSheet
>
(
game
->
name
()
+
_
(
"-*"
));
stylesheet_list
->
showData
<
StyleSheet
>
(
game
->
name
()
+
_
(
"-*"
));
stylesheet_list
->
select
(
gs
.
default_stylesheet
);
stylesheet_list
->
select
(
gs
.
default_stylesheet
);
enableStyle
(
true
);
UpdateWindowUI
(
wxUPDATE_UI_RECURSE
);
}
/*void NewSetWindow::onGameDeselect(wxCommandEvent&) {
stylesheet_list->clear();
enableStyle(false);
}
}
*/
void
NewSetWindow
::
onStyleSheetSelect
(
wxCommandEvent
&
)
{
void
NewSetWindow
::
onStyleSheetSelect
(
wxCommandEvent
&
)
{
enableOk
(
true
);
// store this as default selection
// store this as default selection
GameP
game
=
game_list
->
getSelection
<
Game
>
();
GameP
game
=
game_list
->
getSelection
<
Game
>
();
StyleSheetP
stylesheet
=
stylesheet_list
->
getSelection
<
StyleSheet
>
();
StyleSheetP
stylesheet
=
stylesheet_list
->
getSelection
<
StyleSheet
>
();
GameSettings
&
gs
=
settings
.
gameSettingsFor
(
*
game
);
GameSettings
&
gs
=
settings
.
gameSettingsFor
(
*
game
);
gs
.
default_stylesheet
=
stylesheet
->
name
();
gs
.
default_stylesheet
=
stylesheet
->
name
();
UpdateWindowUI
(
wxUPDATE_UI_RECURSE
);
}
}
/*void NewSetWindow::onStyleSheetDeselect(wxCommandEvent&) {
enableOk(false);
}
*/
void
NewSetWindow
::
onStyleSheetActivate
(
wxCommandEvent
&
)
{
void
NewSetWindow
::
onStyleSheetActivate
(
wxCommandEvent
&
)
{
done
();
done
();
}
}
...
@@ -101,10 +81,21 @@ void NewSetWindow::done() {
...
@@ -101,10 +81,21 @@ void NewSetWindow::done() {
EndModal
(
wxID_OK
);
EndModal
(
wxID_OK
);
}
}
void
NewSetWindow
::
onUpdateUI
(
wxUpdateUIEvent
&
ev
)
{
switch
(
ev
.
GetId
())
{
case
ID_STYLESHEET_LIST
:
ev
.
Enable
(
game_list
->
hasSelection
());
break
;
case
wxID_OK
:
ev
.
Enable
(
stylesheet_list
->
hasSelection
());
break
;
}
}
BEGIN_EVENT_TABLE
(
NewSetWindow
,
wxDialog
)
BEGIN_EVENT_TABLE
(
NewSetWindow
,
wxDialog
)
EVT_GALLERY_SELECT
(
ID_GAME_LIST
,
NewSetWindow
::
onGameSelect
)
EVT_GALLERY_SELECT
(
ID_GAME_LIST
,
NewSetWindow
::
onGameSelect
)
// EVT_LIST_ITEM_DESELECTED (ID_GAME_LIST, NewSetWindow::onGameDeselect)
EVT_GALLERY_SELECT
(
ID_STYLESHEET_LIST
,
NewSetWindow
::
onStyleSheetSelect
)
EVT_GALLERY_SELECT
(
ID_STYLESHEET_LIST
,
NewSetWindow
::
onStyleSheetSelect
)
// EVT_LIST_ITEM_DESELECTED (ID_STYLESHEET_LIST, NewSetWindow::onStyleDeselect)
EVT_GALLERY_ACTIVATE
(
ID_STYLESHEET_LIST
,
NewSetWindow
::
onStyleSheetActivate
)
EVT_GALLERY_ACTIVATE
(
ID_STYLESHEET_LIST
,
NewSetWindow
::
onStyleSheetActivate
)
EVT_BUTTON
(
wxID_OK
,
NewSetWindow
::
OnOK
)
EVT_UPDATE_UI
(
wxID_ANY
,
NewSetWindow
::
onUpdateUI
)
END_EVENT_TABLE
()
END_EVENT_TABLE
()
src/gui/new_window.hpp
View file @
54d7eee5
...
@@ -36,22 +36,17 @@ class NewSetWindow : public wxDialog {
...
@@ -36,22 +36,17 @@ class NewSetWindow : public wxDialog {
wxStaticText
*
game_text
,
*
stylesheet_text
;
wxStaticText
*
game_text
,
*
stylesheet_text
;
Window
*
ok_button
;
Window
*
ok_button
;
// --------------------------------------------------- : enabling stuff
void
enableStyle
(
bool
e
);
void
enableOk
(
bool
e
);
// --------------------------------------------------- : events
// --------------------------------------------------- : events
void
onGameSelect
(
wxCommandEvent
&
);
void
onGameSelect
(
wxCommandEvent
&
);
// void onGameDeselect(wxCommandEvent&);
void
onStyleSheetSelect
(
wxCommandEvent
&
);
void
onStyleSheetSelect
(
wxCommandEvent
&
);
// void onStyleSheetDeselect(wxCommandEvent&);
void
onStyleSheetActivate
(
wxCommandEvent
&
);
void
onStyleSheetActivate
(
wxCommandEvent
&
);
virtual
void
OnOK
(
wxCommandEvent
&
);
virtual
void
OnOK
(
wxCommandEvent
&
);
void
onUpdateUI
(
wxUpdateUIEvent
&
);
// we are done, close the window
// we are done, close the window
void
done
();
void
done
();
};
};
...
...
src/main.cpp
View file @
54d7eee5
...
@@ -49,10 +49,10 @@ bool MSE::OnInit() {
...
@@ -49,10 +49,10 @@ bool MSE::OnInit() {
check_updates
();
check_updates
();
//Window* wnd = new SymbolWindow(nullptr);
//Window* wnd = new SymbolWindow(nullptr);
//GameP g = Game::byName(_("magic"))
//GameP g = Game::byName(_("magic"))
SetP
s
=
new_shared
<
Set
>
();
//
SetP s = new_shared<Set>();
s
->
open
(
_
(
"test.mse-set"
));
//
s->open(_("test.mse-set"));
Window
*
wnd
=
new
SetWindow
(
nullptr
,
s
);
//
Window* wnd = new SetWindow(nullptr, s);
//
Window* wnd = new WelcomeWindow();
Window
*
wnd
=
new
WelcomeWindow
();
wnd
->
Show
();
wnd
->
Show
();
return
true
;
return
true
;
...
...
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