diff --git a/src/kits/tracker/ContainerWindow.cpp b/src/kits/tracker/ContainerWindow.cpp index 8093c73eaa..6df95aeb2a 100644 --- a/src/kits/tracker/ContainerWindow.cpp +++ b/src/kits/tracker/ContainerWindow.cpp @@ -471,7 +471,7 @@ DraggableContainerIcon::FrameMoved(BPoint /*newLocation*/) // This is a trick to get the actual width of all menu items // (BMenuBar may not have set the item coordinates yet...) float width, height; - int32 resizingMode = bar->ResizingMode(); + uint32 resizingMode = bar->ResizingMode(); bar->SetResizingMode(B_FOLLOW_NONE); bar->GetPreferredSize(&width, &height); bar->SetResizingMode(resizingMode); @@ -1068,11 +1068,23 @@ BContainerWindow::UpdateBackgroundImage() void BContainerWindow::FrameResized(float, float) { - if (PoseView()) { + if (PoseView() && dynamic_cast(this) == NULL) { + BRect extent = PoseView()->Extent(); + if (extent.bottom < PoseView()->Bounds().bottom + && fPreviousBounds.Height() < Bounds().Height()) { + PoseView()->ScrollBy(0, max_c(extent.bottom - PoseView()->Bounds().bottom, + fPreviousBounds.Height() - Bounds().Height())); + } + if (extent.right < PoseView()->Bounds().right + && fPreviousBounds.Width() < Bounds().Width()) { + PoseView()->ScrollBy(max_c(extent.right - PoseView()->Bounds().right, + fPreviousBounds.Width() - Bounds().Width()), 0); + } PoseView()->UpdateScrollRange(); PoseView()->ResetPosePlacementHint(); } - + + fPreviousBounds = Bounds(); fStateNeedsSaving = true; } @@ -1288,47 +1300,31 @@ BContainerWindow::ResizeToFit() BRect frame(Frame()); + float widthDiff = frame.Width() - PoseView()->Frame().Width(); + float heightDiff = frame.Height() - PoseView()->Frame().Height(); + // move frame left top on screen BPoint leftTop(frame.LeftTop()); leftTop.ConstrainTo(screenFrame); frame.OffsetTo(leftTop); // resize to extent size - float menuHeight; - if (KeyMenuBar()) - menuHeight = KeyMenuBar()->Bounds().Height(); - else - menuHeight = 0; - BRect extent(PoseView()->Extent()); - frame.right = frame.left + extent.Width() + (float)B_V_SCROLL_BAR_WIDTH + 1.0f; - frame.bottom = frame.top + extent.Height() + (float)B_H_SCROLL_BAR_HEIGHT + 1.0f - + menuHeight; + frame.right = frame.left + extent.Width() + widthDiff; + frame.bottom = frame.top + extent.Height() + heightDiff; - if (PoseView()->ViewMode() == kListMode) - frame.bottom += kTitleViewHeight + 1; // account for list titles - - TrackerSettings settings; - if (settings.SingleWindowBrowse() - && settings.ShowNavigator() - && Navigator()) - frame.bottom += fNavigator->Bounds().bottom + 1; - - // ToDo: - // clean this up, move each special case to respective class - - if (!TargetModel()) - frame.bottom += 60; // Open with window - else if (TargetModel()->IsQuery()) - frame.bottom += 15; // account for query string - // make sure entire window fits on screen frame = frame & screenFrame; ResizeTo(frame.Width(), frame.Height()); MoveTo(frame.LeftTop()); PoseView()->DisableScrollBars(); - PoseView()->ScrollTo(extent.LeftTop()); + + if (PoseView()->Bounds().bottom > extent.bottom) + PoseView()->ScrollBy(0, extent.bottom - PoseView()->Bounds().bottom); + if (PoseView()->Bounds().right > extent.right) + PoseView()->ScrollBy(extent.right - PoseView()->Bounds().right, 0); + PoseView()->UpdateScrollRange(); PoseView()->EnableScrollBars(); } @@ -1502,6 +1498,16 @@ BContainerWindow::MessageReceived(BMessage *message) if (settings.ShowNavigator() || settings.ShowFullPathInTitleBar()) SetPathWatchingEnabled(true); + // Update draggable folder icon + BView *view = FindView("MenuBar"); + if (view != NULL) { + view = view->FindView("ThisContainer"); + if (view != NULL) { + IconCache::sIconCache->IconChanged(TargetModel()); + view->Invalidate(); + } + } + // Update window title UpdateTitle(); } @@ -3350,6 +3356,8 @@ BContainerWindow::RestoreWindowState(AttributeStreamNode *node) } else sNewWindRect.OffsetBy(kWindowStaggerBy, kWindowStaggerBy); + fPreviousBounds = Bounds(); + uint32 workspace; if ((fContainerWindowFlags & kRestoreWorkspace) && node->Read(workspaceAttributeName, 0, B_INT32_TYPE, sizeof(uint32), &workspace) == sizeof(uint32)) diff --git a/src/kits/tracker/ContainerWindow.h b/src/kits/tracker/ContainerWindow.h index 62994f10f4..3dd2e1ae97 100644 --- a/src/kits/tracker/ContainerWindow.h +++ b/src/kits/tracker/ContainerWindow.h @@ -274,6 +274,7 @@ class BContainerWindow : public BWindow { private: BRect fSavedZoomRect; + BRect fPreviousBounds; static BRect sNewWindRect; diff --git a/src/kits/tracker/DialogPane.cpp b/src/kits/tracker/DialogPane.cpp index da29afbf33..2e943e05f6 100644 --- a/src/kits/tracker/DialogPane.cpp +++ b/src/kits/tracker/DialogPane.cpp @@ -77,6 +77,7 @@ DialogPane::DialogPane(BRect mode1Frame, BRect mode2Frame, int32 initialMode, fMode2Frame(mode2Frame), fMode3Frame(mode2Frame) { + SetMode(fMode, true); } @@ -89,6 +90,7 @@ DialogPane::DialogPane(BRect mode1Frame, BRect mode2Frame, BRect mode3Frame, fMode2Frame(mode2Frame), fMode3Frame(mode3Frame) { + SetMode(fMode, true); } @@ -196,8 +198,6 @@ DialogPane::AttachedToWindow() SetViewColor(parent->ViewColor()); SetLowColor(parent->LowColor()); } - - SetMode(fMode, true); } diff --git a/src/kits/tracker/InfoWindow.cpp b/src/kits/tracker/InfoWindow.cpp index d182ee96a0..96a487dfb2 100644 --- a/src/kits/tracker/InfoWindow.cpp +++ b/src/kits/tracker/InfoWindow.cpp @@ -32,6 +32,21 @@ names are registered trademarks or trademarks of their respective holders. All rights reserved. */ + +#include "Attributes.h" +#include "AutoLock.h" +#include "Commands.h" +#include "DialogPane.h" +#include "FSUtils.h" +#include "IconCache.h" +#include "IconMenuItem.h" +#include "InfoWindow.h" +#include "Model.h" +#include "NavMenu.h" +#include "PoseView.h" +#include "Tracker.h" +#include "WidgetAttributeText.h" + #include #include #include @@ -56,18 +71,6 @@ All rights reserved. #include #include -#include "Attributes.h" -#include "AutoLock.h" -#include "Commands.h" -#include "FSUtils.h" -#include "IconCache.h" -#include "IconMenuItem.h" -#include "InfoWindow.h" -#include "Model.h" -#include "NavMenu.h" -#include "PoseView.h" -#include "Tracker.h" -#include "WidgetAttributeText.h" namespace BPrivate { diff --git a/src/kits/tracker/InfoWindow.h b/src/kits/tracker/InfoWindow.h index 37a74ff526..581a5eb191 100644 --- a/src/kits/tracker/InfoWindow.h +++ b/src/kits/tracker/InfoWindow.h @@ -31,19 +31,19 @@ of Be Incorporated in the United States and other countries. Other brand product names are registered trademarks or trademarks of their respective holders. All rights reserved. */ - #ifndef INFO_WINDOW_H #define INFO_WINDOW_H + #include #include #include -#include "DialogPane.h" #include "FilePermissionsView.h" #include "LockingList.h" #include "Utilities.h" + class BMenuField; namespace BPrivate { diff --git a/src/kits/tracker/TrackerSettingsWindow.cpp b/src/kits/tracker/TrackerSettingsWindow.cpp index 7ca5525925..4f3fccde91 100644 --- a/src/kits/tracker/TrackerSettingsWindow.cpp +++ b/src/kits/tracker/TrackerSettingsWindow.cpp @@ -75,7 +75,7 @@ TrackerSettingsWindow::TrackerSettingsWindow() rect.InsetBy(10, 10); rect.right = rect.left + be_plain_font->StringWidth("Volume Icons") - + B_V_SCROLL_BAR_WIDTH + 40.0f; + + (float)B_V_SCROLL_BAR_WIDTH + 40.0f; fSettingsTypeListView = new BListView(rect, "List View", B_SINGLE_SELECTION_LIST, B_FOLLOW_LEFT | B_FOLLOW_TOP_BOTTOM); BScrollView* scrollView = new BScrollView("scrollview", fSettingsTypeListView,