* Imported files from OT-current:

- InfoWindow.cpp 1.17, .h 1.5
  - TrackerSettingsWindow.cpp 1.9
  - ContainerWindow.cpp 1.37, .h 1.7
  - DialogPane.cpp 1.4
* This also fixes bug #718.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18481 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2006-08-11 13:23:10 +00:00
parent 943da1a9b7
commit 4f459891dd
6 changed files with 59 additions and 47 deletions
+38 -30
View File
@@ -471,7 +471,7 @@ DraggableContainerIcon::FrameMoved(BPoint /*newLocation*/)
// This is a trick to get the actual width of all menu items // This is a trick to get the actual width of all menu items
// (BMenuBar may not have set the item coordinates yet...) // (BMenuBar may not have set the item coordinates yet...)
float width, height; float width, height;
int32 resizingMode = bar->ResizingMode(); uint32 resizingMode = bar->ResizingMode();
bar->SetResizingMode(B_FOLLOW_NONE); bar->SetResizingMode(B_FOLLOW_NONE);
bar->GetPreferredSize(&width, &height); bar->GetPreferredSize(&width, &height);
bar->SetResizingMode(resizingMode); bar->SetResizingMode(resizingMode);
@@ -1068,11 +1068,23 @@ BContainerWindow::UpdateBackgroundImage()
void void
BContainerWindow::FrameResized(float, float) BContainerWindow::FrameResized(float, float)
{ {
if (PoseView()) { if (PoseView() && dynamic_cast<BDeskWindow *>(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()->UpdateScrollRange();
PoseView()->ResetPosePlacementHint(); PoseView()->ResetPosePlacementHint();
} }
fPreviousBounds = Bounds();
fStateNeedsSaving = true; fStateNeedsSaving = true;
} }
@@ -1288,47 +1300,31 @@ BContainerWindow::ResizeToFit()
BRect frame(Frame()); BRect frame(Frame());
float widthDiff = frame.Width() - PoseView()->Frame().Width();
float heightDiff = frame.Height() - PoseView()->Frame().Height();
// move frame left top on screen // move frame left top on screen
BPoint leftTop(frame.LeftTop()); BPoint leftTop(frame.LeftTop());
leftTop.ConstrainTo(screenFrame); leftTop.ConstrainTo(screenFrame);
frame.OffsetTo(leftTop); frame.OffsetTo(leftTop);
// resize to extent size // resize to extent size
float menuHeight;
if (KeyMenuBar())
menuHeight = KeyMenuBar()->Bounds().Height();
else
menuHeight = 0;
BRect extent(PoseView()->Extent()); BRect extent(PoseView()->Extent());
frame.right = frame.left + extent.Width() + (float)B_V_SCROLL_BAR_WIDTH + 1.0f; frame.right = frame.left + extent.Width() + widthDiff;
frame.bottom = frame.top + extent.Height() + (float)B_H_SCROLL_BAR_HEIGHT + 1.0f frame.bottom = frame.top + extent.Height() + heightDiff;
+ menuHeight;
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 // make sure entire window fits on screen
frame = frame & screenFrame; frame = frame & screenFrame;
ResizeTo(frame.Width(), frame.Height()); ResizeTo(frame.Width(), frame.Height());
MoveTo(frame.LeftTop()); MoveTo(frame.LeftTop());
PoseView()->DisableScrollBars(); 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()->UpdateScrollRange();
PoseView()->EnableScrollBars(); PoseView()->EnableScrollBars();
} }
@@ -1502,6 +1498,16 @@ BContainerWindow::MessageReceived(BMessage *message)
if (settings.ShowNavigator() || settings.ShowFullPathInTitleBar()) if (settings.ShowNavigator() || settings.ShowFullPathInTitleBar())
SetPathWatchingEnabled(true); 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 // Update window title
UpdateTitle(); UpdateTitle();
} }
@@ -3350,6 +3356,8 @@ BContainerWindow::RestoreWindowState(AttributeStreamNode *node)
} else } else
sNewWindRect.OffsetBy(kWindowStaggerBy, kWindowStaggerBy); sNewWindRect.OffsetBy(kWindowStaggerBy, kWindowStaggerBy);
fPreviousBounds = Bounds();
uint32 workspace; uint32 workspace;
if ((fContainerWindowFlags & kRestoreWorkspace) if ((fContainerWindowFlags & kRestoreWorkspace)
&& node->Read(workspaceAttributeName, 0, B_INT32_TYPE, sizeof(uint32), &workspace) == sizeof(uint32)) && node->Read(workspaceAttributeName, 0, B_INT32_TYPE, sizeof(uint32), &workspace) == sizeof(uint32))
+1
View File
@@ -274,6 +274,7 @@ class BContainerWindow : public BWindow {
private: private:
BRect fSavedZoomRect; BRect fSavedZoomRect;
BRect fPreviousBounds;
static BRect sNewWindRect; static BRect sNewWindRect;
+2 -2
View File
@@ -77,6 +77,7 @@ DialogPane::DialogPane(BRect mode1Frame, BRect mode2Frame, int32 initialMode,
fMode2Frame(mode2Frame), fMode2Frame(mode2Frame),
fMode3Frame(mode2Frame) fMode3Frame(mode2Frame)
{ {
SetMode(fMode, true);
} }
@@ -89,6 +90,7 @@ DialogPane::DialogPane(BRect mode1Frame, BRect mode2Frame, BRect mode3Frame,
fMode2Frame(mode2Frame), fMode2Frame(mode2Frame),
fMode3Frame(mode3Frame) fMode3Frame(mode3Frame)
{ {
SetMode(fMode, true);
} }
@@ -196,8 +198,6 @@ DialogPane::AttachedToWindow()
SetViewColor(parent->ViewColor()); SetViewColor(parent->ViewColor());
SetLowColor(parent->LowColor()); SetLowColor(parent->LowColor());
} }
SetMode(fMode, true);
} }
+15 -12
View File
@@ -32,6 +32,21 @@ names are registered trademarks or trademarks of their respective holders.
All rights reserved. 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 <Alert.h> #include <Alert.h>
#include <Debug.h> #include <Debug.h>
#include <Directory.h> #include <Directory.h>
@@ -56,18 +71,6 @@ All rights reserved.
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#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 { namespace BPrivate {
+2 -2
View File
@@ -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. names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#ifndef INFO_WINDOW_H #ifndef INFO_WINDOW_H
#define INFO_WINDOW_H #define INFO_WINDOW_H
#include <String.h> #include <String.h>
#include <Window.h> #include <Window.h>
#include <MessageFilter.h> #include <MessageFilter.h>
#include "DialogPane.h"
#include "FilePermissionsView.h" #include "FilePermissionsView.h"
#include "LockingList.h" #include "LockingList.h"
#include "Utilities.h" #include "Utilities.h"
class BMenuField; class BMenuField;
namespace BPrivate { namespace BPrivate {
+1 -1
View File
@@ -75,7 +75,7 @@ TrackerSettingsWindow::TrackerSettingsWindow()
rect.InsetBy(10, 10); rect.InsetBy(10, 10);
rect.right = rect.left + be_plain_font->StringWidth("Volume Icons") 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, fSettingsTypeListView = new BListView(rect, "List View", B_SINGLE_SELECTION_LIST,
B_FOLLOW_LEFT | B_FOLLOW_TOP_BOTTOM); B_FOLLOW_LEFT | B_FOLLOW_TOP_BOTTOM);
BScrollView* scrollView = new BScrollView("scrollview", fSettingsTypeListView, BScrollView* scrollView = new BScrollView("scrollview", fSettingsTypeListView,