Eliminated most build errors (gcc,linux,wxGTK).

What is left is mostly:
 - warning: converting double to int
     -> add a cast/to_int or ignore
 - wrong initialization order in ctor
     -> just swap the order to match the class
 - errors about wxCursors
     -> add a function loadResourceCursor


git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@183 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2007-01-29 00:04:20 +00:00
parent 1cd80a3710
commit 3d9181e5f6
42 changed files with 151 additions and 125 deletions
+1 -1
View File
@@ -100,7 +100,7 @@ struct CompareTabIndex {
Field& af = *as.fieldP, &bf = *bs.fieldP;
if (af.tab_index < bf.tab_index) return true;
if (af.tab_index > bf.tab_index) return false;
if (abs(as.top - bs.top) < 15) {
if (fabs(as.top - bs.top) < 15) {
// the fields are almost on the same 'row'
// compare horizontally first
if (as.left < bs.left) return true; // horizontal sorting
+4 -2
View File
@@ -79,8 +79,10 @@ void CardListColumnSelectDialog::initList() {
// check
int i = list->GetCount() - 1;
list->Check(i, c.settings.visible);
// fix the background color
list->GetItem(i)->SetBackgroundColour(window_color);
#ifdef _WX_MSW_
// fix the background color
list->GetItem(i)->SetBackgroundColour(window_color);
#endif
}
}
+1 -1
View File
@@ -80,7 +80,7 @@ void CardViewer::drawViewer(RotatedDC& dc, ValueViewer& v) {
}
bool CardViewer::shouldDraw(const ValueViewer& v) const {
return GetUpdateRegion().Contains((wxRect)v.boundingBox()) != wxOutRegion;
return GetUpdateRegion().Contains(v.boundingBox().toRect()) != wxOutRegion;
}
// helper class for overdrawDC()
+5 -5
View File
@@ -22,13 +22,13 @@ const int BORDER = 1; // margin between items
GalleryList::GalleryList(Window* parent, int id, int direction)
: wxScrolledWindow(parent, id, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER | (direction == wxHORIZONTAL ? wxHSCROLL : wxVSCROLL) )
, direction(direction)
, selection(NO_SELECTION)
, direction(direction)
{}
void GalleryList::update() {
const int w = item_size.width + MARGIN + 2*BORDER;
const int h = item_size.height + MARGIN + 2*BORDER;
const int w = (int)item_size.width + MARGIN + 2*BORDER;
const int h = (int)item_size.height + MARGIN + 2*BORDER;
// resize and scroll
if (direction == wxHORIZONTAL) {
SetVirtualSize(w * (int)itemCount() + MARGIN, h + MARGIN);
@@ -56,11 +56,11 @@ void GalleryList::update() {
size_t GalleryList::findItem(const wxMouseEvent& ev) const {
if (direction == wxHORIZONTAL) {
int x, w = item_size.width + MARGIN + 2*BORDER;
int x, w = (int)item_size.width + MARGIN + 2*BORDER;
GetViewStart (&x, 0);
return static_cast<size_t>( x + ev.GetX() / w );
} else { // wxVERTICAL
int y, h = item_size.height + MARGIN + 2*BORDER;
int y, h = (int)item_size.height + MARGIN + 2*BORDER;
GetViewStart (0, &y);
return static_cast<size_t>( y + ev.GetY() / h );
}
+2 -2
View File
@@ -40,14 +40,14 @@ void NativeLookEditor::drawViewer(RotatedDC& dc, ValueViewer& v) {
dc.SetFont(*wxNORMAL_FONT);
dc.DrawText(capitalize_sentence(s.fieldP->name), RealPoint(margin_left, s.top + 1));
// draw 3D border
draw_control_border(this, dc.getDC(), wxRect(s.left - 1, s.top - 1, s.width + 2, s.height + 2));
draw_control_border(this, dc.getDC(), RealRect(s.left - 1, s.top - 1, s.width + 2, s.height + 2));
// draw viewer
v.draw(dc);
}
void NativeLookEditor::resizeViewers() {
// size stuff
UInt y = margin;
double y = margin;
int w;
GetClientSize(&w, 0);
const int default_height = 17;
+2 -2
View File
@@ -35,12 +35,12 @@ void PackageList::drawItem(DC& dc, int x, int y, size_t item, bool selected) {
dc.SetFont(wxFont(12,wxSWISS,wxNORMAL,wxBOLD,false,_("Arial")));
dc.GetTextExtent(capitalize(d.package->short_name), &w, &h);
pos = align_in_rect(ALIGN_CENTER, RealSize(w,h), rect);
dc.DrawText(capitalize(d.package->short_name), pos.x, pos.y + 110);
dc.DrawText(capitalize(d.package->short_name), (int)pos.x, (int)pos.y + 110);
// draw name
dc.SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
dc.GetTextExtent(d.package->full_name, &w, &h);
RealPoint text_pos = align_in_rect(ALIGN_CENTER, RealSize(w,h), rect);
dc.DrawText(d.package->full_name, text_pos.x, text_pos.y + 130);
dc.DrawText(d.package->full_name, (int)text_pos.x, (int)text_pos.y + 130);
}
void PackageList::showData(const String& pattern) {
+1
View File
@@ -10,6 +10,7 @@
// ----------------------------------------------------------------------------- : Includes
#include <util/prec.hpp>
#include <util/error.hpp>
#include <gui/control/gallery_list.hpp>
DECLARE_POINTER_TYPE(Packaged);
+2 -1
View File
@@ -11,6 +11,7 @@
#include <util/prec.hpp>
#include <gui/control/card_list.hpp>
#include <set>
// ----------------------------------------------------------------------------- : SelectCardList
@@ -30,7 +31,7 @@ class SelectCardList : public CardListBase {
private:
DECLARE_EVENT_TABLE();
set<CardP> selected; ///< which cards are selected?
std::set<CardP> selected; ///< which cards are selected?
void toggle(const CardP& card);
+1 -1
View File
@@ -55,7 +55,7 @@ void TextCtrl::setValue(String* value) {
style->width = cs.GetWidth() - 2;
style->height = cs.GetHeight() - 2;
viewers.front()->getEditor()->determineSize(true);
SetMinSize(wxSize(style->width + 6, style->height + 6));
SetMinSize(RealSize(style->width + 6, style->height + 6));
}
valueChanged();
}
+21 -21
View File
@@ -56,15 +56,15 @@ class DropDownHider : public wxEvtHandler {
DropDownList::DropDownList(Window* parent, bool is_submenu, ValueViewer* viewer)
: wxPopupWindow(parent)
, mouse_down(false)
, selected_item(NO_SELECTION)
, open_sub_menu(nullptr)
, parent_menu(nullptr)
, hider(is_submenu ? nullptr : new DropDownHider(*this))
, viewer(viewer)
, text_offset(1)
, item_size(100,1)
, icon_size(0,0)
, text_offset(1)
, selected_item(NO_SELECTION)
, mouse_down(false)
, open_sub_menu(nullptr)
, parent_menu(nullptr)
, viewer(viewer)
, hider(is_submenu ? nullptr : new DropDownHider(*this))
{
if (is_submenu) {
parent_menu = &dynamic_cast<DropDownList&>(*GetParent());
@@ -110,16 +110,16 @@ void DropDownList::show(bool in_place, wxPoint pos) {
// Position the drop down list below the editor control (based on the style)
RealRect r = viewer->viewer.getRotation().trNoNeg(viewer->getStyle()->getRect());
if (viewer->viewer.nativeLook()) {
pos = wxPoint(r.x - 3, r.y - 3);
pos = RealPoint(r.x - 3, r.y - 3);
size.width = max(size.width, r.width + 6);
parent_height = r.height + 6;
parent_height = (int)r.height + 6;
} else {
pos = wxPoint(r.x - 1, r.y - 1);
pos = RealPoint(r.x - 1, r.y - 1);
size.width = max(size.width, r.width + 2);
parent_height = r.height;
parent_height = (int)r.height;
}
} else if (parent_menu) {
parent_height = -item_size.height - 1;
parent_height = -(int)item_size.height - 1;
}
pos = GetParent()->ClientToScreen(pos);
// move & resize
@@ -191,7 +191,7 @@ bool DropDownList::showSubMenu(size_t item, int y) {
wxSize size = GetSize();
sub_menu->show(true,
sub_menu->GetParent()->ScreenToClient(ClientToScreen(
wxPoint(size.GetWidth() - 1, y + item_size.height)
wxPoint(size.GetWidth() - 1, y + (int)item_size.height)
)));
return true;
}
@@ -201,7 +201,7 @@ int DropDownList::itemPosition(size_t item) const {
size_t count = itemCount();
for (size_t i = 0 ; i < count ; ++i) {
if (i == item) return y;
y += item_size.height + lineBelow(item);
y += (int)item_size.height + lineBelow(item);
}
// not found
assert(false);
@@ -237,7 +237,7 @@ void DropDownList::draw(DC& dc) {
size_t count = itemCount();
for (size_t i = 0 ; i < count ; ++i) {
drawItem(dc, y, i);
y += item_size.height + lineBelow(i);
y += (int)item_size.height + lineBelow(i);
}
}
@@ -247,27 +247,27 @@ void DropDownList::drawItem(DC& dc, int y, size_t item) {
if (item == selected_item) {
dc.SetBrush (wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT));
dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT));
dc.DrawRectangle(marginW, y, item_size.width, item_size.height);
dc.DrawRectangle(marginW, y, (int)item_size.width, (int)item_size.height);
} else if (highlightItem(item)) {
// mix a color between selection and window
dc.SetBrush (lerp(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT),
wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW), 0.75));
dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
dc.DrawRectangle(marginW, y, item_size.width, item_size.height);
dc.DrawRectangle(marginW, y, (int)item_size.width, (int)item_size.height);
} else {
dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
}
// draw text and icon
drawIcon(dc, marginW, y, item, item == selected_item);
dc.DrawText(capitalize(itemText(item)), marginW + icon_size.width + 1, y + text_offset);
dc.DrawText(capitalize(itemText(item)), marginW + (int)icon_size.width + 1, y + text_offset);
// draw popup icon
if (submenu(item)) {
draw_menu_arrow(this, dc, wxRect(marginW, y, item_size.width, item_size.height), item == selected_item);
draw_menu_arrow(this, dc, RealRect(marginW, y, item_size.width, item_size.height), item == selected_item);
}
// draw line below
if (lineBelow(item)) {
dc.SetPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DSHADOW));
dc.DrawLine(marginW, y + item_size.height, marginW + item_size.width, y + item_size.height);
dc.DrawLine(marginW, y + (int)item_size.height, marginW + (int)item_size.width, y + (int)item_size.height);
}
}
@@ -293,7 +293,7 @@ void DropDownList::onMotion(wxMouseEvent& ev) {
int startY = marginH;
size_t count = itemCount();
for (size_t i = 0 ; i < count ; ++i) {
int endY = startY + item_size.height;
int endY = startY + (int)item_size.height;
if (ev.GetY() >= startY && ev.GetY() < endY) {
selected_item = i;
showSubMenu(i, startY);
+18 -9
View File
@@ -47,15 +47,24 @@ Image generateDisabledImage(const Image& imgIn) {
// ----------------------------------------------------------------------------- : IconMenu
void IconMenu::Append(int id, const String& resource, const String& text, const String& help, int style, wxMenu* submenu) {
// load bitmap
Bitmap bitmap(resource);
bitmap = bitmap.GetSubBitmap(wxRect(0,0,16,16));
Image disabledImage = generateDisabledImage(bitmap.ConvertToImage());
// add menu item
wxMenuItem* item = new wxMenuItem(this, id, text, help, style, submenu);
item->SetBitmaps(bitmap, bitmap);
item->SetDisabledBitmap(disabledImage);
wxMenu::Append(item);
#ifdef __WXMSW__
// load bitmap
Bitmap bitmap(resource);
bitmap = bitmap.GetSubBitmap(wxRect(0,0,16,16));
Image disabledImage = generateDisabledImage(bitmap.ConvertToImage());
// add menu item
wxMenuItem* item = new wxMenuItem(this, id, text, help, style, submenu);
item->SetBitmaps(bitmap, bitmap);
item->SetDisabledBitmap(disabledImage);
wxMenu::Append(item);
#else
// load bitmap
Bitmap bitmap = loadResourceImage(resource);
// add menu
wxMenuItem* item = new wxMenuItem(this, id, text, help, style, submenu);
item->SetBitmaps(bitmap);
wxMenu::Append(item);
#endif
}
+1 -1
View File
@@ -126,7 +126,7 @@ DisplayPreferencesPage::DisplayPreferencesPage(Window* parent)
borders-> SetValue( settings.default_stylesheet_settings.card_borders());
non_normal_export->SetValue(!settings.default_stylesheet_settings.card_normal_export());
zoom->SetRange(1, 1000);
zoom-> SetValue( settings.default_stylesheet_settings.card_zoom() * 100);
zoom-> SetValue(static_cast<int>(settings.default_stylesheet_settings.card_zoom() * 100));
// init sizer
wxSizer* s = new wxBoxSizer(wxVERTICAL);
wxSizer* s2 = new wxStaticBoxSizer(wxVERTICAL, this, _("Card Display"));
+1 -1
View File
@@ -149,7 +149,7 @@ class StatsFilter : public CardListFilter {
virtual bool keep(const CardP& card) {
Context& ctx = set.getContext(card);
FOR_EACH(v, values) {
if ((String)*v.first->script.invoke(ctx) != v.second) return false;
if (v.first->script.invoke(ctx)->toString() != v.second) return false;
}
return true;
}
+3 -3
View File
@@ -160,10 +160,10 @@ void SymbolBasicShapeEditor::makeShape(const Vector2D& a, const Vector2D& b, boo
// constrain
Vector2D size = b - a;
if (constrained) {
if (abs(size.x) > abs(size.y)) {
size.y = sgn(size.y) * abs(size.x);
if (fabs(size.x) > fabs(size.y)) {
size.y = sgn(size.y) * fabs(size.x);
} else {
size.x = sgn(size.x) * abs(size.y);
size.x = sgn(size.x) * fabs(size.y);
}
}
// make shape
+2 -2
View File
@@ -12,7 +12,7 @@
#include <wx/mstream.h>
#include <wx/renderer.h>
#if wxUSE_UXTHEME
#if wxUSE_UXTHEME && defined(__WXMSW__)
#include <wx/msw/uxtheme.h>
#include <tmschema.h>
#include <shlobj.h>
@@ -109,7 +109,7 @@ void draw3DBorder(DC& dc, int x1, int y1, int x2, int y2) {
}
void draw_control_border(Window* win, DC& dc, const wxRect& rect) {
#if wxUSE_UXTHEME
#if wxUSE_UXTHEME && defined(__WXMSW__)
RECT r;
wxUxThemeEngine *themeEngine = wxUxThemeEngine::Get();
if (themeEngine && themeEngine->IsAppThemed()) {
+2 -2
View File
@@ -23,8 +23,8 @@ class ChoiceThumbnailRequest : public ThumbnailRequest {
virtual Image generate();
virtual void store(const Image&);
private:
int id;
StyleSheetP stylesheet;
int id;
};
ChoiceThumbnailRequest::ChoiceThumbnailRequest(ChoiceValueEditor* cve, int id)
@@ -84,8 +84,8 @@ void ChoiceThumbnailRequest::store(const Image& img) {
DropDownChoiceList::DropDownChoiceList(Window* parent, bool is_submenu, ChoiceValueEditor& cve, ChoiceField::ChoiceP group)
: DropDownList(parent, is_submenu, is_submenu ? nullptr : &cve)
, group(group)
, cve(cve)
, group(group)
{
icon_size.width = 16;
icon_size.height = 16;
+2 -2
View File
@@ -53,7 +53,7 @@ DropDownColorList::DropDownColorList(Window* parent, ColorValueEditor& cve)
{
icon_size.width = 25;
if (item_size.height < 16) {
text_offset = (16 - item_size.height) / 2;
text_offset = (16 - (int)item_size.height) / 2;
item_size.height = 16;
}
}
@@ -86,7 +86,7 @@ void DropDownColorList::drawIcon(DC& dc, int x, int y, size_t item, bool selecte
// draw a rectangle with the right color
dc.SetPen(wxSystemSettings::GetColour(selected ? wxSYS_COLOUR_HIGHLIGHTTEXT : wxSYS_COLOUR_WINDOWTEXT));
dc.SetBrush(col);
dc.DrawRectangle(x+1, y+1, icon_size.width-2, item_size.height-2);
dc.DrawRectangle(x+1, y+1, (int)icon_size.width-2, (int)item_size.height-2);
}
+1
View File
@@ -31,6 +31,7 @@
*/
class ValueEditor {
public:
virtual ~ValueEditor();
// --------------------------------------------------- : Events
/// This editor gains focus
+5 -5
View File
@@ -605,10 +605,10 @@ void TextValueEditor::determineSize(bool force_fit) {
if (!force_fit) style().height = 100;
int sbw = wxSystemSettings::GetMetric(wxSYS_VSCROLL_X);
scrollbar->SetSize(
style().left + style().width - sbw + 1,
style().top - 1,
sbw,
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
@@ -681,4 +681,4 @@ void TextValueEditor::prepareDrawScrollbar(RotatedDC& dc) {
updateScrollbar();
style().width.mutate() += scrollbar_width;
}
}
}
+4 -6
View File
@@ -84,8 +84,9 @@ class TextValueEditor : public TextValueViewer, public ValueEditor {
private:
size_t selection_start, selection_end; ///< Cursor position/selection (if any), cursor positions
size_t selection_start_i, selection_end_i; ///< Cursor position/selection, character indices
TextValueEditorScrollBar* scrollbar; ///< Scrollbar for multiline fields in native look
bool select_words; ///< Select whole words when dragging the mouse?
bool select_words; ///< Select whole words when dragging the mouse?
TextValueEditorScrollBar* scrollbar; ///< Scrollbar for multiline fields in native look
bool scroll_with_cursor; ///< When the cursor moves, should the scrollposition change?
// --------------------------------------------------- : Selection / movement
@@ -126,10 +127,7 @@ class TextValueEditor : public TextValueViewer, public ValueEditor {
// --------------------------------------------------- : Scrolling
friend class TextValueEditorScrollBar;
/// When the cursor moves, should the scrollposition change?
bool scroll_with_cursor;
/// Scroll to the given position, called by scrollbar
void scrollTo(int pos);
/// Update the scrollbar to show the current scroll position
+1 -1
View File
@@ -107,8 +107,8 @@ END_EVENT_TABLE ()
HoverButtonExt::HoverButtonExt(Window* parent, int id, const String& icon_name, const String& label, const String& sub_label)
: HoverButton(parent, id, _("BTN"))
, label(label), sub_label(sub_label)
, icon(load_resource_image(icon_name))
, label(label), sub_label(sub_label)
, font_large(14, wxSWISS, wxNORMAL, wxNORMAL, false, _("Arial"))
, font_small(8, wxSWISS, wxNORMAL, wxNORMAL, false, _("Arial"))
{}