From 204d0bdc0acaf8017372a3b93f54bb846b6be58e Mon Sep 17 00:00:00 2001 From: Dan Gudmundsson Date: Thu, 13 Dec 2012 08:54:29 +0100 Subject: wx: Fix int to enum In 2.9 several functions takes enum's instead of int as arguments, remove dirty -fpermissive fix and fix it correctly instead. --- lib/wx/api_gen/wx_gen.erl | 8 +++- lib/wx/api_gen/wx_gen_cpp.erl | 12 ++++- lib/wx/api_gen/wx_gen_erl.erl | 23 +++++---- lib/wx/api_gen/wxapi.conf | 55 ++++++++++++++------- lib/wx/c_src/gen/wxe_derived_dest.h | 4 +- lib/wx/c_src/gen/wxe_funcs.cpp | 93 ++++++++++++++++++++---------------- lib/wx/configure.in | 2 +- lib/wx/src/gen/wxCursor.erl | 2 + lib/wx/src/gen/wxDC.erl | 15 ++++-- lib/wx/src/gen/wxGraphicsContext.erl | 9 ++-- lib/wx/src/gen/wxGraphicsPath.erl | 8 ++-- lib/wx/src/gen/wxImage.erl | 9 ++-- lib/wx/src/gen/wxPen.erl | 6 ++- 13 files changed, 159 insertions(+), 87 deletions(-) (limited to 'lib/wx') diff --git a/lib/wx/api_gen/wx_gen.erl b/lib/wx/api_gen/wx_gen.erl index cc1453158d..53bf9a6ecb 100644 --- a/lib/wx/api_gen/wx_gen.erl +++ b/lib/wx/api_gen/wx_gen.erl @@ -103,7 +103,12 @@ mangle_info({class,CN,P,O,FL}) -> Event = get_value(event,O, false), Acc = get_value(acc, O, []), {Fs,Fopts} = foldr(fun(FWO={F,FO},{Fl,Fopt}) when is_list(FO) -> - {[F|Fl],[FWO|Fopt]}; + Opt = case F of + {Name, ArgLen} when is_integer(ArgLen) -> + {Name, FO}; + _ -> FWO + end, + {[F|Fl],[Opt|Fopt]}; (F,{Fl,Fopt}) -> {[F|Fl], Fopt} end, {[],[]}, FL), @@ -568,6 +573,7 @@ handle_param_opt(both, P) -> P#param{in=both}; handle_param_opt({def,Def},P) -> P#param{def=Def}; handle_param_opt({type,Type}, P=#param{type=T}) -> P#param{type=T#type{name=Type}}; handle_param_opt({single,Opt}, P=#param{type=T}) -> P#param{type=T#type{single=Opt}}; +handle_param_opt({base,Enum={enum,Type}}, P=#param{type=T}) -> P#param{type=T#type{base=Enum, name=Type}}; handle_param_opt({base,Opt}, P=#param{type=T}) -> P#param{type=T#type{base=Opt}}; handle_param_opt({c_only,Opt},P) -> P#param{where=c, alt=Opt}; handle_param_opt({ref, pointer}, P=#param{type=T}) -> diff --git a/lib/wx/api_gen/wx_gen_cpp.erl b/lib/wx/api_gen/wx_gen_cpp.erl index 04d3f9264c..7027ac305d 100644 --- a/lib/wx/api_gen/wx_gen_cpp.erl +++ b/lib/wx/api_gen/wx_gen_cpp.erl @@ -170,6 +170,14 @@ gen_funcs(Defs) -> w("#include \"wxe_macros.h\"~n"), w("#include \"wxe_derived_dest.h\"~n~n"), + w("#if !wxCHECK_VERSION(2,9,0)~n", []), + [w("#define ~p int~n", [Enum]) || + Enum <- [wxPenJoin, wxPenCap, wxImageResizeQuality, %%wxBitmapType, + wxPolygonFillMode, wxMappingMode, wxRasterOperationMode, + wxFloodFillStyle + ]], + w("#endif~n",[]), + w("void WxeApp::wxe_dispatch(wxeCommand& Ecmd)~n{~n"), w(" char * bp = Ecmd.buffer;~n"), w(" wxeMemEnv *memenv = getMemEnv(Ecmd.port);~n"), @@ -812,12 +820,12 @@ call_arg(#param{where=c, alt={size,Id}}) when is_integer(Id) -> call_arg(#param{name=N,def=Def,type=#type{name=Type,by_val=true,single=true,base=Base}}) when Base =:= int; Base =:= long; Base =:= float; Base =:= double; Base =:= bool -> case Def of - none -> "(" ++ to_string(Type) ++ ") *" ++ N; + none -> "(" ++ to_string(Type) ++ ") *" ++ N; %% Remove _ -> N end; call_arg(#param{name=N,type=#type{base={enum,Type}, by_val=true,single=true}}) -> - "(" ++ enum_type(Type) ++") " ++ N; + "(" ++ enum_type(Type) ++") " ++ N; %% Remove call_arg(#param{name=N,type=#type{base={class,_},by_val=true,single=true}}) -> "*" ++ N; call_arg(#param{name=N,type=#type{base={class,_},ref=reference,single=true}}) -> "*" ++ N; call_arg(#param{name=N,type=#type{base=eventType}}) -> diff --git a/lib/wx/api_gen/wx_gen_erl.erl b/lib/wx/api_gen/wx_gen_erl.erl index 35eba29450..a999a869e6 100644 --- a/lib/wx/api_gen/wx_gen_erl.erl +++ b/lib/wx/api_gen/wx_gen_erl.erl @@ -842,15 +842,20 @@ doc_enum(_,Ps) -> [doc_enum_type(Type,Name) || #param{name=Name, type=#type{base={enum,Type}}} <- Ps]. doc_enum_type(Type, Name) -> - {Enum0, #enum{vals=Vals}} = wx_gen:get_enum(Type), - Enum = case Enum0 of {_, E} -> E; E -> E end, - Consts = get(consts), - Format = fun({N,_What}) -> - #const{name=N} = gb_trees:get(N, Consts), - "?" ++ enum_name(N) - end, - Vs = args(Format, " | ", Vals), - {uppercase(Enum),Name, Vs}. + try + {Enum0, #enum{vals=Vals}} = wx_gen:get_enum(Type), + Enum = case Enum0 of {_, E} -> E; E -> E end, + Consts = get(consts), + Format = fun({N,_What}) -> + #const{name=N} = gb_trees:get(N, Consts), + "?" ++ enum_name(N) + end, + Vs = args(Format, " | ", Vals), + {uppercase(Enum),Name, Vs} + catch _:_ -> + io:format("Warning missing enum type ~p~n", [Type]), + {uppercase(Type),Name,"integer"} + end. doc_enum_desc([]) -> ok; doc_enum_desc([{_Enum,Name,Vs}|R]) -> diff --git a/lib/wx/api_gen/wxapi.conf b/lib/wx/api_gen/wxapi.conf index 385d7ca7f2..4610f80234 100644 --- a/lib/wx/api_gen/wxapi.conf +++ b/lib/wx/api_gen/wxapi.conf @@ -322,7 +322,8 @@ {class, wxDC, object, [{skip, [{'DrawEllipse',5},{'DrawRectangle',5}, {'DrawRoundedRectangle',6},{'SetClippingRegion',5}]}], - [{'Blit',7},'CalcBoundingBox','Clear', + [{{'Blit',7},[{"rop", [{base, {enum, "wxRasterOperationMode"}}]}]}, + 'CalcBoundingBox','Clear', {'ComputeScaleAndOrigin',[{deprecated, "!wxCHECK_VERSION(2,9,0)"}]}, {'CrossHair',1}, 'DestroyClippingRegion','DeviceToLogicalX','DeviceToLogicalXRel', @@ -330,11 +331,16 @@ {'DrawCheckMark',1},{'DrawCircle',2},'DrawEllipse',{'DrawEllipticArc',4}, {'DrawIcon',2},{'DrawLabel',4},{'DrawLine',2}, {'DrawLines', [{"n",{c_only,{length,"points"}}}]}, - {'DrawPolygon', [{"n",{c_only,{length,"points"}}}]}, %'DrawPolyPolygon', + {'DrawPolygon', [{"n",{c_only,{length,"points"}}}, + {"fillStyle", [{base, {enum, "wxPolygonFillMode"}}]} + ]}, + %%'DrawPolyPolygon', {'DrawPoint',1},'DrawRectangle', {'DrawRotatedText',3}, 'DrawRoundedRectangle',%'DrawSpline', {'DrawText',2}, - 'EndDoc','EndPage',{'FloodFill',3},'GetBackground','GetBackgroundMode', + 'EndDoc','EndPage', + {{'FloodFill',3},[{"style", [{base, {enum, "wxFloodFillStyle"}}]}]}, + 'GetBackground','GetBackgroundMode', 'GetBrush','GetCharHeight','GetCharWidth',{'GetClippingBox',[{"rect", skip_member}]}, 'GetFont','GetLayoutDirection','GetLogicalFunction','GetMapMode','GetMultiLineTextExtent', {'GetPartialTextExtents', [{"widths", out}]}, @@ -345,7 +351,10 @@ 'LogicalToDeviceX','LogicalToDeviceXRel','LogicalToDeviceY','LogicalToDeviceYRel', 'MaxX','MaxY','MinX','MinY','IsOk','ResetBoundingBox','SetAxisOrientation', 'SetBackground','SetBackgroundMode','SetBrush','SetClippingRegion','SetDeviceOrigin', - 'SetFont','SetLayoutDirection','SetLogicalFunction','SetMapMode', 'SetPalette', + 'SetFont','SetLayoutDirection', + {'SetLogicalFunction', [{"function", [{base, {enum, "wxRasterOperationMode"}}]}]}, + {'SetMapMode', [{"mode", [{base, {enum, "wxMappingMode"}}]}]}, + 'SetPalette', 'SetPen','SetTextBackground','SetTextForeground','SetUserScale','StartDoc','StartPage']}. {class,wxMirrorDC, wxDC, [], ['wxMirrorDC', '~wxMirrorDC']}. @@ -382,9 +391,11 @@ 'CreateFont','CreateMatrix', 'CreatePath','Clip','ResetClip', 'DrawBitmap','DrawEllipse','DrawIcon', - {'DrawLines', [{"n",{c_only,{length,"points"}}}, {"points", {single,array}}]}, - 'DrawPath', - 'DrawRectangle','DrawRoundedRectangle','DrawText','FillPath', + {'DrawLines', [{"n",{c_only,{length,"points"}}}, {"points", {single,array}}, + {"fillStyle", [{base, {enum, "wxPolygonFillMode"}}]}]}, + {'DrawPath',[{"fillStyle", [{base, {enum, "wxPolygonFillMode"}}]}]}, + 'DrawRectangle','DrawRoundedRectangle','DrawText', + {'FillPath',[{"fillStyle", [{base, {enum, "wxPolygonFillMode"}}]}]}, 'StrokePath', %% 'GetNativeContext', {'GetPartialTextExtents', [{"widths", out}]}, 'GetTextExtent','Rotate','Scale','Translate', @@ -399,8 +410,9 @@ {class, wxGraphicsPath, wxGraphicsObject, [{ifdef, wxUSE_GRAPHICS_CONTEXT}], ['MoveToPoint','AddArc','AddArcToPoint','AddCircle','AddCurveToPoint', 'AddEllipse','AddLineToPoint','AddPath','AddQuadCurveToPoint', - 'AddRectangle','AddRoundedRectangle','CloseSubpath','Contains', - 'GetBox','GetCurrentPoint','Transform' + 'AddRectangle','AddRoundedRectangle','CloseSubpath', + {'Contains', [{"fillStyle", [{base, {enum, "wxPolygonFillMode"}}]}]}, + 'GetBox','GetCurrentPoint','Transform' %'GetNativePath','UnGetNativePath' ]}. {class, wxGraphicsRenderer, object, [{ifdef, wxUSE_GRAPHICS_CONTEXT}], @@ -519,10 +531,13 @@ 'CopyFromBitmap','~wxIcon']}. {class, wxIconBundle, root, [], - ['wxIconBundle','~wxIconBundle','AddIcon','GetIcon']}. + ['wxIconBundle','~wxIconBundle','AddIcon', + 'GetIcon']}. +%% {'GetIcon', [{return, {by_val, true}}]}]}. {class, wxCursor, wxBitmap,[], - [{'wxCursor',[{"bits",[in,{base,binary},{single,true}]}, + [{'wxCursor',[{{func, 5}, [{deprecated, "!wxCHECK_VERSION(2,9,0)"}]}, + {"bits",[in,{base,binary},{single,true}]}, {"maskBits",nowhere},{"fg",nowhere},{"bg",nowhere}]}, '~wxCursor','Ok']}. @@ -567,16 +582,22 @@ {'GetAlpha',[{{0,return},{base,{binary,"(This->GetWidth()*This->GetHeight())"}}}]}, 'GetBlue', {'GetData', [{return,{base,{binary,"(This->GetWidth()*This->GetHeight()*3)"}}}]}, - 'GetGreen', 'GetImageCount', %'GetHandlers', + 'GetGreen', + {'GetImageCount', [{"type", [{base, {enum, "wxBitmapType"}}]}]}, + %%'GetHandlers', 'GetHeight','GetMaskBlue','GetMaskGreen', 'GetMaskRed','GetOrFindMaskColour','GetPalette', 'GetRed','GetSubImage', 'GetWidth',%%':HSVValue', 'HSVtoRGB', 'HasAlpha','HasMask','GetOption','GetOptionInt','HasOption', 'InitAlpha','InitStandardHandlers',%'InsertHandler', 'IsTransparent', 'LoadFile','Ok',%%RGBValue 'RGBtoHSV', - 'RemoveHandler','Mirror','Replace','Rescale','Resize', + 'RemoveHandler','Mirror','Replace', + {'Rescale', [{"quality", [{base, {enum, "wxImageResizeQuality"}}]}]}, + 'Resize', 'Rotate', 'RotateHue', - 'Rotate90','SaveFile','Scale','Size', + 'Rotate90','SaveFile', + {'Scale', [{"quality", [{base, {enum, "wxImageResizeQuality"}}]}]}, + 'Size', {'SetAlpha', [{{2,"alpha"},[in,{base,binary}, {def, none}]}, {{2,pre_hook}, [{c, "if(!static_data) {" @@ -600,9 +621,11 @@ {class, wxPen, object, [], ['wxPen','~wxPen','GetCap','GetColour', %%'GetDashes', %'GetStipple', - 'GetJoin', 'GetStyle','GetWidth','IsOk','SetCap','SetColour', + 'GetJoin', 'GetStyle','GetWidth','IsOk', + {'SetCap', [{"capStyle", [{base, {enum, "wxPenCap"}}]}]}, + 'SetColour', %%'SetDashes', %'SetStipple', - 'SetJoin', 'SetStyle','SetWidth']}. + {'SetJoin', [{"joinStyle", [{base, {enum, "wxPenJoin"}}]}]}, 'SetStyle','SetWidth']}. {enum, wxRegionContain, "wx"}. diff --git a/lib/wx/c_src/gen/wxe_derived_dest.h b/lib/wx/c_src/gen/wxe_derived_dest.h index 948e1ffe0c..5fdce27d4b 100644 --- a/lib/wx/c_src/gen/wxe_derived_dest.h +++ b/lib/wx/c_src/gen/wxe_derived_dest.h @@ -188,7 +188,9 @@ class EwxIcon : public wxIcon { class EwxCursor : public wxCursor { public: ~EwxCursor() {((WxeApp *)wxTheApp)->clearPtr(this);}; +#if !wxCHECK_VERSION(2,9,0) EwxCursor(const char * bits,int width,int height,int hotSpotX,int hotSpotY) : wxCursor(bits,width,height,hotSpotX,hotSpotY) {}; +#endif EwxCursor(int cursorId) : wxCursor(cursorId) {}; EwxCursor(const wxImage& image) : wxCursor(image) {}; EwxCursor() : wxCursor() {}; @@ -292,7 +294,7 @@ class EwxStdDialogButtonSizer : public wxStdDialogButtonSizer { class EwxFont : public wxFont { public: ~EwxFont() {((WxeApp *)wxTheApp)->clearPtr(this);}; - EwxFont(int size,int family,int style,int weight,bool underlined,const wxString& face,wxFontEncoding encoding) : wxFont(size,family,style,weight,underlined,face,encoding) {}; + EwxFont(int size,wxFontFamily family,wxFontStyle style,int weight,bool underlined,const wxString& face,wxFontEncoding encoding) : wxFont(size,family,style,weight,underlined,face,encoding) {}; EwxFont(const wxString& fontname) : wxFont(fontname) {}; EwxFont() : wxFont() {}; }; diff --git a/lib/wx/c_src/gen/wxe_funcs.cpp b/lib/wx/c_src/gen/wxe_funcs.cpp index 1aa25ff7b4..b5ac38f1af 100644 --- a/lib/wx/c_src/gen/wxe_funcs.cpp +++ b/lib/wx/c_src/gen/wxe_funcs.cpp @@ -27,6 +27,15 @@ #include "wxe_macros.h" #include "wxe_derived_dest.h" +#if !wxCHECK_VERSION(2,9,0) +#define wxPenJoin int +#define wxPenCap int +#define wxImageResizeQuality int +#define wxPolygonFillMode int +#define wxMappingMode int +#define wxRasterOperationMode int +#define wxFloodFillStyle int +#endif void WxeApp::wxe_dispatch(wxeCommand& Ecmd) { char * bp = Ecmd.buffer; @@ -4896,7 +4905,7 @@ case wxGridCellAttr_SetDefAttr: { // wxGridCellAttr::SetDefAttr break; } case wxDC_Blit: { // wxDC::Blit - int rop=wxCOPY; + wxRasterOperationMode rop=wxCOPY; bool useMask=false; wxPoint srcPtMask= wxDefaultPosition; wxDC *This = (wxDC *) getPtr(bp,memenv); bp += 4; @@ -4912,7 +4921,7 @@ case wxDC_Blit: { // wxDC::Blit wxPoint srcPt = wxPoint(*srcPtX,*srcPtY); while( * (int*) bp) { switch (* (int*) bp) { case 1: {bp += 4; - rop = (int)*(int *) bp; bp += 4; +rop = *(wxRasterOperationMode *) bp; bp += 4;; } break; case 2: {bp += 4; useMask = *(bool *) bp; bp += 4; @@ -4925,7 +4934,7 @@ case wxDC_Blit: { // wxDC::Blit } break; }}; if(!This) throw wxe_badarg(0); - bool Result = This->Blit(destPt,sz,source,srcPt,rop,useMask,srcPtMask); + bool Result = This->Blit(destPt,sz,source,srcPt,(wxRasterOperationMode) rop,useMask,srcPtMask); rt.addBool(Result); break; } @@ -5161,7 +5170,7 @@ case wxDC_DrawLines: { // wxDC::DrawLines case wxDC_DrawPolygon: { // wxDC::DrawPolygon wxCoord xoffset=0; wxCoord yoffset=0; - int fillStyle=wxODDEVEN_RULE; + wxPolygonFillMode fillStyle=wxODDEVEN_RULE; wxDC *This = (wxDC *) getPtr(bp,memenv); bp += 4; int * pointsLen = (int *) bp; bp += 4; wxPoint *points; @@ -5178,11 +5187,11 @@ case wxDC_DrawPolygon: { // wxDC::DrawPolygon yoffset = (wxCoord)*(int *) bp; bp += 4; } break; case 3: {bp += 4; - fillStyle = (int)*(int *) bp; bp += 4; +fillStyle = *(wxPolygonFillMode *) bp; bp += 4;; } break; }}; if(!This) throw wxe_badarg(0); - This->DrawPolygon(*pointsLen,points,xoffset,yoffset,fillStyle); + This->DrawPolygon(*pointsLen,points,xoffset,yoffset,(wxPolygonFillMode) fillStyle); driver_free(points); break; } @@ -5283,7 +5292,7 @@ case wxDC_EndPage: { // wxDC::EndPage break; } case wxDC_FloodFill: { // wxDC::FloodFill - int style=wxFLOOD_SURFACE; + wxFloodFillStyle style=wxFLOOD_SURFACE; wxDC *This = (wxDC *) getPtr(bp,memenv); bp += 4; int * ptX = (int *) bp; bp += 4; int * ptY = (int *) bp; bp += 4; @@ -5296,11 +5305,11 @@ case wxDC_FloodFill: { // wxDC::FloodFill bp += 4; /* Align */ while( * (int*) bp) { switch (* (int*) bp) { case 1: {bp += 4; - style = (int)*(int *) bp; bp += 4; +style = *(wxFloodFillStyle *) bp; bp += 4;; } break; }}; if(!This) throw wxe_badarg(0); - bool Result = This->FloodFill(pt,col,style); + bool Result = This->FloodFill(pt,col,(wxFloodFillStyle) style); rt.addBool(Result); break; } @@ -5756,16 +5765,16 @@ case wxDC_SetLayoutDirection: { // wxDC::SetLayoutDirection } case wxDC_SetLogicalFunction: { // wxDC::SetLogicalFunction wxDC *This = (wxDC *) getPtr(bp,memenv); bp += 4; - int * function = (int *) bp; bp += 4; + wxRasterOperationMode function = *(wxRasterOperationMode *) bp; bp += 4;; if(!This) throw wxe_badarg(0); - This->SetLogicalFunction((int) *function); + This->SetLogicalFunction((wxRasterOperationMode) function); break; } case wxDC_SetMapMode: { // wxDC::SetMapMode wxDC *This = (wxDC *) getPtr(bp,memenv); bp += 4; - int * mode = (int *) bp; bp += 4; + wxMappingMode mode = *(wxMappingMode *) bp; bp += 4;; if(!This) throw wxe_badarg(0); - This->SetMapMode((int) *mode); + This->SetMapMode((wxMappingMode) mode); break; } case wxDC_SetPalette: { // wxDC::SetPalette @@ -6274,7 +6283,7 @@ case wxGraphicsContext_DrawIcon: { // wxGraphicsContext::DrawIcon break; } case wxGraphicsContext_DrawLines: { // wxGraphicsContext::DrawLines - int fillStyle=wxODDEVEN_RULE; + wxPolygonFillMode fillStyle=wxODDEVEN_RULE; wxGraphicsContext *This = (wxGraphicsContext *) getPtr(bp,memenv); bp += 4; int * pointsLen = (int *) bp; bp += 4; wxPoint2DDouble *points; @@ -6285,25 +6294,25 @@ case wxGraphicsContext_DrawLines: { // wxGraphicsContext::DrawLines points[i] = wxPoint2DDouble(x,y);} while( * (int*) bp) { switch (* (int*) bp) { case 1: {bp += 4; - fillStyle = (int)*(int *) bp; bp += 4; +fillStyle = *(wxPolygonFillMode *) bp; bp += 4;; } break; }}; if(!This) throw wxe_badarg(0); - This->DrawLines(*pointsLen,points,fillStyle); + This->DrawLines(*pointsLen,points,(wxPolygonFillMode) fillStyle); driver_free(points); break; } case wxGraphicsContext_DrawPath: { // wxGraphicsContext::DrawPath - int fillStyle=wxODDEVEN_RULE; + wxPolygonFillMode fillStyle=wxODDEVEN_RULE; wxGraphicsContext *This = (wxGraphicsContext *) getPtr(bp,memenv); bp += 4; wxGraphicsPath *path = (wxGraphicsPath *) getPtr(bp,memenv); bp += 4; while( * (int*) bp) { switch (* (int*) bp) { case 1: {bp += 4; - fillStyle = (int)*(int *) bp; bp += 4; +fillStyle = *(wxPolygonFillMode *) bp; bp += 4;; } break; }}; if(!This) throw wxe_badarg(0); - This->DrawPath(*path,fillStyle); + This->DrawPath(*path,(wxPolygonFillMode) fillStyle); break; } case wxGraphicsContext_DrawRectangle: { // wxGraphicsContext::DrawRectangle @@ -6378,16 +6387,16 @@ case wxGraphicsContext_DrawText_5: { // wxGraphicsContext::DrawText break; } case wxGraphicsContext_FillPath: { // wxGraphicsContext::FillPath - int fillStyle=wxODDEVEN_RULE; + wxPolygonFillMode fillStyle=wxODDEVEN_RULE; wxGraphicsContext *This = (wxGraphicsContext *) getPtr(bp,memenv); bp += 4; wxGraphicsPath *path = (wxGraphicsPath *) getPtr(bp,memenv); bp += 4; while( * (int*) bp) { switch (* (int*) bp) { case 1: {bp += 4; - fillStyle = (int)*(int *) bp; bp += 4; +fillStyle = *(wxPolygonFillMode *) bp; bp += 4;; } break; }}; if(!This) throw wxe_badarg(0); - This->FillPath(*path,fillStyle); + This->FillPath(*path,(wxPolygonFillMode) fillStyle); break; } case wxGraphicsContext_StrokePath: { // wxGraphicsContext::StrokePath @@ -6858,23 +6867,23 @@ case wxGraphicsPath_CloseSubpath: { // wxGraphicsPath::CloseSubpath break; } case wxGraphicsPath_Contains_3: { // wxGraphicsPath::Contains - int fillStyle=wxODDEVEN_RULE; + wxPolygonFillMode fillStyle=wxODDEVEN_RULE; wxGraphicsPath *This = (wxGraphicsPath *) getPtr(bp,memenv); bp += 4; bp += 4; /* Align */ wxDouble * x = (wxDouble *) bp; bp += 8; wxDouble * y = (wxDouble *) bp; bp += 8; while( * (int*) bp) { switch (* (int*) bp) { case 1: {bp += 4; - fillStyle = (int)*(int *) bp; bp += 4; +fillStyle = *(wxPolygonFillMode *) bp; bp += 4;; } break; }}; if(!This) throw wxe_badarg(0); - bool Result = This->Contains((wxDouble) *x,(wxDouble) *y,fillStyle); + bool Result = This->Contains((wxDouble) *x,(wxDouble) *y,(wxPolygonFillMode) fillStyle); rt.addBool(Result); break; } case wxGraphicsPath_Contains_2: { // wxGraphicsPath::Contains - int fillStyle=wxODDEVEN_RULE; + wxPolygonFillMode fillStyle=wxODDEVEN_RULE; wxGraphicsPath *This = (wxGraphicsPath *) getPtr(bp,memenv); bp += 4; bp += 4; /* Align */ wxDouble * cX = (wxDouble *) bp; bp += 8; @@ -6882,11 +6891,11 @@ case wxGraphicsPath_Contains_2: { // wxGraphicsPath::Contains wxPoint2DDouble c = wxPoint2DDouble(*cX,*cY); while( * (int*) bp) { switch (* (int*) bp) { case 1: {bp += 4; - fillStyle = (int)*(int *) bp; bp += 4; +fillStyle = *(wxPolygonFillMode *) bp; bp += 4;; } break; }}; if(!This) throw wxe_badarg(0); - bool Result = This->Contains(c,fillStyle); + bool Result = This->Contains(c,(wxPolygonFillMode) fillStyle); rt.addBool(Result); break; } @@ -9312,6 +9321,7 @@ case wxCursor_new_1_1: { // wxCursor::wxCursor rt.addRef(getRef((void *)Result,memenv), "wxCursor"); break; } +#if !wxCHECK_VERSION(2,9,0) case wxCursor_new_4: { // wxCursor::wxCursor int hotSpotX=-1; int hotSpotY=-1; @@ -9331,6 +9341,7 @@ case wxCursor_new_4: { // wxCursor::wxCursor rt.addRef(getRef((void *)Result,memenv), "wxCursor"); break; } +#endif case wxCursor_Ok: { // wxCursor::Ok wxCursor *This = (wxCursor *) getPtr(bp,memenv); bp += 4; if(!This) throw wxe_badarg(0); @@ -9710,16 +9721,16 @@ case wxImage_GetGreen: { // wxImage::GetGreen break; } case wxImage_GetImageCount: { // wxImage::GetImageCount - long type=wxBITMAP_TYPE_ANY; + wxBitmapType type=wxBITMAP_TYPE_ANY; int * nameLen = (int *) bp; bp += 4; wxString name = wxString(bp, wxConvUTF8); bp += *nameLen+((8-((4+ *nameLen) & 7)) & 7); while( * (int*) bp) { switch (* (int*) bp) { case 1: {bp += 4; - type = (long)*(int *) bp; bp += 4; +type = *(wxBitmapType *) bp; bp += 4;; } break; }}; - int Result = wxImage::GetImageCount(name,type); + int Result = wxImage::GetImageCount(name,(wxBitmapType) type); rt.addInt(Result); break; } @@ -9951,18 +9962,18 @@ case wxImage_Replace: { // wxImage::Replace break; } case wxImage_Rescale: { // wxImage::Rescale - int quality=wxIMAGE_QUALITY_NORMAL; + wxImageResizeQuality quality=wxIMAGE_QUALITY_NORMAL; wxImage *This = (wxImage *) getPtr(bp,memenv); bp += 4; int * width = (int *) bp; bp += 4; int * height = (int *) bp; bp += 4; bp += 4; /* Align */ while( * (int*) bp) { switch (* (int*) bp) { case 1: {bp += 4; - quality = (int)*(int *) bp; bp += 4; +quality = *(wxImageResizeQuality *) bp; bp += 4;; } break; }}; if(!This) throw wxe_badarg(0); - wxImage * Result = &This->Rescale((int) *width,(int) *height,quality); + wxImage * Result = &This->Rescale((int) *width,(int) *height,(wxImageResizeQuality) quality); rt.addRef(getRef((void *)Result,memenv), "wxImage"); break; } @@ -10076,18 +10087,18 @@ case wxImage_SaveFile_2_1: { // wxImage::SaveFile break; } case wxImage_Scale: { // wxImage::Scale - int quality=wxIMAGE_QUALITY_NORMAL; + wxImageResizeQuality quality=wxIMAGE_QUALITY_NORMAL; wxImage *This = (wxImage *) getPtr(bp,memenv); bp += 4; int * width = (int *) bp; bp += 4; int * height = (int *) bp; bp += 4; bp += 4; /* Align */ while( * (int*) bp) { switch (* (int*) bp) { case 1: {bp += 4; - quality = (int)*(int *) bp; bp += 4; +quality = *(wxImageResizeQuality *) bp; bp += 4;; } break; }}; if(!This) throw wxe_badarg(0); - wxImage * Result = new wxImage(This->Scale((int) *width,(int) *height,quality)); newPtr((void *) Result,3, memenv);; + wxImage * Result = new wxImage(This->Scale((int) *width,(int) *height,(wxImageResizeQuality) quality)); newPtr((void *) Result,3, memenv);; rt.addRef(getRef((void *)Result,memenv), "wxImage"); break; } @@ -10432,9 +10443,9 @@ case wxPen_IsOk: { // wxPen::IsOk } case wxPen_SetCap: { // wxPen::SetCap wxPen *This = (wxPen *) getPtr(bp,memenv); bp += 4; - int * capStyle = (int *) bp; bp += 4; + wxPenCap capStyle = *(wxPenCap *) bp; bp += 4;; if(!This) throw wxe_badarg(0); - This->SetCap((int) *capStyle); + This->SetCap((wxPenCap) capStyle); break; } case wxPen_SetColour_1: { // wxPen::SetColour @@ -10459,9 +10470,9 @@ case wxPen_SetColour_3: { // wxPen::SetColour } case wxPen_SetJoin: { // wxPen::SetJoin wxPen *This = (wxPen *) getPtr(bp,memenv); bp += 4; - int * joinStyle = (int *) bp; bp += 4; + wxPenJoin joinStyle = *(wxPenJoin *) bp; bp += 4;; if(!This) throw wxe_badarg(0); - This->SetJoin((int) *joinStyle); + This->SetJoin((wxPenJoin) joinStyle); break; } case wxPen_SetStyle: { // wxPen::SetStyle diff --git a/lib/wx/configure.in b/lib/wx/configure.in index 0f84cada51..f58c8d92fa 100755 --- a/lib/wx/configure.in +++ b/lib/wx/configure.in @@ -169,7 +169,7 @@ case $host_os in CPPFLAGS="$CPPFLAGS -D_WIN32_WINNT=0x0500" ;; *) - CFLAGS="$CFLAGS -fpermissive -Wno-deprecated-declarations" + CFLAGS="$CFLAGS -Wno-deprecated-declarations" CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE $PTHR_CFLAGS" ;; esac diff --git a/lib/wx/src/gen/wxCursor.erl b/lib/wx/src/gen/wxCursor.erl index b9e3a8e3f7..423e444f2f 100644 --- a/lib/wx/src/gen/wxCursor.erl +++ b/lib/wx/src/gen/wxCursor.erl @@ -35,6 +35,8 @@ saveFile/4,setDepth/2,setHeight/2,setMask/2,setPalette/2,setWidth/2]). -export_type([wxCursor/0]). +-deprecated([new/3,new/4]). + %% @hidden parent_class(wxBitmap) -> true; parent_class(_Class) -> erlang:error({badtype, ?MODULE}). diff --git a/lib/wx/src/gen/wxDC.erl b/lib/wx/src/gen/wxDC.erl index aebd3e2498..42d5d7b1df 100644 --- a/lib/wx/src/gen/wxDC.erl +++ b/lib/wx/src/gen/wxDC.erl @@ -65,9 +65,10 @@ blit(This,DestPt={DestPtX,DestPtY},Sz={SzW,SzH},Source,SrcPt={SrcPtX,SrcPtY}) blit(This,DestPt,Sz,Source,SrcPt, []). %% @doc See external documentation. +%%
Rop = integer -spec blit(This, DestPt, Sz, Source, SrcPt, [Option]) -> boolean() when This::wxDC(), DestPt::{X::integer(), Y::integer()}, Sz::{W::integer(), H::integer()}, Source::wxDC(), SrcPt::{X::integer(), Y::integer()}, - Option :: {rop, integer()} + Option :: {rop, wx:wx_enum()} | {useMask, boolean()} | {srcPtMask, {X::integer(), Y::integer()}}. blit(#wx_ref{type=ThisT,ref=ThisRef},{DestPtX,DestPtY},{SzW,SzH},#wx_ref{type=SourceT,ref=SourceRef},{SrcPtX,SrcPtY}, Options) @@ -312,11 +313,12 @@ drawPolygon(This,Points) drawPolygon(This,Points, []). %% @doc See external documentation. +%%
FillStyle = integer -spec drawPolygon(This, Points, [Option]) -> ok when This::wxDC(), Points::[{X::integer(), Y::integer()}], Option :: {xoffset, integer()} | {yoffset, integer()} - | {fillStyle, integer()}. + | {fillStyle, wx:wx_enum()}. drawPolygon(#wx_ref{type=ThisT,ref=ThisRef},Points, Options) when is_list(Points),is_list(Options) -> ?CLASS(ThisT,wxDC), @@ -419,9 +421,10 @@ floodFill(This,Pt={PtX,PtY},Col) floodFill(This,Pt,Col, []). %% @doc See external documentation. +%%
Style = integer -spec floodFill(This, Pt, Col, [Option]) -> boolean() when This::wxDC(), Pt::{X::integer(), Y::integer()}, Col::wx:wx_colour(), - Option :: {style, integer()}. + Option :: {style, wx:wx_enum()}. floodFill(#wx_ref{type=ThisT,ref=ThisRef},{PtX,PtY},Col, Options) when is_integer(PtX),is_integer(PtY),tuple_size(Col) =:= 3; tuple_size(Col) =:= 4,is_list(Options) -> ?CLASS(ThisT,wxDC), @@ -857,8 +860,9 @@ setLayoutDirection(#wx_ref{type=ThisT,ref=ThisRef},Dir) <>). %% @doc See external documentation. +%%
Function = integer -spec setLogicalFunction(This, Function) -> ok when - This::wxDC(), Function::integer(). + This::wxDC(), Function::wx:wx_enum(). setLogicalFunction(#wx_ref{type=ThisT,ref=ThisRef},Function) when is_integer(Function) -> ?CLASS(ThisT,wxDC), @@ -866,8 +870,9 @@ setLogicalFunction(#wx_ref{type=ThisT,ref=ThisRef},Function) <>). %% @doc See external documentation. +%%
Mode = integer -spec setMapMode(This, Mode) -> ok when - This::wxDC(), Mode::integer(). + This::wxDC(), Mode::wx:wx_enum(). setMapMode(#wx_ref{type=ThisT,ref=ThisRef},Mode) when is_integer(Mode) -> ?CLASS(ThisT,wxDC), diff --git a/lib/wx/src/gen/wxGraphicsContext.erl b/lib/wx/src/gen/wxGraphicsContext.erl index 8cec84a596..575e48d7af 100644 --- a/lib/wx/src/gen/wxGraphicsContext.erl +++ b/lib/wx/src/gen/wxGraphicsContext.erl @@ -227,9 +227,10 @@ drawLines(This,Points) drawLines(This,Points, []). %% @doc See external documentation. +%%
FillStyle = integer -spec drawLines(This, Points, [Option]) -> ok when This::wxGraphicsContext(), Points::[{X::float(), Y::float()}], - Option :: {fillStyle, integer()}. + Option :: {fillStyle, wx:wx_enum()}. drawLines(#wx_ref{type=ThisT,ref=ThisRef},Points, Options) when is_list(Points),is_list(Options) -> ?CLASS(ThisT,wxGraphicsContext), @@ -249,9 +250,10 @@ drawPath(This,Path) drawPath(This,Path, []). %% @doc See external documentation. +%%
FillStyle = integer -spec drawPath(This, Path, [Option]) -> ok when This::wxGraphicsContext(), Path::wxGraphicsPath:wxGraphicsPath(), - Option :: {fillStyle, integer()}. + Option :: {fillStyle, wx:wx_enum()}. drawPath(#wx_ref{type=ThisT,ref=ThisRef},#wx_ref{type=PathT,ref=PathRef}, Options) when is_list(Options) -> ?CLASS(ThisT,wxGraphicsContext), @@ -333,9 +335,10 @@ fillPath(This,Path) fillPath(This,Path, []). %% @doc See external documentation. +%%
FillStyle = integer -spec fillPath(This, Path, [Option]) -> ok when This::wxGraphicsContext(), Path::wxGraphicsPath:wxGraphicsPath(), - Option :: {fillStyle, integer()}. + Option :: {fillStyle, wx:wx_enum()}. fillPath(#wx_ref{type=ThisT,ref=ThisRef},#wx_ref{type=PathT,ref=PathRef}, Options) when is_list(Options) -> ?CLASS(ThisT,wxGraphicsContext), diff --git a/lib/wx/src/gen/wxGraphicsPath.erl b/lib/wx/src/gen/wxGraphicsPath.erl index 56b853899a..246ea489ec 100644 --- a/lib/wx/src/gen/wxGraphicsPath.erl +++ b/lib/wx/src/gen/wxGraphicsPath.erl @@ -197,13 +197,14 @@ contains(This,C={CX,CY}) %%
Also:
%% contains(This, C, [Option]) -> boolean() when
%% This::wxGraphicsPath(), C::{X::float(), Y::float()},
-%% Option :: {fillStyle, integer()}.
+%% Option :: {fillStyle, wx:wx_enum()}.
%% +%%
FillStyle = integer -spec contains(This, X, Y) -> boolean() when This::wxGraphicsPath(), X::number(), Y::number(); (This, C, [Option]) -> boolean() when This::wxGraphicsPath(), C::{X::float(), Y::float()}, - Option :: {fillStyle, integer()}. + Option :: {fillStyle, wx:wx_enum()}. contains(This,X,Y) when is_record(This, wx_ref),is_number(X),is_number(Y) -> @@ -218,9 +219,10 @@ contains(#wx_ref{type=ThisT,ref=ThisRef},{CX,CY}, Options) <>). %% @doc See external documentation. +%%
FillStyle = integer -spec contains(This, X, Y, [Option]) -> boolean() when This::wxGraphicsPath(), X::number(), Y::number(), - Option :: {fillStyle, integer()}. + Option :: {fillStyle, wx:wx_enum()}. contains(#wx_ref{type=ThisT,ref=ThisRef},X,Y, Options) when is_number(X),is_number(Y),is_list(Options) -> ?CLASS(ThisT,wxGraphicsPath), diff --git a/lib/wx/src/gen/wxImage.erl b/lib/wx/src/gen/wxImage.erl index c21b5d4789..0edaee2979 100644 --- a/lib/wx/src/gen/wxImage.erl +++ b/lib/wx/src/gen/wxImage.erl @@ -424,9 +424,10 @@ getImageCount(Name) getImageCount(Name, []). %% @doc See external documentation. +%%
Type = ?wxBITMAP_TYPE_INVALID | ?wxBITMAP_TYPE_BMP | ?wxBITMAP_TYPE_BMP_RESOURCE | ?wxBITMAP_TYPE_RESOURCE | ?wxBITMAP_TYPE_ICO | ?wxBITMAP_TYPE_ICO_RESOURCE | ?wxBITMAP_TYPE_CUR | ?wxBITMAP_TYPE_CUR_RESOURCE | ?wxBITMAP_TYPE_XBM | ?wxBITMAP_TYPE_XBM_DATA | ?wxBITMAP_TYPE_XPM | ?wxBITMAP_TYPE_XPM_DATA | ?wxBITMAP_TYPE_TIF | ?wxBITMAP_TYPE_TIF_RESOURCE | ?wxBITMAP_TYPE_GIF | ?wxBITMAP_TYPE_GIF_RESOURCE | ?wxBITMAP_TYPE_PNG | ?wxBITMAP_TYPE_PNG_RESOURCE | ?wxBITMAP_TYPE_JPEG | ?wxBITMAP_TYPE_JPEG_RESOURCE | ?wxBITMAP_TYPE_PNM | ?wxBITMAP_TYPE_PNM_RESOURCE | ?wxBITMAP_TYPE_PCX | ?wxBITMAP_TYPE_PCX_RESOURCE | ?wxBITMAP_TYPE_PICT | ?wxBITMAP_TYPE_PICT_RESOURCE | ?wxBITMAP_TYPE_ICON | ?wxBITMAP_TYPE_ICON_RESOURCE | ?wxBITMAP_TYPE_ANI | ?wxBITMAP_TYPE_IFF | ?wxBITMAP_TYPE_TGA | ?wxBITMAP_TYPE_MACCURSOR | ?wxBITMAP_TYPE_MACCURSOR_RESOURCE | ?wxBITMAP_TYPE_ANY -spec getImageCount(Name, [Option]) -> integer() when Name::unicode:chardata(), - Option :: {type, integer()}. + Option :: {type, wx:wx_enum()}. getImageCount(Name, Options) when is_list(Name),is_list(Options) -> Name_UC = unicode:characters_to_binary([Name,0]), @@ -687,9 +688,10 @@ rescale(This,Width,Height) rescale(This,Width,Height, []). %% @doc See external documentation. +%%
Quality = integer -spec rescale(This, Width, Height, [Option]) -> wxImage() when This::wxImage(), Width::integer(), Height::integer(), - Option :: {quality, integer()}. + Option :: {quality, wx:wx_enum()}. rescale(#wx_ref{type=ThisT,ref=ThisRef},Width,Height, Options) when is_integer(Width),is_integer(Height),is_list(Options) -> ?CLASS(ThisT,wxImage), @@ -819,9 +821,10 @@ scale(This,Width,Height) scale(This,Width,Height, []). %% @doc See external documentation. +%%
Quality = integer -spec scale(This, Width, Height, [Option]) -> wxImage() when This::wxImage(), Width::integer(), Height::integer(), - Option :: {quality, integer()}. + Option :: {quality, wx:wx_enum()}. scale(#wx_ref{type=ThisT,ref=ThisRef},Width,Height, Options) when is_integer(Width),is_integer(Height),is_list(Options) -> ?CLASS(ThisT,wxImage), diff --git a/lib/wx/src/gen/wxPen.erl b/lib/wx/src/gen/wxPen.erl index 8b8aafddba..681a7edebc 100644 --- a/lib/wx/src/gen/wxPen.erl +++ b/lib/wx/src/gen/wxPen.erl @@ -113,8 +113,9 @@ isOk(#wx_ref{type=ThisT,ref=ThisRef}) -> <>). %% @doc See external documentation. +%%
CapStyle = integer -spec setCap(This, CapStyle) -> ok when - This::wxPen(), CapStyle::integer(). + This::wxPen(), CapStyle::wx:wx_enum(). setCap(#wx_ref{type=ThisT,ref=ThisRef},CapStyle) when is_integer(CapStyle) -> ?CLASS(ThisT,wxPen), @@ -140,8 +141,9 @@ setColour(#wx_ref{type=ThisT,ref=ThisRef},Red,Green,Blue) <>). %% @doc See external documentation. +%%
JoinStyle = integer -spec setJoin(This, JoinStyle) -> ok when - This::wxPen(), JoinStyle::integer(). + This::wxPen(), JoinStyle::wx:wx_enum(). setJoin(#wx_ref{type=ThisT,ref=ThisRef},JoinStyle) when is_integer(JoinStyle) -> ?CLASS(ThisT,wxPen), -- cgit v1.2.3