mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 13:06:59 -04:00
Changed scroll size of PackageList;
Added 'collapse' option for card notes; Made variant of DECLARE_TYPEOF for maps (two template arguments). git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@202 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -64,18 +64,26 @@ END_EVENT_TABLE ()
|
||||
// ----------------------------------------------------------------------------- : Button with image and hover effect
|
||||
|
||||
|
||||
HoverButton::HoverButton(Window* parent, int id, const String& name)
|
||||
: wxControl(parent, id, wxDefaultPosition, wxDefaultSize, wxNO_BORDER)
|
||||
, bg_normal(load_resource_image(name + _("_normal")))
|
||||
, bg_hover (load_resource_image(name + _("_hover")))
|
||||
, bg_focus (load_resource_image(name + _("_focus")))
|
||||
, bg_down (load_resource_image(name + _("_down")))
|
||||
HoverButton::HoverButton(Window* parent, int id, const String& name, const Color& background)
|
||||
: wxControl(parent, id, wxDefaultPosition, wxDefaultSize, wxNO_BORDER )
|
||||
, hover(false), focus(false), mouse_down(false), key_down(false)
|
||||
, last_drawn(nullptr)
|
||||
, background(background)
|
||||
{
|
||||
loadBitmaps(name);
|
||||
SetSize(DoGetBestSize());
|
||||
}
|
||||
|
||||
void HoverButton::loadBitmaps(const String& name) {
|
||||
if (bitmaps == name) return;
|
||||
bitmaps = name;
|
||||
bg_normal = Bitmap(load_resource_image(name + _("_normal")));
|
||||
bg_hover = Bitmap(load_resource_image(name + _("_hover")));
|
||||
bg_focus = Bitmap(load_resource_image(name + _("_focus")));
|
||||
bg_down = Bitmap(load_resource_image(name + _("_down")));
|
||||
Refresh(false);
|
||||
}
|
||||
|
||||
void HoverButton::onMouseEnter(wxMouseEvent&) {
|
||||
hover = true;
|
||||
refreshIfNeeded();
|
||||
@@ -151,10 +159,10 @@ void HoverButton::draw(DC& dc) {
|
||||
// clear background (for transparent button images)
|
||||
wxSize ws = GetClientSize();
|
||||
dc.SetPen(*wxTRANSPARENT_PEN);
|
||||
dc.SetBrush(Color(240,247,255));
|
||||
dc.SetBrush(background != wxNullColour ? background : wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
|
||||
dc.DrawRectangle(0, 0, ws.GetWidth(), ws.GetHeight());
|
||||
// draw button
|
||||
dc.DrawBitmap(*toDraw(), 0, 0);
|
||||
dc.DrawBitmap(*toDraw(), 0, 0, true);
|
||||
last_drawn = toDraw();
|
||||
}
|
||||
int HoverButton::drawDelta() const {
|
||||
|
||||
@@ -30,16 +30,25 @@ class AboutWindow : public wxDialog {
|
||||
|
||||
// ----------------------------------------------------------------------------- : Button with image and hover effect
|
||||
|
||||
// A button that changes images on mouseenter/leave
|
||||
/// A button that changes images on mouseenter/leave
|
||||
class HoverButton : public wxControl {
|
||||
public:
|
||||
HoverButton(Window* parent, int id, const String& name);
|
||||
/// Create a HoverButton, name is the resource name of the images to use
|
||||
/** name+"_normal", name+"_hover", name+"_focus", name+"_down"
|
||||
* are the resource names of the images used.
|
||||
*/
|
||||
HoverButton(Window* parent, int id, const String& name, const Color& background = Color(240,247,255));
|
||||
|
||||
/// Load different bitmaps for this button
|
||||
void loadBitmaps(const String& name);
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE();
|
||||
|
||||
Bitmap bg_normal, bg_hover, bg_focus, bg_down; /// Bitmaps for the states of the button
|
||||
String bitmaps; ///< Name of the loaded bitmaps
|
||||
Bitmap bg_normal, bg_hover, bg_focus, bg_down; ///< Bitmaps for the states of the button
|
||||
bool hover, focus, mouse_down, key_down;
|
||||
Color background;
|
||||
|
||||
void onMouseEnter(wxMouseEvent&);
|
||||
void onMouseLeave(wxMouseEvent&);
|
||||
|
||||
@@ -26,10 +26,8 @@
|
||||
DECLARE_TYPEOF_COLLECTION(CardP);
|
||||
DECLARE_TYPEOF_COLLECTION(FieldP);
|
||||
DECLARE_POINTER_TYPE(ChoiceValue);
|
||||
typedef map<int,FieldP> map_int_FieldP;
|
||||
DECLARE_TYPEOF(map_int_FieldP);
|
||||
typedef IndexMap<FieldP,StyleP> IndexMap_FieldP_StyleP;
|
||||
DECLARE_TYPEOF_NO_REV(IndexMap_FieldP_StyleP);
|
||||
DECLARE_TYPEOF2(map<int,FieldP>);
|
||||
DECLARE_TYPEOF_NO_REV2(IndexMap<FieldP,StyleP>);
|
||||
|
||||
// ----------------------------------------------------------------------------- : Events
|
||||
|
||||
|
||||
@@ -17,37 +17,40 @@ DEFINE_EVENT_TYPE(EVENT_GALLERY_ACTIVATE);
|
||||
|
||||
// ----------------------------------------------------------------------------- : GalleryList
|
||||
|
||||
const int MARGIN = 1; // margin between items
|
||||
const int BORDER = 1; // margin between items
|
||||
const int MARGIN = 1; // margin between items (excluding border)
|
||||
const int BORDER = 1; // border aroung items
|
||||
const int SPACING = MARGIN + 2*BORDER; // distance between items
|
||||
|
||||
GalleryList::GalleryList(Window* parent, int id, int direction)
|
||||
: wxScrolledWindow(parent, id, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER | (direction == wxHORIZONTAL ? wxHSCROLL : wxVSCROLL) )
|
||||
, selection(NO_SELECTION)
|
||||
, direction(direction)
|
||||
, scroll_increment(10)
|
||||
{}
|
||||
|
||||
void GalleryList::update() {
|
||||
const int w = (int)item_size.width + MARGIN + 2*BORDER;
|
||||
const int h = (int)item_size.height + MARGIN + 2*BORDER;
|
||||
const int w = item_size.x + SPACING;
|
||||
const int h = item_size.y + SPACING;
|
||||
// resize and scroll
|
||||
if (direction == wxHORIZONTAL) {
|
||||
SetVirtualSize(w * (int)itemCount() + MARGIN, h + MARGIN);
|
||||
SetScrollRate(w, 0);
|
||||
SetScrollRate(scroll_increment, 0);
|
||||
} else { // wxVERTICAL
|
||||
SetVirtualSize(w, h * (int)itemCount() + MARGIN + MARGIN);
|
||||
SetScrollRate(0, h);
|
||||
SetVirtualSize(w + MARGIN, h * (int)itemCount() + MARGIN);
|
||||
SetScrollRate(0, scroll_increment);
|
||||
}
|
||||
// ensure selected item + its margin is visible
|
||||
if (selection < itemCount()) {
|
||||
int x, y, cw, ch;
|
||||
GetViewStart (&x, &y);
|
||||
GetClientSize(&cw, &ch);
|
||||
cw = (cw - w + 1) / w; ch = (ch - h + 1) / h;
|
||||
RealPoint pos = itemPos(selection);
|
||||
x = min(x, (int)selection);
|
||||
y = min(y, (int)selection);
|
||||
x = max(x + cw, (int)selection) - cw;
|
||||
y = max(y + ch, (int)selection) - ch;
|
||||
cw = (cw - scroll_increment + 1) / scroll_increment;
|
||||
ch = (ch - scroll_increment + 1) / scroll_increment;
|
||||
wxPoint pos = itemPos(selection);
|
||||
x = min(x, (int)(selection * w) / scroll_increment);
|
||||
y = min(y, (int)(selection * h) / scroll_increment);
|
||||
x = max(x + cw, (int)(selection * w + w - 1) / scroll_increment) - cw;
|
||||
y = max(y + ch, (int)(selection * h + h - 1) / scroll_increment) - ch;
|
||||
Scroll(x,y);
|
||||
}
|
||||
// redraw
|
||||
@@ -56,21 +59,21 @@ void GalleryList::update() {
|
||||
|
||||
size_t GalleryList::findItem(const wxMouseEvent& ev) const {
|
||||
if (direction == wxHORIZONTAL) {
|
||||
int x, w = (int)item_size.width + MARGIN + 2*BORDER;
|
||||
int x, w = item_size.x + SPACING;
|
||||
GetViewStart (&x, 0);
|
||||
return static_cast<size_t>( x + ev.GetX() / w );
|
||||
return static_cast<size_t>( max(0, x * scroll_increment + ev.GetX() - MARGIN) / w );
|
||||
} else { // wxVERTICAL
|
||||
int y, h = (int)item_size.height + MARGIN + 2*BORDER;
|
||||
int y, h = item_size.y + SPACING;
|
||||
GetViewStart (0, &y);
|
||||
return static_cast<size_t>( y + ev.GetY() / h );
|
||||
return static_cast<size_t>( max(0, y * scroll_increment + ev.GetY() - MARGIN) / h );
|
||||
}
|
||||
}
|
||||
|
||||
RealPoint GalleryList::itemPos(size_t item) const {
|
||||
wxPoint GalleryList::itemPos(size_t item) const {
|
||||
if (direction == wxHORIZONTAL) {
|
||||
return RealPoint(item * (item_size.width + MARGIN + 2*BORDER) + MARGIN + BORDER, MARGIN + BORDER);
|
||||
return wxPoint((int)item * (item_size.x + SPACING) + MARGIN + BORDER, MARGIN + BORDER);
|
||||
} else {
|
||||
return RealPoint(MARGIN + BORDER, item * (item_size.height + MARGIN + 2*BORDER) + MARGIN + BORDER);
|
||||
return wxPoint(MARGIN + BORDER, (int)item * (item_size.y + SPACING) + MARGIN + BORDER);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,8 +120,8 @@ void GalleryList::onChar(wxKeyEvent& ev) {
|
||||
|
||||
wxSize GalleryList::DoGetBestSize() const {
|
||||
wxSize ws = GetSize(), cs = GetClientSize();
|
||||
const int w = int(item_size.width) + 2*MARGIN + 2*BORDER;
|
||||
const int h = int(item_size.height) + 2*MARGIN + 2*BORDER;
|
||||
const int w = item_size.x + SPACING;
|
||||
const int h = item_size.y + SPACING;
|
||||
return wxSize(w, h) + ws - cs;
|
||||
}
|
||||
|
||||
@@ -136,15 +139,15 @@ void GalleryList::OnDraw(DC& dc) {
|
||||
GetViewStart(&x, &y);
|
||||
GetClientSize(&cw, &ch);
|
||||
if (direction == wxHORIZONTAL) {
|
||||
dx = int(item_size.width) + MARGIN + 2*BORDER;
|
||||
dx = item_size.x + MARGIN + 2*BORDER;
|
||||
dy = 0;
|
||||
start = (size_t) x;
|
||||
end = (size_t) (start + cw / dx + 1);
|
||||
start = (size_t) max(0, x * scroll_increment - MARGIN) / dx;
|
||||
end = (size_t) max(0, x * scroll_increment - MARGIN + cw + dx) / dx;
|
||||
} else {
|
||||
dx = 0;
|
||||
dy = int(item_size.height) + MARGIN + 2*BORDER;
|
||||
start = (size_t) y;
|
||||
end = (size_t) (start + ch / dy + 1);
|
||||
dy = item_size.y + MARGIN + 2*BORDER;
|
||||
start = (size_t) max(0, y * scroll_increment - MARGIN) / dy;
|
||||
end = (size_t) max(0, y * scroll_increment - MARGIN + ch + dy) / dy;
|
||||
}
|
||||
end = min(end, itemCount());
|
||||
// clear background
|
||||
@@ -161,10 +164,10 @@ void GalleryList::OnDraw(DC& dc) {
|
||||
Color c = selected ? wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT) : unselected;
|
||||
dc.SetPen(c);
|
||||
dc.SetBrush(saturate(lerp(background, c, 0.3), selected ? 0.5 : 0));
|
||||
RealPoint pos = itemPos(i);
|
||||
dc.DrawRectangle(int(pos.x) - BORDER, int(pos.y) - BORDER, int(item_size.width) + 2*BORDER, int(item_size.height) + 2*BORDER);
|
||||
wxPoint pos = itemPos(i);
|
||||
dc.DrawRectangle(pos.x - BORDER, pos.y - BORDER, item_size.x + 2*BORDER, item_size.y + 2*BORDER);
|
||||
// draw item
|
||||
drawItem(dc, int(pos.x), int(pos.y), i, selected);
|
||||
drawItem(dc, pos.x, pos.y, i, selected);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,9 +36,10 @@ class GalleryList : public wxScrolledWindow {
|
||||
|
||||
protected:
|
||||
static const size_t NO_SELECTION = (size_t)-1;
|
||||
size_t selection; ///< The selected item, or NO_SELECTION if there is no selection
|
||||
RealSize item_size; ///< The size of a single item
|
||||
int direction; ///< Direction of the list, can be wxHORIZONTAL or wxVERTICAL
|
||||
size_t selection; ///< The selected item, or NO_SELECTION if there is no selection
|
||||
wxSize item_size; ///< The size of a single item
|
||||
int scroll_increment; ///< How large are the scroll steps?
|
||||
int direction; ///< Direction of the list, can be wxHORIZONTAL or wxVERTICAL
|
||||
|
||||
/// Redraw the list after changing the selection or the number of items
|
||||
void update();
|
||||
@@ -63,7 +64,7 @@ class GalleryList : public wxScrolledWindow {
|
||||
/// Find the item corresponding to the given location
|
||||
size_t findItem(const wxMouseEvent&) const;
|
||||
/// Find the coordinates of an item
|
||||
RealPoint itemPos(size_t item) const;
|
||||
wxPoint itemPos(size_t item) const;
|
||||
protected:
|
||||
/// Send an event
|
||||
void sendEvent(WXTYPE type);
|
||||
|
||||
@@ -15,8 +15,7 @@ DECLARE_TYPEOF_COLLECTION(GraphAxisP);
|
||||
DECLARE_TYPEOF_COLLECTION(GraphElementP);
|
||||
DECLARE_TYPEOF_COLLECTION(GraphGroup);
|
||||
DECLARE_TYPEOF_COLLECTION(int);
|
||||
typedef map<String,UInt> map_String_UInt;
|
||||
DECLARE_TYPEOF(map_String_UInt);
|
||||
DECLARE_TYPEOF2(map<String,UInt>);
|
||||
|
||||
// ----------------------------------------------------------------------------- : Events
|
||||
|
||||
|
||||
@@ -12,8 +12,7 @@
|
||||
#include <data/stylesheet.hpp>
|
||||
|
||||
DECLARE_TYPEOF_COLLECTION(ValueViewerP);
|
||||
typedef IndexMap<FieldP,StyleP> IndexMap_FieldP_StyleP;
|
||||
DECLARE_TYPEOF_NO_REV(IndexMap_FieldP_StyleP);
|
||||
DECLARE_TYPEOF_NO_REV2(IndexMap<FieldP,StyleP>);
|
||||
|
||||
// ----------------------------------------------------------------------------- : NativeLookEditor
|
||||
|
||||
|
||||
@@ -15,7 +15,8 @@
|
||||
PackageList::PackageList(Window* parent, int id, int direction)
|
||||
: GalleryList(parent, id, direction)
|
||||
{
|
||||
item_size = wxSize(110, 150);
|
||||
item_size = wxSize(108, 150);
|
||||
SetThemeEnabled(true);
|
||||
}
|
||||
|
||||
size_t PackageList::itemCount() const {
|
||||
@@ -29,7 +30,7 @@ void PackageList::drawItem(DC& dc, int x, int y, size_t item, bool selected) {
|
||||
int w, h;
|
||||
// draw image
|
||||
if (d.image.Ok()) {
|
||||
dc.DrawBitmap(d.image, x + int(align_delta_x(ALIGN_CENTER, item_size.width, d.image.GetWidth())), y + 3);
|
||||
dc.DrawBitmap(d.image, x + int(align_delta_x(ALIGN_CENTER, item_size.x, d.image.GetWidth())), y + 3, true);
|
||||
}
|
||||
// draw short name
|
||||
dc.SetFont(wxFont(12,wxSWISS,wxNORMAL,wxBOLD,false,_("Arial")));
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <gui/control/image_card_list.hpp>
|
||||
#include <gui/control/card_editor.hpp>
|
||||
#include <gui/control/text_ctrl.hpp>
|
||||
#include <gui/about_window.hpp>
|
||||
#include <gui/icon_menu.hpp>
|
||||
#include <gui/util.hpp>
|
||||
#include <data/set.hpp>
|
||||
@@ -26,19 +27,23 @@ CardsPanel::CardsPanel(Window* parent, int id)
|
||||
{
|
||||
// init controls
|
||||
wxPanel* notesP;
|
||||
wxSplitterWindow* splitter;
|
||||
editor = new CardEditor(this, ID_EDITOR);
|
||||
splitter = new wxSplitterWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0);
|
||||
card_list = new ImageCardList(splitter, ID_CARD_LIST);
|
||||
notesP = new Panel(splitter, wxID_ANY);
|
||||
notes = new TextCtrl(notesP, ID_NOTES);
|
||||
collapse_notes = new HoverButton(notesP, ID_COLLAPSE_NOTES, _("btn_collapse"), wxNullColour);
|
||||
collapse_notes->SetExtraStyle(wxWS_EX_PROCESS_UI_UPDATES);
|
||||
// init sizer for notes panel
|
||||
wxSizer* sn = new wxBoxSizer(wxVERTICAL);
|
||||
sn->Add(new wxStaticText(notesP, wxID_ANY, _LABEL_("card notes")), 0, wxEXPAND, 2);
|
||||
wxSizer* sc = new wxBoxSizer(wxHORIZONTAL);
|
||||
sc->Add(new wxStaticText(notesP, wxID_ANY, _LABEL_("card notes")), 1, wxEXPAND);
|
||||
sc->Add(collapse_notes, 0, wxALIGN_CENTER | wxRIGHT, 2);
|
||||
sn->Add(sc, 0, wxEXPAND, 2);
|
||||
sn->Add(notes, 1, wxEXPAND | wxTOP, 2);
|
||||
notesP->SetSizer(sn);
|
||||
// init splitter
|
||||
splitter->SetMinimumPaneSize(14);
|
||||
splitter->SetMinimumPaneSize(15);
|
||||
splitter->SetSashGravity(1.0);
|
||||
splitter->SplitHorizontally(card_list, notesP, -40);
|
||||
// init sizer
|
||||
@@ -162,10 +167,15 @@ void CardsPanel::onUpdateUI(wxUpdateUIEvent& ev) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ID_COLLAPSE_NOTES: {
|
||||
bool collapse = notes->GetSize().y > 0;
|
||||
collapse_notes->loadBitmaps(collapse ? _("btn_collapse") : _("btn_expand"));
|
||||
break;
|
||||
}
|
||||
case ID_INSERT_SYMBOL: {
|
||||
wxMenu* menu = editor->getMenu(ID_INSERT_SYMBOL);
|
||||
ev.Enable(menu);
|
||||
if (insertSymbolMenu->GetSubMenu() != menu || menu->GetParent() != menuFormat) {
|
||||
if (insertSymbolMenu->GetSubMenu() != menu || (menu && menu->GetParent() != menuFormat)) {
|
||||
// re-add the menu
|
||||
menuFormat->Remove(insertSymbolMenu);
|
||||
insertSymbolMenu->SetSubMenu(menu);
|
||||
@@ -211,6 +221,17 @@ void CardsPanel::onCommand(int id) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
case ID_COLLAPSE_NOTES: {
|
||||
bool collapse = notes->GetSize().y > 0;
|
||||
if (collapse) {
|
||||
splitter->SetSashPosition(-1);
|
||||
notes->SetFocus();
|
||||
} else {
|
||||
splitter->SetSashPosition(-150);
|
||||
card_list->SetFocus();
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
if (id >= ID_INSERT_SYMBOL_MENU_MIN && id <= ID_INSERT_SYMBOL_MENU_MAX) {
|
||||
// pass on to editor
|
||||
|
||||
@@ -17,6 +17,7 @@ class ImageCardList;
|
||||
class DataEditor;
|
||||
class TextCtrl;
|
||||
class IconMenu;
|
||||
class HoverButton;
|
||||
|
||||
// ----------------------------------------------------------------------------- : CardsPanel
|
||||
|
||||
@@ -94,6 +95,7 @@ class CardsPanel : public SetWindowPanel {
|
||||
DataEditor* editor;
|
||||
ImageCardList* card_list;
|
||||
TextCtrl* notes;
|
||||
HoverButton* collapse_notes;
|
||||
|
||||
// --------------------------------------------------- : Menus & tools
|
||||
IconMenu* menuCard, *menuFormat;
|
||||
|
||||
@@ -20,10 +20,23 @@ class KeywordList : public wxListView {
|
||||
/// Set the list of keywords to show
|
||||
void setData(vector<KeywordP>& dat);
|
||||
|
||||
// --------------------------------------------------- : Selection
|
||||
|
||||
inline KeywordP getKeyword() const { return selected_keyword; }
|
||||
inline void setKeyword(const KeywordP& kw) { /* TODO */ }
|
||||
|
||||
bool canSelectPrevious() const;
|
||||
bool canSelectNext() const;
|
||||
void selectPrevious();
|
||||
void selectNext();
|
||||
|
||||
protected:
|
||||
/// Get the text of an item in a specific column
|
||||
/** Overrides a function from wxListCtrl */
|
||||
virtual String OnGetItemText (long pos, long col) const;
|
||||
private:
|
||||
KeywordP selected_keyword;
|
||||
long selected_keyword_pos;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------- : KeywordsPanel
|
||||
|
||||
@@ -12,12 +12,16 @@
|
||||
#include <util/prec.hpp>
|
||||
#include <gui/set/panel.hpp>
|
||||
|
||||
class KeywordList;
|
||||
|
||||
// ----------------------------------------------------------------------------- : KeywordsPanel
|
||||
|
||||
/// A panel for listing and editing the keywords in a set
|
||||
class KeywordsPanel : public SetWindowPanel {
|
||||
public:
|
||||
KeywordsPanel(Window* parent, int id);
|
||||
private:
|
||||
KeywordList* list;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------- : EOF
|
||||
|
||||
@@ -72,7 +72,7 @@ void StatCategoryList::drawItem(DC& dc, int x, int y, size_t item, bool selected
|
||||
dc.DrawBitmap(cat.icon, x+1, y+1);
|
||||
}
|
||||
// draw name
|
||||
RealRect rect(RealPoint(x + 24, y), RealSize(item_size.width - 30, item_size.height));
|
||||
RealRect rect(RealPoint(x + 24, y), RealSize(item_size.x - 30, item_size.y));
|
||||
String str = capitalize(cat.name);
|
||||
// dc.SetFont(wxFont(9.5 * text_scaling, wxSWISS, wxNORMAL, wxNORMAL, false,_("Arial")));
|
||||
dc.SetFont(*wxNORMAL_FONT);
|
||||
|
||||
@@ -135,7 +135,7 @@ SetWindow::SetWindow(Window* parent, const SetP& set)
|
||||
addPanel(menuWindow, tabBar, new KeywordsPanel(this, wxID_ANY), 2, _("F8"), _("Keywords"), _("Keywords"), _("Define extra keywords for this set"));
|
||||
addPanel(menuWindow, tabBar, new StatsPanel (this, wxID_ANY), 3, _("F9"), _("Stats"), _("Statistics"), _("Show statistics about the cards in the set"));
|
||||
// addPanel(*s, *menuWindow, *tabBar, new DraftPanel (&this, wxID_ANY), 4, _("F10"))
|
||||
selectPanel(ID_WINDOW_MIN + 4); // select cards panel
|
||||
selectPanel(ID_WINDOW_CARDS); // select cards panel
|
||||
|
||||
// loose ends
|
||||
tabBar->Realize();
|
||||
@@ -253,6 +253,7 @@ void SetWindow::onCardSelect(CardSelectEvent& ev) {
|
||||
void SetWindow::fixMinWindowSize() {
|
||||
current_panel->SetMinSize(current_panel->GetSizer()->GetMinSize());
|
||||
Layout();
|
||||
current_panel->Layout();
|
||||
wxSize s = GetSizer()->GetMinSize();
|
||||
wxSize ws = GetSize();
|
||||
wxSize cs = GetClientSize();
|
||||
@@ -348,6 +349,9 @@ void SetWindow::onUpdateUI(wxUpdateUIEvent& ev) {
|
||||
case ID_EDIT_FIND : ev.Enable(current_panel->canFind()); break;
|
||||
case ID_EDIT_FIND_NEXT : ev.Enable(current_panel->canFind()); break;
|
||||
case ID_EDIT_REPLACE : ev.Enable(current_panel->canReplace());break;
|
||||
// windows
|
||||
case ID_WINDOW_KEYWORDS: ev.Enable(set->game->has_keywords); break;
|
||||
// other
|
||||
default:
|
||||
// items created by the panel, and cut/copy/paste and find/replace
|
||||
if(current_panel) current_panel->onUpdateUI(ev);
|
||||
@@ -600,6 +604,7 @@ BEGIN_EVENT_TABLE(SetWindow, wxFrame)
|
||||
EVT_MENU (ID_HELP_WEBSITE, SetWindow::onHelpWebsite)
|
||||
EVT_MENU (ID_HELP_ABOUT, SetWindow::onHelpAbout)
|
||||
EVT_TOOL_RANGE (ID_CHILD_MIN, ID_CHILD_MAX, SetWindow::onChildMenu)
|
||||
EVT_COMMAND_RANGE (ID_CHILD_MIN, ID_CHILD_MAX, wxEVT_COMMAND_BUTTON_CLICKED, SetWindow::onChildMenu)
|
||||
EVT_GALLERY_SELECT (ID_FIELD_LIST, SetWindow::onChildMenu) // for StatsPanel, because it is not a EVT_TOOL
|
||||
|
||||
EVT_UPDATE_UI (wxID_ANY, SetWindow::onUpdateUI)
|
||||
|
||||
Reference in New Issue
Block a user