mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
Copy&paste for keywords panel;
Fixed: initialization of 'direction' for TextStyle git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@292 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -53,6 +53,7 @@ TextStyle::TextStyle(const TextFieldP& field)
|
||||
, line_height_soft(1.0)
|
||||
, line_height_hard(1.0)
|
||||
, line_height_line(1.0)
|
||||
, direction(LEFT_TO_RIGHT)
|
||||
{}
|
||||
|
||||
bool TextStyle::update(Context& ctx) {
|
||||
|
||||
@@ -35,10 +35,10 @@ KeywordsPanel::KeywordsPanel(Window* parent, int id)
|
||||
splitter = new wxSplitterWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0);
|
||||
list = new KeywordList(splitter, wxID_ANY);
|
||||
panel = new Panel(splitter, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 /* no tab traversal*/);
|
||||
keyword = new TextCtrl(panel, wxID_ANY, false);
|
||||
match = new TextCtrl(panel, wxID_ANY, false);
|
||||
reminder = new TextCtrl(panel, wxID_ANY, true); // allow multiline for wordwrap
|
||||
rules = new TextCtrl(panel, wxID_ANY, true);
|
||||
keyword = new TextCtrl(panel, ID_KEYWORD, false);
|
||||
match = new TextCtrl(panel, ID_MATCH, false);
|
||||
reminder = new TextCtrl(panel, ID_REMINDER, true); // allow multiline for wordwrap
|
||||
rules = new TextCtrl(panel, ID_RULES, true);
|
||||
errors = new wxStaticText(panel, wxID_ANY, _(""));
|
||||
errors->SetForegroundColour(*wxRED);
|
||||
mode = new wxChoice(panel, ID_KEYWORD_MODE, wxDefaultPosition, wxDefaultSize, 0, nullptr);
|
||||
@@ -222,6 +222,28 @@ String KeywordsPanel::runRefScript(int find_i) {
|
||||
return wxEmptyString;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------- : Clipboard
|
||||
|
||||
// determine what control to use for clipboard actions
|
||||
#define CUT_COPY_PASTE(op,return) \
|
||||
int id = focused_control(this); \
|
||||
if (id == ID_KEYWORD && keyword ->IsEnabled()) { return keyword ->op(); } \
|
||||
else if (id == ID_MATCH && match ->IsEnabled()) { return match ->op(); } \
|
||||
else if (id == ID_REMINDER && reminder->IsEnabled()) { return reminder->op(); } \
|
||||
else if (id == ID_RULES && rules ->IsEnabled()) { return rules ->op(); } \
|
||||
else { return false; }
|
||||
|
||||
bool KeywordsPanel::canCopy() const { CUT_COPY_PASTE(canCopy, return) }
|
||||
bool KeywordsPanel::canCut() const { if (!list->getKeyword() || list->getKeyword()->fixed) return false;
|
||||
CUT_COPY_PASTE(canCut, return) }
|
||||
bool KeywordsPanel::canPaste() const { if (!list->getKeyword() || list->getKeyword()->fixed) return false;
|
||||
CUT_COPY_PASTE(canPaste, return) }
|
||||
void KeywordsPanel::doCopy() { CUT_COPY_PASTE(doCopy, ;) }
|
||||
void KeywordsPanel::doCut() { if (!list->getKeyword() || list->getKeyword()->fixed) return;
|
||||
CUT_COPY_PASTE(doCut, ;) }
|
||||
void KeywordsPanel::doPaste() { if (!list->getKeyword() || list->getKeyword()->fixed) return;
|
||||
CUT_COPY_PASTE(doPaste, ;) }
|
||||
|
||||
// ----------------------------------------------------------------------------- : Events
|
||||
|
||||
void KeywordsPanel::onChangeSet() {
|
||||
|
||||
@@ -36,6 +36,14 @@ class KeywordsPanel : public SetWindowPanel {
|
||||
virtual void onUpdateUI(wxUpdateUIEvent&);
|
||||
virtual void onCommand(int id);
|
||||
|
||||
// --------------------------------------------------- : Clipboard
|
||||
virtual bool canCut() const;
|
||||
virtual bool canCopy() const;
|
||||
virtual bool canPaste() const;
|
||||
virtual void doCut();
|
||||
virtual void doCopy();
|
||||
virtual void doPaste();
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE();
|
||||
|
||||
|
||||
@@ -191,7 +191,7 @@ enum ControlID {
|
||||
, ID_STYLESHEET_LIST
|
||||
, ID_NOTES
|
||||
, ID_KEYWORD
|
||||
, ID_PARAMETER
|
||||
, ID_MATCH
|
||||
, ID_REMINDER
|
||||
, ID_RULES
|
||||
// Card list column select
|
||||
|
||||
Reference in New Issue
Block a user