mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 13:06:59 -04:00
Fixed keyword list replacements messing up due to being multi-line.
Fixed GCC warnings. Added linux installer directory. git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@394 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
+11
-11
@@ -199,8 +199,8 @@ RealRect bar_graph_bar(const RealRect& rect, int group, int group_count, int sta
|
||||
double width = width_space / 5 * 4;
|
||||
double space = width_space / 5;
|
||||
double step_height = rect.height / max; // multiplier for bar height
|
||||
int top = rect.bottom() - start * step_height;
|
||||
int bottom = rect.bottom() - end * step_height;
|
||||
int top = (int)(rect.bottom() - start * step_height);
|
||||
int bottom = (int)(rect.bottom() - end * step_height);
|
||||
if (bottom < top) swap(top,bottom);
|
||||
bottom += 1;
|
||||
return RealRect(
|
||||
@@ -215,7 +215,7 @@ int find_bar_graph_column(double width, double x, int count) {
|
||||
double width_space = width / count; // including spacing
|
||||
double space = width_space / 5;
|
||||
// Find column in which the point could be located
|
||||
int col = floor(x / width_space);
|
||||
int col = (int)floor(x / width_space);
|
||||
if (col < 0 || col >= count) return -1; // not a column
|
||||
double in_col = x - col * width_space;
|
||||
if (in_col < space / 2) return -1; // left
|
||||
@@ -322,7 +322,7 @@ bool BarGraph2D::findItem(const RealPoint& pos, const RealRect& rect, vector<int
|
||||
if (col < 0) return false;
|
||||
// row
|
||||
int max_value = (int)axis1.max;
|
||||
int value = (rect.bottom() - pos.y) / rect.height * max_value;
|
||||
int value = (int)((rect.bottom() - pos.y) / rect.height * max_value);
|
||||
if (value < 0 || value > max_value) return false;
|
||||
// find row
|
||||
int row = -1;
|
||||
@@ -460,8 +460,8 @@ bool ScatterGraph::findItem(const RealPoint& pos, const RealRect& rect, vector<i
|
||||
// clicked item
|
||||
GraphAxis& axis1 = axis1_data();
|
||||
GraphAxis& axis2 = axis2_data();
|
||||
int col = floor((pos.x - rect.x) / rect.width * axis1.groups.size());
|
||||
int row = floor((rect.bottom() - pos.y) / rect.height * axis2.groups.size());
|
||||
int col = (int) floor((pos.x - rect.x) / rect.width * axis1.groups.size());
|
||||
int row = (int) floor((rect.bottom() - pos.y) / rect.height * axis2.groups.size());
|
||||
if (col < 0 || col >= (int)axis1.groups.size()) return false;
|
||||
if (row < 0 || row >= (int)axis2.groups.size()) return false;
|
||||
// done
|
||||
@@ -583,7 +583,7 @@ int GraphLegend::findItem(const RealPoint& pos, const RealRect& rect) const {
|
||||
RealPoint mypos = align_in_rect(alignment, size, rect);
|
||||
RealPoint pos2(pos.x - mypos.x, pos.y - mypos.y);
|
||||
if (pos2.x < 0 || pos2.y < 0 || pos2.x >= size.width || pos2.y >= size.height) return -1;
|
||||
int col = floor((pos2.y-1) / item_size.height);
|
||||
int col = (int) floor((pos2.y-1) / item_size.height);
|
||||
if (col < 0 || col >= (int)axis_data().groups.size()) return -1;
|
||||
return reverse ? (int)axis_data().groups.size() - col - 1 : col;
|
||||
}
|
||||
@@ -673,10 +673,10 @@ int GraphLabelAxis::findItem(const RealPoint& pos, const RealRect& rect) const {
|
||||
GraphAxis& axis = axis_data();
|
||||
int col;
|
||||
if (direction == HORIZONTAL) {
|
||||
col = floor((pos.x - rect.x) / rect.width * axis.groups.size());
|
||||
col = (int) floor((pos.x - rect.x) / rect.width * axis.groups.size());
|
||||
if (pos.y < rect.bottom()) return -1;
|
||||
} else {
|
||||
col = floor((rect.bottom() - pos.y) / rect.height * axis.groups.size());
|
||||
col = (int) floor((rect.bottom() - pos.y) / rect.height * axis.groups.size());
|
||||
if (pos.x > rect.left()) return -1;
|
||||
}
|
||||
if (col < 0 || col >= (int)axis.groups.size()) return -1;
|
||||
@@ -693,7 +693,7 @@ void GraphValueAxis::draw(RotatedDC& dc, int current, DrawLayer layer) const {
|
||||
GraphAxis& axis = axis_data();
|
||||
double step_height = rect.height / axis.max; // height of a single value
|
||||
dc.SetFont(*wxNORMAL_FONT);
|
||||
int label_step = ceil(max(1.0, (dc.GetCharHeight()) / step_height)); // values per labeled line
|
||||
int label_step = (int) ceil(max(1.0, (dc.GetCharHeight()) / step_height)); // values per labeled line
|
||||
// Colors
|
||||
Color bg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW);
|
||||
Color fg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT);
|
||||
@@ -710,7 +710,7 @@ void GraphValueAxis::draw(RotatedDC& dc, int current, DrawLayer layer) const {
|
||||
dc.SetPen(fg);
|
||||
}
|
||||
// draw line
|
||||
int y = rect.bottom() - i * step_height;
|
||||
int y = (int) (rect.bottom() - i * step_height);
|
||||
dc.DrawLine(RealPoint(rect.left() - 2, y), RealPoint(rect.right(), y));
|
||||
// draw label, aligned middle right
|
||||
if (! ((i < highlight && i + label_step > highlight) ||
|
||||
|
||||
@@ -277,9 +277,9 @@ class GraphWithMargins : public Graph {
|
||||
virtual bool findItem(const RealPoint& pos, const RealRect& rect, vector<int>& out) const;
|
||||
virtual void setData(const GraphDataP& d);
|
||||
private:
|
||||
const GraphP graph;
|
||||
double margin_left, margin_top, margin_right, margin_bottom;
|
||||
bool upside_down; // put the coordinate system upside down, since graphs are usually bottom-to-top
|
||||
const GraphP graph;
|
||||
};
|
||||
|
||||
/// A display containing multiple graphs
|
||||
|
||||
@@ -87,8 +87,8 @@ class ItemList : public wxListView {
|
||||
// --------------------------------------------------- : Data
|
||||
VoidP selected_item; ///< The currently selected item
|
||||
long selected_item_pos; ///< Position of the selected item in the sorted_list, or -1 if no card is selected
|
||||
bool sort_ascending; ///< Sort order
|
||||
long sort_by_column; ///< Column to use for sorting, or -1 if not sorted
|
||||
bool sort_ascending; ///< Sort order
|
||||
vector<VoidP> sorted_list; ///< Sorted list of items, can be considered a map: pos->item
|
||||
|
||||
private:
|
||||
|
||||
@@ -165,12 +165,25 @@ bool KeywordList::compareItems(void* a, void* b) const {
|
||||
|
||||
String KeywordList::OnGetItemText (long pos, long col) const {
|
||||
const Keyword& kw = *getKeyword(pos);
|
||||
String formatted;
|
||||
wxChar c;
|
||||
switch(col) {
|
||||
case 0: return kw.keyword;
|
||||
case 1: return match_string(kw);
|
||||
case 2: return kw.mode;
|
||||
case 3: return _("?");
|
||||
case 4: return kw.reminder.getUnparsed();
|
||||
case 4:
|
||||
formatted.Clear();
|
||||
for (size_t i = 0; i < kw.reminder.getUnparsed().Len(); ++i) {
|
||||
c = kw.reminder.getUnparsed().GetChar(i);
|
||||
if (isSpace(c)) {
|
||||
formatted.Trim();
|
||||
formatted += ' ';
|
||||
}
|
||||
else
|
||||
formatted += c;
|
||||
}
|
||||
return formatted;
|
||||
default: return wxEmptyString;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,8 +71,8 @@ void NativeLookEditor::resizeViewers() {
|
||||
if (e) e->determineSize();
|
||||
y += s->height + vspace;
|
||||
}
|
||||
SetVirtualSize(w,y);
|
||||
SetScrollbar(wxVERTICAL, 0, h, y);
|
||||
SetVirtualSize(w, (int)y);
|
||||
SetScrollbar(wxVERTICAL, 0, h, (int) y);
|
||||
if (y >= h) {
|
||||
// Doesn't fit vertically, add scrollbar and resize
|
||||
/*
|
||||
|
||||
@@ -262,9 +262,9 @@ bool CardsPanel::wantsToHandle(const Action&, bool undone) const {
|
||||
bool CardsPanel::canCut() const { CUT_COPY_PASTE(canCut, return) }
|
||||
bool CardsPanel::canCopy() const { CUT_COPY_PASTE(canCopy, return) }
|
||||
bool CardsPanel::canPaste() const { CUT_COPY_PASTE(canPaste, return) }
|
||||
void CardsPanel::doCut() { CUT_COPY_PASTE(doCut, ;) }
|
||||
void CardsPanel::doCopy() { CUT_COPY_PASTE(doCopy, ;) }
|
||||
void CardsPanel::doPaste() { CUT_COPY_PASTE(doPaste, ;) }
|
||||
void CardsPanel::doCut() { CUT_COPY_PASTE(doCut, return (void)) }
|
||||
void CardsPanel::doCopy() { CUT_COPY_PASTE(doCopy, return (void)) }
|
||||
void CardsPanel::doPaste() { CUT_COPY_PASTE(doPaste, return (void)) }
|
||||
|
||||
// ----------------------------------------------------------------------------- : Searching
|
||||
|
||||
|
||||
@@ -238,12 +238,12 @@ String KeywordsPanel::runRefScript(int find_i) {
|
||||
else if (id == ID_RULES && rules ->IsEnabled()) { return rules ->op(); } \
|
||||
else { return false; }
|
||||
|
||||
bool KeywordsPanel::canCopy() const { CUT_COPY_PASTE(canCopy, return, false) }
|
||||
bool KeywordsPanel::canCut() const { CUT_COPY_PASTE(canCut, return, !list->getKeyword() || list->getKeyword()->fixed) }
|
||||
bool KeywordsPanel::canPaste() const { CUT_COPY_PASTE(canPaste, return, !list->getKeyword() || list->getKeyword()->fixed) }
|
||||
void KeywordsPanel::doCopy() { CUT_COPY_PASTE(doCopy, ;, false) }
|
||||
void KeywordsPanel::doCut() { CUT_COPY_PASTE(doCut, ;, !list->getKeyword() || list->getKeyword()->fixed) }
|
||||
void KeywordsPanel::doPaste() { CUT_COPY_PASTE(doPaste, ;, !list->getKeyword() || list->getKeyword()->fixed) }
|
||||
bool KeywordsPanel::canCopy() const { CUT_COPY_PASTE(canCopy, return, false) }
|
||||
bool KeywordsPanel::canCut() const { CUT_COPY_PASTE(canCut, return, !list->getKeyword() || list->getKeyword()->fixed) }
|
||||
bool KeywordsPanel::canPaste() const { CUT_COPY_PASTE(canPaste, return, !list->getKeyword() || list->getKeyword()->fixed) }
|
||||
void KeywordsPanel::doCopy() { CUT_COPY_PASTE(doCopy, return (void), false) }
|
||||
void KeywordsPanel::doCut() { CUT_COPY_PASTE(doCut, return (void), !list->getKeyword() || list->getKeyword()->fixed) }
|
||||
void KeywordsPanel::doPaste() { CUT_COPY_PASTE(doPaste, return (void), !list->getKeyword() || list->getKeyword()->fixed) }
|
||||
|
||||
// ----------------------------------------------------------------------------- : Events
|
||||
|
||||
|
||||
@@ -152,7 +152,7 @@ void SymbolControl::draw(DC& dc) {
|
||||
wxSize s = dc.GetSize();
|
||||
double lines = settings.symbol_grid_size;
|
||||
for (int i = 0 ; i <= lines ; ++i) {
|
||||
int x = floor(rotation.trS(i/lines-0.0001));
|
||||
int x = (int) floor(rotation.trS(i/lines-0.0001));
|
||||
//dc.SetPen(Color(0, i%5 == 0 ? 64 : 31, 0));
|
||||
//dc.SetPen(Color(i%5 == 0 ? 64 : 31, 0, 0));
|
||||
dc.SetLogicalFunction(wxAND);
|
||||
|
||||
@@ -96,7 +96,7 @@ void MultipleChoiceValueEditor::determineSize(bool force_fit) {
|
||||
bool MultipleChoiceValueEditor::onLeftDown(const RealPoint& pos, wxMouseEvent& ev) {
|
||||
// find item under cursor
|
||||
if (style().render_style & RENDER_CHECKLIST) {
|
||||
int id = (pos.y - style().top) / item_height;
|
||||
int id = (int)((pos.y - style().top) / item_height);
|
||||
int end = field().choices->lastId();
|
||||
if (id >= 0 && id < end) {
|
||||
toggle(id);
|
||||
|
||||
@@ -734,7 +734,7 @@ void TextValueEditor::determineSize(bool force_fit) {
|
||||
int sbw = wxSystemSettings::GetMetric(wxSYS_VSCROLL_X);
|
||||
RealPoint pos = rot.tr(style().getPos());
|
||||
scrollbar->SetSize(
|
||||
(int)pos.x + rot.trS(style().width) + 1 - sbw,
|
||||
(int)(pos.x + rot.trS(style().width) + 1 - sbw),
|
||||
(int)pos.y - 1,
|
||||
(int)sbw,
|
||||
(int)rot.trS(style().height) + 2);
|
||||
|
||||
@@ -52,4 +52,4 @@ void ErrorTextElement::draw(RotatedDC& dc, double scale, const RealRect& rect, c
|
||||
}
|
||||
// Draw the contents
|
||||
CompoundTextElement::draw(dc, scale, rect, xs, what, start, end);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ class IndexMap : private vector<Value> {
|
||||
using vector<Value>::const_reference;
|
||||
using vector<Value>::begin;
|
||||
using vector<Value>::end;
|
||||
using vector<Value>::clear;
|
||||
using vector<Value>::at; // for using numeric indices directly
|
||||
|
||||
/// Initialize this map with default values given a list of keys
|
||||
|
||||
Reference in New Issue
Block a user