Commit 902f493d authored by coppro's avatar coppro

Fixed keyword list replacements messing up due to being multi-line.

Fixed GCC warnings.
Added linux installer directory.
parent 75e34a88
...@@ -245,14 +245,14 @@ OBJEXT = o ...@@ -245,14 +245,14 @@ OBJEXT = o
PACKAGE = magicseteditor PACKAGE = magicseteditor
PACKAGE_BUGREPORT = twanvl@users.sourceforge.net PACKAGE_BUGREPORT = twanvl@users.sourceforge.net
PACKAGE_NAME = magicseteditor PACKAGE_NAME = magicseteditor
PACKAGE_STRING = magicseteditor 0.3.0 PACKAGE_STRING = magicseteditor 0.3.3
PACKAGE_TARNAME = magicseteditor PACKAGE_TARNAME = magicseteditor
PACKAGE_VERSION = 0.3.0 PACKAGE_VERSION = 0.3.3
PATH_SEPARATOR = : PATH_SEPARATOR = :
SET_MAKE = SET_MAKE =
SHELL = /bin/bash SHELL = /bin/bash
STRIP = STRIP =
VERSION = 0.3.0 VERSION = 0.3.3
WX_CFLAGS = -I/usr/lib/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -pthread WX_CFLAGS = -I/usr/lib/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -pthread
WX_CFLAGS_ONLY = -pthread WX_CFLAGS_ONLY = -pthread
WX_CONFIG_PATH = /usr/bin/wx-config WX_CONFIG_PATH = /usr/bin/wx-config
......
...@@ -6,11 +6,10 @@ ...@@ -6,11 +6,10 @@
# Process this file with autoconf to produce a configure script. # Process this file with autoconf to produce a configure script.
AC_INIT(magicseteditor, 0.3.0, twanvl@users.sourceforge.net) AC_INIT(magicseteditor, 0.3.3, twanvl@users.sourceforge.net)
AC_CONFIG_SRCDIR([src/main.cpp]) AC_CONFIG_SRCDIR([src/main.cpp])
# TODO: Actually use the config header # TODO: Actually use the config header
AC_CONFIG_HEADER([src/config.h]) AC_CONFIG_HEADER([src/config.h])
CXXFLAGS = [-g3 -O0 ]
AM_INIT_AUTOMAKE([-Wall foreign]) AM_INIT_AUTOMAKE([-Wall foreign])
......
...@@ -199,8 +199,8 @@ RealRect bar_graph_bar(const RealRect& rect, int group, int group_count, int sta ...@@ -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 width = width_space / 5 * 4;
double space = width_space / 5; double space = width_space / 5;
double step_height = rect.height / max; // multiplier for bar height double step_height = rect.height / max; // multiplier for bar height
int top = rect.bottom() - start * step_height; int top = (int)(rect.bottom() - start * step_height);
int bottom = rect.bottom() - end * step_height; int bottom = (int)(rect.bottom() - end * step_height);
if (bottom < top) swap(top,bottom); if (bottom < top) swap(top,bottom);
bottom += 1; bottom += 1;
return RealRect( return RealRect(
...@@ -215,7 +215,7 @@ int find_bar_graph_column(double width, double x, int count) { ...@@ -215,7 +215,7 @@ int find_bar_graph_column(double width, double x, int count) {
double width_space = width / count; // including spacing double width_space = width / count; // including spacing
double space = width_space / 5; double space = width_space / 5;
// Find column in which the point could be located // 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 if (col < 0 || col >= count) return -1; // not a column
double in_col = x - col * width_space; double in_col = x - col * width_space;
if (in_col < space / 2) return -1; // left if (in_col < space / 2) return -1; // left
...@@ -322,7 +322,7 @@ bool BarGraph2D::findItem(const RealPoint& pos, const RealRect& rect, vector<int ...@@ -322,7 +322,7 @@ bool BarGraph2D::findItem(const RealPoint& pos, const RealRect& rect, vector<int
if (col < 0) return false; if (col < 0) return false;
// row // row
int max_value = (int)axis1.max; 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; if (value < 0 || value > max_value) return false;
// find row // find row
int row = -1; int row = -1;
...@@ -460,8 +460,8 @@ bool ScatterGraph::findItem(const RealPoint& pos, const RealRect& rect, vector<i ...@@ -460,8 +460,8 @@ bool ScatterGraph::findItem(const RealPoint& pos, const RealRect& rect, vector<i
// clicked item // clicked item
GraphAxis& axis1 = axis1_data(); GraphAxis& axis1 = axis1_data();
GraphAxis& axis2 = axis2_data(); GraphAxis& axis2 = axis2_data();
int col = floor((pos.x - rect.x) / rect.width * axis1.groups.size()); int col = (int) floor((pos.x - rect.x) / rect.width * axis1.groups.size());
int row = floor((rect.bottom() - pos.y) / rect.height * axis2.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 (col < 0 || col >= (int)axis1.groups.size()) return false;
if (row < 0 || row >= (int)axis2.groups.size()) return false; if (row < 0 || row >= (int)axis2.groups.size()) return false;
// done // done
...@@ -583,7 +583,7 @@ int GraphLegend::findItem(const RealPoint& pos, const RealRect& rect) const { ...@@ -583,7 +583,7 @@ int GraphLegend::findItem(const RealPoint& pos, const RealRect& rect) const {
RealPoint mypos = align_in_rect(alignment, size, rect); RealPoint mypos = align_in_rect(alignment, size, rect);
RealPoint pos2(pos.x - mypos.x, pos.y - mypos.y); 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; 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; if (col < 0 || col >= (int)axis_data().groups.size()) return -1;
return reverse ? (int)axis_data().groups.size() - col - 1 : col; return reverse ? (int)axis_data().groups.size() - col - 1 : col;
} }
...@@ -673,10 +673,10 @@ int GraphLabelAxis::findItem(const RealPoint& pos, const RealRect& rect) const { ...@@ -673,10 +673,10 @@ int GraphLabelAxis::findItem(const RealPoint& pos, const RealRect& rect) const {
GraphAxis& axis = axis_data(); GraphAxis& axis = axis_data();
int col; int col;
if (direction == HORIZONTAL) { 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; if (pos.y < rect.bottom()) return -1;
} else { } 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 (pos.x > rect.left()) return -1;
} }
if (col < 0 || col >= (int)axis.groups.size()) 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 { ...@@ -693,7 +693,7 @@ void GraphValueAxis::draw(RotatedDC& dc, int current, DrawLayer layer) const {
GraphAxis& axis = axis_data(); GraphAxis& axis = axis_data();
double step_height = rect.height / axis.max; // height of a single value double step_height = rect.height / axis.max; // height of a single value
dc.SetFont(*wxNORMAL_FONT); 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 // Colors
Color bg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW); Color bg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW);
Color fg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT); Color fg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT);
...@@ -710,7 +710,7 @@ void GraphValueAxis::draw(RotatedDC& dc, int current, DrawLayer layer) const { ...@@ -710,7 +710,7 @@ void GraphValueAxis::draw(RotatedDC& dc, int current, DrawLayer layer) const {
dc.SetPen(fg); dc.SetPen(fg);
} }
// draw line // 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)); dc.DrawLine(RealPoint(rect.left() - 2, y), RealPoint(rect.right(), y));
// draw label, aligned middle right // draw label, aligned middle right
if (! ((i < highlight && i + label_step > highlight) || if (! ((i < highlight && i + label_step > highlight) ||
......
...@@ -277,9 +277,9 @@ class GraphWithMargins : public Graph { ...@@ -277,9 +277,9 @@ class GraphWithMargins : public Graph {
virtual bool findItem(const RealPoint& pos, const RealRect& rect, vector<int>& out) const; virtual bool findItem(const RealPoint& pos, const RealRect& rect, vector<int>& out) const;
virtual void setData(const GraphDataP& d); virtual void setData(const GraphDataP& d);
private: private:
const GraphP graph;
double margin_left, margin_top, margin_right, margin_bottom; 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 bool upside_down; // put the coordinate system upside down, since graphs are usually bottom-to-top
const GraphP graph;
}; };
/// A display containing multiple graphs /// A display containing multiple graphs
......
...@@ -87,8 +87,8 @@ class ItemList : public wxListView { ...@@ -87,8 +87,8 @@ class ItemList : public wxListView {
// --------------------------------------------------- : Data // --------------------------------------------------- : Data
VoidP selected_item; ///< The currently selected item 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 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 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 vector<VoidP> sorted_list; ///< Sorted list of items, can be considered a map: pos->item
private: private:
......
...@@ -165,12 +165,25 @@ bool KeywordList::compareItems(void* a, void* b) const { ...@@ -165,12 +165,25 @@ bool KeywordList::compareItems(void* a, void* b) const {
String KeywordList::OnGetItemText (long pos, long col) const { String KeywordList::OnGetItemText (long pos, long col) const {
const Keyword& kw = *getKeyword(pos); const Keyword& kw = *getKeyword(pos);
String formatted;
wxChar c;
switch(col) { switch(col) {
case 0: return kw.keyword; case 0: return kw.keyword;
case 1: return match_string(kw); case 1: return match_string(kw);
case 2: return kw.mode; case 2: return kw.mode;
case 3: return _("?"); 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; default: return wxEmptyString;
} }
} }
......
...@@ -71,8 +71,8 @@ void NativeLookEditor::resizeViewers() { ...@@ -71,8 +71,8 @@ void NativeLookEditor::resizeViewers() {
if (e) e->determineSize(); if (e) e->determineSize();
y += s->height + vspace; y += s->height + vspace;
} }
SetVirtualSize(w,y); SetVirtualSize(w, (int)y);
SetScrollbar(wxVERTICAL, 0, h, y); SetScrollbar(wxVERTICAL, 0, h, (int) y);
if (y >= h) { if (y >= h) {
// Doesn't fit vertically, add scrollbar and resize // Doesn't fit vertically, add scrollbar and resize
/* /*
......
...@@ -262,9 +262,9 @@ bool CardsPanel::wantsToHandle(const Action&, bool undone) const { ...@@ -262,9 +262,9 @@ bool CardsPanel::wantsToHandle(const Action&, bool undone) const {
bool CardsPanel::canCut() const { CUT_COPY_PASTE(canCut, return) } bool CardsPanel::canCut() const { CUT_COPY_PASTE(canCut, return) }
bool CardsPanel::canCopy() const { CUT_COPY_PASTE(canCopy, return) } bool CardsPanel::canCopy() const { CUT_COPY_PASTE(canCopy, return) }
bool CardsPanel::canPaste() const { CUT_COPY_PASTE(canPaste, return) } bool CardsPanel::canPaste() const { CUT_COPY_PASTE(canPaste, return) }
void CardsPanel::doCut() { CUT_COPY_PASTE(doCut, ;) } void CardsPanel::doCut() { CUT_COPY_PASTE(doCut, return (void)) }
void CardsPanel::doCopy() { CUT_COPY_PASTE(doCopy, ;) } void CardsPanel::doCopy() { CUT_COPY_PASTE(doCopy, return (void)) }
void CardsPanel::doPaste() { CUT_COPY_PASTE(doPaste, ;) } void CardsPanel::doPaste() { CUT_COPY_PASTE(doPaste, return (void)) }
// ----------------------------------------------------------------------------- : Searching // ----------------------------------------------------------------------------- : Searching
......
...@@ -238,12 +238,12 @@ String KeywordsPanel::runRefScript(int find_i) { ...@@ -238,12 +238,12 @@ String KeywordsPanel::runRefScript(int find_i) {
else if (id == ID_RULES && rules ->IsEnabled()) { return rules ->op(); } \ else if (id == ID_RULES && rules ->IsEnabled()) { return rules ->op(); } \
else { return false; } else { return false; }
bool KeywordsPanel::canCopy() const { CUT_COPY_PASTE(canCopy, 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::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) } bool KeywordsPanel::canPaste() const { CUT_COPY_PASTE(canPaste, return, !list->getKeyword() || list->getKeyword()->fixed) }
void KeywordsPanel::doCopy() { CUT_COPY_PASTE(doCopy, ;, false) } void KeywordsPanel::doCopy() { CUT_COPY_PASTE(doCopy, return (void), false) }
void KeywordsPanel::doCut() { CUT_COPY_PASTE(doCut, ;, !list->getKeyword() || list->getKeyword()->fixed) } void KeywordsPanel::doCut() { CUT_COPY_PASTE(doCut, return (void), !list->getKeyword() || list->getKeyword()->fixed) }
void KeywordsPanel::doPaste() { CUT_COPY_PASTE(doPaste, ;, !list->getKeyword() || list->getKeyword()->fixed) } void KeywordsPanel::doPaste() { CUT_COPY_PASTE(doPaste, return (void), !list->getKeyword() || list->getKeyword()->fixed) }
// ----------------------------------------------------------------------------- : Events // ----------------------------------------------------------------------------- : Events
......
...@@ -152,7 +152,7 @@ void SymbolControl::draw(DC& dc) { ...@@ -152,7 +152,7 @@ void SymbolControl::draw(DC& dc) {
wxSize s = dc.GetSize(); wxSize s = dc.GetSize();
double lines = settings.symbol_grid_size; double lines = settings.symbol_grid_size;
for (int i = 0 ; i <= lines ; ++i) { 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(0, i%5 == 0 ? 64 : 31, 0));
//dc.SetPen(Color(i%5 == 0 ? 64 : 31, 0, 0)); //dc.SetPen(Color(i%5 == 0 ? 64 : 31, 0, 0));
dc.SetLogicalFunction(wxAND); dc.SetLogicalFunction(wxAND);
......
...@@ -96,7 +96,7 @@ void MultipleChoiceValueEditor::determineSize(bool force_fit) { ...@@ -96,7 +96,7 @@ void MultipleChoiceValueEditor::determineSize(bool force_fit) {
bool MultipleChoiceValueEditor::onLeftDown(const RealPoint& pos, wxMouseEvent& ev) { bool MultipleChoiceValueEditor::onLeftDown(const RealPoint& pos, wxMouseEvent& ev) {
// find item under cursor // find item under cursor
if (style().render_style & RENDER_CHECKLIST) { 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(); int end = field().choices->lastId();
if (id >= 0 && id < end) { if (id >= 0 && id < end) {
toggle(id); toggle(id);
......
...@@ -734,7 +734,7 @@ void TextValueEditor::determineSize(bool force_fit) { ...@@ -734,7 +734,7 @@ void TextValueEditor::determineSize(bool force_fit) {
int sbw = wxSystemSettings::GetMetric(wxSYS_VSCROLL_X); int sbw = wxSystemSettings::GetMetric(wxSYS_VSCROLL_X);
RealPoint pos = rot.tr(style().getPos()); RealPoint pos = rot.tr(style().getPos());
scrollbar->SetSize( 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)pos.y - 1,
(int)sbw, (int)sbw,
(int)rot.trS(style().height) + 2); (int)rot.trS(style().height) + 2);
......
...@@ -52,4 +52,4 @@ void ErrorTextElement::draw(RotatedDC& dc, double scale, const RealRect& rect, c ...@@ -52,4 +52,4 @@ void ErrorTextElement::draw(RotatedDC& dc, double scale, const RealRect& rect, c
} }
// Draw the contents // Draw the contents
CompoundTextElement::draw(dc, scale, rect, xs, what, start, end); CompoundTextElement::draw(dc, scale, rect, xs, what, start, end);
} }
\ No newline at end of file
...@@ -39,6 +39,7 @@ class IndexMap : private vector<Value> { ...@@ -39,6 +39,7 @@ class IndexMap : private vector<Value> {
using vector<Value>::const_reference; using vector<Value>::const_reference;
using vector<Value>::begin; using vector<Value>::begin;
using vector<Value>::end; using vector<Value>::end;
using vector<Value>::clear;
using vector<Value>::at; // for using numeric indices directly using vector<Value>::at; // for using numeric indices directly
/// Initialize this map with default values given a list of keys /// Initialize this map with default values given a list of keys
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment