mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 21:06:59 -04:00
Added actions for adding/removing keywords
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@254 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include <gui/card_select_window.hpp>
|
||||
#include <gui/util.hpp>
|
||||
#include <data/set.hpp>
|
||||
#include <wx/print.h>
|
||||
|
||||
DECLARE_TYPEOF_COLLECTION(CardP);
|
||||
|
||||
@@ -88,8 +89,42 @@ void TextBufferDC::drawToDevice(DC& dc, int x, int y) {
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------- : Layout
|
||||
|
||||
/// Layout of a page of cards
|
||||
class PageLayout {
|
||||
public:
|
||||
RealSize card_size; ///< Size of a card
|
||||
RealSize card_space; ///< Spacing between cards
|
||||
double margin_left, margin_right, margin_top, margin_bottom; ///< Page margins
|
||||
int rows, cols; ///< Number of rows/columns of cards
|
||||
bool landscape; ///< Are cards rotated to landscape orientation?
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------- : Printout
|
||||
|
||||
/// A printout object specifying how to print a specified set of cards
|
||||
class CardsPrintout : wxPrintout {
|
||||
public:
|
||||
CardsPrintout(const SetP& set, const vector<CardP>& cards);
|
||||
/// Determine card size, cards per row
|
||||
void OnPreparePrinting();
|
||||
/// Number of pages, and something else I don't understand...
|
||||
void GetPageInfo(int* pageMin, int* pageMax, int* pageFrom, int* pageTo);
|
||||
/// Again, 'number of pages', strange wx interface
|
||||
bool HasPage(int page);
|
||||
/// Print a page
|
||||
bool OnPrintPage(int page);
|
||||
|
||||
private:
|
||||
PageLayout layout;
|
||||
|
||||
/// Draw a card, that is card_nr on this page, find the postion by asking the layout
|
||||
void drawCard(DC& dc, const CardP& card, UInt card_nr);
|
||||
/// Draw a card at the specified coordinates
|
||||
void drawCard(DC& dc, const CardP& card, double x, double y, int rotation = 0);
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------- : PrintWindow
|
||||
|
||||
void print_preview(Window* parent, const SetP& set) {
|
||||
|
||||
@@ -30,7 +30,7 @@ CardsPanel::CardsPanel(Window* parent, int id)
|
||||
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);
|
||||
notesP = new Panel(splitter, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 /* no tab traversal*/);
|
||||
notes = new TextCtrl(notesP, ID_NOTES, true);
|
||||
collapse_notes = new HoverButton(notesP, ID_COLLAPSE_NOTES, _("btn_collapse"), wxNullColour);
|
||||
collapse_notes->SetExtraStyle(wxWS_EX_PROCESS_UI_UPDATES);
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <gui/icon_menu.hpp>
|
||||
#include <gui/util.hpp>
|
||||
#include <data/keyword.hpp>
|
||||
#include <data/action/keyword.hpp>
|
||||
#include <data/field/text.hpp>
|
||||
#include <util/window_id.hpp>
|
||||
#include <wx/listctrl.h>
|
||||
@@ -25,7 +26,7 @@ KeywordsPanel::KeywordsPanel(Window* parent, int id)
|
||||
// init controls
|
||||
splitter = new wxSplitterWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0);
|
||||
list = new KeywordList(splitter, wxID_ANY);
|
||||
panel = new Panel(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, false);
|
||||
@@ -114,10 +115,13 @@ void KeywordsPanel::onCommand(int id) {
|
||||
list->selectNext();
|
||||
break;
|
||||
case ID_KEYWORD_ADD:
|
||||
// set->actions.add(new AddKeywordAction(*set));
|
||||
set->actions.add(new AddKeywordAction(*set));
|
||||
break;
|
||||
case ID_KEYWORD_REMOVE:
|
||||
// set->actions.add(new RemoveKeywordAction(*set, list->getKeyword()));
|
||||
if (!list->getKeyword()->fixed) {
|
||||
// only remove set keywords
|
||||
set->actions.add(new RemoveKeywordAction(*set, list->getKeyword()));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user