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
3cd40a7d
Commit
3cd40a7d
authored
Dec 22, 2006
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Layout() always called when editor/viewer control changes size
parent
7b570b21
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
41 additions
and
35 deletions
+41
-35
src/gui/control/card_viewer.cpp
src/gui/control/card_viewer.cpp
+14
-0
src/gui/control/card_viewer.hpp
src/gui/control/card_viewer.hpp
+8
-0
src/gui/set/cards_panel.cpp
src/gui/set/cards_panel.cpp
+0
-13
src/gui/set/cards_panel.hpp
src/gui/set/cards_panel.hpp
+0
-2
src/gui/set/panel.hpp
src/gui/set/panel.hpp
+0
-2
src/gui/set/style_panel.cpp
src/gui/set/style_panel.cpp
+1
-3
src/gui/set/window.cpp
src/gui/set/window.cpp
+10
-9
src/gui/set/window.hpp
src/gui/set/window.hpp
+3
-4
src/render/card/viewer.cpp
src/render/card/viewer.cpp
+2
-0
src/render/card/viewer.hpp
src/render/card/viewer.hpp
+3
-2
No files found.
src/gui/control/card_viewer.cpp
View file @
3cd40a7d
...
@@ -10,6 +10,10 @@
...
@@ -10,6 +10,10 @@
#include <data/stylesheet.hpp>
#include <data/stylesheet.hpp>
#include <wx/dcbuffer.h>
#include <wx/dcbuffer.h>
// ----------------------------------------------------------------------------- : Events
DEFINE_EVENT_TYPE
(
EVENT_SIZE_CHANGE
);
// ----------------------------------------------------------------------------- : CardViewer
// ----------------------------------------------------------------------------- : CardViewer
CardViewer
::
CardViewer
(
Window
*
parent
,
int
id
,
long
style
)
CardViewer
::
CardViewer
(
Window
*
parent
,
int
id
,
long
style
)
...
@@ -30,6 +34,16 @@ void CardViewer::onChange() {
...
@@ -30,6 +34,16 @@ void CardViewer::onChange() {
up_to_date
=
false
;
up_to_date
=
false
;
}
}
void
CardViewer
::
onChangeSize
()
{
wxSize
ws
=
GetSize
(),
cs
=
GetClientSize
();
wxSize
desired_cs
=
(
wxSize
)
getRotation
().
getExternalSize
()
+
ws
-
cs
;
if
(
desired_cs
!=
cs
)
{
wxCommandEvent
ev
(
EVENT_SIZE_CHANGE
,
GetId
());
ProcessEvent
(
ev
);
}
}
#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
);
...
...
src/gui/control/card_viewer.hpp
View file @
3cd40a7d
...
@@ -12,6 +12,13 @@
...
@@ -12,6 +12,13 @@
#include <util/prec.hpp>
#include <util/prec.hpp>
#include <render/card/viewer.hpp>
#include <render/card/viewer.hpp>
// ----------------------------------------------------------------------------- : Events
/// Event that indicates the size of a CardViewer has changed
DECLARE_EVENT_TYPE
(
EVENT_SIZE_CHANGE
,
<
not
used
>
)
/// Handle EVENT_SIZE_CHANGE events
#define EVT_SIZE_CHANGE(id, handler) EVT_COMMAND(id, EVENT_SIZE_CHANGE, handler)
// ----------------------------------------------------------------------------- : CardViewer
// ----------------------------------------------------------------------------- : CardViewer
/// A control to view a single card
/// A control to view a single card
...
@@ -28,6 +35,7 @@ class CardViewer : public wxControl, public DataViewer {
...
@@ -28,6 +35,7 @@ class CardViewer : public wxControl, public DataViewer {
virtual
wxSize
DoGetBestSize
()
const
;
virtual
wxSize
DoGetBestSize
()
const
;
virtual
void
onChange
();
virtual
void
onChange
();
virtual
void
onChangeSize
();
private:
private:
DECLARE_EVENT_TABLE
();
DECLARE_EVENT_TABLE
();
...
...
src/gui/set/cards_panel.cpp
View file @
3cd40a7d
...
@@ -196,19 +196,6 @@ bool CardsPanel::wantsToHandle(const Action&, bool undone) const {
...
@@ -196,19 +196,6 @@ bool CardsPanel::wantsToHandle(const Action&, bool undone) const {
return
false
;
return
false
;
}
}
void
CardsPanel
::
onAction
(
const
Action
&
action
,
bool
undone
)
{
TYPE_CASE_
(
action
,
DisplayChangeAction
)
{
// The style changed, maybe also the size of editor
Layout
();
//if (current_panel) current_panel->Layout();
//fixMinWindowSize();
}
}
void
CardsPanel
::
onRenderSettingsChange
()
{
// TODO
}
// ----------------------------------------------------------------------------- : Clipboard
// ----------------------------------------------------------------------------- : Clipboard
bool
CardsPanel
::
canCut
()
const
{
return
focused_control
(
this
)
==
ID_EDITOR
?
editor
->
canCut
()
:
card_list
->
canCut
();
}
bool
CardsPanel
::
canCut
()
const
{
return
focused_control
(
this
)
==
ID_EDITOR
?
editor
->
canCut
()
:
card_list
->
canCut
();
}
...
...
src/gui/set/cards_panel.hpp
View file @
3cd40a7d
...
@@ -37,8 +37,6 @@ class CardsPanel : public SetWindowPanel {
...
@@ -37,8 +37,6 @@ class CardsPanel : public SetWindowPanel {
// --------------------------------------------------- : Actions
// --------------------------------------------------- : Actions
virtual
bool
wantsToHandle
(
const
Action
&
,
bool
undone
)
const
;
virtual
bool
wantsToHandle
(
const
Action
&
,
bool
undone
)
const
;
virtual
void
onAction
(
const
Action
&
,
bool
undone
);
virtual
void
onRenderSettingsChange
();
public:
public:
// --------------------------------------------------- : Clipboard
// --------------------------------------------------- : Clipboard
...
...
src/gui/set/panel.hpp
View file @
3cd40a7d
...
@@ -49,8 +49,6 @@ class SetWindowPanel : public wxPanel, public SetView {
...
@@ -49,8 +49,6 @@ class SetWindowPanel : public wxPanel, public SetView {
virtual
bool
wantsToHandle
(
const
Action
&
,
bool
undone
)
const
{
return
false
;
}
virtual
bool
wantsToHandle
(
const
Action
&
,
bool
undone
)
const
{
return
false
;
}
/// Handle an action that changes the current set
/// Handle an action that changes the current set
virtual
void
onAction
(
const
Action
&
,
bool
undone
)
{}
virtual
void
onAction
(
const
Action
&
,
bool
undone
)
{}
/// The settings for rendering cards have changed, refresh card viewers/editors
virtual
void
onRenderSettingsChange
()
{}
// --------------------------------------------------- : Clipboard
// --------------------------------------------------- : Clipboard
virtual
bool
canPaste
()
const
{
return
false
;
}
///< Is pasting possible?
virtual
bool
canPaste
()
const
{
return
false
;
}
///< Is pasting possible?
...
...
src/gui/set/style_panel.cpp
View file @
3cd40a7d
...
@@ -53,15 +53,13 @@ void StylePanel::onChangeSet() {
...
@@ -53,15 +53,13 @@ void StylePanel::onChangeSet() {
void
StylePanel
::
onAction
(
const
Action
&
action
,
bool
undone
)
{
void
StylePanel
::
onAction
(
const
Action
&
action
,
bool
undone
)
{
TYPE_CASE_
(
action
,
ChangeSetStyleAction
)
{
TYPE_CASE_
(
action
,
ChangeSetStyleAction
)
{
list
->
select
(
set
->
stylesheetFor
(
card
)
->
name
(),
false
);
list
->
select
(
set
->
stylesheetFor
(
card
)
->
name
(),
false
);
// updateSize();
}
}
TYPE_CASE
(
action
,
ChangeCardStyleAction
)
{
TYPE_CASE
(
action
,
ChangeCardStyleAction
)
{
if
(
action
.
card
==
card
)
{
if
(
action
.
card
==
card
)
{
// preview->onAction(action, undone); // update the preview control before we determine our new size
list
->
select
(
set
->
stylesheetFor
(
card
)
->
name
(),
false
);
list
->
select
(
set
->
stylesheetFor
(
card
)
->
name
(),
false
);
// updateSize();
}
}
}
}
use_for_all
->
Enable
(
card
&&
card
->
stylesheet
);
}
}
// ----------------------------------------------------------------------------- : Selection
// ----------------------------------------------------------------------------- : Selection
...
...
src/gui/set/window.cpp
View file @
3cd40a7d
...
@@ -14,6 +14,7 @@
...
@@ -14,6 +14,7 @@
#include <gui/set/keywords_panel.hpp>
#include <gui/set/keywords_panel.hpp>
#include <gui/set/stats_panel.hpp>
#include <gui/set/stats_panel.hpp>
#include <gui/control/card_list.hpp>
#include <gui/control/card_list.hpp>
#include <gui/control/card_viewer.hpp>
#include <gui/control/gallery_list.hpp>
#include <gui/control/gallery_list.hpp>
#include <gui/about_window.hpp>
#include <gui/about_window.hpp>
#include <gui/update_checker.hpp>
#include <gui/update_checker.hpp>
...
@@ -232,11 +233,12 @@ void SetWindow::onChangeSet() {
...
@@ -232,11 +233,12 @@ void SetWindow::onChangeSet() {
}
}
void
SetWindow
::
onAction
(
const
Action
&
action
,
bool
undone
)
{
void
SetWindow
::
onAction
(
const
Action
&
action
,
bool
undone
)
{
TYPE_CASE_
(
action
,
DisplayChangeAction
)
{
/*
TYPE_CASE_(action, DisplayChangeAction) {
// The style changed, maybe also the size of card viewers
// The style changed, maybe also the size of card viewers
if (current_panel) current_panel->Layout();
if (current_panel) current_panel->Layout();
fixMinWindowSize();
fixMinWindowSize();
}
}
*/
}
}
...
@@ -244,14 +246,6 @@ void SetWindow::onCardSelect(CardSelectEvent& ev) {
...
@@ -244,14 +246,6 @@ void SetWindow::onCardSelect(CardSelectEvent& ev) {
FOR_EACH
(
p
,
panels
)
{
FOR_EACH
(
p
,
panels
)
{
p
->
selectCard
(
ev
.
card
);
p
->
selectCard
(
ev
.
card
);
}
}
fixMinWindowSize
();
}
void
SetWindow
::
onRenderSettingsChange
()
{
FOR_EACH
(
p
,
panels
)
{
p
->
onRenderSettingsChange
();
}
fixMinWindowSize
();
}
}
void
SetWindow
::
fixMinWindowSize
()
{
void
SetWindow
::
fixMinWindowSize
()
{
...
@@ -267,6 +261,12 @@ void SetWindow::fixMinWindowSize() {
...
@@ -267,6 +261,12 @@ void SetWindow::fixMinWindowSize() {
SetMinSize
(
minSize
);
SetMinSize
(
minSize
);
}
}
void
SetWindow
::
onSizeChange
(
wxCommandEvent
&
)
{
FOR_EACH
(
p
,
panels
)
{
p
->
Layout
();
}
fixMinWindowSize
();
}
// ----------------------------------------------------------------------------- : Window events - close
// ----------------------------------------------------------------------------- : Window events - close
...
@@ -603,4 +603,5 @@ BEGIN_EVENT_TABLE(SetWindow, wxFrame)
...
@@ -603,4 +603,5 @@ BEGIN_EVENT_TABLE(SetWindow, wxFrame)
EVT_CLOSE
(
SetWindow
::
onClose
)
EVT_CLOSE
(
SetWindow
::
onClose
)
EVT_IDLE
(
SetWindow
::
onIdle
)
EVT_IDLE
(
SetWindow
::
onIdle
)
EVT_CARD_SELECT
(
wxID_ANY
,
SetWindow
::
onCardSelect
)
EVT_CARD_SELECT
(
wxID_ANY
,
SetWindow
::
onCardSelect
)
EVT_SIZE_CHANGE
(
wxID_ANY
,
SetWindow
::
onSizeChange
)
END_EVENT_TABLE
()
END_EVENT_TABLE
()
src/gui/set/window.hpp
View file @
3cd40a7d
...
@@ -76,10 +76,7 @@ class SetWindow : public wxFrame, public SetView {
...
@@ -76,10 +76,7 @@ class SetWindow : public wxFrame, public SetView {
private:
private:
/// A different card has been selected
/// A different card has been selected
void
onCardSelect
(
CardSelectEvent
&
);
void
onCardSelect
(
CardSelectEvent
&
);
/// Render settings have changed (because of editing of preferences)
void
onRenderSettingsChange
();
// minSize = mainSizer->getMinWindowSize(this)
// minSize = mainSizer->getMinWindowSize(this)
// but wx made that private
// but wx made that private
void
fixMinWindowSize
();
void
fixMinWindowSize
();
...
@@ -149,6 +146,8 @@ class SetWindow : public wxFrame, public SetView {
...
@@ -149,6 +146,8 @@ class SetWindow : public wxFrame, public SetView {
void
onChildMenu
(
wxCommandEvent
&
);
void
onChildMenu
(
wxCommandEvent
&
);
void
onIdle
(
wxIdleEvent
&
);
void
onIdle
(
wxIdleEvent
&
);
void
onSizeChange
(
wxCommandEvent
&
);
};
};
// ----------------------------------------------------------------------------- : EOF
// ----------------------------------------------------------------------------- : EOF
...
...
src/render/card/viewer.cpp
View file @
3cd40a7d
...
@@ -58,6 +58,7 @@ ValueViewer* DataViewer::focusedViewer() const { return nullptr; }
...
@@ -58,6 +58,7 @@ ValueViewer* DataViewer::focusedViewer() const { return nullptr; }
Context
&
DataViewer
::
getContext
()
const
{
return
set
->
getContext
();
}
Context
&
DataViewer
::
getContext
()
const
{
return
set
->
getContext
();
}
Rotation
DataViewer
::
getRotation
()
const
{
Rotation
DataViewer
::
getRotation
()
const
{
if
(
!
stylesheet
)
stylesheet
=
set
->
stylesheet
;
StyleSheetSettings
&
ss
=
settings
.
stylesheetSettingsFor
(
*
stylesheet
);
StyleSheetSettings
&
ss
=
settings
.
stylesheetSettingsFor
(
*
stylesheet
);
return
Rotation
(
ss
.
card_angle
(),
stylesheet
->
getCardRect
(),
ss
.
card_zoom
(),
true
);
return
Rotation
(
ss
.
card_angle
(),
stylesheet
->
getCardRect
(),
ss
.
card_zoom
(),
true
);
}
}
...
@@ -71,6 +72,7 @@ void DataViewer::setCard(const CardP& card) {
...
@@ -71,6 +72,7 @@ void DataViewer::setCard(const CardP& card) {
stylesheet
=
set
->
stylesheetFor
(
card
);
stylesheet
=
set
->
stylesheetFor
(
card
);
setStyles
(
stylesheet
,
stylesheet
->
card_style
);
setStyles
(
stylesheet
,
stylesheet
->
card_style
);
setData
(
card
->
data
);
setData
(
card
->
data
);
onChangeSize
();
}
}
// ----------------------------------------------------------------------------- : Viewers
// ----------------------------------------------------------------------------- : Viewers
...
...
src/render/card/viewer.hpp
View file @
3cd40a7d
...
@@ -73,14 +73,15 @@ class DataViewer : public SetView {
...
@@ -73,14 +73,15 @@ class DataViewer : public SetView {
/// Notification that the total image has changed
/// Notification that the total image has changed
virtual
void
onChange
()
{}
virtual
void
onChange
()
{}
/// Notification that the viewers are initialized
/// Notification that the viewers are initialized
virtual
void
onInit
()
{}
virtual
void
onInit
()
{}
/// Notification that the size of the viewer may have changed
virtual
void
onChangeSize
()
{}
vector
<
ValueViewerP
>
viewers
;
///< The viewers for the different values in the data
vector
<
ValueViewerP
>
viewers
;
///< The viewers for the different values in the data
CardP
card
;
///< The card that is currently displayed, if any
CardP
card
;
///< The card that is currently displayed, if any
public:
public:
StyleSheetP
stylesheet
;
///< Stylesheet being used
mutable
StyleSheetP
stylesheet
;
///< Stylesheet being used
};
};
// ----------------------------------------------------------------------------- : EOF
// ----------------------------------------------------------------------------- : EOF
...
...
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