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
d98d23d2
Commit
d98d23d2
authored
Jan 22, 2011
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
copying messages from console
parent
8b698c47
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
15 deletions
+37
-15
src/gui/set/console_panel.cpp
src/gui/set/console_panel.cpp
+36
-10
src/gui/set/console_panel.hpp
src/gui/set/console_panel.hpp
+0
-5
src/util/window_id.hpp
src/util/window_id.hpp
+1
-0
No files found.
src/gui/set/console_panel.cpp
View file @
d98d23d2
...
...
@@ -15,6 +15,7 @@
#include <data/stylesheet.hpp>
#include <wx/splitter.h>
#include <wx/dcbuffer.h>
#include <wx/clipbrd.h>
DECLARE_POINTER_TYPE
(
ConsoleMessage
);
DECLARE_TYPEOF_COLLECTION
(
ScriptParseError
);
...
...
@@ -77,6 +78,27 @@ class MessageCtrl : public wxScrolledWindow {
add_message
(
intrusive
(
new
ConsoleMessage
(
type
,
text
)));
}
bool
have_selection
()
const
{
return
selection
<
messages
.
size
();
}
bool
canCopy
()
const
{
return
have_selection
();
}
bool
doCopy
()
{
if
(
selection
>=
messages
.
size
())
return
false
;
ConsoleMessage
const
&
msg
=
*
messages
[
selection
];
if
(
!
wxTheClipboard
->
Open
())
return
false
;
bool
ok
=
false
;
if
(
msg
.
bitmap
.
Ok
())
{
ok
=
wxTheClipboard
->
SetData
(
new
wxBitmapDataObject
(
msg
.
bitmap
));
}
else
{
ok
=
wxTheClipboard
->
SetData
(
new
wxTextDataObject
(
msg
.
text
));
}
wxTheClipboard
->
Close
();
return
ok
;
}
private:
DECLARE_EVENT_TABLE
();
...
...
@@ -97,6 +119,7 @@ class MessageCtrl : public wxScrolledWindow {
ensure_visible
(
*
messages
[
selection
]);
}
Refresh
(
false
);
ev
.
Skip
();
// for focus
}
size_t
find_point
(
int
y
)
{
...
...
@@ -275,7 +298,7 @@ ConsolePanel::ConsolePanel(Window* parent, int id)
{
// init controls
splitter
=
new
wxSplitterWindow
(
this
,
wxID_ANY
,
wxDefaultPosition
,
wxDefaultSize
,
wxTAB_TRAVERSAL
);
messages
=
new
MessageCtrl
(
splitter
,
wxID_ANY
);
messages
=
new
MessageCtrl
(
splitter
,
ID_MESSAGE_LIST
);
entry_panel
=
new
Panel
(
splitter
,
wxID_ANY
);
entry
=
new
wxTextCtrl
(
entry_panel
,
wxID_ANY
,
_
(
""
),
wxDefaultPosition
,
wxDefaultSize
,
wxTE_PROCESS_ENTER
);
wxButton
*
evaluate
=
new
wxButton
(
entry_panel
,
ID_EVALUATE
,
_BUTTON_
(
"evaluate"
));
...
...
@@ -388,7 +411,7 @@ void ConsolePanel::exec(String const& command) {
AColor
color
=
(
AColor
)
*
result
;
wxImage
image
(
30
,
20
);
fill_image
(
image
,
color
);
set_alpha
(
image
,
color
.
alpha
);
set_alpha
(
image
,
color
.
alpha
/
255.0
);
message
->
bitmap
=
wxBitmap
(
image
);
}
else
{
message
->
text
=
result
->
toCode
();
...
...
@@ -406,14 +429,17 @@ BEGIN_EVENT_TABLE(ConsolePanel, wxPanel)
END_EVENT_TABLE
()
// ----------------------------------------------------------------------------- : Clipboard
/*
bool ConsolePanel::canCut() const { return entry->canCut(); }
bool ConsolePanel::canCopy() const { return entry->canCopy(); }
bool ConsolePanel::canPaste() const { return entry->canPaste(); }
void ConsolePanel::doCut() { entry->doCut(); }
void ConsolePanel::doCopy() { entry->doCopy(); }
void ConsolePanel::doPaste() { entry->doPaste(); }
*/
// determine what control to use for clipboard actions
#define CUT_COPY_PASTE(op,return) \
int
id
=
focused_control
(
this
);
\
if
(
id
==
ID_MESSAGE_LIST
)
{
return
messages
->
op
();
}
\
else
{
return
false
;
}
bool
ConsolePanel
::
canCut
()
const
{
return
false
;
}
bool
ConsolePanel
::
canCopy
()
const
{
CUT_COPY_PASTE
(
canCopy
,
return
)
}
//void ConsolePanel::doCut() { CUT_COPY_PASTE(doCut, return (void)) }
void
ConsolePanel
::
doCopy
()
{
CUT_COPY_PASTE
(
doCopy
,
return
(
void
))
}
// ----------------------------------------------------------------------------- : Annoying blinking icon thing
...
...
src/gui/set/console_panel.hpp
View file @
d98d23d2
...
...
@@ -33,14 +33,9 @@ class ConsolePanel : public SetWindowPanel {
// --------------------------------------------------- : Clipboard
/*
virtual
bool
canCut
()
const
;
virtual
bool
canCopy
()
const
;
virtual bool canPaste() const;
virtual void doCut();
virtual
void
doCopy
();
virtual void doPaste();
*/
protected:
virtual
void
onChangeSet
();
...
...
src/util/window_id.hpp
View file @
d98d23d2
...
...
@@ -244,6 +244,7 @@ enum ControlID {
,
ID_MATCH
,
ID_REMINDER
,
ID_RULES
,
ID_MESSAGE_LIST
// Card list column select
,
ID_MOVE_UP
,
ID_MOVE_DOWN
...
...
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