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
0ec81401
Commit
0ec81401
authored
Aug 09, 2008
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Put card notes below the card editor if they fit there (dynamically)
parent
5e5aa565
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
12 deletions
+52
-12
src/gui/set/cards_panel.cpp
src/gui/set/cards_panel.cpp
+41
-11
src/gui/set/cards_panel.hpp
src/gui/set/cards_panel.hpp
+9
-0
src/gui/set/window.hpp
src/gui/set/window.hpp
+2
-1
No files found.
src/gui/set/cards_panel.cpp
View file @
0ec81401
...
@@ -31,31 +31,33 @@ CardsPanel::CardsPanel(Window* parent, int id)
...
@@ -31,31 +31,33 @@ CardsPanel::CardsPanel(Window* parent, int id)
:
SetWindowPanel
(
parent
,
id
)
:
SetWindowPanel
(
parent
,
id
)
{
{
// init controls
// init controls
wxPanel
*
notesP
;
editor
=
new
CardEditor
(
this
,
ID_EDITOR
);
editor
=
new
CardEditor
(
this
,
ID_EDITOR
);
splitter
=
new
wxSplitterWindow
(
this
,
wxID_ANY
,
wxDefaultPosition
,
wxDefaultSize
,
wxTAB_TRAVERSAL
);
splitter
=
new
wxSplitterWindow
(
this
,
wxID_ANY
,
wxDefaultPosition
,
wxDefaultSize
,
wxTAB_TRAVERSAL
);
card_list
=
new
ImageCardList
(
splitter
,
ID_CARD_LIST
);
card_list
=
new
ImageCardList
(
splitter
,
ID_CARD_LIST
);
nodes_panel
=
new
Panel
(
splitter
,
wxID_ANY
);
notesP
=
new
Panel
(
splitter
,
wxID_ANY
);
notes
=
new
TextCtrl
(
nodes_panel
,
ID_NOTES
,
true
);
notes
=
new
TextCtrl
(
notesP
,
ID_NOTES
,
true
);
collapse_notes
=
new
HoverButton
(
nodes_panel
,
ID_COLLAPSE_NOTES
,
_
(
"btn_collapse"
),
wxNullColour
,
false
);
collapse_notes
=
new
HoverButton
(
notesP
,
ID_COLLAPSE_NOTES
,
_
(
"btn_collapse"
),
wxNullColour
,
false
);
collapse_notes
->
SetExtraStyle
(
wxWS_EX_PROCESS_UI_UPDATES
);
collapse_notes
->
SetExtraStyle
(
wxWS_EX_PROCESS_UI_UPDATES
);
filter
=
nullptr
;
filter
=
nullptr
;
editor
->
next_in_tab_order
=
card_list
;
editor
->
next_in_tab_order
=
card_list
;
// init sizer for notes panel
// init sizer for notes panel
wxSizer
*
sn
=
new
wxBoxSizer
(
wxVERTICAL
);
wxSizer
*
sn
=
new
wxBoxSizer
(
wxVERTICAL
);
wxSizer
*
sc
=
new
wxBoxSizer
(
wxHORIZONTAL
);
wxSizer
*
sc
=
new
wxBoxSizer
(
wxHORIZONTAL
);
sc
->
Add
(
new
wxStaticText
(
no
tesP
,
wxID_ANY
,
_LABEL_
(
"card notes"
)),
1
,
wxEXPAND
);
sc
->
Add
(
new
wxStaticText
(
no
des_panel
,
wxID_ANY
,
_LABEL_
(
"card notes"
)),
1
,
wxEXPAND
);
sc
->
Add
(
collapse_notes
,
0
,
wxALIGN_CENTER
|
wxRIGHT
,
2
);
sc
->
Add
(
collapse_notes
,
0
,
wxALIGN_CENTER
|
wxRIGHT
,
2
);
sn
->
Add
(
sc
,
0
,
wxEXPAND
,
2
);
sn
->
Add
(
sc
,
0
,
wxEXPAND
,
2
);
sn
->
Add
(
notes
,
1
,
wxEXPAND
|
wxTOP
,
2
);
sn
->
Add
(
notes
,
1
,
wxEXPAND
|
wxTOP
,
2
);
no
tesP
->
SetSizer
(
sn
);
no
des_panel
->
SetSizer
(
sn
);
// init splitter
// init splitter
splitter
->
SetMinimumPaneSize
(
15
);
splitter
->
SetMinimumPaneSize
(
15
);
splitter
->
SetSashGravity
(
1.0
);
splitter
->
SetSashGravity
(
1.0
);
splitter
->
SplitHorizontally
(
card_list
,
notesP
,
-
40
);
splitter
->
SplitHorizontally
(
card_list
,
nodes_panel
,
-
40
);
notes_below_editor
=
false
;
// init sizer
// init sizer
wxSizer
*
s
=
new
wxBoxSizer
(
wxHORIZONTAL
);
wxSizer
*
s
=
new
wxBoxSizer
(
wxHORIZONTAL
);
s
->
Add
(
editor
,
0
,
wxRIGHT
,
2
);
s_left
=
new
wxBoxSizer
(
wxVERTICAL
);
s_left
->
Add
(
editor
);
s
->
Add
(
s_left
,
0
,
wxEXPAND
|
wxRIGHT
,
2
);
s
->
Add
(
splitter
,
1
,
wxEXPAND
);
s
->
Add
(
splitter
,
1
,
wxEXPAND
);
s
->
SetSizeHints
(
this
);
s
->
SetSizeHints
(
this
);
SetSizer
(
s
);
SetSizer
(
s
);
...
@@ -92,6 +94,33 @@ CardsPanel::CardsPanel(Window* parent, int id)
...
@@ -92,6 +94,33 @@ CardsPanel::CardsPanel(Window* parent, int id)
menuFormat
->
Append
(
insertSymbolMenu
);
menuFormat
->
Append
(
insertSymbolMenu
);
}
}
void
CardsPanel
::
updateNotesPosition
()
{
wxSize
editor_size
=
editor
->
GetBestSize
();
int
room_below_editor
=
GetSize
().
y
-
editor_size
.
y
;
bool
should_be_below
=
room_below_editor
>
100
;
// move?
if
(
should_be_below
&&
!
notes_below_editor
)
{
notes_below_editor
=
true
;
// move the notes_panel to below the editor, it gets this as its parent
splitter
->
Unsplit
(
nodes_panel
);
nodes_panel
->
Reparent
(
this
);
s_left
->
Add
(
nodes_panel
,
1
,
wxEXPAND
|
wxTOP
,
2
);
collapse_notes
->
Hide
();
nodes_panel
->
Show
();
}
else
if
(
!
should_be_below
&&
notes_below_editor
)
{
notes_below_editor
=
false
;
// move the notes_panel back to below the card list
s_left
->
Detach
(
nodes_panel
);
nodes_panel
->
Reparent
(
splitter
);
collapse_notes
->
Show
();
splitter
->
SplitHorizontally
(
card_list
,
nodes_panel
,
-
80
);
}
}
bool
CardsPanel
::
Layout
()
{
updateNotesPosition
();
return
SetWindowPanel
::
Layout
();
}
CardsPanel
::~
CardsPanel
()
{
CardsPanel
::~
CardsPanel
()
{
// settings.card_notes_height = splitter->GetSashPosition();
// settings.card_notes_height = splitter->GetSashPosition();
// we don't own the submenu
// we don't own the submenu
...
@@ -352,6 +381,7 @@ void CardsPanel::selectCard(const CardP& card) {
...
@@ -352,6 +381,7 @@ void CardsPanel::selectCard(const CardP& card) {
editor
->
setCard
(
card
);
editor
->
setCard
(
card
);
notes
->
setValue
(
card
?
&
card
->
notes
:
nullptr
);
notes
->
setValue
(
card
?
&
card
->
notes
:
nullptr
);
Layout
();
Layout
();
updateNotesPosition
();
}
}
void
CardsPanel
::
selectFirstCard
()
{
void
CardsPanel
::
selectFirstCard
()
{
...
...
src/gui/set/cards_panel.hpp
View file @
0ec81401
...
@@ -72,12 +72,21 @@ class CardsPanel : public SetWindowPanel {
...
@@ -72,12 +72,21 @@ class CardsPanel : public SetWindowPanel {
private:
private:
// --------------------------------------------------- : Controls
// --------------------------------------------------- : Controls
wxSizer
*
s_left
;
wxSplitterWindow
*
splitter
;
wxSplitterWindow
*
splitter
;
DataEditor
*
editor
;
DataEditor
*
editor
;
ImageCardList
*
card_list
;
ImageCardList
*
card_list
;
Panel
*
nodes_panel
;
TextCtrl
*
notes
;
TextCtrl
*
notes
;
HoverButton
*
collapse_notes
;
HoverButton
*
collapse_notes
;
wxTextCtrl
*
filter
;
wxTextCtrl
*
filter
;
bool
notes_below_editor
;
/// Move the notes panel below the editor or below the card list
void
updateNotesPosition
();
// before Layout, call updateNotesPosition.
// NOTE: docs say this function returns void, but the code says bool
virtual
bool
Layout
();
// --------------------------------------------------- : Menus & tools
// --------------------------------------------------- : Menus & tools
IconMenu
*
menuCard
,
*
menuFormat
;
IconMenu
*
menuCard
,
*
menuFormat
;
...
...
src/gui/set/window.hpp
View file @
0ec81401
...
@@ -86,10 +86,11 @@ class SetWindow : public wxFrame, public SetView {
...
@@ -86,10 +86,11 @@ class SetWindow : public wxFrame, public SetView {
/// Actions that change the set
/// Actions that change the set
virtual
void
onAction
(
const
Action
&
,
bool
undone
);
virtual
void
onAction
(
const
Action
&
,
bool
undone
);
p
rivate
:
p
ublic
:
// minSize = mainSizer->getMinWindowSize(this)
// minSize = mainSizer->getMinWindowSize(this)
// but wx made that private
// but wx made that private
void
fixMinWindowSize
();
void
fixMinWindowSize
();
private:
/// Update the window title based on the set name
/// Update the window title based on the set name
void
updateTitle
();
void
updateTitle
();
...
...
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