Various warning fixes and minor source cleaning.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32373 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -64,7 +64,6 @@ public:
|
||||
wxMultiCellItemHandle( int row, int column, int height = 1, int width = 1, wxSize size = wxDefaultSize, wxResizable style = wxNOT_RESIZABLE, wxSize weight = wxSize(1,1), int align = wxALIGN_NOT);
|
||||
wxMultiCellItemHandle( int row, int column, wxSize size, wxResizable style = wxNOT_RESIZABLE, wxSize weight = wxSize(1,1), int align = wxALIGN_NOT);
|
||||
wxMultiCellItemHandle( int row, int column, wxResizable style, wxSize weight = wxSize(1,1), int align = wxALIGN_NOT);
|
||||
wxMultiCellItemHandle( int row, int column, int align);
|
||||
int GetColumn();
|
||||
int GetRow();
|
||||
int GetWidth();
|
||||
|
@@ -1435,14 +1435,14 @@ void wxColourListValidator::OnEdit(wxProperty *property, wxPropertyListView *vie
|
||||
return;
|
||||
|
||||
wxChar *s = property->GetValue().StringValue();
|
||||
int r = 0;
|
||||
int g = 0;
|
||||
int b = 0;
|
||||
unsigned char r = 0;
|
||||
unsigned char g = 0;
|
||||
unsigned char b = 0;
|
||||
if (s)
|
||||
{
|
||||
r = wxHexToDec(s);
|
||||
g = wxHexToDec(s+2);
|
||||
b = wxHexToDec(s+4);
|
||||
r = (unsigned char)wxHexToDec(s);
|
||||
g = (unsigned char)wxHexToDec(s+2);
|
||||
b = (unsigned char)wxHexToDec(s+4);
|
||||
}
|
||||
|
||||
wxColour col(r,g,b);
|
||||
@@ -1453,7 +1453,9 @@ void wxColourListValidator::OnEdit(wxProperty *property, wxPropertyListView *vie
|
||||
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
wxColour colour(i*16, i*16, i*16);
|
||||
wxColour colour((unsigned char)(i*16),
|
||||
(unsigned char)(i*16),
|
||||
(unsigned char)(i*16));
|
||||
data.SetCustomColour(i, colour);
|
||||
}
|
||||
|
||||
|
@@ -151,13 +151,13 @@ IMPLEMENT_DYNAMIC_CLASS(wxResourceTable, wxHashTable)
|
||||
|
||||
wxItemResource::wxItemResource()
|
||||
{
|
||||
m_itemType = wxT("");
|
||||
m_title = wxT("");
|
||||
m_name = wxT("");
|
||||
m_itemType = wxEmptyString;
|
||||
m_title = wxEmptyString;
|
||||
m_name = wxEmptyString;
|
||||
m_windowStyle = 0;
|
||||
m_x = m_y = m_width = m_height = 0;
|
||||
m_value1 = m_value2 = m_value3 = m_value5 = 0;
|
||||
m_value4 = wxT("");
|
||||
m_value4 = wxEmptyString;
|
||||
m_windowId = 0;
|
||||
m_exStyle = 0;
|
||||
}
|
||||
@@ -196,9 +196,9 @@ wxItemResource *wxResourceTable::FindResource(const wxString& name) const
|
||||
void wxResourceTable::AddResource(wxItemResource *item)
|
||||
{
|
||||
wxString name = item->GetName();
|
||||
if (name == wxT(""))
|
||||
if (name.empty())
|
||||
name = item->GetTitle();
|
||||
if (name == wxT(""))
|
||||
if (name.empty())
|
||||
name = wxT("no name");
|
||||
|
||||
// Delete existing resource, if any.
|
||||
@@ -324,7 +324,7 @@ wxControl *wxResourceTable::CreateItem(wxWindow *parent, const wxItemResource* c
|
||||
{
|
||||
int id = childResource->GetId();
|
||||
if ( id == 0 )
|
||||
id = -1;
|
||||
id = wxID_ANY;
|
||||
|
||||
bool dlgUnits = ((parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) != 0);
|
||||
|
||||
@@ -346,7 +346,7 @@ wxControl *wxResourceTable::CreateItem(wxWindow *parent, const wxItemResource* c
|
||||
|
||||
if (itemType == wxString(wxT("wxButton")) || itemType == wxString(wxT("wxBitmapButton")))
|
||||
{
|
||||
if (childResource->GetValue4() != wxT(""))
|
||||
if (!childResource->GetValue4().empty())
|
||||
{
|
||||
// Bitmap button
|
||||
wxBitmap bitmap = childResource->GetBitmap();
|
||||
@@ -375,7 +375,7 @@ wxControl *wxResourceTable::CreateItem(wxWindow *parent, const wxItemResource* c
|
||||
else if (itemType == wxString(wxT("wxMessage")) || itemType == wxString(wxT("wxStaticText")) ||
|
||||
itemType == wxString(wxT("wxStaticBitmap")))
|
||||
{
|
||||
if (childResource->GetValue4() != wxT("") || itemType == wxString(wxT("wxStaticBitmap")) )
|
||||
if (!childResource->GetValue4().empty() || itemType == wxString(wxT("wxStaticBitmap")) )
|
||||
{
|
||||
// Bitmap message
|
||||
wxBitmap bitmap = childResource->GetBitmap();
|
||||
@@ -611,7 +611,7 @@ bool wxResourceInterpretResources(wxResourceTable& table, wxExprDatabase& db)
|
||||
if (item)
|
||||
{
|
||||
// Remove any existing resource of same name
|
||||
if (item->GetName() != wxT(""))
|
||||
if (!item->GetName().empty())
|
||||
table.DeleteResource(item->GetName());
|
||||
table.AddResource(item);
|
||||
}
|
||||
@@ -661,12 +661,12 @@ wxItemResource *wxResourceInterpretDialog(wxResourceTable& table, wxExpr *expr,
|
||||
dialogItem->SetType(wxT("wxPanel"));
|
||||
else
|
||||
dialogItem->SetType(wxT("wxDialog"));
|
||||
wxString style = wxT("");
|
||||
wxString title = wxT("");
|
||||
wxString name = wxT("");
|
||||
wxString backColourHex = wxT("");
|
||||
wxString labelColourHex = wxT("");
|
||||
wxString buttonColourHex = wxT("");
|
||||
wxString style = wxEmptyString;
|
||||
wxString title = wxEmptyString;
|
||||
wxString name = wxEmptyString;
|
||||
wxString backColourHex = wxEmptyString;
|
||||
wxString labelColourHex = wxEmptyString;
|
||||
wxString buttonColourHex = wxEmptyString;
|
||||
|
||||
long windowStyle = wxDEFAULT_DIALOG_STYLE;
|
||||
if (isPanel)
|
||||
@@ -706,7 +706,7 @@ wxItemResource *wxResourceInterpretDialog(wxResourceTable& table, wxExpr *expr,
|
||||
expr->GetAttributeValue(wxT("id"), id);
|
||||
dialogItem->SetId(id);
|
||||
|
||||
if (style != wxT(""))
|
||||
if (!style.empty())
|
||||
{
|
||||
windowStyle = wxParseWindowStyle(style);
|
||||
}
|
||||
@@ -731,7 +731,7 @@ wxItemResource *wxResourceInterpretDialog(wxResourceTable& table, wxExpr *expr,
|
||||
else if (style.Find(wxT("HORIZONTAL_LABEL")) != wxNOT_FOUND)
|
||||
dialogItem->SetResourceStyle(dialogItem->GetResourceStyle() | wxRESOURCE_HORIZONTAL_LABEL);
|
||||
|
||||
if (backColourHex != wxT(""))
|
||||
if (!backColourHex.empty())
|
||||
{
|
||||
int r = 0;
|
||||
int g = 0;
|
||||
@@ -741,7 +741,7 @@ wxItemResource *wxResourceInterpretDialog(wxResourceTable& table, wxExpr *expr,
|
||||
b = wxHexToDec(backColourHex.Mid(4, 2));
|
||||
dialogItem->SetBackgroundColour(wxColour((unsigned char)r,(unsigned char)g,(unsigned char)b));
|
||||
}
|
||||
if (labelColourHex != wxT(""))
|
||||
if (!labelColourHex.empty())
|
||||
{
|
||||
int r = 0;
|
||||
int g = 0;
|
||||
@@ -751,7 +751,7 @@ wxItemResource *wxResourceInterpretDialog(wxResourceTable& table, wxExpr *expr,
|
||||
b = wxHexToDec(labelColourHex.Mid(4, 2));
|
||||
dialogItem->SetLabelColour(wxColour((unsigned char)r,(unsigned char)g,(unsigned char)b));
|
||||
}
|
||||
if (buttonColourHex != wxT(""))
|
||||
if (!buttonColourHex.empty())
|
||||
{
|
||||
int r = 0;
|
||||
int g = 0;
|
||||
@@ -776,7 +776,7 @@ wxItemResource *wxResourceInterpretDialog(wxResourceTable& table, wxExpr *expr,
|
||||
if (controlExpr->Number() == 3)
|
||||
{
|
||||
wxString controlKeyword(controlExpr->Nth(1)->StringValue());
|
||||
if (controlKeyword != wxT("") && controlKeyword == wxT("control"))
|
||||
if (!controlKeyword.empty() && controlKeyword == wxT("control"))
|
||||
{
|
||||
// The value part: always a list.
|
||||
wxExpr *listExpr = controlExpr->Nth(2);
|
||||
@@ -906,7 +906,7 @@ wxItemResource *wxResourceInterpretControl(wxResourceTable& table, wxExpr *expr)
|
||||
wxString str(expr->Nth(count)->StringValue());
|
||||
count ++;
|
||||
|
||||
if (str != wxT(""))
|
||||
if (!str.empty())
|
||||
{
|
||||
controlItem->SetValue4(str);
|
||||
controlItem->SetType(wxT("wxBitmapButton"));
|
||||
@@ -1416,18 +1416,18 @@ wxItemResource *wxResourceInterpretBitmap(wxResourceTable& WXUNUSED(table), wxEx
|
||||
wxExpr *coloursExpr = listExpr->Nth(3);
|
||||
wxExpr *xresExpr = listExpr->Nth(4);
|
||||
wxExpr *yresExpr = listExpr->Nth(5);
|
||||
if (nameExpr && nameExpr->StringValue() != wxT(""))
|
||||
if (nameExpr && !nameExpr->StringValue().empty())
|
||||
{
|
||||
bitmapSpec->SetName(nameExpr->StringValue());
|
||||
}
|
||||
if (typeExpr && typeExpr->StringValue() != wxT(""))
|
||||
if (typeExpr && !typeExpr->StringValue().empty())
|
||||
{
|
||||
bitmapSpec->SetValue1(wxParseWindowStyle(typeExpr->StringValue()));
|
||||
}
|
||||
else
|
||||
bitmapSpec->SetValue1(0);
|
||||
|
||||
if (platformExpr && platformExpr->StringValue() != wxT(""))
|
||||
if (platformExpr && !platformExpr->StringValue().empty())
|
||||
{
|
||||
wxString plat(platformExpr->StringValue());
|
||||
if (plat == wxT("windows") || plat == wxT("WINDOWS"))
|
||||
@@ -1486,7 +1486,7 @@ wxFont wxResourceInterpretFontSpec(wxExpr *expr)
|
||||
int style = wxNORMAL;
|
||||
int weight = wxNORMAL;
|
||||
int underline = 0;
|
||||
wxString faceName(wxT(""));
|
||||
wxString faceName;
|
||||
|
||||
wxExpr *pointExpr = expr->Nth(0);
|
||||
wxExpr *familyExpr = expr->Nth(1);
|
||||
@@ -1604,7 +1604,7 @@ static bool wxEatWhiteSpace(FILE *fd)
|
||||
}
|
||||
static bool wxEatWhiteSpace(wxInputStream *is)
|
||||
{
|
||||
int ch = is->GetC() ;
|
||||
char ch = is->GetC() ;
|
||||
if ((ch != ' ') && (ch != '/') && (ch != ' ') && (ch != 10) && (ch != 13) && (ch != 9))
|
||||
{
|
||||
is->Ungetch(ch);
|
||||
@@ -2385,7 +2385,7 @@ wxBitmap wxResourceCreateBitmap(const wxString& resource, wxResourceTable *table
|
||||
wxItemResource *item = table->FindResource(resource);
|
||||
if (item)
|
||||
{
|
||||
if ((item->GetType() == wxT("")) || (item->GetType() != wxT("wxBitmap")))
|
||||
if ((item->GetType().empty()) || (item->GetType() != wxT("wxBitmap")))
|
||||
{
|
||||
wxLogWarning(_("%s not a bitmap resource specification."), (const wxChar*) resource);
|
||||
return wxNullBitmap;
|
||||
@@ -2539,7 +2539,7 @@ wxIcon wxResourceCreateIcon(const wxString& resource, wxResourceTable *table)
|
||||
wxItemResource *item = table->FindResource(resource);
|
||||
if (item)
|
||||
{
|
||||
if ((item->GetType() == wxT("")) || wxStrcmp(item->GetType(), wxT("wxIcon")) != 0)
|
||||
if ((item->GetType().empty()) || wxStrcmp(item->GetType(), wxT("wxIcon")) != 0)
|
||||
{
|
||||
wxLogWarning(_("%s not an icon resource specification."), (const wxChar*) resource);
|
||||
return wxNullIcon;
|
||||
@@ -2695,7 +2695,7 @@ wxMenu *wxResourceCreateMenu(wxItemResource *item)
|
||||
while (node)
|
||||
{
|
||||
wxItemResource *child = (wxItemResource *)node->GetData();
|
||||
if ((child->GetType() != wxT("")) && (child->GetType() == wxT("wxMenuSeparator")))
|
||||
if ((!child->GetType().empty()) && (child->GetType() == wxT("wxMenuSeparator")))
|
||||
menu->AppendSeparator();
|
||||
else if (child->GetChildren().GetCount() > 0)
|
||||
{
|
||||
@@ -2718,7 +2718,7 @@ wxMenuBar *wxResourceCreateMenuBar(const wxString& resource, wxResourceTable *ta
|
||||
table = wxDefaultResourceTable;
|
||||
|
||||
wxItemResource *menuResource = table->FindResource(resource);
|
||||
if (menuResource && (menuResource->GetType() != wxT("")) && (menuResource->GetType() == wxT("wxMenu")))
|
||||
if (menuResource && (!menuResource->GetType().empty()) && (menuResource->GetType() == wxT("wxMenu")))
|
||||
{
|
||||
if (!menuBar)
|
||||
menuBar = new wxMenuBar;
|
||||
@@ -2742,7 +2742,7 @@ wxMenu *wxResourceCreateMenu(const wxString& resource, wxResourceTable *table)
|
||||
table = wxDefaultResourceTable;
|
||||
|
||||
wxItemResource *menuResource = table->FindResource(resource);
|
||||
if (menuResource && (menuResource->GetType() != wxT("")) && (menuResource->GetType() == wxT("wxMenu")))
|
||||
if (menuResource && (!menuResource->GetType().empty()) && (menuResource->GetType() == wxT("wxMenu")))
|
||||
// if (menuResource && (menuResource->GetType() == wxTYPE_MENU))
|
||||
return wxResourceCreateMenu(menuResource);
|
||||
return (wxMenu *) NULL;
|
||||
@@ -3184,7 +3184,7 @@ bool wxLoadFromResource(wxWindow* thisWindow, wxWindow *parent, const wxString&
|
||||
|
||||
wxItemResource *resource = table->FindResource((const wxChar *)resourceName);
|
||||
// if (!resource || (resource->GetType() != wxTYPE_DIALOG_BOX))
|
||||
if (!resource || (resource->GetType() == wxT("")) ||
|
||||
if (!resource || (resource->GetType().empty()) ||
|
||||
! ((resource->GetType() == wxT("wxDialog")) || (resource->GetType() == wxT("wxPanel"))))
|
||||
return false;
|
||||
|
||||
|
@@ -236,7 +236,7 @@ void cbBarDragPlugin::CalcOnScreenDims( wxRect& rect )
|
||||
}
|
||||
}
|
||||
|
||||
// helpers
|
||||
// helpers
|
||||
|
||||
static inline void check_upper_overrun( int& pos, int width, int mousePos )
|
||||
{
|
||||
@@ -274,7 +274,7 @@ void cbBarDragPlugin::StickToPane( cbDockPane* pPane, wxPoint& mousePos )
|
||||
|
||||
// true, if hint enters the pane through it's lower edge
|
||||
|
||||
bool fromLowerEdge = ( pPane->IsHorizontal() )
|
||||
bool fromLowerEdge = ( pPane->IsHorizontal() )
|
||||
? mousePos.y > bounds.y
|
||||
: mousePos.x > bounds.x;
|
||||
|
||||
@@ -348,7 +348,7 @@ void cbBarDragPlugin::UnstickFromPane( cbDockPane* pPane, wxPoint& mousePos )
|
||||
|
||||
// true, if hint leaves the pane through it's lower edge
|
||||
|
||||
bool fromLowerEdge = ( pPane->IsHorizontal() )
|
||||
bool fromLowerEdge = ( pPane->IsHorizontal() )
|
||||
? mousePos.y > bounds.y
|
||||
: mousePos.x > bounds.x;
|
||||
|
||||
@@ -444,7 +444,7 @@ void cbBarDragPlugin::ShowHint( bool prevWasInClient )
|
||||
if ( mpSrcPane->mProps.mExactDockPredictionOn && mpCurPane )
|
||||
{
|
||||
#ifdef __WXDEBUG__
|
||||
bool success =
|
||||
bool success =
|
||||
#endif
|
||||
mpLayout->RedockBar( mpDraggedBar, mHintRect, mpCurPane, false );
|
||||
|
||||
@@ -476,7 +476,7 @@ void cbBarDragPlugin::ShowHint( bool prevWasInClient )
|
||||
|
||||
mPrevHintRect = actualRect;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
// otherwise, if real-time updates option is ON
|
||||
|
||||
@@ -501,7 +501,7 @@ void cbBarDragPlugin::ShowHint( bool prevWasInClient )
|
||||
mpDraggedBar->mUMgrData.SetDirty( true );
|
||||
|
||||
#ifdef __WXDEBUG__
|
||||
bool success =
|
||||
bool success =
|
||||
#endif
|
||||
mpLayout->RedockBar( mpDraggedBar, mHintRect, mpCurPane, false );
|
||||
|
||||
@@ -551,10 +551,10 @@ void cbBarDragPlugin::OnMouseMove( cbMotionEvent& event )
|
||||
cbDockPane* pPane = HitTestPanes( mHintRect );
|
||||
|
||||
// enable sticking again, if we've left the pane completely
|
||||
if ( !pPane )
|
||||
if ( !pPane )
|
||||
mCanStick = true;
|
||||
|
||||
if ( mCanStick && pPane &&
|
||||
if ( mCanStick && pPane &&
|
||||
GetDistanceToPane( pPane, mousePos ) < GetBarHeightInPane( pPane ) )
|
||||
StickToPane( pPane, mousePos );
|
||||
else
|
||||
@@ -583,7 +583,7 @@ void cbBarDragPlugin::OnMouseMove( cbMotionEvent& event )
|
||||
{
|
||||
cbDockPane* pPane = HitTestPanes( mHintRect );
|
||||
|
||||
if ( pPane &&
|
||||
if ( pPane &&
|
||||
pPane != mpCurPane &&
|
||||
GetDistanceToPane( pPane, mousePos ) < GetBarHeightInPane( pPane ) )
|
||||
StickToPane( pPane, mousePos );
|
||||
@@ -713,7 +713,7 @@ void cbBarDragPlugin::OnLButtonUp( cbLeftUpEvent& event )
|
||||
|
||||
if ( mBarWasFloating && mpDraggedBar->mState != wxCBAR_FLOATING )
|
||||
{
|
||||
// save bar's floating position before it was docked
|
||||
// save bar's floating position before it was docked
|
||||
|
||||
mpDraggedBar->mDimInfo.mBounds[ wxCBAR_FLOATING ] = mFloatedBarBounds;
|
||||
}
|
||||
@@ -753,7 +753,7 @@ void cbBarDragPlugin::OnLDblClick( cbLeftDClickEvent& event )
|
||||
void cbBarDragPlugin::OnStartBarDragging( cbStartBarDraggingEvent& event )
|
||||
{
|
||||
mpDraggedBar = event.mpBar;
|
||||
mpSrcPane = event.mpPane;
|
||||
mpSrcPane = event.mpPane;
|
||||
|
||||
mpLayout->CaptureEventsForPane( event.mpPane );
|
||||
mpLayout->CaptureEventsForPlugin( this );
|
||||
@@ -792,24 +792,22 @@ void cbBarDragPlugin::OnStartBarDragging( cbStartBarDraggingEvent& event )
|
||||
|
||||
mPrevHintRect.x = POS_UNDEFINED;
|
||||
|
||||
mCanStick = false; // we're not stuck into any pane now -
|
||||
mCanStick = false; // we're not stuck into any pane now -
|
||||
// there's nowhere to "stick-twice"
|
||||
|
||||
mBarWidthInSrcPane = mpDraggedBar->mDimInfo.mSizes[ mpDraggedBar->mState ].x;
|
||||
|
||||
if ( mpSrcPane->mProps.mRealTimeUpdatesOn == false &&
|
||||
if ( mpSrcPane->mProps.mRealTimeUpdatesOn == false &&
|
||||
mpSrcPane->mProps.mExactDockPredictionOn )
|
||||
mpLayout->GetUpdatesManager().OnStartChanges(); // capture initial state of layout
|
||||
|
||||
// simulate the first mouse movement
|
||||
|
||||
int x = event.mPos.x, y = event.mPos.y;
|
||||
|
||||
mpSrcPane->FrameToPane( &x, &y );
|
||||
|
||||
cbMotionEvent motionEvt( wxPoint(x,y), event.mpPane );
|
||||
|
||||
|
||||
wxPoint pt(x,y);
|
||||
cbMotionEvent motionEvt( pt, event.mpPane );
|
||||
this->OnMouseMove( motionEvt );
|
||||
|
||||
return; // event is "eaten" by this plugin
|
||||
@@ -859,7 +857,7 @@ void cbBarDragPlugin::DoDrawHintRect( wxRect& rect, bool isInClientRect)
|
||||
|
||||
if ( isInClientRect )
|
||||
{
|
||||
// BUG BUG BUG (wx):: somehow stippled brush works only
|
||||
// BUG BUG BUG (wx):: somehow stippled brush works only
|
||||
// when the bitmap created on stack, not
|
||||
// as a member of the class
|
||||
|
||||
@@ -891,16 +889,16 @@ void cbBarDragPlugin::DoDrawHintRect( wxRect& rect, bool isInClientRect)
|
||||
{
|
||||
mpScrDc->SetPen( mpLayout->mBlackPen );
|
||||
|
||||
mpScrDc->DrawLine( scrRect.x, scrRect.y,
|
||||
mpScrDc->DrawLine( scrRect.x, scrRect.y,
|
||||
scrRect.x + scrRect.width, scrRect.y );
|
||||
|
||||
mpScrDc->DrawLine( scrRect.x, scrRect.y + 1,
|
||||
mpScrDc->DrawLine( scrRect.x, scrRect.y + 1,
|
||||
scrRect.x, scrRect.y + scrRect.height );
|
||||
|
||||
mpScrDc->DrawLine( scrRect.x+1, scrRect.y + scrRect.height,
|
||||
mpScrDc->DrawLine( scrRect.x+1, scrRect.y + scrRect.height,
|
||||
scrRect.x + scrRect.width, scrRect.y + scrRect.height );
|
||||
|
||||
mpScrDc->DrawLine( scrRect.x + scrRect.width , scrRect.y,
|
||||
mpScrDc->DrawLine( scrRect.x + scrRect.width , scrRect.y,
|
||||
scrRect.x + scrRect.width, scrRect.y + scrRect.height + 1);
|
||||
}
|
||||
|
||||
|
@@ -51,14 +51,14 @@ static int* create_array( int width, int height, int fill = 0 )
|
||||
|
||||
#define IS_IN_ARRAY(x,y) ( (x) < width && (y) < height && (x) >= 0 && (y) >= 0 )
|
||||
|
||||
#define GET_RED(col) col & 0xFF
|
||||
#define GET_GREEN(col) (col >> 8) & 0xFF
|
||||
#define GET_BLUE(col) (col >> 16) & 0xFF
|
||||
#define GET_RED(col) col & 0xFF
|
||||
#define GET_GREEN(col) (col >> 8) & 0xFF
|
||||
#define GET_BLUE(col) (col >> 16) & 0xFF
|
||||
|
||||
#define MAKE_INT_COLOR(red,green,blue) ( (red) | \
|
||||
( ( (green) << 8 ) & 0xFF00 ) | \
|
||||
( ( (blue) << 16) & 0xFF0000) \
|
||||
)
|
||||
)
|
||||
|
||||
#define IS_GREATER(col1,col2) ( ( (GET_RED(col1) ) > (GET_RED(col2) ) + MIN_COLOR_DIFF ) && \
|
||||
( (GET_GREEN(col1)) > (GET_GREEN(col2)) + MIN_COLOR_DIFF ) && \
|
||||
@@ -101,7 +101,7 @@ static void gray_out_pixmap( int* src, int* dest, int width, int height )
|
||||
else
|
||||
{
|
||||
if ( GET_ELEM(dest,x-1,y-1) == MASK_LIGHT )
|
||||
|
||||
|
||||
GET_ELEM(dest,x,y) = MASK_BG;
|
||||
|
||||
if ( GET_ELEM(dest,x-1,y-1 ) == MASK_DARK )
|
||||
@@ -114,14 +114,14 @@ static void gray_out_pixmap( int* src, int* dest, int width, int height )
|
||||
|
||||
// go zig-zag
|
||||
|
||||
if ( IS_IN_ARRAY(x+1,y-1) )
|
||||
if ( IS_IN_ARRAY(x+1,y-1) )
|
||||
{
|
||||
++x;
|
||||
--y;
|
||||
}
|
||||
else
|
||||
{
|
||||
while ( IS_IN_ARRAY(x-1,y+1) )
|
||||
while ( IS_IN_ARRAY(x-1,y+1) )
|
||||
{
|
||||
--x;
|
||||
++y;
|
||||
@@ -183,13 +183,13 @@ void gray_out_image_on_dc( wxDC& dc, int width, int height )
|
||||
|
||||
switch (mask)
|
||||
{
|
||||
case MASK_BG : { dc.SetPen( bgPen );
|
||||
case MASK_BG : { dc.SetPen( bgPen );
|
||||
dc.DrawPoint( x,y ); break;
|
||||
}
|
||||
case MASK_DARK : { dc.SetPen( darkPen );
|
||||
case MASK_DARK : { dc.SetPen( darkPen );
|
||||
dc.DrawPoint( x,y ); break;
|
||||
}
|
||||
case MASK_LIGHT : { dc.SetPen( lightPen );
|
||||
case MASK_LIGHT : { dc.SetPen( lightPen );
|
||||
dc.DrawPoint( x,y ); break;
|
||||
}
|
||||
default : break;
|
||||
@@ -274,7 +274,7 @@ wxNewBitmapButton::wxNewBitmapButton( const wxString& bitmapFileName,
|
||||
const wxString& labelText,
|
||||
int alignText,
|
||||
bool isFlat,
|
||||
int WXUNUSED(firedEventType),
|
||||
int WXUNUSED(firedEventType),
|
||||
int WXUNUSED(marginX),
|
||||
int WXUNUSED(marginY),
|
||||
int WXUNUSED(textToLabelGap),
|
||||
@@ -313,7 +313,7 @@ wxNewBitmapButton::wxNewBitmapButton( const wxString& bitmapFileName,
|
||||
{
|
||||
}
|
||||
|
||||
wxNewBitmapButton::~wxNewBitmapButton(void)
|
||||
wxNewBitmapButton::~wxNewBitmapButton(void)
|
||||
{
|
||||
DestroyLabels();
|
||||
}
|
||||
@@ -379,11 +379,16 @@ wxBitmap* wxNewBitmapButton::GetStateLabel()
|
||||
return mpDisabledImg;
|
||||
}
|
||||
|
||||
#ifndef __WXMSW__
|
||||
|
||||
static const unsigned char _gDisableImage[] = { 0x55,0xAA,0x55,0xAA,
|
||||
0x55,0xAA,0x55,0xAA,
|
||||
0x55,0xAA,0x55,0xAA,
|
||||
0x55,0xAA,0x55,0xAA
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
void wxNewBitmapButton::RenderLabelImage( wxBitmap*& destBmp, wxBitmap* srcBmp,
|
||||
bool isEnabled, bool isPressed )
|
||||
{
|
||||
@@ -454,11 +459,9 @@ void wxNewBitmapButton::RenderLabelImage( wxBitmap*& destBmp, wxBitmap* srcBmp,
|
||||
destDc.SelectObject( *destBmp );
|
||||
|
||||
wxBrush grayBrush( wxSystemSettings::GetColour( wxSYS_COLOUR_3DFACE), wxSOLID );
|
||||
wxPen nullPen( wxColour(0,0,0), 1, wxTRANSPARENT );
|
||||
|
||||
destDc.SetBrush( grayBrush );
|
||||
destDc.SetPen( nullPen );
|
||||
|
||||
destDc.SetPen( *wxTRANSPARENT_PEN );
|
||||
destDc.DrawRectangle( 0,0, destDim.x+1, destDim.y+1 );
|
||||
|
||||
if ( isPressed )
|
||||
@@ -688,7 +691,7 @@ void wxNewBitmapButton::OnLButtonUp( wxMouseEvent& event )
|
||||
mIsPressed = false;
|
||||
Refresh();
|
||||
|
||||
if ( IsInWindow( event.m_x, event.m_y ) )
|
||||
if ( IsInWindow( event.m_x, event.m_y ) )
|
||||
{
|
||||
// fire event, if mouse was released
|
||||
// within the bounds of button
|
||||
@@ -742,16 +745,16 @@ void wxNewBitmapButton::OnSize( wxSizeEvent& WXUNUSED(event) )
|
||||
}
|
||||
|
||||
void wxNewBitmapButton::Reshape( )
|
||||
{
|
||||
{
|
||||
bool wasCreated = mIsCreated;
|
||||
mIsCreated = true;
|
||||
|
||||
if ( !wasCreated )
|
||||
{
|
||||
// in the case of loading button from stream, check if we
|
||||
// have non-empty image-file name, load if possible
|
||||
// have non-empty image-file name, load if possible
|
||||
|
||||
if ( mImageFileName != wxT("") )
|
||||
if (!mImageFileName.empty())
|
||||
{
|
||||
mDepressedBmp.LoadFile( mImageFileName, mImageFileType );
|
||||
|
||||
@@ -786,10 +789,10 @@ void wxNewBitmapButton::DrawLabel( wxDC& dc )
|
||||
wxMemoryDC mdc;
|
||||
mdc.SelectObject( *pCurBmp );
|
||||
|
||||
dc.Blit( mMarginX, mMarginY,
|
||||
dc.Blit( mMarginX, mMarginY,
|
||||
pCurBmp->GetWidth(),
|
||||
pCurBmp->GetHeight(),
|
||||
&mdc, 0,0, wxCOPY
|
||||
&mdc, 0,0, wxCOPY
|
||||
);
|
||||
|
||||
mdc.SelectObject( wxNullBitmap );
|
||||
|
@@ -8,7 +8,7 @@
|
||||
// Copyright: (c) Aleksandras Gluchovas
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "rowlayoutpl.h"
|
||||
#endif
|
||||
@@ -61,10 +61,10 @@ void cbRowLayoutPlugin::CheckIfAtTheBoundary( cbBarInfo* pTheBar, cbRowInfo& row
|
||||
// In this case we need to check if the pBarNode appears to be inserted
|
||||
// chain of fixed-bars on the very right or left side of the row,
|
||||
// then all the white-space, such chain should be eliminated,
|
||||
// and the resulting chain justified to the right or the left
|
||||
// and the resulting chain justified to the right or the left
|
||||
// side of the row
|
||||
|
||||
if ( !pTheBar->IsFixed() || rowInfo.mHasOnlyFixedBars )
|
||||
if ( !pTheBar->IsFixed() || rowInfo.mHasOnlyFixedBars )
|
||||
|
||||
return;
|
||||
|
||||
@@ -76,7 +76,7 @@ void cbRowLayoutPlugin::CheckIfAtTheBoundary( cbBarInfo* pTheBar, cbRowInfo& row
|
||||
|
||||
do
|
||||
{
|
||||
if ( !pBar->IsFixed() )
|
||||
if ( !pBar->IsFixed() )
|
||||
break;
|
||||
|
||||
wxRect& bounds = pBar->mBounds;
|
||||
@@ -91,15 +91,15 @@ void cbRowLayoutPlugin::CheckIfAtTheBoundary( cbBarInfo* pTheBar, cbRowInfo& row
|
||||
}
|
||||
while( 1 );
|
||||
|
||||
// slide fixed bars to the left on the left side relative to the pBarNode
|
||||
// slide fixed bars to the left on the left side relative to the pBarNode
|
||||
|
||||
pBar = rowInfo.mBars[0];
|
||||
|
||||
prevX = 0;
|
||||
|
||||
|
||||
do
|
||||
{
|
||||
if ( pBar->IsFixed() )
|
||||
if ( pBar->IsFixed() )
|
||||
|
||||
break;
|
||||
|
||||
@@ -152,11 +152,11 @@ void cbRowLayoutPlugin::ExpandNotFixedBars( cbRowInfo* pRow )
|
||||
{
|
||||
bar.mLenRatio = bar.mLenRatio/(pcntSum);
|
||||
|
||||
bar.mBounds.width =
|
||||
|
||||
bar.mBounds.width =
|
||||
|
||||
wxMax( mpPane->mProps.mMinCBarDim.x, int( freeSpc*bar.mLenRatio ) );
|
||||
}
|
||||
|
||||
|
||||
bar.mBounds.x = curX;
|
||||
curX = bar.mBounds.x + bar.mBounds.width;
|
||||
}
|
||||
@@ -260,7 +260,7 @@ void cbRowLayoutPlugin::FitBarsToRange( int from, int till,
|
||||
{
|
||||
pBar->mBounds.width =
|
||||
wxMax( mpPane->mProps.mMinCBarDim.x,
|
||||
(int)( double(freeSpc) * (pBar->mLenRatio/pcntSum) )
|
||||
(int)( ((double)freeSpc) * (pBar->mLenRatio/pcntSum) )
|
||||
);
|
||||
}
|
||||
pBar = pBar->mpNext;
|
||||
@@ -286,7 +286,7 @@ void cbRowLayoutPlugin::FitBarsToRange( int from, int till,
|
||||
bounds.x = prevX;
|
||||
|
||||
prevX = bounds.x + bounds.width;
|
||||
|
||||
|
||||
pBar = pBar->mpNext;
|
||||
}
|
||||
|
||||
@@ -389,10 +389,10 @@ void cbRowLayoutPlugin::RecalcLengthRatios( cbRowInfo* pRow )
|
||||
// attach remainder (the result of lost precision) to the
|
||||
// last not-fixed bar
|
||||
|
||||
#if !defined(__EXPERIMENTAL)
|
||||
#if !defined(__EXPERIMENTAL)
|
||||
|
||||
if ( pLastNotFixed )
|
||||
|
||||
|
||||
pLastNotFixed->mLenRatio += pcntLeft;
|
||||
#endif
|
||||
|
||||
@@ -413,13 +413,13 @@ void cbRowLayoutPlugin::ApplyLengthRatios( cbRowInfo* pRow )
|
||||
|
||||
/*
|
||||
pBar = node_to_first_bar_node( pRow );
|
||||
|
||||
|
||||
while( pBar )
|
||||
{
|
||||
cbBarInfo& bar = node_to_bar( pBar );
|
||||
|
||||
if ( !bar.IsFixed() )
|
||||
|
||||
|
||||
bar.mLenRatio = pcntSum / bar.mLenRatio;
|
||||
|
||||
pBar = pBar->Next();
|
||||
@@ -437,10 +437,10 @@ void cbRowLayoutPlugin::ApplyLengthRatios( cbRowInfo* pRow )
|
||||
// is returned right back to the row - so that it would retain
|
||||
// it's original dimensions in this row (this is kind of AI...)
|
||||
//
|
||||
// The problem is - when it's remvoed, the sum of
|
||||
// The problem is - when it's remvoed, the sum of
|
||||
// mLenRatio's is not in "balance", i.e. is < 1.0,
|
||||
// it's possible to restore balance, but instead of that
|
||||
// we artifically ajdust freeSpc value in a way that it would
|
||||
// we artifically ajdust freeSpc value in a way that it would
|
||||
// look like total of mLetRatio's is 1.0, thus original
|
||||
// len. ratios are _preserved_:
|
||||
|
||||
@@ -455,8 +455,8 @@ void cbRowLayoutPlugin::ApplyLengthRatios( cbRowInfo* pRow )
|
||||
{
|
||||
if ( !pRow->mBars[i]->IsFixed() )
|
||||
{
|
||||
cbBarInfo& bar = *pRow->mBars[i];
|
||||
|
||||
cbBarInfo& bar = *pRow->mBars[i];
|
||||
|
||||
if ( int( unit * bar.mLenRatio ) < mpPane->mProps.mMinCBarDim.x )
|
||||
{
|
||||
haveSquished = true;
|
||||
@@ -487,8 +487,8 @@ void cbRowLayoutPlugin::ApplyLengthRatios( cbRowInfo* pRow )
|
||||
else
|
||||
bar.mBounds.width = int( unit * bar.mLenRatio );
|
||||
|
||||
// a little bit of AI:
|
||||
// memorize bar's height and width, when docked in
|
||||
// a little bit of AI:
|
||||
// memorize bar's height and width, when docked in
|
||||
// the current orientation - by making the current
|
||||
// dimensions to be "preffered" ones for this docking state
|
||||
|
||||
@@ -513,16 +513,16 @@ void cbRowLayoutPlugin::DetectBarHandles( cbRowInfo* pRow )
|
||||
for ( i = 0; i != pRow->mBars.Count(); ++i )
|
||||
{
|
||||
cbBarInfo& bar = *pRow->mBars[i];
|
||||
|
||||
|
||||
bar.mHasLeftHandle = false;
|
||||
|
||||
if ( !bar.IsFixed() )
|
||||
{
|
||||
if ( foundNotFixed )
|
||||
|
||||
|
||||
if ( bar.mpPrev &&
|
||||
bar.mpPrev->IsFixed() )
|
||||
|
||||
|
||||
bar.mHasLeftHandle = true;
|
||||
|
||||
foundNotFixed = true;
|
||||
@@ -560,7 +560,7 @@ void cbRowLayoutPlugin::RelayoutNotFixedBarsAround( cbBarInfo* pTheBar, cbRowInf
|
||||
{
|
||||
if ( !pTheBar->IsFixed() )
|
||||
{
|
||||
// this bar the first in the row, move it's
|
||||
// this bar the first in the row, move it's
|
||||
// left edge to the very left
|
||||
pTheBar->mBounds.width += pTheBar->mBounds.x;
|
||||
pTheBar->mBounds.x = 0;
|
||||
@@ -573,7 +573,7 @@ void cbRowLayoutPlugin::RelayoutNotFixedBarsAround( cbBarInfo* pTheBar, cbRowInf
|
||||
{
|
||||
if ( !pTheBar->IsFixed() )
|
||||
{
|
||||
// this bar is the last one, move it's
|
||||
// this bar is the last one, move it's
|
||||
// right edge to the very right
|
||||
|
||||
pTheBar->mBounds.width = mpPane->mPaneWidth - pTheBar->mBounds.x;
|
||||
@@ -611,7 +611,7 @@ int cbRowLayoutPlugin::CalcRowHeight( cbRowInfo& row )
|
||||
|
||||
size_t i;
|
||||
for ( i = 0; i != row.mBars.Count(); ++i )
|
||||
|
||||
|
||||
maxHeight = wxMax( maxHeight, row.mBars[i]->mBounds.height );
|
||||
|
||||
return maxHeight;
|
||||
@@ -778,8 +778,8 @@ void cbRowLayoutPlugin::ShiftRightTrashold( cbBarInfo* pTheBar, cbRowInfo& row )
|
||||
}
|
||||
}
|
||||
|
||||
int leftShift = ( rightOverflow > leftFreeSpc )
|
||||
? leftFreeSpc
|
||||
int leftShift = ( rightOverflow > leftFreeSpc )
|
||||
? leftFreeSpc
|
||||
: rightOverflow;
|
||||
|
||||
theBar.x -= leftShift;
|
||||
@@ -796,7 +796,7 @@ void cbRowLayoutPlugin::ShiftRightTrashold( cbBarInfo* pTheBar, cbRowInfo& row )
|
||||
} while(1);
|
||||
}
|
||||
|
||||
void cbRowLayoutPlugin::InsertBefore( cbBarInfo* pBeforeBar,
|
||||
void cbRowLayoutPlugin::InsertBefore( cbBarInfo* pBeforeBar,
|
||||
cbBarInfo* pTheBar,
|
||||
cbRowInfo& row )
|
||||
{
|
||||
@@ -834,7 +834,7 @@ void cbRowLayoutPlugin::DoInsertBar( cbBarInfo* pTheBar, cbRowInfo& row )
|
||||
InsertBefore( &bar, pTheBar, row );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
else
|
||||
// if bar hits the right edge
|
||||
if ( theBar.x <= cur.x + cur.width )
|
||||
@@ -926,14 +926,14 @@ void cbRowLayoutPlugin::OnInsertBar( cbInsertBarEvent& event )
|
||||
|
||||
DetectBarHandles( pIntoRow );
|
||||
|
||||
// do proportional resizing of not-fixed bars
|
||||
// do proportional resizing of not-fixed bars
|
||||
ApplyLengthRatios( pIntoRow );
|
||||
}
|
||||
|
||||
// adjust the bar's docking state
|
||||
|
||||
// a little bit of AI:
|
||||
// memorize bar's height and width, when docked in
|
||||
// a little bit of AI:
|
||||
// memorize bar's height and width, when docked in
|
||||
// the current orientation - by making the current
|
||||
// dimensions to be "preferred" ones for this docking state
|
||||
|
||||
@@ -1004,7 +1004,7 @@ void cbRowLayoutPlugin::OnLayoutRow( cbLayoutRowEvent& event )
|
||||
|
||||
if ( !pRow->mHasOnlyFixedBars )
|
||||
{
|
||||
// do proportional resizing of not-fixed bars
|
||||
// do proportional resizing of not-fixed bars
|
||||
ApplyLengthRatios( pRow );
|
||||
}
|
||||
|
||||
@@ -1051,7 +1051,7 @@ void cbRowLayoutPlugin::OnLayoutRows( cbLayoutRowsEvent& event )
|
||||
cbRowInfo& row = *mpPane->GetRowList()[ i ];
|
||||
//mpPane->CalcLengthRatios(& row);
|
||||
|
||||
// setup "has-handle" flags for rows, which depend on the existance
|
||||
// setup "has-handle" flags for rows, which depend on the existence
|
||||
// of not-fixed bars in the row
|
||||
|
||||
if ( !row.mHasOnlyFixedBars )
|
||||
@@ -1061,20 +1061,20 @@ void cbRowLayoutPlugin::OnLayoutRows( cbLayoutRowsEvent& event )
|
||||
{
|
||||
row.mHasLowerHandle = true;
|
||||
|
||||
row.mHasUpperHandle = false;
|
||||
row.mHasUpperHandle = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
row.mHasUpperHandle = true;
|
||||
|
||||
row.mHasLowerHandle = false;
|
||||
row.mHasLowerHandle = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// otherwise, rows with fixed-bars only, have no height-resizing handles
|
||||
row.mHasUpperHandle = false;
|
||||
row.mHasLowerHandle = false;
|
||||
row.mHasUpperHandle = false;
|
||||
row.mHasLowerHandle = false;
|
||||
}
|
||||
|
||||
// setup vertical positions for items in the row
|
||||
@@ -1116,7 +1116,7 @@ void cbRowLayoutPlugin::OnResizeRow( cbResizeRowEvent& event )
|
||||
|
||||
cbRowInfo* pRow = pTheRow->mpPrev;
|
||||
|
||||
while( pRow )
|
||||
while( pRow )
|
||||
{
|
||||
pRow = pRow->mpPrev;
|
||||
}
|
||||
@@ -1128,7 +1128,7 @@ void cbRowLayoutPlugin::OnResizeRow( cbResizeRowEvent& event )
|
||||
|
||||
cbRowInfo* pRow = pTheRow->mpNext;
|
||||
|
||||
while( pRow )
|
||||
while( pRow )
|
||||
{
|
||||
pRow = pRow->mpNext;
|
||||
}
|
||||
@@ -1162,7 +1162,7 @@ void cbRowLayoutPlugin::OnResizeRow( cbResizeRowEvent& event )
|
||||
{
|
||||
int prevHeight = pRow->mRowHeight;
|
||||
|
||||
int newHeight = wxMax( event.mpPane->GetMinimalRowHeight( pRow ),
|
||||
int newHeight = wxMax( event.mpPane->GetMinimalRowHeight( pRow ),
|
||||
prevHeight - needed );
|
||||
|
||||
if ( newHeight != prevHeight )
|
||||
@@ -1195,7 +1195,7 @@ void cbRowLayoutPlugin::OnResizeRow( cbResizeRowEvent& event )
|
||||
{
|
||||
int prevHeight = pRow->mRowHeight;
|
||||
|
||||
int newHeight = wxMax( event.mpPane->GetMinimalRowHeight( pRow ),
|
||||
int newHeight = wxMax( event.mpPane->GetMinimalRowHeight( pRow ),
|
||||
prevHeight - needed );
|
||||
|
||||
if ( newHeight != prevHeight )
|
||||
@@ -1211,7 +1211,7 @@ void cbRowLayoutPlugin::OnResizeRow( cbResizeRowEvent& event )
|
||||
}
|
||||
|
||||
if ( forUpperHandle )
|
||||
|
||||
|
||||
event.mpPane->SetRowHeight( pTheRow, pTheRow->mRowHeight + (-ofs) );
|
||||
else
|
||||
event.mpPane->SetRowHeight( pTheRow, pTheRow->mRowHeight + ofs );
|
||||
|
@@ -86,12 +86,6 @@ wxMultiCellItemHandle :: wxMultiCellItemHandle( int row, int column, wxResizable
|
||||
{
|
||||
Initialize(row, column, 1, 1, wxSize(1, 1), style, weight, align);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
wxMultiCellItemHandle :: wxMultiCellItemHandle( int row, int column, int align)
|
||||
{
|
||||
Initialize(row, column, 1, 1, wxSize(1,1), wxNOT_RESIZABLE, wxSize(1, 1), align);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
int wxMultiCellItemHandle::GetColumn()
|
||||
{
|
||||
@@ -653,7 +647,7 @@ void wxMultiCellCanvas :: CalculateConstraints()
|
||||
if (!m_cells[CELL_LOC(row, col)])
|
||||
{
|
||||
// Create an empty static text field as a placeholder
|
||||
m_cells[CELL_LOC(row, col)] = new wxCell(new wxStaticText(m_parent, wxID_ANY, wxT("")));
|
||||
m_cells[CELL_LOC(row, col)] = new wxCell(new wxStaticText(m_parent, wxID_ANY, wxEmptyString));
|
||||
}
|
||||
wxFlexGridSizer::Add(m_cells[CELL_LOC(row, col)]->m_window);
|
||||
}
|
||||
|
Reference in New Issue
Block a user