From 89add395bb84be854da1008ba068ae216b8a5fe8 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 5 May 2007 14:19:50 +0000 Subject: [PATCH] fix warning about signed/unsigned comparison; use STL-compatible methods; deTABified git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@45825 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/aui/framemanager.cpp | 118 +++++++++++++++++++-------------------- 1 file changed, 59 insertions(+), 59 deletions(-) diff --git a/src/aui/framemanager.cpp b/src/aui/framemanager.cpp index ae0144140b..e981be60e9 100644 --- a/src/aui/framemanager.cpp +++ b/src/aui/framemanager.cpp @@ -502,7 +502,7 @@ wxAuiManager::wxAuiManager(wxWindow* managed_wnd, unsigned int flags) m_dock_constraint_x = 0.3; m_dock_constraint_y = 0.3; m_reserved = NULL; - + if (managed_wnd) { SetManagedWindow(managed_wnd); @@ -511,12 +511,12 @@ wxAuiManager::wxAuiManager(wxWindow* managed_wnd, unsigned int flags) wxAuiManager::~wxAuiManager() { - for(int i = 0; i < m_panes.Count(); i++ ) - { - wxAuiPaneInfo& pinfo = m_panes.Item(i); - if( pinfo.window && pinfo.window->GetParent() == 0 ) - delete pinfo.window; - } + for(size_t i = 0; i < m_panes.size(); i++ ) + { + wxAuiPaneInfo& pinfo = m_panes[i]; + if( pinfo.window && !pinfo.window->GetParent() ) + delete pinfo.window; + } delete m_art; } @@ -618,7 +618,7 @@ void wxAuiManager::SetFlags(unsigned int flags) // set the new flags m_flags = flags; - + if (update_hint_wnd) { UpdateHintWindowConfig(); @@ -656,7 +656,7 @@ wxAuiManager* wxAuiManager::GetManager(wxWindow* window) evt.ResumePropagation(wxEVENT_PROPAGATE_MAX); if (!window->ProcessEvent(evt)) return NULL; - + return evt.GetManager(); } @@ -665,7 +665,7 @@ void wxAuiManager::UpdateHintWindowConfig() { // find out if the the system can do transparent frames bool can_do_transparent = false; - + wxWindow* w = m_frame; while (w) { @@ -675,10 +675,10 @@ void wxAuiManager::UpdateHintWindowConfig() can_do_transparent = f->CanSetTransparent(); break; } - + w = w->GetParent(); } - + // if there is an existing hint window, delete it if (m_hint_wnd) { @@ -688,9 +688,9 @@ void wxAuiManager::UpdateHintWindowConfig() m_hint_fademax = 50; m_hint_wnd = NULL; - + if ((m_flags & wxAUI_MGR_TRANSPARENT_HINT) && can_do_transparent) - { + { // Make a window to use for a transparent hint #if defined(__WXMSW__) || defined(__WXGTK__) m_hint_wnd = new wxFrame(m_frame, wxID_ANY, wxEmptyString, @@ -718,7 +718,7 @@ void wxAuiManager::UpdateHintWindowConfig() // blue. p->SetBackgroundColour(*wxBLUE); #endif - + } else { @@ -878,14 +878,14 @@ bool wxAuiManager::AddPane(wxWindow* window, const wxAuiPaneInfo& pane_info) button.button_id = wxAUI_BUTTON_MAXIMIZE_RESTORE; pinfo.buttons.Add(button); } - + if (pinfo.HasPinButton()) { wxAuiPaneButton button; button.button_id = wxAUI_BUTTON_PIN; pinfo.buttons.Add(button); } - + if (pinfo.HasCloseButton()) { wxAuiPaneButton button; @@ -1041,7 +1041,7 @@ bool wxAuiManager::DetachPane(wxWindow* window) { m_action_window = NULL; } - + p.window->Reparent(m_frame); p.frame->SetSizer(NULL); p.frame->Destroy(); @@ -1102,7 +1102,7 @@ void wxAuiManager::ClosePane(wxAuiPaneInfo& pane_info) } // now we need to either destroy or hide the pane - if (pane_info.IsDestroyOnClose()) + if (pane_info.IsDestroyOnClose()) { wxWindow * window = pane_info.window; DetachPane(window); @@ -1110,8 +1110,8 @@ void wxAuiManager::ClosePane(wxAuiPaneInfo& pane_info) { window->Destroy(); } - } - else + } + else { pane_info.Hide(); } @@ -1128,7 +1128,7 @@ void wxAuiManager::MaximizePane(wxAuiPaneInfo& pane_info) if (!p.IsToolbar()) { p.Restore(); - + // save hidden state p.SetFlag(wxAuiPaneInfo::savedHiddenState, p.HasFlag(wxAuiPaneInfo::optionHidden)); @@ -1614,7 +1614,7 @@ void wxAuiManager::LayoutAddPane(wxSizer* cont, part.sizer_item = sizer_item; uiparts.Add(part); } - + // if we have buttons, add a little space to the right // of them to ease visual crowding if (button_count >= 1) @@ -1748,7 +1748,7 @@ void wxAuiManager::LayoutAddDock(wxSizer* cont, { wxAuiPaneInfo& pane = *(dock.panes.Item(pane_i)); int pane_pos = pane_positions.Item(pane_i); - + if (pane.IsMaximized()) has_maximized_pane = true; @@ -1795,7 +1795,7 @@ void wxAuiManager::LayoutAddDock(wxSizer* cont, for (pane_i = 0; pane_i < pane_count; ++pane_i) { wxAuiPaneInfo& pane = *(dock.panes.Item(pane_i)); - + if (pane.IsMaximized()) has_maximized_pane = true; @@ -1874,10 +1874,10 @@ wxSizer* wxAuiManager::LayoutAll(wxAuiPaneInfoArray& panes, for (i = 0, dock_count = docks.GetCount(); i < dock_count; ++i) { wxAuiDockInfo& dock = docks.Item(i); - + // empty out all panes, as they will be readded below dock.panes.Empty(); - + if (dock.fixed) { // always reset fixed docks' sizes, because @@ -2000,10 +2000,10 @@ wxSizer* wxAuiManager::LayoutAll(wxAuiPaneInfoArray& panes, // new dock's size may not be more than the dock constraint // parameter specifies. See SetDockSizeConstraint() - + int max_dock_x_size = (int)(m_dock_constraint_x * ((double)cli_size.x)); int max_dock_y_size = (int)(m_dock_constraint_y * ((double)cli_size.y)); - + if (dock.IsHorizontal()) size = wxMin(size, max_dock_y_size); else @@ -2012,7 +2012,7 @@ wxSizer* wxAuiManager::LayoutAll(wxAuiPaneInfoArray& panes, // absolute minimum size for a dock is 10 pixels if (size < 10) size = 10; - + dock.size = size; } @@ -2259,7 +2259,7 @@ void wxAuiManager::GetDockSizeConstraint(double* width_pct, double* height_pct) { if (width_pct) *width_pct = m_dock_constraint_x; - + if (height_pct) *height_pct = m_dock_constraint_y; } @@ -2314,7 +2314,7 @@ void wxAuiManager::Update() { m_action_window = NULL; } - + p.window->Reparent(m_frame); p.frame->SetSizer(NULL); p.frame->Destroy(); @@ -2656,10 +2656,10 @@ bool wxAuiManager::DoDrop(wxAuiDockInfoArray& docks, int new_layer = wxMax(wxMax(GetMaxLayer(docks, wxAUI_DOCK_LEFT), GetMaxLayer(docks, wxAUI_DOCK_BOTTOM)), GetMaxLayer(docks, wxAUI_DOCK_TOP)) + 1; - + if (drop.IsToolbar()) new_layer = auiToolBarLayer; - + drop.Dock().Left(). Layer(new_layer). Row(0). @@ -2672,10 +2672,10 @@ bool wxAuiManager::DoDrop(wxAuiDockInfoArray& docks, int new_layer = wxMax(wxMax(GetMaxLayer(docks, wxAUI_DOCK_TOP), GetMaxLayer(docks, wxAUI_DOCK_LEFT)), GetMaxLayer(docks, wxAUI_DOCK_RIGHT)) + 1; - + if (drop.IsToolbar()) new_layer = auiToolBarLayer; - + drop.Dock().Top(). Layer(new_layer). Row(0). @@ -2687,11 +2687,11 @@ bool wxAuiManager::DoDrop(wxAuiDockInfoArray& docks, { int new_layer = wxMax(wxMax(GetMaxLayer(docks, wxAUI_DOCK_RIGHT), GetMaxLayer(docks, wxAUI_DOCK_TOP)), - GetMaxLayer(docks, wxAUI_DOCK_BOTTOM)) + 1; - + GetMaxLayer(docks, wxAUI_DOCK_BOTTOM)) + 1; + if (drop.IsToolbar()) new_layer = auiToolBarLayer; - + drop.Dock().Right(). Layer(new_layer). Row(0). @@ -2704,10 +2704,10 @@ bool wxAuiManager::DoDrop(wxAuiDockInfoArray& docks, int new_layer = wxMax( wxMax( GetMaxLayer(docks, wxAUI_DOCK_BOTTOM), GetMaxLayer(docks, wxAUI_DOCK_LEFT)), GetMaxLayer(docks, wxAUI_DOCK_RIGHT)) + 1; - + if (drop.IsToolbar()) new_layer = auiToolBarLayer; - + drop.Dock().Bottom(). Layer(new_layer). Row(0). @@ -3056,7 +3056,7 @@ void wxAuiManager::ShowHint(const wxRect& rect) m_last_hint = rect; m_hint_fadeamt = m_hint_fademax; - + if ((m_flags & wxAUI_MGR_HINT_FADE) && !((m_hint_wnd->IsKindOf(CLASSINFO(wxPseudoTransparentFrame))) && (m_flags & wxAUI_MGR_NO_VENETIAN_BLINDS_FADE)) @@ -3088,7 +3088,7 @@ void wxAuiManager::ShowHint(const wxRect& rect) { if (!(m_flags & wxAUI_MGR_RECTANGLE_HINT)) return; - + if (m_last_hint != rect) { // remove the last hint rectangle @@ -3170,7 +3170,7 @@ void wxAuiManager::StartPaneDrag(wxWindow* pane_window, wxAuiPaneInfo& pane = GetPane(pane_window); if (!pane.IsOk()) return; - + if (pane.IsToolbar()) { m_action = actionDragToolbarPane; @@ -3179,7 +3179,7 @@ void wxAuiManager::StartPaneDrag(wxWindow* pane_window, { m_action = actionDragFloatingPane; } - + m_action_window = pane_window; m_action_offset = offset; m_frame->CaptureMouse(); @@ -3286,7 +3286,7 @@ void wxAuiManager::DrawHintRect(wxWindow* pane_window, const wxPoint& offset) { wxRect rect = CalculateHintRect(pane_window, pt, offset); - + if (rect.IsEmpty()) { HideHint(); @@ -3517,7 +3517,7 @@ void wxAuiManager::OnFloatingPaneClosed(wxWindow* wnd, wxCloseEvent& evt) evt.Veto(); return; } - else + else { ClosePane(pane); } @@ -3657,7 +3657,7 @@ void wxAuiManager::OnSize(wxSizeEvent& event) { DoFrameLayout(); Repaint(); - + #if wxUSE_MDI if (m_frame->IsKindOf(CLASSINFO(wxMDIParentFrame))) { @@ -3681,7 +3681,7 @@ void wxAuiManager::OnFindManager(wxAuiManagerEvent& evt) evt.SetManager(NULL); return; } - + // if we are managing a child frame, get the 'real' manager if (window->IsKindOf(CLASSINFO(wxAuiFloatingFrame))) { @@ -3689,7 +3689,7 @@ void wxAuiManager::OnFindManager(wxAuiManagerEvent& evt) evt.SetManager(float_frame->GetOwnerManager()); return; } - + // return pointer to ourself evt.SetManager(this); } @@ -3738,7 +3738,7 @@ void wxAuiManager::UpdateButtonOnScreen(wxAuiDockUIPart* button_ui_part, wxAuiDockUIPart* hit_test = HitTest(event.GetX(), event.GetY()); if (!hit_test || !button_ui_part) return; - + int state = wxAUI_BUTTON_STATE_NORMAL; if (hit_test == button_ui_part) @@ -3783,7 +3783,7 @@ void wxAuiManager::OnLeftDown(wxMouseEvent& event) { if (part->dock && part->dock->dock_direction == wxAUI_DOCK_CENTER) return; - + // a dock may not be resized if it has a single // pane which is not resizable if (part->type == wxAuiDockUIPart::typeDockSizer && part->dock && @@ -3819,8 +3819,8 @@ void wxAuiManager::OnLeftDown(wxMouseEvent& event) // we are an embedded wxAuiManager inside the wxAuiFloatingFrame. // We want to initiate a toolbar drag in our owner manager wxWindow* managed_wnd = GetManagedWindow(); - - if (part->pane && + + if (part->pane && part->pane->window && managed_wnd && managed_wnd->IsKindOf(CLASSINFO(wxAuiFloatingFrame))) @@ -3832,9 +3832,9 @@ void wxAuiManager::OnLeftDown(wxMouseEvent& event) event.m_y - part->rect.y)); return; } - - - + + + if (part->dock && part->dock->dock_direction == wxAUI_DOCK_CENTER) return; @@ -4259,12 +4259,12 @@ void wxAuiManager::OnMotion(wxMouseEvent& event) UpdateButtonOnScreen(m_hover_button, event); Repaint(); } - + // mouse is over a button, so repaint the // button in hover mode UpdateButtonOnScreen(part, event); m_hover_button = part; - + } } else