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
b1ffd63f
Commit
b1ffd63f
authored
Nov 24, 2006
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added value actions for common value types; drop down list is now correctly aligned
parent
60760f6f
Changes
23
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
268 additions
and
66 deletions
+268
-66
src/data/action/value.cpp
src/data/action/value.cpp
+62
-0
src/data/action/value.hpp
src/data/action/value.hpp
+72
-0
src/data/field/choice.hpp
src/data/field/choice.hpp
+2
-1
src/data/field/color.hpp
src/data/field/color.hpp
+2
-1
src/data/field/image.hpp
src/data/field/image.hpp
+2
-1
src/data/field/symbol.hpp
src/data/field/symbol.hpp
+2
-1
src/data/field/text.hpp
src/data/field/text.hpp
+2
-1
src/gfx/color.cpp
src/gfx/color.cpp
+10
-0
src/gfx/gfx.hpp
src/gfx/gfx.hpp
+3
-0
src/gui/control/card_viewer.cpp
src/gui/control/card_viewer.cpp
+5
-1
src/gui/control/card_viewer.hpp
src/gui/control/card_viewer.hpp
+0
-1
src/gui/control/gallery_list.cpp
src/gui/control/gallery_list.cpp
+1
-1
src/gui/control/native_look_editor.cpp
src/gui/control/native_look_editor.cpp
+5
-1
src/gui/control/native_look_editor.hpp
src/gui/control/native_look_editor.hpp
+1
-0
src/gui/drop_down_list.cpp
src/gui/drop_down_list.cpp
+53
-54
src/gui/drop_down_list.hpp
src/gui/drop_down_list.hpp
+3
-0
src/gui/set/window.cpp
src/gui/set/window.cpp
+1
-0
src/gui/value/color.cpp
src/gui/value/color.cpp
+2
-1
src/gui/value/editor.hpp
src/gui/value/editor.hpp
+1
-1
src/mse.vcproj
src/mse.vcproj
+30
-0
src/render/card/viewer.cpp
src/render/card/viewer.cpp
+6
-0
src/render/card/viewer.hpp
src/render/card/viewer.hpp
+2
-0
src/render/value/viewer.hpp
src/render/value/viewer.hpp
+1
-1
No files found.
src/data/action/value.cpp
0 → 100644
View file @
b1ffd63f
//+----------------------------------------------------------------------------+
//| Description: Magic Set Editor - Program to make Magic (tm) cards |
//| Copyright: (C) 2001 - 2006 Twan van Laarhoven |
//| License: GNU General Public License 2 or later (see file COPYING) |
//+----------------------------------------------------------------------------+
// ----------------------------------------------------------------------------- : Includes
#include <data/action/value.hpp>
#include <data/field.hpp>
#include <data/field/text.hpp>
#include <data/field/choice.hpp>
#include <data/field/multiple_choice.hpp>
#include <data/field/color.hpp>
#include <data/field/image.hpp>
#include <data/field/symbol.hpp>
// ----------------------------------------------------------------------------- : ValueAction
String
ValueAction
::
getName
(
bool
to_undo
)
const
{
return
_
(
"Change "
)
+
valueP
->
fieldP
->
name
;
}
// ----------------------------------------------------------------------------- : Simple
/// A ValueAction that swaps between old and new values
template
<
typename
T
,
typename
T
::
ValueType
T
::*
member
,
bool
ALLOW_MERGE
>
class
SimpleValueAction
:
public
ValueAction
{
public:
inline
SimpleValueAction
(
const
shared_ptr
<
T
>&
value
,
const
typename
T
::
ValueType
&
new_value
)
:
ValueAction
(
value
),
new_value
(
new_value
)
{}
virtual
void
perform
(
bool
to_undo
)
{
swap
(
static_cast
<
T
&>
(
*
valueP
).
*
member
,
new_value
);
}
virtual
bool
merge
(
const
Action
*
action
)
{
if
(
!
ALLOW_MERGE
)
return
false
;
if
(
const
SimpleValueAction
*
sva
=
dynamic_cast
<
const
SimpleValueAction
*>
(
action
))
{
if
(
sva
->
valueP
==
valueP
)
{
// adjacent actions on the same value, discard the other one,
// because it only keeps an intermediate value
return
true
;
}
}
else
{
return
false
;
}
return
false
;
}
private:
typename
T
::
ValueType
new_value
;
};
ValueAction
*
value_action
(
const
ChoiceValueP
&
value
,
const
Defaultable
<
String
>&
new_value
)
{
return
new
SimpleValueAction
<
ChoiceValue
,
&
ChoiceValue
::
value
,
true
>
(
value
,
new_value
);
}
ValueAction
*
value_action
(
const
ColorValueP
&
value
,
const
Defaultable
<
Color
>&
new_value
)
{
return
new
SimpleValueAction
<
ColorValue
,
&
ColorValue
::
value
,
true
>
(
value
,
new_value
);
}
ValueAction
*
value_action
(
const
ImageValueP
&
value
,
const
FileName
&
new_value
)
{
return
new
SimpleValueAction
<
ImageValue
,
&
ImageValue
::
filename
,
false
>
(
value
,
new_value
);
}
ValueAction
*
value_action
(
const
SymbolValueP
&
value
,
const
FileName
&
new_value
)
{
return
new
SimpleValueAction
<
SymbolValue
,
&
SymbolValue
::
filename
,
false
>
(
value
,
new_value
);
}
// ----------------------------------------------------------------------------- : Text
src/data/action/value.hpp
0 → 100644
View file @
b1ffd63f
//+----------------------------------------------------------------------------+
//| Description: Magic Set Editor - Program to make Magic (tm) cards |
//| Copyright: (C) 2001 - 2006 Twan van Laarhoven |
//| License: GNU General Public License 2 or later (see file COPYING) |
//+----------------------------------------------------------------------------+
#ifndef HEADER_DATA_ACTION_VALUE
#define HEADER_DATA_ACTION_VALUE
/** @file data/action/set.hpp
*
* Actions operating on Values (and derived classes, "*Value")
*/
// ----------------------------------------------------------------------------- : Includes
#include <util/prec.hpp>
#include <util/action_stack.hpp>
#include <util/defaultable.hpp>
DECLARE_POINTER_TYPE
(
Value
);
DECLARE_POINTER_TYPE
(
TextValue
);
DECLARE_POINTER_TYPE
(
ChoiceValue
);
DECLARE_POINTER_TYPE
(
ColorValue
);
DECLARE_POINTER_TYPE
(
ImageValue
);
DECLARE_POINTER_TYPE
(
SymbolValue
);
// ----------------------------------------------------------------------------- : ValueAction (based class)
/// An Action the changes a Value
class
ValueAction
:
public
Action
{
public:
inline
ValueAction
(
const
ValueP
&
value
)
:
valueP
(
value
)
{}
virtual
String
getName
(
bool
to_undo
)
const
;
const
ValueP
valueP
;
///< The modified value
};
/// Utility macro for declaring classes derived from ValueAction
#define DECLARE_VALUE_ACTION(Type) \
protected
:
\
inline
Type
##
Value
&
value
()
const
{
\
return
static_cast
<
Type
##
Value
&>
(
*
valueP
);
\
}
\
public
:
\
virtual
void
perform
(
bool
to_undo
)
// ----------------------------------------------------------------------------- : Simple
ValueAction
*
value_action
(
const
ChoiceValueP
&
value
,
const
Defaultable
<
String
>&
new_value
);
ValueAction
*
value_action
(
const
ColorValueP
&
value
,
const
Defaultable
<
Color
>&
new_value
);
ValueAction
*
value_action
(
const
ImageValueP
&
value
,
const
FileName
&
new_value
);
ValueAction
*
value_action
(
const
SymbolValueP
&
value
,
const
FileName
&
new_value
);
// ----------------------------------------------------------------------------- : Text
/*
class ColorValueAction : public ValueAction {
public:
ColorValueAction(const ColorValueP& value, const Defaultable<Color>& color);
DECLARE_VALUE_ACTION(Color);
private:
Defaultable<Color> color; ///< The new/old color
};
*/
// ----------------------------------------------------------------------------- : EOF
#endif
src/data/field/choice.hpp
View file @
b1ffd63f
...
...
@@ -143,7 +143,8 @@ class ChoiceValue : public Value {
{}
DECLARE_HAS_FIELD
(
Choice
)
Defaultable
<
String
>
value
;
/// The name of the selected choice
typedef
Defaultable
<
String
>
ValueType
;
ValueType
value
;
/// The name of the selected choice
virtual
String
toString
()
const
;
virtual
bool
update
(
Context
&
);
...
...
src/data/field/color.hpp
View file @
b1ffd63f
...
...
@@ -76,7 +76,8 @@ class ColorValue : public Value {
inline
ColorValue
(
const
ColorFieldP
&
field
)
:
Value
(
field
)
{}
DECLARE_HAS_FIELD
(
Color
)
Defaultable
<
Color
>
value
;
///< The value
typedef
Defaultable
<
Color
>
ValueType
;
ValueType
value
;
///< The value
virtual
String
toString
()
const
;
virtual
bool
update
(
Context
&
);
...
...
src/data/field/image.hpp
View file @
b1ffd63f
...
...
@@ -50,7 +50,8 @@ class ImageValue : public Value {
public:
inline
ImageValue
(
const
ImageFieldP
&
field
)
:
Value
(
field
)
{}
FileName
filename
;
///< Filename of the image (in the current package), or ""
typedef
FileName
ValueType
;
ValueType
filename
;
///< Filename of the image (in the current package), or ""
virtual
String
toString
()
const
;
...
...
src/data/field/symbol.hpp
View file @
b1ffd63f
...
...
@@ -65,7 +65,8 @@ class SymbolValue : public Value {
inline
SymbolValue
(
const
SymbolFieldP
&
field
)
:
Value
(
field
)
{}
DECLARE_HAS_FIELD
(
Symbol
)
FileName
filename
;
///< Filename of the symbol (in the current package)
typedef
FileName
ValueType
;
ValueType
filename
;
///< Filename of the symbol (in the current package)
virtual
String
toString
()
const
;
...
...
src/data/field/text.hpp
View file @
b1ffd63f
...
...
@@ -80,7 +80,8 @@ class TextValue : public Value {
inline
TextValue
(
const
TextFieldP
&
field
)
:
Value
(
field
)
{}
DECLARE_HAS_FIELD
(
Text
)
Defaultable
<
String
>
value
;
///< The text of this value
typedef
Defaultable
<
String
>
ValueType
;
ValueType
value
;
///< The text of this value
virtual
String
toString
()
const
;
virtual
bool
update
(
Context
&
);
...
...
src/gfx/color.cpp
View file @
b1ffd63f
...
...
@@ -46,3 +46,13 @@ Color darken(const Color& c) {
c
.
Blue
()
*
8
/
10
);
}
Color
saturate
(
const
Color
&
c
,
double
amount
)
{
int
r
=
c
.
Red
(),
g
=
c
.
Green
(),
b
=
c
.
Blue
();
double
l
=
(
r
+
g
+
b
)
/
3
;
return
Color
(
col
((
r
-
amount
*
l
)
/
(
1
-
amount
)),
col
((
g
-
amount
*
l
)
/
(
1
-
amount
)),
col
((
b
-
amount
*
l
)
/
(
1
-
amount
))
);
}
src/gfx/gfx.hpp
View file @
b1ffd63f
...
...
@@ -169,5 +169,8 @@ Color hsl2rgb(double h, double s, double l);
/// A darker version of a color
Color
darken
(
const
Color
&
c
);
/// A saturated version of a color
Color
saturate
(
const
Color
&
c
,
double
amount
);
// ----------------------------------------------------------------------------- : EOF
#endif
src/gui/control/card_viewer.cpp
View file @
b1ffd63f
...
...
@@ -32,7 +32,11 @@ void CardViewer::onChange() {
}
void
CardViewer
::
onPaint
(
wxPaintEvent
&
)
{
wxBufferedPaintDC
dc
(
this
);
wxSize
cs
=
GetClientSize
();
if
(
!
buffer
.
Ok
()
||
buffer
.
GetWidth
()
!=
cs
.
GetWidth
()
||
buffer
.
GetHeight
()
!=
cs
.
GetHeight
())
{
buffer
=
Bitmap
(
cs
.
GetWidth
(),
cs
.
GetHeight
());
}
wxBufferedPaintDC
dc
(
this
,
buffer
);
dc
.
BeginDrawing
();
draw
(
dc
);
dc
.
EndDrawing
();
...
...
src/gui/control/card_viewer.hpp
View file @
b1ffd63f
...
...
@@ -29,7 +29,6 @@ class CardViewer : public wxControl, public DataViewer {
DECLARE_EVENT_TABLE
();
void
onPaint
(
wxPaintEvent
&
);
void
onSize
(
wxSizeEvent
&
);
Bitmap
buffer
;
/// < Off-screen buffer we draw to
};
...
...
src/gui/control/gallery_list.cpp
View file @
b1ffd63f
...
...
@@ -159,7 +159,7 @@ void GalleryList::OnDraw(DC& dc) {
bool
selected
=
i
==
selection
;
Color
c
=
selected
?
wxSystemSettings
::
GetColour
(
wxSYS_COLOUR_HIGHLIGHT
)
:
unselected
;
dc
.
SetPen
(
c
);
dc
.
SetBrush
(
lerp
(
background
,
c
,
0.3
));
dc
.
SetBrush
(
saturate
(
lerp
(
background
,
c
,
0.3
),
selected
?
0.5
:
0
));
RealPoint
pos
=
itemPos
(
i
);
dc
.
DrawRectangle
(
pos
.
x
-
BORDER
,
pos
.
y
-
BORDER
,
item_size
.
width
+
2
*
BORDER
,
item_size
.
height
+
2
*
BORDER
);
// draw item
...
...
src/gui/control/native_look_editor.cpp
View file @
b1ffd63f
...
...
@@ -21,8 +21,12 @@ NativeLookEditor::NativeLookEditor(Window* parent, int id, long style)
:
DataEditor
(
parent
,
id
,
style
)
{}
Rotation
NativeLookEditor
::
getRotation
()
const
{
return
Rotation
(
0
,
RealRect
(
RealPoint
(
0
,
0
),
GetClientSize
()));
}
void
NativeLookEditor
::
draw
(
DC
&
dc
)
{
RotatedDC
rdc
(
dc
,
0
,
RealRect
(
RealPoint
(
0
,
0
),
GetClientSize
()),
1
,
0
);
RotatedDC
rdc
(
dc
,
getRotation
(),
false
);
DataViewer
::
draw
(
rdc
,
wxSystemSettings
::
GetColour
(
wxSYS_COLOUR_3DFACE
));
}
void
NativeLookEditor
::
drawViewer
(
RotatedDC
&
dc
,
ValueViewer
&
v
)
{
...
...
src/gui/control/native_look_editor.hpp
View file @
b1ffd63f
...
...
@@ -22,6 +22,7 @@ class NativeLookEditor : public DataEditor {
/// Uses a native look
virtual
bool
nativeLook
()
const
{
return
true
;
}
virtual
bool
drawBorders
()
const
{
return
false
;
}
virtual
Rotation
getRotation
()
const
;
virtual
void
draw
(
DC
&
dc
);
virtual
void
drawViewer
(
RotatedDC
&
dc
,
ValueViewer
&
v
);
...
...
src/gui/drop_down_list.cpp
View file @
b1ffd63f
...
...
@@ -9,6 +9,8 @@
#include <gui/drop_down_list.hpp>
#include <gui/util.hpp>
#include <render/value/viewer.hpp>
#include <render/card/viewer.hpp>
#include <util/rotation.hpp>
#include <gfx/gfx.hpp>
#include <wx/dcbuffer.h>
...
...
@@ -23,38 +25,31 @@ class DropDownHider : public wxEvtHandler {
DropDownList
&
list
;
virtual
bool
ProcessEvent
(
wxEvent
&
ev
)
{
// close the list, and pass on the event
// don't just use ev.Skip(), because this event handler will be removed by hiding,
// so there will be no next handler to skip to
wxEvtHandler
*
nh
=
GetNextHandler
();
list
.
hide
(
false
);
if
(
nh
)
nh
->
ProcessEvent
(
ev
);
int
t
=
ev
.
GetEventType
();
if
(
t
==
wxEVT_LEFT_DOWN
||
t
==
wxEVT_RIGHT_DOWN
||
t
==
wxEVT_MOVE
||
t
==
wxEVT_SIZE
||
t
==
wxEVT_MENU_HIGHLIGHT
||
t
==
wxEVT_MENU_OPEN
||
t
==
wxEVT_MENU_OPEN
||
t
==
wxEVT_ACTIVATE
||
t
==
wxEVT_CLOSE_WINDOW
||
t
==
wxEVT_KILL_FOCUS
||
t
==
wxEVT_COMMAND_TOOL_CLICKED
)
{
// close the list, and pass on the event
// don't just use ev.Skip(), because this event handler will be removed by hiding,
// so there will be no next handler to skip to
wxEvtHandler
*
nh
=
GetNextHandler
();
list
.
hide
(
false
);
if
(
nh
)
nh
->
ProcessEvent
(
ev
);
return
false
;
}
else
{
// if (t !=10093 && t !=10098 && t !=10097 && t !=10099 && t !=10004 && t !=10062
// && t !=10025 && t !=10035 && t !=10034 && t !=10036 && t !=10042 && t !=10119)
// {
// t=t;//DEBUG
// }
return
wxEvtHandler
::
ProcessEvent
(
ev
);
}
}
};
/*BEGIN_EVENT_TABLE(DropDownHider, wxEvtHandler)
EVT_CUSTOM(wxEVT_LEFT_DOWN, wxID_ANY, DropDownHider::onEvent)
EVT_CUSTOM(wxEVT_RIGHT_DOWN, wxID_ANY, DropDownHider::onEvent)
EVT_CUSTOM(wxEVT_MOVE, wxID_ANY, DropDownHider::onEvent)
EVT_CUSTOM(wxEVT_SIZE, wxID_ANY, DropDownHider::onEvent)
EVT_CUSTOM(wxEVT_MENU_HIGHLIGHT, wxID_ANY, DropDownHider::onEvent)
EVT_CUSTOM(wxEVT_MENU, wxID_ANY, DropDownHider::onEvent)
EVT_CUSTOM(wxEVT_MENU_OPEN, wxID_ANY, DropDownHider::onEvent)
EVT_CUSTOM(wxEVT_ACTIVATE, wxID_ANY, DropDownHider::onEvent)
// EVT_CUSTOM(wxEVT_CLOSE, wxID_ANY, DropDownHider::onEvent)
EVT_CUSTOM(wxEVT_KILL_FOCUS, wxID_ANY, DropDownHider::onEvent)
/* EVT_LEFT_DOWN ( (wxMouseEventFunction)&DropDownHider::onEvent)
EVT_RIGHT_DOWN ( DropDownHider::onMouseEvent)
EVT_MOVE ( DropDownHider::onMoveEvent)
EVT_SIZE ( DropDownHider::onSizeEvent)
EVT_MENU_HIGHLIGHT (wxID_ANY, DropDownHider::onMenuEvent)
EVT_MENU (wxID_ANY, DropDownHider::onCommandEvent)
EVT_MENU_OPEN ( DropDownHider::onMenuEvent)
EVT_ACTIVATE ( DropDownHider::onActivateEvent)
EVT_CLOSE ( DropDownHider::onCloseEvent)
EVT_KILL_FOCUS ( DropDownHider::onFocusEvent)
END_EVENT_TABLE ()
*/
// ----------------------------------------------------------------------------- : DropDownList : Show/Hide
...
...
@@ -64,6 +59,7 @@ DropDownList::DropDownList(Window* parent, bool is_submenu, ValueViewer* viewer)
,
selected_item
(
NO_SELECTION
)
,
open_sub_menu
(
nullptr
)
,
parent_menu
(
is_submenu
?
static_cast
<
DropDownList
*>
(
GetParent
())
:
nullptr
)
,
hider
(
is_submenu
?
nullptr
:
new
DropDownHider
(
*
this
))
,
viewer
(
viewer
)
,
item_size
(
100
,
1
)
{
...
...
@@ -75,6 +71,10 @@ DropDownList::DropDownList(Window* parent, bool is_submenu, ValueViewer* viewer)
item_size
.
height
=
h
;
}
DropDownList
::~
DropDownList
()
{
delete
hider
;
}
void
DropDownList
::
show
(
bool
in_place
,
wxPoint
pos
)
{
if
(
IsShown
())
return
;
// find selection
...
...
@@ -83,40 +83,38 @@ void DropDownList::show(bool in_place, wxPoint pos) {
int
line_count
=
0
;
size_t
count
=
itemCount
();
for
(
size_t
i
=
0
;
i
<
count
;
++
i
)
if
(
lineBelow
(
i
))
line_count
+=
1
;
wx
Size
size
(
Real
Size
size
(
item_size
.
width
+
marginW
*
2
,
item_size
.
height
*
count
+
marginH
*
2
+
line_count
);
int
parent_height
=
0
;
/*if (!in_place
) {
if
(
!
in_place
&&
viewer
)
{
// Position the drop down list below the editor control (based on the style)
RotatedObject rot(editor.rotation);
Rect r = rot.trNoNeg(style->rect);
if (editor.nativeLook()) {
pos = Point(r.left - 3, r.top - 3);
size.width = max(size.width, r.width + 6);
editorHeight = r.height + 6;
RealRect
r
=
viewer
->
viewer
.
getRotation
().
trNoNeg
(
viewer
->
getStyle
()
->
getRect
());
if
(
viewer
->
viewer
.
nativeLook
())
{
pos
=
wxPoint
(
r
.
x
-
3
,
r
.
y
-
3
);
size
.
width
=
max
(
size
.
width
,
r
.
width
+
6
);
parent_height
=
r
.
height
+
6
;
}
else
{
pos
= Point(r.left - 1, r.top
- 1);
size.width = max(size.width, r.width + 2);
editorH
eight = r.height;
pos
=
wxPoint
(
r
.
x
-
1
,
r
.
y
-
1
);
size
.
width
=
max
(
size
.
width
,
r
.
width
+
2
);
parent_h
eight
=
r
.
height
;
}
}
else
if
(
parent_menu
)
{
parent_height = -item_height - 1;
parent_height
=
-
item_
size
.
height
-
1
;
}
*/
pos
=
GetParent
()
->
ClientToScreen
(
pos
);
// move & resize
item_size
.
width
=
size
.
GetWidth
()
-
marginW
*
2
;
item_size
.
width
=
size
.
width
-
marginW
*
2
;
SetSize
(
size
);
Position
(
pos
,
wxSize
(
0
,
parent_height
));
// set event handler
if
(
!
parent_menu
)
{
// Window* parent = wxGetTopLevelParent(this
);
// parent->PushEventHandler(&
hider);
if
(
hider
)
{
Window
*
parent
=
wxGetTopLevelParent
(
GetParent
()
);
parent
->
PushEventHandler
(
hider
);
}
// show
// oldSelectedItem = selectedItem;
if
(
selected_item
==
NO_SELECTION
&&
itemCount
()
>
0
)
selected_item
=
0
;
// select first item by default
mouse_down
=
false
;
Window
::
Show
();
...
...
@@ -143,10 +141,10 @@ void DropDownList::realHide() {
if
(
parent_menu
)
{
parent_menu
->
open_sub_menu
=
0
;
}
else
{
// redrawDropDown
ArrowOnParent();
redraw
ArrowOnParent
();
// disconnect event handler
// Window* parent = getTopLevelParent(&editor
);
// parent->RemoveEventHandler(&
hider);
Window
*
parent
=
wxGetTopLevelParent
(
GetParent
()
);
parent
->
RemoveEventHandler
(
hider
);
}
}
...
...
@@ -306,7 +304,7 @@ void DropDownList::onCharInParent(wxKeyEvent& ev) {
}
else
{
switch
(
k
)
{
case
WXK_UP
:
if
(
selected_item
-
1
>=
0
)
{
if
(
selected_item
>
0
)
{
selected_item
-=
1
;
Refresh
(
false
);
}
...
...
@@ -332,11 +330,12 @@ void DropDownList::onCharInParent(wxKeyEvent& ev) {
// match first character of an item, start searching just after the current selection
size_t
si
=
selected_item
!=
NO_SELECTION
?
selected_item
+
1
:
0
;
size_t
count
=
itemCount
();
for
(
size_t
i
=
si
;
i
<
count
+
si
;
++
i
)
{
String
c
=
itemText
(
i
);
for
(
size_t
i
=
0
;
i
<
count
;
++
i
)
{
size_t
index
=
(
si
+
i
)
%
count
;
String
c
=
itemText
(
index
);
if
(
!
c
.
empty
()
&&
toUpper
(
c
.
GetChar
(
0
))
==
toUpper
(
ev
.
GetUnicodeKey
()))
{
// first character matches
selected_item
=
i
;
selected_item
=
i
ndex
;
showSubMenu
();
Refresh
(
false
);
return
;
...
...
src/gui/drop_down_list.hpp
View file @
b1ffd63f
...
...
@@ -14,6 +14,7 @@
#include <wx/popupwin.h> // undocumented: wxPopupWindow
class
ValueViewer
;
class
DropDownHider
;
// ----------------------------------------------------------------------------- : DropDownList
...
...
@@ -21,6 +22,7 @@ class ValueViewer;
/** This class is an abstract base for various drop down lists */
class
DropDownList
:
public
wxPopupWindow
{
public:
~
DropDownList
();
/// Create a drop down list, possibly a sub menu
/** the viewer will be notified to redraw its drop down icon */
DropDownList
(
Window
*
parent
,
bool
is_submenu
=
false
,
ValueViewer
*
viewer
=
nullptr
);
...
...
@@ -78,6 +80,7 @@ class DropDownList : public wxPopupWindow {
DropDownList
*
open_sub_menu
;
///< The sub menu that is currently shown, if any
DropDownList
*
parent_menu
;
///< The parent menu, only applies to sub menus
ValueViewer
*
viewer
;
///< The parent viewer object (optional)
DropDownHider
*
hider
;
///< Class to hide this window when we lose focus
// --------------------------------------------------- : Events
DECLARE_EVENT_TABLE
();
...
...
src/gui/set/window.cpp
View file @
b1ffd63f
...
...
@@ -96,6 +96,7 @@ SetWindow::SetWindow(Window* parent, const SetP& set)
// tool bar
wxToolBar
*
tb
=
CreateToolBar
(
wxTB_FLAT
|
wxNO_BORDER
|
wxTB_HORIZONTAL
);
tb
->
SetToolBitmapSize
(
wxSize
(
18
,
18
));
tb
->
AddTool
(
ID_FILE_NEW
,
_
(
""
),
Bitmap
(
_
(
"TOOL_NEW"
)),
wxNullBitmap
,
wxITEM_NORMAL
,
_
(
"New set"
),
_
(
"Creates a new set"
));
tb
->
AddTool
(
ID_FILE_OPEN
,
_
(
""
),
Bitmap
(
_
(
"TOOL_OPEN"
)),
wxNullBitmap
,
wxITEM_NORMAL
,
_
(
"Open set"
),
_
(
"Opens an existing set"
));
tb
->
AddTool
(
ID_FILE_SAVE
,
_
(
""
),
Bitmap
(
_
(
"TOOL_SAVE"
)),
wxNullBitmap
,
wxITEM_NORMAL
,
_
(
"Save set"
),
_
(
"Saves the current set"
));
...
...
src/gui/value/color.cpp
View file @
b1ffd63f
...
...
@@ -9,6 +9,7 @@
#include <gui/value/color.hpp>
#include <gui/drop_down_list.hpp>
#include <gui/util.hpp>
#include <data/action/value.hpp>
#include <wx/colordlg.h>
DECLARE_TYPEOF_COLLECTION
(
ColorField
::
ChoiceP
);
...
...
@@ -141,7 +142,7 @@ void ColorValueEditor::determineSize() {
}
void
ColorValueEditor
::
change
(
const
Defaultable
<
Color
>&
c
)
{
// getSet().actions.add(new ColorChangeAction(value(
), c));
getSet
().
actions
.
add
(
value_action
(
static_pointer_cast
<
ColorValue
>
(
valueP
),
c
));
}
void
ColorValueEditor
::
changeCustom
()
{
Color
c
=
wxGetColourFromUser
(
0
,
value
().
value
());
...
...
src/gui/value/editor.hpp
View file @
b1ffd63f
...
...
@@ -47,7 +47,7 @@ class ValueEditor {
virtual
void
onMouseWheel
(
const
RealPoint
&
pos
,
wxMouseEvent
&
ev
)
{}
/// Key events
virtual
void
onChar
(
wxKeyEvent
ev
)
{}
virtual
void
onChar
(
wxKeyEvent
&
ev
)
{}
/// a context menu is requested, add extra items to the menu m
/** return false to suppress menu */
...
...
src/mse.vcproj
View file @
b1ffd63f
...
...
@@ -984,6 +984,36 @@
<File
RelativePath=
".\data\action\symbol_part.hpp"
>
</File>
<File
RelativePath=
".\data\action\value.cpp"
>
<FileConfiguration
Name=
"Debug|Win32"
>
<Tool
Name=
"VCCLCompilerTool"
ObjectFile=
"$(IntDir)/$(InputName)1.obj"
/>
</FileConfiguration>
<FileConfiguration
Name=
"Release|Win32"
>
<Tool
Name=
"VCCLCompilerTool"
ObjectFile=
"$(IntDir)/$(InputName)1.obj"
/>
</FileConfiguration>
<FileConfiguration
Name=
"Debug Unicode|Win32"
>
<Tool
Name=
"VCCLCompilerTool"
ObjectFile=
"$(IntDir)/$(InputName)1.obj"
/>
</FileConfiguration>
<FileConfiguration
Name=
"Release Unicode|Win32"
>
<Tool
Name=
"VCCLCompilerTool"
ObjectFile=
"$(IntDir)/$(InputName)1.obj"
/>
</FileConfiguration>
</File>
<File
RelativePath=
".\data\action\value.hpp"
>
</File>
</Filter>
<Filter
Name=
"format"
...
...
src/render/card/viewer.cpp
View file @
b1ffd63f
...
...
@@ -57,6 +57,12 @@ wxPen DataViewer::borderPen(bool) const { return wxPen(); }
ValueViewer
*
DataViewer
::
focusedViewer
()
const
{
return
nullptr
;
}
Context
&
DataViewer
::
getContext
()
const
{
return
set
->
getContext
();
}
Rotation
DataViewer
::
getRotation
()
const
{
StyleSheetP
stylesheet
=
set
->
stylesheetFor
(
card
);
StyleSheetSettings
&
ss
=
settings
.
stylesheetSettingsFor
(
*
stylesheet
);
return
Rotation
(
ss
.
card_angle
(),
stylesheet
->
getCardRect
(),
ss
.
card_zoom
());
}
// ----------------------------------------------------------------------------- : Setting data
void
DataViewer
::
setCard
(
const
CardP
&
card
)
{
...
...
src/render/card/viewer.hpp
View file @
b1ffd63f
...
...
@@ -52,6 +52,8 @@ class DataViewer : public SetView {
virtual
ValueViewer
*
focusedViewer
()
const
;
/// Get a script context to use for scripts in the viewers
Context
&
getContext
()
const
;
/// The rotation to use
virtual
Rotation
getRotation
()
const
;
// --------------------------------------------------- : Setting data
...
...
src/render/value/viewer.hpp
View file @
b1ffd63f
...
...
@@ -58,8 +58,8 @@ class ValueViewer {
/// Convert this viewer to an editor, if possible
virtual
ValueEditor
*
getEditor
()
{
return
0
;
}
protected:
DataViewer
&
viewer
;
///< Our parent object
protected:
StyleP
styleP
;
///< The style of this viewer
ValueP
valueP
;
///< The value we are currently viewing
...
...
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