* Workspaces can now be a replicant.
* The view must be a follow all view since the workspaces are handled differently. * No longer needs to use kWorkspacesWindowFlag; this makes it no longer work on BeOS. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24387 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -10,14 +10,10 @@
|
|||||||
* Matt Madia
|
* Matt Madia
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
|
||||||
Workspaces window trick found by Michael "Minox" Paine.
|
|
||||||
(using B_ALL_WORKSPACES as flags in BWindow)
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#include <Alert.h>
|
#include <Alert.h>
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
|
#include <Dragger.h>
|
||||||
#include <Entry.h>
|
#include <Entry.h>
|
||||||
#include <File.h>
|
#include <File.h>
|
||||||
#include <FindDirectory.h>
|
#include <FindDirectory.h>
|
||||||
@@ -36,7 +32,7 @@
|
|||||||
#include <WindowPrivate.h>
|
#include <WindowPrivate.h>
|
||||||
|
|
||||||
|
|
||||||
static const char *kWorkspacesSignature = "application/x-vnd.Be-WORK";
|
static const char *kSignature = "application/x-vnd.Be-WORK";
|
||||||
static const char *kWorkspacesSettingFile = "Workspace_data";
|
static const char *kWorkspacesSettingFile = "Workspace_data";
|
||||||
|
|
||||||
static const float kScreenBorderOffset = 10.0;
|
static const float kScreenBorderOffset = 10.0;
|
||||||
@@ -61,8 +57,12 @@ class WorkspacesPreferences {
|
|||||||
class WorkspacesView : public BView {
|
class WorkspacesView : public BView {
|
||||||
public:
|
public:
|
||||||
WorkspacesView(BRect frame);
|
WorkspacesView(BRect frame);
|
||||||
|
WorkspacesView(BMessage* archive);
|
||||||
~WorkspacesView();
|
~WorkspacesView();
|
||||||
|
|
||||||
|
static WorkspacesView* Instantiate(BMessage* archive);
|
||||||
|
virtual status_t Archive(BMessage* archive, bool deep = true) const;
|
||||||
|
|
||||||
virtual void MouseMoved(BPoint where, uint32 transit,
|
virtual void MouseMoved(BPoint where, uint32 transit,
|
||||||
const BMessage* dragMessage);
|
const BMessage* dragMessage);
|
||||||
virtual void MouseDown(BPoint where);
|
virtual void MouseDown(BPoint where);
|
||||||
@@ -133,7 +133,7 @@ WorkspacesPreferences::WorkspacesPreferences()
|
|||||||
&& screen.Frame().bottom + 5 >= fWindowFrame.bottom
|
&& screen.Frame().bottom + 5 >= fWindowFrame.bottom
|
||||||
&& screen.Frame().left - 5 <= fWindowFrame.left
|
&& screen.Frame().left - 5 <= fWindowFrame.left
|
||||||
&& screen.Frame().top - 5 <= fWindowFrame.top)
|
&& screen.Frame().top - 5 <= fWindowFrame.top)
|
||||||
settingsValid = true;
|
settingsValid = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -204,7 +204,19 @@ WorkspacesPreferences::SetWindowFrame(BRect frame)
|
|||||||
|
|
||||||
|
|
||||||
WorkspacesView::WorkspacesView(BRect frame)
|
WorkspacesView::WorkspacesView(BRect frame)
|
||||||
: BView(frame, "workspaces", B_FOLLOW_NONE, kWorkspacesViewFlag)
|
: BView(frame, "workspaces", B_FOLLOW_ALL, kWorkspacesViewFlag)
|
||||||
|
{
|
||||||
|
frame.OffsetTo(B_ORIGIN);
|
||||||
|
frame.top = frame.bottom - 7;
|
||||||
|
frame.left = frame.right - 7;
|
||||||
|
BDragger* dragger = new BDragger(frame, this,
|
||||||
|
B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
|
||||||
|
AddChild(dragger);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
WorkspacesView::WorkspacesView(BMessage* archive)
|
||||||
|
: BView(archive)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -214,6 +226,29 @@ WorkspacesView::~WorkspacesView()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*static*/ WorkspacesView*
|
||||||
|
WorkspacesView::Instantiate(BMessage* archive)
|
||||||
|
{
|
||||||
|
if (!validate_instantiation(archive, "WorkspacesView"))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return new WorkspacesView(archive);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
WorkspacesView::Archive(BMessage* archive, bool deep) const
|
||||||
|
{
|
||||||
|
status_t status = BView::Archive(archive, deep);
|
||||||
|
if (status == B_OK)
|
||||||
|
status = archive->AddString("add_on", kSignature);
|
||||||
|
if (status == B_OK)
|
||||||
|
status = archive->AddString("class", "WorkspacesView");
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WorkspacesView::MouseMoved(BPoint where, uint32 transit,
|
WorkspacesView::MouseMoved(BPoint where, uint32 transit,
|
||||||
const BMessage* dragMessage)
|
const BMessage* dragMessage)
|
||||||
@@ -254,8 +289,7 @@ WorkspacesView::MouseDown(BPoint where)
|
|||||||
|
|
||||||
WorkspacesWindow::WorkspacesWindow(WorkspacesPreferences *preferences)
|
WorkspacesWindow::WorkspacesWindow(WorkspacesPreferences *preferences)
|
||||||
: BWindow(preferences->WindowFrame(), "Workspaces", B_TITLED_WINDOW_LOOK,
|
: BWindow(preferences->WindowFrame(), "Workspaces", B_TITLED_WINDOW_LOOK,
|
||||||
B_NORMAL_WINDOW_FEEL,
|
B_NORMAL_WINDOW_FEEL, B_AVOID_FRONT | B_WILL_ACCEPT_FIRST_CLICK,
|
||||||
kWorkspacesWindowFlag | B_AVOID_FRONT | B_WILL_ACCEPT_FIRST_CLICK,
|
|
||||||
B_ALL_WORKSPACES),
|
B_ALL_WORKSPACES),
|
||||||
fPreferences(preferences)
|
fPreferences(preferences)
|
||||||
{
|
{
|
||||||
@@ -303,7 +337,7 @@ WorkspacesWindow::FrameResized(float width, float height)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WorkspacesWindow::Zoom(BPoint origin, float width, float height)
|
WorkspacesWindow::Zoom(BPoint origin, float width, float height)
|
||||||
{
|
{
|
||||||
BScreen screen;
|
BScreen screen;
|
||||||
@@ -347,8 +381,8 @@ WorkspacesWindow::SetAutoRaise()
|
|||||||
|
|
||||||
|
|
||||||
WorkspacesApp::WorkspacesApp()
|
WorkspacesApp::WorkspacesApp()
|
||||||
: BApplication(kWorkspacesSignature)
|
: BApplication(kSignature)
|
||||||
{
|
{
|
||||||
fWindow = new WorkspacesWindow(new WorkspacesPreferences());
|
fWindow = new WorkspacesWindow(new WorkspacesPreferences());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -372,7 +406,7 @@ WorkspacesApp::AboutRequested()
|
|||||||
|
|
||||||
view->GetFont(&font);
|
view->GetFont(&font);
|
||||||
font.SetSize(18);
|
font.SetSize(18);
|
||||||
font.SetFace(B_BOLD_FACE);
|
font.SetFace(B_BOLD_FACE);
|
||||||
view->SetFontAndColor(0, 10, &font);
|
view->SetFontAndColor(0, 10, &font);
|
||||||
|
|
||||||
alert->Go();
|
alert->Go();
|
||||||
@@ -408,7 +442,7 @@ WorkspacesApp::ArgvReceived(int32 argc, char **argv)
|
|||||||
// evaluate --arguments
|
// evaluate --arguments
|
||||||
if (!strcmp(argv[i], "--notitle"))
|
if (!strcmp(argv[i], "--notitle"))
|
||||||
fWindow->SetLook(B_MODAL_WINDOW_LOOK);
|
fWindow->SetLook(B_MODAL_WINDOW_LOOK);
|
||||||
else if (!strcmp(argv[i], "--noborder"))
|
else if (!strcmp(argv[i], "--noborder"))
|
||||||
fWindow->SetLook(B_NO_BORDER_WINDOW_LOOK);
|
fWindow->SetLook(B_NO_BORDER_WINDOW_LOOK);
|
||||||
else if (!strcmp(argv[i], "--avoidfocus"))
|
else if (!strcmp(argv[i], "--avoidfocus"))
|
||||||
fWindow->SetFlags(fWindow->Flags() | B_AVOID_FOCUS);
|
fWindow->SetFlags(fWindow->Flags() | B_AVOID_FOCUS);
|
||||||
|
|||||||
Reference in New Issue
Block a user