mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-11 05:07:00 -04:00
Added 'insert symbol' menu for SymbolFonts;
Added scriptable 'enabled' to symbols in symbol font, used instead of scripted filenames. This means changing the tap symbol style now works; Added localisation for games, stylesheets and symbolfonts; Warnings from Reader are now shown onIdle; git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@198 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -53,8 +53,10 @@ class ValueEditor {
|
||||
/// a context menu is requested, add extra items to the menu m
|
||||
/** return false to suppress menu */
|
||||
virtual bool onContextMenu(wxMenu& m, wxContextMenuEvent& ev) { return true; }
|
||||
/// A menu item was selected
|
||||
virtual void onMenu(wxCommandEvent& ev) { ev.Skip(); }
|
||||
/// Get a special menu, events will be sent to onMenu
|
||||
virtual wxMenu* getMenu(int type) const { return nullptr; }
|
||||
/// A menu item was selected, return true if the command was processed
|
||||
virtual bool onCommand(int id) { return false; }
|
||||
|
||||
// --------------------------------------------------- : Clipboard
|
||||
|
||||
|
||||
+27
-1
@@ -192,7 +192,7 @@ void TextValueEditor::onChar(wxKeyEvent& ev) {
|
||||
// TODO: Find a more correct way to determine normal characters,
|
||||
// this might not work for internationalized input.
|
||||
// It might also not be portable!
|
||||
replaceSelection(String(ev.GetUnicodeKey(), 1), _("Typing"));
|
||||
replaceSelection(escape(String(ev.GetUnicodeKey(), 1)), _("Typing"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -224,6 +224,31 @@ bool TextValueEditor::onContextMenu(wxMenu& m, wxContextMenuEvent& ev) {
|
||||
// always show the menu
|
||||
return true;
|
||||
}
|
||||
bool TextValueEditor::onCommand(int id) {
|
||||
if (id >= ID_INSERT_SYMBOL_MENU_MIN && id <= ID_INSERT_SYMBOL_MENU_MAX) {
|
||||
// Insert a symbol
|
||||
if ((style().always_symbol || style().allow_formating) && style().symbol_font.valid()) {
|
||||
String code = style().symbol_font.font->insertSymbolCode(id);
|
||||
if (!style().always_symbol) {
|
||||
code = _("<sym>") + code + _("</sym>");
|
||||
}
|
||||
replaceSelection(code, _("Insert Symbol"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
wxMenu* TextValueEditor::getMenu(int type) const {
|
||||
if (type == ID_INSERT_SYMBOL && (style().always_symbol || style().allow_formating)
|
||||
&& style().symbol_font.valid()) {
|
||||
return style().symbol_font.font->insertSymbolMenu(viewer.getContext());
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
/// TODO : move to doFormat
|
||||
void TextValueEditor::onMenu(wxCommandEvent& ev) {
|
||||
if (ev.GetId() == ID_FORMAT_REMINDER) {
|
||||
// toggle reminder text
|
||||
@@ -235,6 +260,7 @@ void TextValueEditor::onMenu(wxCommandEvent& ev) {
|
||||
ev.Skip();
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// ----------------------------------------------------------------------------- : Other overrides
|
||||
|
||||
|
||||
@@ -44,7 +44,8 @@ class TextValueEditor : public TextValueViewer, public ValueEditor {
|
||||
virtual void onMouseWheel(const RealPoint& pos, wxMouseEvent& ev);
|
||||
|
||||
virtual bool onContextMenu(wxMenu& m, wxContextMenuEvent&);
|
||||
virtual void onMenu(wxCommandEvent&);
|
||||
virtual wxMenu* getMenu(int type) const;
|
||||
virtual bool onCommand(int);
|
||||
|
||||
virtual void onChar(wxKeyEvent&);
|
||||
|
||||
@@ -98,6 +99,7 @@ class TextValueEditor : public TextValueViewer, public ValueEditor {
|
||||
void moveSelectionNoRedraw(IndexType t, size_t new_end, bool also_move_start=true, Movement dir = MOVE_MID);
|
||||
|
||||
/// Replace the current selection with 'replacement', name the action
|
||||
/** replacement should be a tagged string (i.e. already escaped) */
|
||||
void replaceSelection(const String& replacement, const String& name);
|
||||
|
||||
/// Make sure the selection satisfies its constraints
|
||||
|
||||
Reference in New Issue
Block a user