Commit a774cfb4 authored by coppro's avatar coppro

Fixed many resource file names, removed raw-char matches input-char...

Fixed many resource file names, removed raw-char matches input-char requirement for Linux operation.

WARNING: This version is unstable. High possibility of encountering a complete processor lockup (likely an infinite loop).

Known bugs on Linux: Some fields are being drawn off-target (such as text) and they need to be fixed in order to allow compatibility. Different style files on different platforms would not be a good idea. The combined-editors are not working. When a text-replacement is made via "~", the cursor is placed before it and attempting to remove or select it causes a lockup. Symbol editor seems to be working fine. The symbol selection dialog causes a crash when used.
parent 6858d3aa
......@@ -117,8 +117,8 @@ void GalleryList::onChar(wxKeyEvent& ev) {
wxSize GalleryList::DoGetBestSize() const {
wxSize ws = GetSize(), cs = GetClientSize();
const int w = item_size.width + 2*MARGIN + 2*BORDER;
const int h = item_size.height + 2*MARGIN + 2*BORDER;
const int w = int(item_size.width) + 2*MARGIN + 2*BORDER;
const int h = int(item_size.height) + 2*MARGIN + 2*BORDER;
return wxSize(w, h) + ws - cs;
}
......@@ -136,13 +136,13 @@ void GalleryList::OnDraw(DC& dc) {
GetViewStart(&x, &y);
GetClientSize(&cw, &ch);
if (direction == wxHORIZONTAL) {
dx = item_size.width + MARGIN + 2*BORDER;
dx = int(item_size.width) + MARGIN + 2*BORDER;
dy = 0;
start = (size_t) x;
end = (size_t) (start + cw / dx + 1);
} else {
dx = 0;
dy = item_size.height + MARGIN + 2*BORDER;
dy = int(item_size.height) + MARGIN + 2*BORDER;
start = (size_t) y;
end = (size_t) (start + ch / dy + 1);
}
......@@ -162,9 +162,9 @@ void GalleryList::OnDraw(DC& dc) {
dc.SetPen(c);
dc.SetBrush(saturate(lerp(background, c, 0.3), selected ? 0.5 : 0));
RealPoint pos = itemPos(i);
dc.DrawRectangle(pos.x - BORDER, pos.y - BORDER, item_size.width + 2*BORDER, item_size.height + 2*BORDER);
dc.DrawRectangle(int(pos.x) - BORDER, int(pos.y) - BORDER, int(item_size.width) + 2*BORDER, int(item_size.height) + 2*BORDER);
// draw item
drawItem(dc, pos.x, pos.y, i, selected);
drawItem(dc, int(pos.x), int(pos.y), i, selected);
}
}
......
......@@ -161,12 +161,12 @@ void BarGraph::draw(RotatedDC& dc, int current) const {
}
// How many labels and lines to draw?
dc.SetFont(*wxNORMAL_FONT);
UInt label_step = max(1.0, dc.GetCharHeight() / step_height);
UInt label_step = UInt(max(1.0, dc.GetCharHeight() / step_height));
// Draw backlines (horizontal) and value labels
dc.SetPen(lerp(bg, fg, 0.5));
for (UInt i = 0 ; i <= axis.max ; ++i) {
if (i % label_step == 0) {
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
String label; label << i;
......@@ -202,7 +202,7 @@ int BarGraph::findItem(const RealPoint& pos, const RealRect& rect1) const {
double width_space = rect.width / count; // including spacing
double space = width_space / 5;
// Find column in which this point could be located
int col = (pos.x - rect.x) / width_space;
int col = int((pos.x - rect.x) / width_space);
double in_col = (pos.x - rect.x) - col * width_space;
if (in_col < space / 2 || // left
in_col > width_space - space / 2 || // right
......
......@@ -29,7 +29,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 + 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.width, d.image.GetWidth())), y + 3);
}
// draw short name
dc.SetFont(wxFont(12,wxSWISS,wxNORMAL,wxBOLD,false,_("Arial")));
......
......@@ -40,10 +40,10 @@ void ImageSlice::constrain() {
int diff = selection.width * target_size.GetHeight() - selection.height * target_size.GetWidth();
if (diff > 0) {
// too wide
selection.width -= diff / target_size.GetHeight();
selection.width -= int(diff / target_size.GetHeight());
} else {
// too high
selection.height -= -diff / target_size.GetWidth();
selection.height -= int(-diff / target_size.GetWidth());
}
}
}
......@@ -286,15 +286,15 @@ void ImageSliceWindow::updateControls() {
height ->SetValue(slice.selection.height);
fix_aspect->SetValue(slice.aspect_fixed);
if (slice.aspect_fixed) {
zoom->SetValue(slice.zoomX() * 100);
zoom->SetValue(int(slice.zoomX() * 100));
if (zoom_x->IsShown()) {
zoom_sizer->Show(zoom_fixed, true);
zoom_sizer->Show(zoom_free, false);
Layout();
}
} else {
zoom_x->SetValue(slice.zoomX() * 100);
zoom_y->SetValue(slice.zoomY() * 100);
zoom_x->SetValue(int(slice.zoomX() * 100));
zoom_y->SetValue(int(slice.zoomY() * 100));
if (zoom->IsShown()) {
zoom_sizer->Show(zoom_fixed, false);
zoom_sizer->Show(zoom_free, true);
......@@ -379,8 +379,8 @@ void ImageSlicePreview::onLeftUp(wxMouseEvent&v) {
void ImageSlicePreview::onMotion(wxMouseEvent& ev) {
if (mouse_down) {
// drag the image
slice.selection.x = start_selection.x + (mouseX - ev.GetX()) / slice.zoomX();
slice.selection.y = start_selection.y + (mouseY - ev.GetY()) / slice.zoomY();
slice.selection.x = int(start_selection.x + (mouseX - ev.GetX()) / slice.zoomX());
slice.selection.y = int(start_selection.y + (mouseY - ev.GetY()) / slice.zoomY());
// Notify parent
wxCommandEvent ev(EVENT_SLICE_CHANGED, GetId());
ProcessEvent(ev);
......@@ -428,10 +428,10 @@ void ImageSliceSelector::draw(DC& dc) {
if (!bitmap.Ok()) return;
// Selected region
wxSize s = GetClientSize();
int left = slice.selection.x * scaleX + border;
int top = slice.selection.y * scaleY + border;
int width = slice.selection.width * scaleX;
int height = slice.selection.height * scaleY;
int left = int(slice.selection.x * scaleX + border);
int top = int(slice.selection.y * scaleY + border);
int width = int(slice.selection.width * scaleX);
int height = int(slice.selection.height * scaleY);
// background
dc.SetPen(*wxTRANSPARENT_PEN);
dc.SetBrush(Color(128,128,128));
......@@ -554,8 +554,8 @@ void ImageSliceSelector::onMotion(wxMouseEvent& ev) {
// are we on a handle?
if (dragX == 0 && dragY == 0) {
// dragging entire selection
slice.selection.x = start_selection.x + deltaX;
slice.selection.y = start_selection.y + deltaY;
slice.selection.x = int(start_selection.x + deltaX);
slice.selection.y = int(start_selection.y + deltaY);
} else {
// fix aspect ratio
if (slice.aspect_fixed) {
......@@ -572,12 +572,12 @@ void ImageSliceSelector::onMotion(wxMouseEvent& ev) {
}
// move
if (dragX) {
slice.selection.x = start_selection.x + deltaX * (1 - dragX) / 2;
slice.selection.width = start_selection.width + deltaX * dragX;
slice.selection.x = int(start_selection.x + deltaX * (1 - dragX) / 2);
slice.selection.width = int(start_selection.width + deltaX * dragX);
}
if (dragY) {
slice.selection.y = start_selection.y + deltaY * (1 - dragY) / 2;
slice.selection.height = start_selection.height + deltaY * dragY;
slice.selection.y = int(start_selection.y + deltaY * (1 - dragY) / 2);
slice.selection.height = int(start_selection.height + deltaY * dragY);
}
}
......@@ -622,8 +622,8 @@ bool ImageSliceSelector::onAnyHandle(const wxMouseEvent& ev, int* dxOut, int* dy
}
wxPoint ImageSliceSelector::handlePos(int dx, int dy) const {
return wxPoint(
scaleX * (slice.selection.x + ((dx + 1) * slice.selection.width) * 0.5) + border,
scaleY * (slice.selection.y + ((dy + 1) * slice.selection.height) * 0.5) + border
int(scaleX * (slice.selection.x + ((dx + 1) * slice.selection.width) * 0.5) + border),
int(scaleY * (slice.selection.y + ((dy + 1) * slice.selection.height) * 0.5) + border)
);
}
......
......@@ -40,8 +40,8 @@ class ImageSlice {
// Zoom factor
inline double zoomX() const { return target_size.GetWidth() / (double)selection.width; }
inline double zoomY() const { return target_size.GetHeight() / (double)selection.height; }
inline void zoomX(double zoom) { selection.width = target_size.GetWidth() / zoom; }
inline void zoomY(double zoom) { selection.height = target_size.GetHeight() / zoom; }
inline void zoomX(double zoom) { selection.width = int(target_size.GetWidth() / zoom); }
inline void zoomY(double zoom) { selection.height = int(target_size.GetHeight() / zoom); }
};
......
......@@ -67,10 +67,10 @@ void CardsPanel::onChangeSet() {
void CardsPanel::initUI(wxToolBar* tb, wxMenuBar* mb) {
// Toolbar
tb->AddTool(ID_FORMAT_BOLD, _(""), load_resource_tool_image(_("bold")), wxNullBitmap, wxITEM_CHECK, _TOOL_("bold"));
tb->AddTool(ID_FORMAT_ITALIC, _(""), load_resource_tool_image(_("italic")), wxNullBitmap, wxITEM_CHECK, _TOOL_("italic"));
tb->AddTool(ID_FORMAT_SYMBOL, _(""), load_resource_tool_image(_("symbol")), wxNullBitmap, wxITEM_CHECK, _TOOL_("symbols"));
tb->AddTool(ID_FORMAT_REMINDER, _(""), load_resource_tool_image(_("reminder")), wxNullBitmap, wxITEM_CHECK, _TOOL_("reminder text"));
tb->AddTool(ID_FORMAT_BOLD, _(""), load_resource_tool_image(_("format_bold")), wxNullBitmap, wxITEM_CHECK, _TOOL_("bold"));
tb->AddTool(ID_FORMAT_ITALIC, _(""), load_resource_tool_image(_("format_italic")), wxNullBitmap, wxITEM_CHECK, _TOOL_("italic"));
tb->AddTool(ID_FORMAT_SYMBOL, _(""), load_resource_tool_image(_("format_symbol")), wxNullBitmap, wxITEM_CHECK, _TOOL_("symbols"));
tb->AddTool(ID_FORMAT_REMINDER, _(""), load_resource_tool_image(_("format_reminder")), wxNullBitmap, wxITEM_CHECK, _TOOL_("reminder text"));
tb->AddSeparator();
tb->AddTool(ID_CARD_ADD, _(""), load_resource_tool_image(_("card_add")), wxNullBitmap, wxITEM_NORMAL,_TOOL_("add card"));
tb->AddTool(ID_CARD_REMOVE, _(""), load_resource_tool_image(_("card_del")), wxNullBitmap, wxITEM_NORMAL,_TOOL_("remove card"));
......@@ -100,10 +100,10 @@ void CardsPanel::initUI(wxToolBar* tb, wxMenuBar* mb) {
mb->Insert(2, menuCard, _("&Cards"));
IconMenu* menuFormat = new IconMenu();
menuFormat->Append(ID_FORMAT_BOLD, _("bold"), _("Bold\tCtrl+B"), _("Makes the selected text bold"), wxITEM_CHECK);
menuFormat->Append(ID_FORMAT_ITALIC, _("italic"), _("Italic\tCtrl+I"), _("Makes the selected text italic"), wxITEM_CHECK);
menuFormat->Append(ID_FORMAT_SYMBOL, _("symbol"), _("Symbols\tCtrl+M"), _("Draws the selected text with symbols"), wxITEM_CHECK);
menuFormat->Append(ID_FORMAT_REMINDER, _("reminder"), _("Reminder Text\tCtrl+R"), _("Show reminder text for the selected keyword"), wxITEM_CHECK);
menuFormat->Append(ID_FORMAT_BOLD, _("format_bold"), _("Bold\tCtrl+B"), _("Makes the selected text bold"), wxITEM_CHECK);
menuFormat->Append(ID_FORMAT_ITALIC, _("format_italic"), _("Italic\tCtrl+I"), _("Makes the selected text italic"), wxITEM_CHECK);
menuFormat->Append(ID_FORMAT_SYMBOL, _("format_symbol"), _("Symbols\tCtrl+M"), _("Draws the selected text with symbols"), wxITEM_CHECK);
menuFormat->Append(ID_FORMAT_REMINDER, _("format_reminder"), _("Reminder Text\tCtrl+R"), _("Show reminder text for the selected keyword"), wxITEM_CHECK);
mb->Insert(3, menuFormat, _("&Format"));
}
......
......@@ -48,19 +48,19 @@ class CardsPanel : public SetWindowPanel {
virtual void doPaste();
// --------------------------------------------------- : Searching (find/replace)
/* virtual bool canFind() const;
#if 0
virtual bool canFind() const;
virtual bool canReplace() const;
virtual bool doFind(wxFindReplaceData& what);
virtual bool doReplace(wxFindReplaceData& what);
private:
// Functions that handle finding
/*
typedef void (CardsPanel::*FindHandler)(const CardP&, const TextValueP&, const size_t, const size_t, wxFindReplaceData&);
/// Execute a find (or replace), and start with the currently selected card and value
/** if findSame==true then find will also find the currently highlighted word
* Returns true if found
* /
*/
bool find(FindReplaceData& what, const FindHandler& handler, bool findSame = false);
/// find handler : select found value
......@@ -70,17 +70,17 @@ class CardsPanel : public SetWindowPanel {
void handleReplace(const CardP& card, const TextValueP& value, size_t start, size_t end, FindReplaceData& what);
/// Find in all cards
/** NOTE: this function is essentially the same as findInCard * /
/** NOTE: this function is essentially the same as findInCard */
bool findInCards(const CardP& firstCard, const ValueP& firstValue, int firstChar, FindReplaceData& what, const FindHandler& handler);
/// Find in a card, if firstValue is specified start searching there
/** NOTE: this function is essentially the same as findInCards * /
/** NOTE: this function is essentially the same as findInCards */
bool findInCard(const CardP& card, const ValueP& firstValue, int firstChar, FindReplaceData& what, const FindHandler& handler);
/// Find the current search string in the specified value
/** if searchDir = up searches from the end and only before firstChar, unless firstChar == -1 * /
/** if searchDir = up searches from the end and only before firstChar, unless firstChar == -1 */
bool findInValue(const CardP& crd_, virtual const ValueP& value, int firstChar, FindReplaceData& what, const FindHandler& handler);
*/
#endif
public:
// --------------------------------------------------- : Selection
......
......@@ -34,16 +34,16 @@ void SetInfoPanel::onChangeSet() {
void SetInfoPanel::initUI(wxToolBar* tb, wxMenuBar* mb) {
// Toolbar
tb->AddTool(ID_FORMAT_BOLD, _(""), load_resource_tool_image(_("bold")), wxNullBitmap, wxITEM_CHECK, _("Bold"));
tb->AddTool(ID_FORMAT_ITALIC, _(""), load_resource_tool_image(_("italic")), wxNullBitmap, wxITEM_CHECK, _("Italic"));
tb->AddTool(ID_FORMAT_SYMBOL, _(""), load_resource_tool_image(_("symbol")), wxNullBitmap, wxITEM_CHECK, _("Symbols"));
tb->AddTool(ID_FORMAT_BOLD, _(""), load_resource_tool_image(_("format_bold")), wxNullBitmap, wxITEM_CHECK, _("Bold"));
tb->AddTool(ID_FORMAT_ITALIC, _(""), load_resource_tool_image(_("format_italic")), wxNullBitmap, wxITEM_CHECK, _("Italic"));
tb->AddTool(ID_FORMAT_SYMBOL, _(""), load_resource_tool_image(_("format_symbol")), wxNullBitmap, wxITEM_CHECK, _("Symbols"));
tb->Realize();
// Menus
IconMenu* menuFormat = new IconMenu();
menuFormat->Append(ID_FORMAT_BOLD, _("bold"), _("Bold\tCtrl+B"), _("Makes the selected text bold"), wxITEM_CHECK);
menuFormat->Append(ID_FORMAT_ITALIC, _("italic"), _("Italic\tCtrl+I"), _("Makes the selected text italic"), wxITEM_CHECK);
menuFormat->Append(ID_FORMAT_SYMBOL, _("symbol"), _("Symbols\tCtrl+M"), _("Draws the selected text with symbols"), wxITEM_CHECK);
menuFormat->Append(ID_FORMAT_REMINDER, _("reminder"), _("Reminder Text\tCtrl+R"), _("Show reminder text for the selected keyword"), wxITEM_CHECK);
menuFormat->Append(ID_FORMAT_BOLD, _("format_bold"), _("Bold\tCtrl+B"), _("Makes the selected text bold"), wxITEM_CHECK);
menuFormat->Append(ID_FORMAT_ITALIC, _("format_italic"), _("Italic\tCtrl+I"), _("Makes the selected text italic"), wxITEM_CHECK);
menuFormat->Append(ID_FORMAT_SYMBOL, _("format_symbol"), _("Symbols\tCtrl+M"), _("Draws the selected text with symbols"), wxITEM_CHECK);
menuFormat->Append(ID_FORMAT_REMINDER, _("format_reminder"), _("Reminder Text\tCtrl+R"), _("Show reminder text for the selected keyword"), wxITEM_CHECK);
mb->Insert(2, menuFormat, _("&Format"));
}
......
......@@ -48,9 +48,9 @@ SetWindow::SetWindow(Window* parent, const SetP& set)
// initialize menu bar
wxMenuBar* menuBar = new wxMenuBar();
IconMenu* menuFile = new IconMenu();
menuFile->Append(ID_FILE_NEW, _("new"), _MENU_("new set"), _HELP_("new set"));
menuFile->Append(ID_FILE_OPEN, _("open"), _MENU_("open set"), _HELP_("open set"));
menuFile->Append(ID_FILE_SAVE, _("save"), _MENU_("save set"), _HELP_("save set"));
menuFile->Append(ID_FILE_NEW, _("file_new"), _MENU_("new set"), _HELP_("new set"));
menuFile->Append(ID_FILE_OPEN, _("file_open"), _MENU_("open set"), _HELP_("open set"));
menuFile->Append(ID_FILE_SAVE, _("file_save"), _MENU_("save set"), _HELP_("save set"));
menuFile->Append(ID_FILE_SAVE_AS, _MENU_("save set as"), _HELP_("save set as"));
IconMenu* menuExport = new IconMenu();
menuExport->Append(ID_FILE_EXPORT_HTML, _("&HTML..."), _("Export the set to a HTML file"));
......@@ -71,14 +71,14 @@ SetWindow::SetWindow(Window* parent, const SetP& set)
menuBar->Append(menuFile, _MENU_("file"));
IconMenu* menuEdit = new IconMenu();
menuEdit->Append(ID_EDIT_UNDO, _("undo"), _MENU_1_("undo",wxEmptyString), _HELP_("undo"));
menuEdit->Append(ID_EDIT_REDO, _("redo"), _MENU_1_("redo",wxEmptyString), _HELP_("redo"));
menuEdit->Append(ID_EDIT_UNDO, _("edit_undo"), _MENU_1_("undo",wxEmptyString), _HELP_("undo"));
menuEdit->Append(ID_EDIT_REDO, _("edit_redo"), _MENU_1_("redo",wxEmptyString), _HELP_("redo"));
menuEdit->AppendSeparator();
menuEdit->Append(ID_EDIT_CUT, _("cut"), _MENU_("cut"), _HELP_("cut"));
menuEdit->Append(ID_EDIT_COPY, _("copy"), _MENU_("copy"), _HELP_("copy"));
menuEdit->Append(ID_EDIT_PASTE, _("paste"), _MENU_("paste"), _HELP_("paste"));
menuEdit->Append(ID_EDIT_CUT, _("edit_cut"), _MENU_("cut"), _HELP_("cut"));
menuEdit->Append(ID_EDIT_COPY, _("edit_copy"), _MENU_("copy"), _HELP_("copy"));
menuEdit->Append(ID_EDIT_PASTE, _("edit_paste"), _MENU_("paste"), _HELP_("paste"));
menuEdit->AppendSeparator();
menuEdit->Append(ID_EDIT_FIND, _("find"), _MENU_("find"), _(""));
menuEdit->Append(ID_EDIT_FIND, _("edit_find"), _MENU_("find"), _(""));
menuEdit->Append(ID_EDIT_FIND_NEXT, _MENU_("find next"), _(""));
menuEdit->Append(ID_EDIT_REPLACE, _MENU_("replace"), _(""));
menuEdit->AppendSeparator();
......@@ -105,16 +105,16 @@ SetWindow::SetWindow(Window* parent, const SetP& set)
// tool bar
wxToolBar* tb = CreateToolBar(wxTB_FLAT | wxNO_BORDER | wxTB_HORIZONTAL);
tb->SetToolBitmapSize(wxSize(18,18));
tb->AddTool(ID_FILE_NEW, _(""), load_resource_tool_image(_("new")), wxNullBitmap, wxITEM_NORMAL, _TOOL_("new set"), _HELP_("new set"));
tb->AddTool(ID_FILE_OPEN, _(""), load_resource_tool_image(_("open")), wxNullBitmap, wxITEM_NORMAL, _TOOL_("open set"), _HELP_("open set"));
tb->AddTool(ID_FILE_SAVE, _(""), load_resource_tool_image(_("save")), wxNullBitmap, wxITEM_NORMAL, _TOOL_("save set"), _HELP_("save set"));
tb->AddTool(ID_FILE_NEW, _(""), load_resource_tool_image(_("file_new")), wxNullBitmap, wxITEM_NORMAL, _TOOL_("new set"), _HELP_("new set"));
tb->AddTool(ID_FILE_OPEN, _(""), load_resource_tool_image(_("file_open")), wxNullBitmap, wxITEM_NORMAL, _TOOL_("open set"), _HELP_("open set"));
tb->AddTool(ID_FILE_SAVE, _(""), load_resource_tool_image(_("file_save")), wxNullBitmap, wxITEM_NORMAL, _TOOL_("save set"), _HELP_("save set"));
tb->AddSeparator();
tb->AddTool(ID_EDIT_CUT, _(""), load_resource_tool_image(_("cut")), wxNullBitmap, wxITEM_NORMAL, _TOOL_("cut"));
tb->AddTool(ID_EDIT_COPY, _(""), load_resource_tool_image(_("copy")), wxNullBitmap, wxITEM_NORMAL, _TOOL_("copy"));
tb->AddTool(ID_EDIT_PASTE, _(""), load_resource_tool_image(_("paste")), wxNullBitmap, wxITEM_NORMAL, _TOOL_("paste"));
tb->AddTool(ID_EDIT_CUT, _(""), load_resource_tool_image(_("edit_cut")), wxNullBitmap, wxITEM_NORMAL, _TOOL_("cut"));
tb->AddTool(ID_EDIT_COPY, _(""), load_resource_tool_image(_("edit_copy")), wxNullBitmap, wxITEM_NORMAL, _TOOL_("copy"));
tb->AddTool(ID_EDIT_PASTE, _(""), load_resource_tool_image(_("edit_paste")), wxNullBitmap, wxITEM_NORMAL, _TOOL_("paste"));
tb->AddSeparator();
tb->AddTool(ID_EDIT_UNDO, _(""), load_resource_tool_image(_("undo")), wxNullBitmap, wxITEM_NORMAL, _TOOL_1_("undo",wxEmptyString));
tb->AddTool(ID_EDIT_REDO, _(""), load_resource_tool_image(_("redo")), wxNullBitmap, wxITEM_NORMAL, _TOOL_1_("redo",wxEmptyString));
tb->AddTool(ID_EDIT_UNDO, _(""), load_resource_tool_image(_("edit_undo")), wxNullBitmap, wxITEM_NORMAL, _TOOL_1_("undo",wxEmptyString));
tb->AddTool(ID_EDIT_REDO, _(""), load_resource_tool_image(_("edit_redo")), wxNullBitmap, wxITEM_NORMAL, _TOOL_1_("redo",wxEmptyString));
tb->AddSeparator();
tb->Realize();
......@@ -349,7 +349,7 @@ void SetWindow::onUpdateUI(wxUpdateUIEvent& ev) {
case ID_EDIT_REPLACE : ev.Enable(current_panel->canReplace());break;
default:
// items created by the panel, and cut/copy/paste and find/replace
current_panel->onUpdateUI(ev);
if(current_panel) current_panel->onUpdateUI(ev);
}
}
......
......@@ -20,12 +20,12 @@ SymbolPartList::SymbolPartList(Window* parent, int id, SymbolP symbol)
// Create image list
wxImageList* images = new wxImageList(16,16);
// NOTE: this is based on the order of the SymbolPartCombine enum!
images->Add(load_resource_image(_("combine_or")));
images->Add(load_resource_image(_("combine_sub")));
images->Add(load_resource_image(_("combine_and")));
images->Add(load_resource_image(_("combine_xor")));
images->Add(load_resource_image(_("combine_over")));
images->Add(load_resource_image(_("combine_border")));
images->Add(load_resource_tool_image(_("combine_or")));
images->Add(load_resource_tool_image(_("combine_sub")));
images->Add(load_resource_tool_image(_("combine_and")));
images->Add(load_resource_tool_image(_("combine_xor")));
images->Add(load_resource_tool_image(_("combine_over")));
images->Add(load_resource_tool_image(_("combine_border")));
AssignImageList(images, wxIMAGE_LIST_SMALL);
// create columns
InsertColumn(0, _("Name"));
......
......@@ -61,8 +61,8 @@ void SymbolPointEditor::drawHoveredLine(DC& dc) {
if (selectPercent > 0) {
// gradient color
Color color(
col(300 - 300 * selectPercent),
col(300 * selectPercent),
col(300 - int(300 * selectPercent)),
col(300 * int(selectPercent)),
col(0)
);
dc.SetPen(wxPen(color, 3));
......
......@@ -107,12 +107,12 @@ void SymbolSelectEditor::drawRotationCenter(DC& dc, const Vector2D& pos) {
void SymbolSelectEditor::initUI(wxToolBar* tb, wxMenuBar* mb) {
tb->AddSeparator();
tb->AddTool(ID_PART_MERGE, _("Merge"), load_resource_image(_("combine_or")), wxNullBitmap, wxITEM_CHECK, _("Merge with shapes below"), _("Merges this shape with those below it"));
tb->AddTool(ID_PART_SUBTRACT, _("Subtract"), load_resource_image(_("combine_sub_dark")), wxNullBitmap, wxITEM_CHECK, _("Subtract from shapes below"), _("Subtracts this shape from shapes below it, leaves only the area in that shape that is not in this shape"));
tb->AddTool(ID_PART_INTERSECTION, _("Intersect"), load_resource_image(_("combine_and_dark")), wxNullBitmap, wxITEM_CHECK, _("Intersect with shapes below"), _("Intersects this shape with shapes below it, leaves only the area in both shapes"));
tb->AddTool(ID_PART_MERGE, _("Merge"), load_resource_tool_image(_("combine_or")), wxNullBitmap, wxITEM_CHECK, _("Merge with shapes below"), _("Merges this shape with those below it"));
tb->AddTool(ID_PART_SUBTRACT, _("Subtract"), load_resource_tool_image(_("combine_sub_dark")), wxNullBitmap, wxITEM_CHECK, _("Subtract from shapes below"), _("Subtracts this shape from shapes below it, leaves only the area in that shape that is not in this shape"));
tb->AddTool(ID_PART_INTERSECTION, _("Intersect"), load_resource_tool_image(_("combine_and_dark")), wxNullBitmap, wxITEM_CHECK, _("Intersect with shapes below"), _("Intersects this shape with shapes below it, leaves only the area in both shapes"));
// note: difference doesn't work (yet)
tb->AddTool(ID_PART_OVERLAP, _("Overlap"), load_resource_image(_("combine_over")), wxNullBitmap, wxITEM_CHECK, _("Place above other shapes"), _("Place this shape, and its border above shapes below it"));
tb->AddTool(ID_PART_BORDER, _("Border"), load_resource_image(_("combine_border")), wxNullBitmap, wxITEM_CHECK, _("Draw as a border"), _("Draws this shape as a border"));
tb->AddTool(ID_PART_OVERLAP, _("Overlap"), load_resource_tool_image(_("combine_over")), wxNullBitmap, wxITEM_CHECK, _("Place above other shapes"), _("Place this shape, and its border above shapes below it"));
tb->AddTool(ID_PART_BORDER, _("Border"), load_resource_tool_image(_("combine_border")), wxNullBitmap, wxITEM_CHECK, _("Draw as a border"), _("Draws this shape as a border"));
tb->Realize();
}
void SymbolSelectEditor::destroyUI(wxToolBar* tb, wxMenuBar* mb) {
......
......@@ -58,9 +58,9 @@ void SymbolWindow::init(Window* parent, SymbolP symbol) {
// Menu bar
wxMenuBar* menuBar = new wxMenuBar();
IconMenu* menuFile = new IconMenu();
menuFile->Append(ID_FILE_NEW, _("new"), _MENU_("new symbol"), _HELP_("new symbol"));
menuFile->Append(ID_FILE_OPEN, _("open"), _MENU_("open symbol"), _HELP_("open symbol"));
menuFile->Append(ID_FILE_SAVE, _("save"), _MENU_("save symbol"), _HELP_("save symbol"));
menuFile->Append(ID_FILE_NEW, _("file_new"), _MENU_("new symbol"), _HELP_("new symbol"));
menuFile->Append(ID_FILE_OPEN, _("file_open"), _MENU_("open symbol"), _HELP_("open symbol"));
menuFile->Append(ID_FILE_SAVE, _("file_save"), _MENU_("save symbol"), _HELP_("save symbol"));
menuFile->Append(ID_FILE_SAVE_AS, _MENU_("save symbol as"), _HELP_("save symbol as"));
menuFile->AppendSeparator();
menuFile->Append(ID_FILE_STORE, _("apply"), _MENU_("store symbol"), _HELP_("store symbol"));
......@@ -69,8 +69,8 @@ void SymbolWindow::init(Window* parent, SymbolP symbol) {
menuBar->Append(menuFile, _MENU_("file"));
IconMenu* menuEdit = new IconMenu();
menuEdit->Append(ID_EDIT_UNDO, _("undo"), _MENU_1_("undo",wxEmptyString), _HELP_("undo"));
menuEdit->Append(ID_EDIT_REDO, _("redo"), _MENU_1_("redo",wxEmptyString), _HELP_("redo"));
menuEdit->Append(ID_EDIT_UNDO, _("edit_undo"), _MENU_1_("undo",wxEmptyString), _HELP_("undo"));
menuEdit->Append(ID_EDIT_REDO, _("edit_redo"), _MENU_1_("redo",wxEmptyString), _HELP_("redo"));
menuEdit->AppendSeparator();
menuEdit->Append(ID_EDIT_DUPLICATE, _("duplicate"), _MENU_("duplicate"), _HELP_("duplicate"));
menuBar->Append(menuEdit, _MENU_("edit"));
......@@ -93,8 +93,8 @@ void SymbolWindow::init(Window* parent, SymbolP symbol) {
wxToolBar* tb = CreateToolBar(wxTB_FLAT | wxNO_BORDER | wxTB_HORIZONTAL | wxTB_TEXT);
tb->AddTool(ID_FILE_STORE, _("Store"), load_resource_tool_image(_("apply")), wxNullBitmap, wxITEM_NORMAL, _TOOL_("store symbol"), _HELP_("store symbol"));
tb->AddSeparator();
tb->AddTool(ID_EDIT_UNDO, _("Undo"), load_resource_tool_image(_("undo")), wxNullBitmap, wxITEM_NORMAL, _TOOL_1_("undo",wxEmptyString));
tb->AddTool(ID_EDIT_REDO, _("Redo"), load_resource_tool_image(_("redo")), wxNullBitmap, wxITEM_NORMAL, _TOOL_1_("redo",wxEmptyString));
tb->AddTool(ID_EDIT_UNDO, _("Undo"), load_resource_tool_image(_("edit_undo")), wxNullBitmap, wxITEM_NORMAL, _TOOL_1_("undo",wxEmptyString));
tb->AddTool(ID_EDIT_REDO, _("Redo"), load_resource_tool_image(_("edit_redo")), wxNullBitmap, wxITEM_NORMAL, _TOOL_1_("redo",wxEmptyString));
tb->Realize();
// Edit mode toolbar
......
......@@ -91,11 +91,12 @@ Image load_resource_image(const String& name) {
#elif defined(__linux__)
static String path = wxStandardPaths::Get().GetDataDir() + _("/resource/");
String file = path + name.Lower();
wxImage resource (file + _(".png"), wxBITMAP_TYPE_PNG);
if (!resource.Ok()) resource.LoadFile (file + _(".bmp"), wxBITMAP_TYPE_BMP);
if (!resource.Ok()) resource.LoadFile (file + _(".ico"), wxBITMAP_TYPE_ICO);
if (!resource.Ok()) resource.LoadFile (file + _(".cur"), wxBITMAP_TYPE_CUR);
if (!resource.Ok()) throw InternalError(String::Format(_("Resource not found: %s"), name.c_str()));
wxImage resource;
if (wxFileExists(file + _(".png"))) resource.LoadFile(file + _(".png"));
else if (wxFileExists(file + _(".bmp"))) resource.LoadFile(file + _(".bmp"));
else if (wxFileExists(file + _(".ico"))) resource.LoadFile(file + _(".ico"));
else if (wxFileExists(file + _(".cur"))) resource.LoadFile(file + _(".cur"));
if (!resource.Ok()) handle_error(InternalError(String(_("Cannot find resource file at ")) + file));
return resource;
#else
#error Handling of resource loading needs to be declared.
......@@ -114,7 +115,8 @@ wxIcon load_resource_icon(const String& name) {
#if defined(__WXMSW__)
return wxIcon(_("icon/") + name);
#else
return wxIcon(_("icon/") + name + _(".ico"), wxBITMAP_TYPE_ICO);
static String path = wxStandardPaths::Get().GetDataDir() + _("/icon/");
return wxIcon(path + name + _(".ico"), wxBITMAP_TYPE_ICO);
#endif
}
......
......@@ -188,7 +188,7 @@ void TextValueEditor::onChar(wxKeyEvent& ev) {
}
break;
default:
if (ev.GetKeyCode() >= _(' ') && ev.GetKeyCode() == (int)ev.GetRawKeyCode()) {
if (ev.GetKeyCode() >= _(' ') /*&& ev.GetKeyCode() == (int)ev.GetRawKeyCode()*/) {
// TODO: Find a more correct way to determine normal characters,
// this might not work for internationalized input.
// It might also not be portable!
......@@ -606,10 +606,10 @@ void TextValueEditor::determineSize(bool force_fit) {
if (!force_fit) style().height = 100;
int sbw = wxSystemSettings::GetMetric(wxSYS_VSCROLL_X);
scrollbar->SetSize(
(int)style().left + style().width - sbw + 1,
(int)style().top - 1,
(int)sbw,
(int)style().height + 2);
int(style().left + style().width - sbw + 1),
int(style().top - 1),
int(sbw),
int(style().height + 2));
v.reset();
} else {
// Height depends on font
......
......@@ -51,7 +51,7 @@ void PackageManager::init() {
data_directory = wxPathOnly(data_directory);
if (d == data_directory) {
// we are at the root -> 'data' not found anywhere in the path -> fatal error
throw Error(_("The MSE data files can not be found, there should be a directory called 'data' with these files"));
throw Error(_("The MSE data files can not be found, there should be a directory called 'data' with these files. The expected directory to find it in was ") + wxStandardPaths::Get().GetDataDir());
}
}
data_directory += _("/data");
......
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