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
fcc1478c
Commit
fcc1478c
authored
Dec 23, 2006
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
redrawing of editors (for drop down lists)
parent
321362d6
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
38 additions
and
11 deletions
+38
-11
src/gui/control/card_viewer.cpp
src/gui/control/card_viewer.cpp
+16
-2
src/gui/control/card_viewer.hpp
src/gui/control/card_viewer.hpp
+8
-0
src/gui/control/native_look_editor.cpp
src/gui/control/native_look_editor.cpp
+1
-0
src/gui/control/text_ctrl.cpp
src/gui/control/text_ctrl.cpp
+0
-4
src/gui/control/text_ctrl.hpp
src/gui/control/text_ctrl.hpp
+0
-1
src/gui/drop_down_list.cpp
src/gui/drop_down_list.cpp
+3
-1
src/gui/value/editor.hpp
src/gui/value/editor.hpp
+7
-0
src/gui/value/text.cpp
src/gui/value/text.cpp
+3
-3
No files found.
src/gui/control/card_viewer.cpp
View file @
fcc1478c
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
#include <gui/control/card_viewer.hpp>
#include <gui/control/card_viewer.hpp>
#include <data/stylesheet.hpp>
#include <data/stylesheet.hpp>
#include <render/value/viewer.hpp>
#include <wx/dcbuffer.h>
#include <wx/dcbuffer.h>
// ----------------------------------------------------------------------------- : Events
// ----------------------------------------------------------------------------- : Events
...
@@ -29,9 +30,14 @@ wxSize CardViewer::DoGetBestSize() const {
...
@@ -29,9 +30,14 @@ wxSize CardViewer::DoGetBestSize() const {
return
cs
;
return
cs
;
}
}
void
CardViewer
::
redraw
(
const
ValueViewer
&
v
)
{
up_to_date
=
false
;
RefreshRect
(
v
.
boundingBox
(),
false
);
}
void
CardViewer
::
onChange
()
{
void
CardViewer
::
onChange
()
{
Refresh
(
false
);
up_to_date
=
false
;
up_to_date
=
false
;
Refresh
(
false
);
}
}
void
CardViewer
::
onChangeSize
()
{
void
CardViewer
::
onChangeSize
()
{
...
@@ -43,7 +49,6 @@ void CardViewer::onChangeSize() {
...
@@ -43,7 +49,6 @@ void CardViewer::onChangeSize() {
}
}
}
}
#ifdef _DEBUG
#ifdef _DEBUG
DECLARE_DYNAMIC_ARG
(
bool
,
inOnPaint
);
DECLARE_DYNAMIC_ARG
(
bool
,
inOnPaint
);
IMPLEMENT_DYNAMIC_ARG
(
bool
,
inOnPaint
,
false
);
IMPLEMENT_DYNAMIC_ARG
(
bool
,
inOnPaint
,
false
);
...
@@ -61,6 +66,7 @@ void CardViewer::onPaint(wxPaintEvent&) {
...
@@ -61,6 +66,7 @@ void CardViewer::onPaint(wxPaintEvent&) {
up_to_date
=
false
;
up_to_date
=
false
;
}
}
wxBufferedPaintDC
dc
(
this
,
buffer
);
wxBufferedPaintDC
dc
(
this
,
buffer
);
dc
.
SetClippingRegion
(
GetUpdateRegion
());
if
(
!
up_to_date
)
{
if
(
!
up_to_date
)
{
up_to_date
=
true
;
up_to_date
=
true
;
dc
.
BeginDrawing
();
dc
.
BeginDrawing
();
...
@@ -69,6 +75,14 @@ void CardViewer::onPaint(wxPaintEvent&) {
...
@@ -69,6 +75,14 @@ void CardViewer::onPaint(wxPaintEvent&) {
}
}
}
}
void
CardViewer
::
drawViewer
(
RotatedDC
&
dc
,
ValueViewer
&
v
)
{
if
(
shouldDraw
(
v
))
v
.
draw
(
dc
);
}
bool
CardViewer
::
shouldDraw
(
const
ValueViewer
&
v
)
const
{
return
GetUpdateRegion
().
Contains
((
wxRect
)
v
.
boundingBox
())
!=
wxOutRegion
;
}
// helper class for overdrawDC()
// helper class for overdrawDC()
class
CardViewer
::
OverdrawDC
:
private
wxClientDC
,
public
wxBufferedDC
{
class
CardViewer
::
OverdrawDC
:
private
wxClientDC
,
public
wxBufferedDC
{
public:
public:
...
...
src/gui/control/card_viewer.hpp
View file @
fcc1478c
...
@@ -30,6 +30,9 @@ class CardViewer : public wxControl, public DataViewer {
...
@@ -30,6 +30,9 @@ class CardViewer : public wxControl, public DataViewer {
/** May NOT be called while in onPaint/draw */
/** May NOT be called while in onPaint/draw */
shared_ptr
<
DC
>
overdrawDC
();
shared_ptr
<
DC
>
overdrawDC
();
/// Invalidate and redraw (the area of) a single value viewer
void
redraw
(
const
ValueViewer
&
);
protected:
protected:
/// Return the desired size of control
/// Return the desired size of control
virtual
wxSize
DoGetBestSize
()
const
;
virtual
wxSize
DoGetBestSize
()
const
;
...
@@ -37,6 +40,11 @@ class CardViewer : public wxControl, public DataViewer {
...
@@ -37,6 +40,11 @@ class CardViewer : public wxControl, public DataViewer {
virtual
void
onChange
();
virtual
void
onChange
();
virtual
void
onChangeSize
();
virtual
void
onChangeSize
();
/// Should the given viewer be drawn?
bool
shouldDraw
(
const
ValueViewer
&
)
const
;
virtual
void
drawViewer
(
RotatedDC
&
dc
,
ValueViewer
&
v
);
private:
private:
DECLARE_EVENT_TABLE
();
DECLARE_EVENT_TABLE
();
...
...
src/gui/control/native_look_editor.cpp
View file @
fcc1478c
...
@@ -30,6 +30,7 @@ void NativeLookEditor::draw(DC& dc) {
...
@@ -30,6 +30,7 @@ void NativeLookEditor::draw(DC& dc) {
DataViewer
::
draw
(
rdc
,
wxSystemSettings
::
GetColour
(
wxSYS_COLOUR_3DFACE
));
DataViewer
::
draw
(
rdc
,
wxSystemSettings
::
GetColour
(
wxSYS_COLOUR_3DFACE
));
}
}
void
NativeLookEditor
::
drawViewer
(
RotatedDC
&
dc
,
ValueViewer
&
v
)
{
void
NativeLookEditor
::
drawViewer
(
RotatedDC
&
dc
,
ValueViewer
&
v
)
{
if
(
!
shouldDraw
(
v
))
return
;
// draw background
// draw background
Style
&
s
=
*
v
.
getStyle
();
Style
&
s
=
*
v
.
getStyle
();
dc
.
SetPen
(
*
wxTRANSPARENT_PEN
);
dc
.
SetPen
(
*
wxTRANSPARENT_PEN
);
...
...
src/gui/control/text_ctrl.cpp
View file @
fcc1478c
...
@@ -29,10 +29,6 @@ void TextCtrl::draw(DC& dc) {
...
@@ -29,10 +29,6 @@ void TextCtrl::draw(DC& dc) {
RotatedDC
rdc
(
dc
,
getRotation
(),
false
);
RotatedDC
rdc
(
dc
,
getRotation
(),
false
);
DataViewer
::
draw
(
rdc
,
wxSystemSettings
::
GetColour
(
wxSYS_COLOUR_WINDOW
));
DataViewer
::
draw
(
rdc
,
wxSystemSettings
::
GetColour
(
wxSYS_COLOUR_WINDOW
));
}
}
void
TextCtrl
::
drawViewer
(
RotatedDC
&
dc
,
ValueViewer
&
v
)
{
// draw viewer
v
.
draw
(
dc
);
}
void
TextCtrl
::
setValue
(
String
*
value
)
{
void
TextCtrl
::
setValue
(
String
*
value
)
{
...
...
src/gui/control/text_ctrl.hpp
View file @
fcc1478c
...
@@ -38,7 +38,6 @@ class TextCtrl : public DataEditor {
...
@@ -38,7 +38,6 @@ class TextCtrl : public DataEditor {
virtual
Rotation
getRotation
()
const
;
virtual
Rotation
getRotation
()
const
;
virtual
void
draw
(
DC
&
dc
);
virtual
void
draw
(
DC
&
dc
);
virtual
void
drawViewer
(
RotatedDC
&
dc
,
ValueViewer
&
v
);
/// When an action is received, change the underlying value
/// When an action is received, change the underlying value
virtual
void
onAction
(
const
Action
&
,
bool
undone
);
virtual
void
onAction
(
const
Action
&
,
bool
undone
);
...
...
src/gui/drop_down_list.cpp
View file @
fcc1478c
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
#include <gui/util.hpp>
#include <gui/util.hpp>
#include <render/value/viewer.hpp>
#include <render/value/viewer.hpp>
#include <render/card/viewer.hpp>
#include <render/card/viewer.hpp>
#include <gui/value/editor.hpp>
#include <util/rotation.hpp>
#include <util/rotation.hpp>
#include <gfx/gfx.hpp>
#include <gfx/gfx.hpp>
#include <wx/dcbuffer.h>
#include <wx/dcbuffer.h>
...
@@ -208,7 +209,8 @@ int DropDownList::itemPosition(size_t item) const {
...
@@ -208,7 +209,8 @@ int DropDownList::itemPosition(size_t item) const {
void
DropDownList
::
redrawArrowOnParent
()
{
void
DropDownList
::
redrawArrowOnParent
()
{
if
(
viewer
)
{
if
(
viewer
)
{
// TODO
ValueEditor
*
e
=
viewer
->
getEditor
();
if
(
e
)
e
->
redraw
();
}
}
}
}
...
...
src/gui/value/editor.hpp
View file @
fcc1478c
...
@@ -99,6 +99,9 @@ class ValueEditor {
...
@@ -99,6 +99,9 @@ class ValueEditor {
virtual
void
determineSize
(
bool
force_fit
=
false
)
{}
virtual
void
determineSize
(
bool
force_fit
=
false
)
{}
/// The editor is shown or hidden
/// The editor is shown or hidden
virtual
void
onShow
(
bool
)
{}
virtual
void
onShow
(
bool
)
{}
/// Redraw this viewer
virtual
void
redraw
()
=
0
;
};
};
// ----------------------------------------------------------------------------- : Utility
// ----------------------------------------------------------------------------- : Utility
...
@@ -106,6 +109,7 @@ class ValueEditor {
...
@@ -106,6 +109,7 @@ class ValueEditor {
#define DECLARE_VALUE_EDITOR(Type) \
#define DECLARE_VALUE_EDITOR(Type) \
Type
##
ValueEditor
(
DataEditor
&
parent
,
const
Type
##
StyleP
&
style
);
\
Type
##
ValueEditor
(
DataEditor
&
parent
,
const
Type
##
StyleP
&
style
);
\
virtual
ValueEditor
*
getEditor
()
{
return
this
;
}
\
virtual
ValueEditor
*
getEditor
()
{
return
this
;
}
\
virtual
void
redraw
();
\
private
:
\
private
:
\
inline
DataEditor
&
editor
()
const
{
\
inline
DataEditor
&
editor
()
const
{
\
return
static_cast
<
DataEditor
&>
(
viewer
);
\
return
static_cast
<
DataEditor
&>
(
viewer
);
\
...
@@ -113,6 +117,9 @@ class ValueEditor {
...
@@ -113,6 +117,9 @@ class ValueEditor {
public
:
public
:
#define IMPLEMENT_VALUE_EDITOR(Type) \
#define IMPLEMENT_VALUE_EDITOR(Type) \
void
Type
##
ValueEditor
::
redraw
()
{
\
editor
().
redraw
(
*
this
);
\
}
\
Type
##
ValueEditor
::
Type
##
ValueEditor
(
DataEditor
&
parent
,
const
Type
##
StyleP
&
style
)
\
Type
##
ValueEditor
::
Type
##
ValueEditor
(
DataEditor
&
parent
,
const
Type
##
StyleP
&
style
)
\
:
Type
##
ValueViewer
(
parent
,
style
)
:
Type
##
ValueViewer
(
parent
,
style
)
...
...
src/gui/value/text.cpp
View file @
fcc1478c
...
@@ -506,7 +506,7 @@ void TextValueEditor::moveSelection(IndexType t, size_t new_end, bool also_move_
...
@@ -506,7 +506,7 @@ void TextValueEditor::moveSelection(IndexType t, size_t new_end, bool also_move_
if
(
ensureCaretVisible
())
{
if
(
ensureCaretVisible
())
{
// we can't redraw just the selection because we must scroll
// we can't redraw just the selection because we must scroll
updateScrollbar
();
updateScrollbar
();
// editor.refreshEditor
();
redraw
();
}
else
{
}
else
{
// draw new selection
// draw new selection
v
.
drawSelection
(
rdc
,
style
(),
selection_start_i
,
selection_end_i
);
v
.
drawSelection
(
rdc
,
style
(),
selection_start_i
,
selection_end_i
);
...
@@ -605,7 +605,7 @@ void TextValueEditor::determineSize(bool force_fit) {
...
@@ -605,7 +605,7 @@ void TextValueEditor::determineSize(bool force_fit) {
style
().
top
-
1
,
style
().
top
-
1
,
sbw
,
sbw
,
style
().
height
+
2
);
style
().
height
+
2
);
// r
.reset();
v
.
reset
();
}
else
{
}
else
{
// Height depends on font
// Height depends on font
wxMemoryDC
dc
;
wxMemoryDC
dc
;
...
@@ -637,7 +637,7 @@ void TextValueEditor::scrollTo(int pos) {
...
@@ -637,7 +637,7 @@ void TextValueEditor::scrollTo(int pos) {
v
.
scrollTo
(
pos
);
v
.
scrollTo
(
pos
);
// move the cursor if needed
// move the cursor if needed
// refresh
// refresh
// viewer.onChange
();
redraw
();
}
}
bool
TextValueEditor
::
ensureCaretVisible
()
{
bool
TextValueEditor
::
ensureCaretVisible
()
{
...
...
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