mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-13 05:57:00 -04:00
Improvements to keyboard handling (TAB)
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@660 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -26,7 +26,7 @@ DECLARE_POINTER_TYPE(InfoValue);
|
|||||||
*/
|
*/
|
||||||
class InfoField : public Field {
|
class InfoField : public Field {
|
||||||
public:
|
public:
|
||||||
InfoField() {}
|
InfoField() { editable = false; }
|
||||||
DECLARE_FIELD_TYPE(Text);
|
DECLARE_FIELD_TYPE(Text);
|
||||||
|
|
||||||
OptionalScript script; ///< Script to apply to all values
|
OptionalScript script; ///< Script to apply to all values
|
||||||
|
|||||||
@@ -62,10 +62,11 @@ END_EVENT_TABLE ()
|
|||||||
// ----------------------------------------------------------------------------- : Button with image and hover effect
|
// ----------------------------------------------------------------------------- : Button with image and hover effect
|
||||||
|
|
||||||
|
|
||||||
HoverButton::HoverButton(Window* parent, int id, const String& name, const Color& background)
|
HoverButton::HoverButton(Window* parent, int id, const String& name, const Color& background, bool accepts_focus)
|
||||||
: wxControl(parent, id, wxDefaultPosition, wxDefaultSize, wxNO_BORDER )
|
: wxControl(parent, id, wxDefaultPosition, wxDefaultSize, wxNO_BORDER )
|
||||||
, hover(false), focus(false), mouse_down(false), key_down(false)
|
, hover(false), focus(false), mouse_down(false), key_down(false)
|
||||||
, background(background)
|
, background(background)
|
||||||
|
, accepts_focus(accepts_focus)
|
||||||
, last_drawn(nullptr)
|
, last_drawn(nullptr)
|
||||||
{
|
{
|
||||||
loadBitmaps(name);
|
loadBitmaps(name);
|
||||||
@@ -136,6 +137,9 @@ void HoverButton::onKeyUp(wxKeyEvent& ev) {
|
|||||||
wxSize HoverButton::DoGetBestSize() const {
|
wxSize HoverButton::DoGetBestSize() const {
|
||||||
return wxSize(bg_normal.GetWidth(), bg_normal.GetHeight());
|
return wxSize(bg_normal.GetWidth(), bg_normal.GetHeight());
|
||||||
}
|
}
|
||||||
|
bool HoverButton::AcceptsFocus() const {
|
||||||
|
return wxControl::AcceptsFocus() && accepts_focus;
|
||||||
|
}
|
||||||
|
|
||||||
const Bitmap* HoverButton::toDraw() const {
|
const Bitmap* HoverButton::toDraw() const {
|
||||||
return (mouse_down && hover) || key_down ? &bg_down
|
return (mouse_down && hover) || key_down ? &bg_down
|
||||||
|
|||||||
@@ -37,11 +37,13 @@ class HoverButton : public wxControl {
|
|||||||
/** name+"_normal", name+"_hover", name+"_focus", name+"_down"
|
/** name+"_normal", name+"_hover", name+"_focus", name+"_down"
|
||||||
* are the resource names of the images used.
|
* are the resource names of the images used.
|
||||||
*/
|
*/
|
||||||
HoverButton(Window* parent, int id, const String& name, const Color& background = Color(240,247,255));
|
HoverButton(Window* parent, int id, const String& name, const Color& background = Color(240,247,255), bool accepts_focus = true);
|
||||||
|
|
||||||
/// Load different bitmaps for this button
|
/// Load different bitmaps for this button
|
||||||
void loadBitmaps(const String& name);
|
void loadBitmaps(const String& name);
|
||||||
|
|
||||||
|
virtual bool AcceptsFocus() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_EVENT_TABLE();
|
DECLARE_EVENT_TABLE();
|
||||||
|
|
||||||
@@ -49,6 +51,7 @@ class HoverButton : public wxControl {
|
|||||||
Bitmap bg_normal, bg_hover, bg_focus, bg_down; ///< Bitmaps for the states of the button
|
Bitmap bg_normal, bg_hover, bg_focus, bg_down; ///< Bitmaps for the states of the button
|
||||||
bool hover, focus, mouse_down, key_down;
|
bool hover, focus, mouse_down, key_down;
|
||||||
Color background;
|
Color background;
|
||||||
|
const bool accepts_focus;
|
||||||
|
|
||||||
void onMouseEnter(wxMouseEvent&);
|
void onMouseEnter(wxMouseEvent&);
|
||||||
void onMouseLeave(wxMouseEvent&);
|
void onMouseLeave(wxMouseEvent&);
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ DECLARE_TYPEOF_COLLECTION(ValueViewer*);
|
|||||||
// ----------------------------------------------------------------------------- : DataEditor
|
// ----------------------------------------------------------------------------- : DataEditor
|
||||||
|
|
||||||
DataEditor::DataEditor(Window* parent, int id, long style)
|
DataEditor::DataEditor(Window* parent, int id, long style)
|
||||||
: CardViewer(parent, id, style)
|
: CardViewer(parent, id, style | wxWANTS_CHARS)
|
||||||
, current_viewer(nullptr)
|
, current_viewer(nullptr)
|
||||||
, current_editor(nullptr)
|
, current_editor(nullptr)
|
||||||
, hovered_viewer(nullptr)
|
, hovered_viewer(nullptr)
|
||||||
@@ -59,6 +59,10 @@ ValueViewer* DataEditor::focusedViewer() const {
|
|||||||
|
|
||||||
// ----------------------------------------------------------------------------- : Selection
|
// ----------------------------------------------------------------------------- : Selection
|
||||||
|
|
||||||
|
bool DataEditor::AcceptsFocus() const {
|
||||||
|
return wxControl::AcceptsFocus();
|
||||||
|
}
|
||||||
|
|
||||||
void DataEditor::select(ValueViewer* v) {
|
void DataEditor::select(ValueViewer* v) {
|
||||||
ValueEditor* old_editor = current_editor;
|
ValueEditor* old_editor = current_editor;
|
||||||
current_viewer = v;
|
current_viewer = v;
|
||||||
@@ -125,7 +129,8 @@ struct CompareTabIndex {
|
|||||||
void DataEditor::createTabIndex() {
|
void DataEditor::createTabIndex() {
|
||||||
by_tab_index.clear();
|
by_tab_index.clear();
|
||||||
FOR_EACH(v, viewers) {
|
FOR_EACH(v, viewers) {
|
||||||
if (v->getField()->editable && v->getStyle()->visible) {
|
ValueEditor* e = v->getEditor();
|
||||||
|
if (e && v->getField()->editable && v->getStyle()->visible) {
|
||||||
by_tab_index.push_back(v.get());
|
by_tab_index.push_back(v.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -136,6 +141,9 @@ void DataEditor::onInit() {
|
|||||||
current_viewer = nullptr;
|
current_viewer = nullptr;
|
||||||
current_editor = nullptr;
|
current_editor = nullptr;
|
||||||
hovered_viewer = nullptr;
|
hovered_viewer = nullptr;
|
||||||
|
// hide caret if it is shown
|
||||||
|
wxCaret* caret = GetCaret();
|
||||||
|
if (caret->IsVisible()) caret->Hide();
|
||||||
}
|
}
|
||||||
// ----------------------------------------------------------------------------- : Search / replace
|
// ----------------------------------------------------------------------------- : Search / replace
|
||||||
|
|
||||||
@@ -195,10 +203,16 @@ void DataEditor::onLeftDown(wxMouseEvent& ev) {
|
|||||||
}
|
}
|
||||||
void DataEditor::onLeftUp(wxMouseEvent& ev) {
|
void DataEditor::onLeftUp(wxMouseEvent& ev) {
|
||||||
if (HasCapture()) ReleaseMouse();
|
if (HasCapture()) ReleaseMouse();
|
||||||
if (current_editor) current_editor->onLeftUp(mousePoint(ev), ev);
|
RealPoint pos = mousePoint(ev);
|
||||||
|
if (current_editor && current_viewer && current_viewer->containsPoint(pos)) {
|
||||||
|
current_editor->onLeftUp(pos, ev);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
void DataEditor::onLeftDClick(wxMouseEvent& ev) {
|
void DataEditor::onLeftDClick(wxMouseEvent& ev) {
|
||||||
if (current_editor) current_editor->onLeftDClick(mousePoint(ev), ev);
|
RealPoint pos = mousePoint(ev);
|
||||||
|
if (current_editor && current_viewer && current_viewer->containsPoint(pos)) {
|
||||||
|
current_editor->onLeftDClick(pos, ev);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
void DataEditor::onRightDown(wxMouseEvent& ev) {
|
void DataEditor::onRightDown(wxMouseEvent& ev) {
|
||||||
ev.Skip(); // for context menu
|
ev.Skip(); // for context menu
|
||||||
@@ -206,8 +220,11 @@ void DataEditor::onRightDown(wxMouseEvent& ev) {
|
|||||||
selectField(ev, &ValueEditor::onRightDown);
|
selectField(ev, &ValueEditor::onRightDown);
|
||||||
}
|
}
|
||||||
void DataEditor::onMouseWheel(wxMouseEvent& ev) {
|
void DataEditor::onMouseWheel(wxMouseEvent& ev) {
|
||||||
if (current_editor && current_editor->onMouseWheel(mousePoint(ev), ev));
|
RealPoint pos = mousePoint(ev);
|
||||||
else ev.Skip();
|
if (current_editor && current_viewer && current_viewer->containsPoint(pos)) {
|
||||||
|
if (current_editor->onMouseWheel(pos, ev)) return;
|
||||||
|
}
|
||||||
|
ev.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataEditor::onMotion(wxMouseEvent& ev) {
|
void DataEditor::onMotion(wxMouseEvent& ev) {
|
||||||
@@ -269,7 +286,9 @@ void DataEditor::selectField(wxMouseEvent& ev, bool (ValueEditor::*event)(const
|
|||||||
if (current_editor) current_editor->onFocus();
|
if (current_editor) current_editor->onFocus();
|
||||||
}
|
}
|
||||||
// pass event
|
// pass event
|
||||||
if (current_editor) (current_editor->*event)(pos, ev);
|
if (current_editor && current_viewer && current_viewer->containsPoint(pos)) {
|
||||||
|
(current_editor->*event)(pos, ev);
|
||||||
|
}
|
||||||
// refresh?
|
// refresh?
|
||||||
if (old_editor != current_editor) {
|
if (old_editor != current_editor) {
|
||||||
// selection has changed, refresh viewers
|
// selection has changed, refresh viewers
|
||||||
@@ -279,14 +298,15 @@ void DataEditor::selectField(wxMouseEvent& ev, bool (ValueEditor::*event)(const
|
|||||||
}
|
}
|
||||||
void DataEditor::selectFieldNoEvents(const RealPoint& p) {
|
void DataEditor::selectFieldNoEvents(const RealPoint& p) {
|
||||||
FOR_EACH_EDITOR_REVERSE { // find high z index fields first
|
FOR_EACH_EDITOR_REVERSE { // find high z index fields first
|
||||||
if (v->containsPoint(p) && v->getField()->editable) {
|
if (v->getField()->editable && (v->containsPoint(p) ||
|
||||||
|
(nativeLook() && p.y >= v->getStyle()->top && p.y < v->getStyle()->bottom) )) {
|
||||||
current_viewer = v.get();
|
current_viewer = v.get();
|
||||||
current_editor = e;
|
current_editor = e;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
current_viewer = nullptr;
|
//% current_viewer = nullptr;
|
||||||
current_editor = nullptr;
|
//% current_editor = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
RealPoint DataEditor::mousePoint(const wxMouseEvent& ev) {
|
RealPoint DataEditor::mousePoint(const wxMouseEvent& ev) {
|
||||||
@@ -348,6 +368,8 @@ void DataEditor::onFocus(wxFocusEvent& ev) {
|
|||||||
if (current_editor) {
|
if (current_editor) {
|
||||||
current_editor->onFocus();
|
current_editor->onFocus();
|
||||||
onChange();
|
onChange();
|
||||||
|
} else {
|
||||||
|
selectFirst();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void DataEditor::onLoseFocus(wxFocusEvent& ev) {
|
void DataEditor::onLoseFocus(wxFocusEvent& ev) {
|
||||||
|
|||||||
@@ -41,6 +41,8 @@ class DataEditor : public CardViewer {
|
|||||||
/// Select the previous editable editor, returns false if the current editor is the first one
|
/// Select the previous editable editor, returns false if the current editor is the first one
|
||||||
bool selectPrevious();
|
bool selectPrevious();
|
||||||
|
|
||||||
|
virtual bool AcceptsFocus() const;
|
||||||
|
|
||||||
// --------------------------------------------------- : Clipboard
|
// --------------------------------------------------- : Clipboard
|
||||||
|
|
||||||
bool canCut() const;
|
bool canCut() const;
|
||||||
|
|||||||
@@ -38,6 +38,8 @@ class CardViewer : public wxControl, public DataViewer {
|
|||||||
/// The rotation to use
|
/// The rotation to use
|
||||||
virtual Rotation getRotation() const;
|
virtual Rotation getRotation() const;
|
||||||
|
|
||||||
|
virtual bool AcceptsFocus() const { return false; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/// Return the desired size of control
|
/// Return the desired size of control
|
||||||
virtual wxSize DoGetBestSize() const;
|
virtual wxSize DoGetBestSize() const;
|
||||||
|
|||||||
@@ -21,11 +21,12 @@ const int MARGIN = 1; // margin between items (excluding border)
|
|||||||
const int BORDER = 1; // border aroung items
|
const int BORDER = 1; // border aroung items
|
||||||
const int SPACING = MARGIN + 2*BORDER; // distance between items
|
const int SPACING = MARGIN + 2*BORDER; // distance between items
|
||||||
|
|
||||||
GalleryList::GalleryList(Window* parent, int id, int direction)
|
GalleryList::GalleryList(Window* parent, int id, int direction, bool always_focused)
|
||||||
: wxScrolledWindow(parent, id, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER | (direction == wxHORIZONTAL ? wxHSCROLL : wxVSCROLL) )
|
: wxScrolledWindow(parent, id, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER | wxWANTS_CHARS | (direction == wxHORIZONTAL ? wxHSCROLL : wxVSCROLL) )
|
||||||
, selection(NO_SELECTION)
|
, selection(NO_SELECTION)
|
||||||
, direction(direction)
|
, direction(direction)
|
||||||
, scroll_increment(10)
|
, scroll_increment(10)
|
||||||
|
, always_focused(always_focused)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void GalleryList::update() {
|
void GalleryList::update() {
|
||||||
@@ -117,7 +118,7 @@ void GalleryList::onChar(wxKeyEvent& ev) {
|
|||||||
} break;
|
} break;
|
||||||
case WXK_TAB: {
|
case WXK_TAB: {
|
||||||
// send a navigation event to our parent, to select another control
|
// send a navigation event to our parent, to select another control
|
||||||
// we need this because tabs are not handled on the set window panels
|
// we need this because tabs of wxWANTS_CHARS
|
||||||
wxNavigationKeyEvent nev;
|
wxNavigationKeyEvent nev;
|
||||||
nev.SetDirection(!ev.ShiftDown());
|
nev.SetDirection(!ev.ShiftDown());
|
||||||
GetParent()->ProcessEvent(nev);
|
GetParent()->ProcessEvent(nev);
|
||||||
@@ -168,7 +169,12 @@ void GalleryList::OnDraw(DC& dc) {
|
|||||||
for (size_t i = start ; i < end ; ++i) {
|
for (size_t i = start ; i < end ; ++i) {
|
||||||
// draw selection rectangle
|
// draw selection rectangle
|
||||||
bool selected = i == selection;
|
bool selected = i == selection;
|
||||||
Color c = selected ? wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT) : unselected;
|
Color c = selected ? ( always_focused || FindFocus() == this
|
||||||
|
? wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT)
|
||||||
|
: lerp(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW),
|
||||||
|
wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT), 0.7)
|
||||||
|
)
|
||||||
|
: unselected;
|
||||||
dc.SetPen(c);
|
dc.SetPen(c);
|
||||||
dc.SetBrush(saturate(lerp(background, c, 0.3), selected ? 0.5 : 0));
|
dc.SetBrush(saturate(lerp(background, c, 0.3), selected ? 0.5 : 0));
|
||||||
wxPoint pos = itemPos(i);
|
wxPoint pos = itemPos(i);
|
||||||
@@ -178,6 +184,10 @@ void GalleryList::OnDraw(DC& dc) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GalleryList::onFocus(wxFocusEvent&) {
|
||||||
|
if (!always_focused) Refresh(false);
|
||||||
|
}
|
||||||
|
|
||||||
void GalleryList::onSize(wxSizeEvent&) {
|
void GalleryList::onSize(wxSizeEvent&) {
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
@@ -193,6 +203,8 @@ BEGIN_EVENT_TABLE(GalleryList, wxScrolledWindow)
|
|||||||
EVT_LEFT_DOWN (GalleryList::onLeftDown)
|
EVT_LEFT_DOWN (GalleryList::onLeftDown)
|
||||||
EVT_LEFT_DCLICK (GalleryList::onLeftDClick)
|
EVT_LEFT_DCLICK (GalleryList::onLeftDClick)
|
||||||
EVT_CHAR (GalleryList::onChar)
|
EVT_CHAR (GalleryList::onChar)
|
||||||
|
EVT_SET_FOCUS (GalleryList::onFocus)
|
||||||
|
EVT_KILL_FOCUS (GalleryList::onFocus)
|
||||||
EVT_PAINT (GalleryList::onPaint)
|
EVT_PAINT (GalleryList::onPaint)
|
||||||
EVT_SIZE (GalleryList::onSize)
|
EVT_SIZE (GalleryList::onSize)
|
||||||
END_EVENT_TABLE ()
|
END_EVENT_TABLE ()
|
||||||
|
|||||||
@@ -29,17 +29,18 @@ DECLARE_EVENT_TYPE(EVENT_GALLERY_ACTIVATE, <not used>)
|
|||||||
*/
|
*/
|
||||||
class GalleryList : public wxScrolledWindow {
|
class GalleryList : public wxScrolledWindow {
|
||||||
public:
|
public:
|
||||||
GalleryList(Window* parent, int id, int direction = wxHORIZONTAL);
|
GalleryList(Window* parent, int id, int direction = wxHORIZONTAL, bool always_focused = true);
|
||||||
|
|
||||||
/// Is there an item selected?
|
/// Is there an item selected?
|
||||||
inline bool hasSelection() const { return selection < itemCount(); }
|
inline bool hasSelection() const { return selection < itemCount(); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static const size_t NO_SELECTION = (size_t)-1;
|
static const size_t NO_SELECTION = (size_t)-1;
|
||||||
size_t selection; ///< The selected item, or NO_SELECTION if there is no selection
|
size_t selection; ///< The selected item, or NO_SELECTION if there is no selection
|
||||||
wxSize item_size; ///< The size of a single item
|
wxSize item_size; ///< The size of a single item
|
||||||
int direction; ///< Direction of the list, can be wxHORIZONTAL or wxVERTICAL
|
int direction; ///< Direction of the list, can be wxHORIZONTAL or wxVERTICAL
|
||||||
int scroll_increment; ///< How large are the scroll steps?
|
int scroll_increment; ///< How large are the scroll steps?
|
||||||
|
bool always_focused; ///< Always draw as if focused
|
||||||
|
|
||||||
/// Redraw the list after changing the selection or the number of items
|
/// Redraw the list after changing the selection or the number of items
|
||||||
void update();
|
void update();
|
||||||
@@ -58,6 +59,7 @@ class GalleryList : public wxScrolledWindow {
|
|||||||
void onLeftDown (wxMouseEvent& ev);
|
void onLeftDown (wxMouseEvent& ev);
|
||||||
void onLeftDClick(wxMouseEvent& ev);
|
void onLeftDClick(wxMouseEvent& ev);
|
||||||
void onChar(wxKeyEvent& ev);
|
void onChar(wxKeyEvent& ev);
|
||||||
|
void onFocus(wxFocusEvent&);
|
||||||
void onPaint(wxPaintEvent&);
|
void onPaint(wxPaintEvent&);
|
||||||
void onSize(wxSizeEvent&);
|
void onSize(wxSizeEvent&);
|
||||||
void OnDraw(DC& dc);
|
void OnDraw(DC& dc);
|
||||||
|
|||||||
@@ -798,7 +798,7 @@ void GraphContainer::add(const GraphP& graph) {
|
|||||||
// ----------------------------------------------------------------------------- : GraphControl
|
// ----------------------------------------------------------------------------- : GraphControl
|
||||||
|
|
||||||
GraphControl::GraphControl(Window* parent, int id)
|
GraphControl::GraphControl(Window* parent, int id)
|
||||||
: wxControl(parent, id)
|
: wxControl(parent, id, wxDefaultPosition, wxDefaultSize, wxWANTS_CHARS)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void GraphControl::setLayout(GraphType type) {
|
void GraphControl::setLayout(GraphType type) {
|
||||||
@@ -912,6 +912,13 @@ void GraphControl::onChar(wxKeyEvent& ev) {
|
|||||||
onSelectionChange();
|
onSelectionChange();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case WXK_TAB: {
|
||||||
|
// send a navigation event to our parent, to select another control
|
||||||
|
// we need this because of wxWANTS_CHARS
|
||||||
|
wxNavigationKeyEvent nev;
|
||||||
|
nev.SetDirection(!ev.ShiftDown());
|
||||||
|
GetParent()->ProcessEvent(nev);
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ DECLARE_TYPEOF_COLLECTION(PackagedP);
|
|||||||
|
|
||||||
// ----------------------------------------------------------------------------- : PackageList
|
// ----------------------------------------------------------------------------- : PackageList
|
||||||
|
|
||||||
PackageList::PackageList(Window* parent, int id, int direction)
|
PackageList::PackageList(Window* parent, int id, int direction, bool always_focused)
|
||||||
: GalleryList(parent, id, direction)
|
: GalleryList(parent, id, direction, always_focused)
|
||||||
{
|
{
|
||||||
item_size = wxSize(108, 150);
|
item_size = wxSize(108, 150);
|
||||||
SetThemeEnabled(true);
|
SetThemeEnabled(true);
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ DECLARE_POINTER_TYPE(Packaged);
|
|||||||
/// A list of Packages of a specific type
|
/// A list of Packages of a specific type
|
||||||
class PackageList : public GalleryList {
|
class PackageList : public GalleryList {
|
||||||
public:
|
public:
|
||||||
PackageList(Window* parent, int id, int direction = wxHORIZONTAL);
|
PackageList(Window* parent, int id, int direction = wxHORIZONTAL, bool always_focused = true);
|
||||||
|
|
||||||
/// Shows packages that match a specific patern, and that are of the given type
|
/// Shows packages that match a specific patern, and that are of the given type
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
|||||||
+8
-13
@@ -29,8 +29,8 @@ NewSetWindow::NewSetWindow(Window* parent)
|
|||||||
{
|
{
|
||||||
wxBusyCursor wait;
|
wxBusyCursor wait;
|
||||||
// init controls
|
// init controls
|
||||||
game_list = new PackageList (this, ID_GAME_LIST);
|
game_list = new PackageList (this, ID_GAME_LIST, wxHORIZONTAL, false);
|
||||||
stylesheet_list = new PackageList (this, ID_STYLESHEET_LIST);
|
stylesheet_list = new PackageList (this, ID_STYLESHEET_LIST, wxHORIZONTAL, false);
|
||||||
wxStaticText* game_text = new wxStaticText(this, ID_GAME_LIST, _LABEL_("game type"));
|
wxStaticText* game_text = new wxStaticText(this, ID_GAME_LIST, _LABEL_("game type"));
|
||||||
wxStaticText* stylesheet_text = new wxStaticText(this, ID_STYLESHEET_LIST, _LABEL_("style type"));
|
wxStaticText* stylesheet_text = new wxStaticText(this, ID_STYLESHEET_LIST, _LABEL_("style type"));
|
||||||
// init sizer
|
// init sizer
|
||||||
@@ -43,10 +43,9 @@ NewSetWindow::NewSetWindow(Window* parent)
|
|||||||
s->SetSizeHints(this);
|
s->SetSizeHints(this);
|
||||||
SetSizer(s);
|
SetSizer(s);
|
||||||
// Resize
|
// Resize
|
||||||
SetSize(630,-1);
|
|
||||||
Layout();
|
Layout();
|
||||||
GetSizer()->SetSizeHints(this);
|
wxSize min_size = GetSizer()->GetMinSize() + GetSize() - GetClientSize();
|
||||||
SetSize(630,-1);
|
SetSize(630,min_size.y);
|
||||||
// init lists
|
// init lists
|
||||||
game_list->showData<Game>();
|
game_list->showData<Game>();
|
||||||
try {
|
try {
|
||||||
@@ -66,12 +65,9 @@ void NewSetWindow::onGameSelect(wxCommandEvent&) {
|
|||||||
stylesheet_list->select(settings.gameSettingsFor(*game).default_stylesheet);
|
stylesheet_list->select(settings.gameSettingsFor(*game).default_stylesheet);
|
||||||
UpdateWindowUI(wxUPDATE_UI_RECURSE);
|
UpdateWindowUI(wxUPDATE_UI_RECURSE);
|
||||||
// resize (yuck)
|
// resize (yuck)
|
||||||
SetSize(630,-1);
|
|
||||||
Layout();
|
Layout();
|
||||||
GetSizer()->SetSizeHints(this);
|
wxSize min_size = GetSizer()->GetMinSize() + GetSize() - GetClientSize();
|
||||||
Layout();
|
SetSize(630,min_size.y);
|
||||||
GetSizer()->SetSizeHints(this);
|
|
||||||
SetSize(630,-1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void NewSetWindow::onStyleSheetSelect(wxCommandEvent&) {
|
void NewSetWindow::onStyleSheetSelect(wxCommandEvent&) {
|
||||||
@@ -157,10 +153,9 @@ SelectStyleSheetWindow::SelectStyleSheetWindow(Window* parent, const Game& game,
|
|||||||
stylesheet_list->showData<StyleSheet>(game.name() + _("-*"));
|
stylesheet_list->showData<StyleSheet>(game.name() + _("-*"));
|
||||||
stylesheet_list->select(settings.gameSettingsFor(game).default_stylesheet);
|
stylesheet_list->select(settings.gameSettingsFor(game).default_stylesheet);
|
||||||
// Resize
|
// Resize
|
||||||
SetSize(630,-1);
|
|
||||||
Layout();
|
Layout();
|
||||||
GetSizer()->SetSizeHints(this);
|
wxSize min_size = GetSizer()->GetMinSize() + GetSize() - GetClientSize();
|
||||||
SetSize(630,-1);
|
SetSize(630,min_size.y);
|
||||||
UpdateWindowUI(wxUPDATE_UI_RECURSE);
|
UpdateWindowUI(wxUPDATE_UI_RECURSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,16 +26,16 @@
|
|||||||
// ----------------------------------------------------------------------------- : CardsPanel
|
// ----------------------------------------------------------------------------- : CardsPanel
|
||||||
|
|
||||||
CardsPanel::CardsPanel(Window* parent, int id)
|
CardsPanel::CardsPanel(Window* parent, int id)
|
||||||
: SetWindowPanel(parent, id, false)
|
: SetWindowPanel(parent, id)
|
||||||
{
|
{
|
||||||
// init controls
|
// init controls
|
||||||
wxPanel* notesP;
|
wxPanel* notesP;
|
||||||
editor = new CardEditor(this, ID_EDITOR);
|
editor = new CardEditor(this, ID_EDITOR);
|
||||||
splitter = new wxSplitterWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0);
|
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);
|
||||||
notesP = new Panel(splitter, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 /* no tab traversal*/);
|
notesP = new Panel(splitter, wxID_ANY);
|
||||||
notes = new TextCtrl(notesP, ID_NOTES, true);
|
notes = new TextCtrl(notesP, ID_NOTES, true);
|
||||||
collapse_notes = new HoverButton(notesP, ID_COLLAPSE_NOTES, _("btn_collapse"), wxNullColour);
|
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);
|
||||||
// init sizer for notes panel
|
// init sizer for notes panel
|
||||||
wxSizer* sn = new wxBoxSizer(wxVERTICAL);
|
wxSizer* sn = new wxBoxSizer(wxVERTICAL);
|
||||||
|
|||||||
@@ -32,18 +32,18 @@ KeywordsPanel::KeywordsPanel(Window* parent, int id)
|
|||||||
: SetWindowPanel(parent, id)
|
: SetWindowPanel(parent, id)
|
||||||
{
|
{
|
||||||
// init controls
|
// init controls
|
||||||
splitter = new wxSplitterWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0);
|
splitter = new wxSplitterWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
|
||||||
list = new KeywordList(splitter, ID_KEYWORD_LIST);
|
list = new KeywordList(splitter, ID_KEYWORD_LIST);
|
||||||
panel = new Panel(splitter, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 /* no tab traversal*/);
|
panel = new Panel(splitter, wxID_ANY);
|
||||||
keyword = new TextCtrl(panel, ID_KEYWORD, false);
|
keyword = new TextCtrl(panel, ID_KEYWORD, false);
|
||||||
|
mode = new wxChoice(panel, ID_KEYWORD_MODE, wxDefaultPosition, wxDefaultSize, 0, nullptr);
|
||||||
match = new TextCtrl(panel, ID_MATCH, false);
|
match = new TextCtrl(panel, ID_MATCH, false);
|
||||||
|
add_param = new wxButton(panel, ID_KEYWORD_ADD_PARAM, _BUTTON_("insert parameter"));
|
||||||
|
ref_param = new wxButton(panel, ID_KEYWORD_REF_PARAM, _BUTTON_("refer parameter"));
|
||||||
reminder = new TextCtrl(panel, ID_REMINDER, true); // allow multiline for wordwrap
|
reminder = new TextCtrl(panel, ID_REMINDER, true); // allow multiline for wordwrap
|
||||||
rules = new TextCtrl(panel, ID_RULES, true);
|
rules = new TextCtrl(panel, ID_RULES, true);
|
||||||
errors = new wxStaticText(panel, wxID_ANY, _(""));
|
errors = new wxStaticText(panel, wxID_ANY, _(""));
|
||||||
errors->SetForegroundColour(*wxRED);
|
errors->SetForegroundColour(*wxRED);
|
||||||
mode = new wxChoice(panel, ID_KEYWORD_MODE, wxDefaultPosition, wxDefaultSize, 0, nullptr);
|
|
||||||
add_param = new wxButton(panel, ID_KEYWORD_ADD_PARAM, _BUTTON_("insert parameter"));
|
|
||||||
ref_param = new wxButton(panel, ID_KEYWORD_REF_PARAM, _BUTTON_("refer parameter"));
|
|
||||||
// warning about fixed keywords
|
// warning about fixed keywords
|
||||||
fixedL = new wxStaticText(panel, wxID_ANY, _(""));
|
fixedL = new wxStaticText(panel, wxID_ANY, _(""));
|
||||||
wxStaticBitmap* fixedI = new wxStaticBitmap(panel, wxID_ANY, wxArtProvider::GetBitmap(wxART_WARNING));
|
wxStaticBitmap* fixedI = new wxStaticBitmap(panel, wxID_ANY, wxArtProvider::GetBitmap(wxART_WARNING));
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class wxFindReplaceData;
|
|||||||
*/
|
*/
|
||||||
class SetWindowPanel : public wxPanel, public SetView {
|
class SetWindowPanel : public wxPanel, public SetView {
|
||||||
public:
|
public:
|
||||||
SetWindowPanel(Window* parent, int id, bool autoTabbing = false);
|
SetWindowPanel(Window* parent, int id, bool autoTabbing = true);
|
||||||
|
|
||||||
/// We will probably want to respond to set changes
|
/// We will probably want to respond to set changes
|
||||||
virtual void onSetChange() {}
|
virtual void onSetChange() {}
|
||||||
|
|||||||
@@ -97,13 +97,13 @@ void StatCategoryList::drawItem(DC& dc, int x, int y, size_t item, bool selected
|
|||||||
// ----------------------------------------------------------------------------- : StatsPanel
|
// ----------------------------------------------------------------------------- : StatsPanel
|
||||||
|
|
||||||
StatsPanel::StatsPanel(Window* parent, int id)
|
StatsPanel::StatsPanel(Window* parent, int id)
|
||||||
: SetWindowPanel(parent, id, true)
|
: SetWindowPanel(parent, id)
|
||||||
, up_to_date(true), active(false)
|
, up_to_date(true), active(false)
|
||||||
{
|
{
|
||||||
// init controls
|
// init controls
|
||||||
wxSplitterWindow* splitter;
|
wxSplitterWindow* splitter;
|
||||||
categories = new StatCategoryList(this, ID_FIELD_LIST);
|
categories = new StatCategoryList(this, ID_FIELD_LIST);
|
||||||
splitter = new wxSplitterWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0);
|
splitter = new wxSplitterWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
|
||||||
graph = new GraphControl (splitter, wxID_ANY);
|
graph = new GraphControl (splitter, wxID_ANY);
|
||||||
card_list = new FilteredCardList(splitter, wxID_ANY);
|
card_list = new FilteredCardList(splitter, wxID_ANY);
|
||||||
// init splitter
|
// init splitter
|
||||||
|
|||||||
@@ -27,10 +27,10 @@ StylePanel::StylePanel(Window* parent, int id)
|
|||||||
{
|
{
|
||||||
// init controls
|
// init controls
|
||||||
preview = new CardViewer (this, wxID_ANY);
|
preview = new CardViewer (this, wxID_ANY);
|
||||||
editor = new StylingEditor(this, wxID_ANY, wxNO_BORDER);
|
|
||||||
list = new PackageList (this, wxID_ANY);
|
list = new PackageList (this, wxID_ANY);
|
||||||
use_for_all = new wxButton (this, ID_STYLE_USE_FOR_ALL, _BUTTON_("use for all cards"));
|
use_for_all = new wxButton (this, ID_STYLE_USE_FOR_ALL, _BUTTON_("use for all cards"));
|
||||||
use_custom_options = new wxCheckBox(this, ID_STYLE_USE_CUSTOM, _BUTTON_("use custom styling options"));
|
use_custom_options = new wxCheckBox(this, ID_STYLE_USE_CUSTOM, _BUTTON_("use custom styling options"));
|
||||||
|
editor = new StylingEditor(this, wxID_ANY, wxNO_BORDER);
|
||||||
// init sizer
|
// init sizer
|
||||||
wxSizer* s = new wxBoxSizer(wxHORIZONTAL);
|
wxSizer* s = new wxBoxSizer(wxHORIZONTAL);
|
||||||
s->Add(preview, 0, wxRIGHT, 2);
|
s->Add(preview, 0, wxRIGHT, 2);
|
||||||
|
|||||||
@@ -228,6 +228,8 @@ void SetWindow::selectPanel(int id) {
|
|||||||
}
|
}
|
||||||
// fix sizer stuff
|
// fix sizer stuff
|
||||||
fixMinWindowSize();
|
fixMinWindowSize();
|
||||||
|
// select something
|
||||||
|
current_panel->SetFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------- : Window managment
|
// ----------------------------------------------------------------------------- : Window managment
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# This file contains the keys expected to be in MSE locales
|
# This file contains the keys expected to be in MSE locales
|
||||||
# It was automatically generated by tools/locale/locale.pl
|
# It was automatically generated by tools/locale/locale.pl
|
||||||
# Generated on Sat Sep 1 23:06:46 2007
|
# Generated on Sun Sep 2 02:25:24 2007
|
||||||
|
|
||||||
action:
|
action:
|
||||||
add control point: 0
|
add control point: 0
|
||||||
@@ -377,7 +377,7 @@ title:
|
|||||||
untitled: 0
|
untitled: 0
|
||||||
update check: 0
|
update check: 0
|
||||||
updates: 0
|
updates: 0
|
||||||
updates availible: 0
|
updates available: 0
|
||||||
tool:
|
tool:
|
||||||
add symmetry: 0
|
add symmetry: 0
|
||||||
basic shapes: 0
|
basic shapes: 0
|
||||||
|
|||||||
Reference in New Issue
Block a user