wrapping cascading! okay, i am really wasting my time now... I will go back to terminal I promise.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4268 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,18 +1,50 @@
|
|||||||
|
|
||||||
|
#include <Alert.h>
|
||||||
#include <Autolock.h>
|
#include <Autolock.h>
|
||||||
#include <Path.h>
|
#include <Path.h>
|
||||||
#include <MenuItem.h>
|
#include <MenuItem.h>
|
||||||
#include <CharacterSet.h>
|
#include <CharacterSet.h>
|
||||||
#include <CharacterSetRoster.h>
|
#include <CharacterSetRoster.h>
|
||||||
#include <Alert.h>
|
#include <Screen.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "Constants.h"
|
|
||||||
#include "StyledEditApp.h"
|
#include <Constants.h>
|
||||||
#include "StyledEditWindow.h"
|
#include <StyledEditApp.h>
|
||||||
|
#include <StyledEditWindow.h>
|
||||||
|
|
||||||
using namespace BPrivate;
|
using namespace BPrivate;
|
||||||
|
|
||||||
BRect windowRect(7,26,507,426);
|
BRect windowRect(7-15,26-15,507,426);
|
||||||
|
|
||||||
|
void cascade() {
|
||||||
|
BScreen screen(NULL);
|
||||||
|
BRect screenBorder = screen.Frame();
|
||||||
|
float left = windowRect.left + 15;
|
||||||
|
if (left + windowRect.Width() > screenBorder.right) {
|
||||||
|
left = 7;
|
||||||
|
}
|
||||||
|
float top = windowRect.top + 15;
|
||||||
|
if (top + windowRect.Height() > screenBorder.bottom) {
|
||||||
|
top = 26;
|
||||||
|
}
|
||||||
|
windowRect.OffsetTo(BPoint(left,top));
|
||||||
|
}
|
||||||
|
|
||||||
|
void uncascade() {
|
||||||
|
BScreen screen(NULL);
|
||||||
|
BRect screenBorder = screen.Frame();
|
||||||
|
float left = windowRect.left - 15;
|
||||||
|
if (left < 7) {
|
||||||
|
left = screenBorder.right - windowRect.Width() - 7;
|
||||||
|
left = left - ((int)left % 15) + 7;
|
||||||
|
}
|
||||||
|
float top = windowRect.top - 15;
|
||||||
|
if (top < 26) {
|
||||||
|
top = screenBorder.bottom - windowRect.Height() - 26;
|
||||||
|
top = top - ((int)left % 15) + 26;
|
||||||
|
}
|
||||||
|
windowRect.OffsetTo(BPoint(left,top));
|
||||||
|
}
|
||||||
|
|
||||||
StyledEditApp * styled_edit_app;
|
StyledEditApp * styled_edit_app;
|
||||||
|
|
||||||
@@ -106,24 +138,24 @@ StyledEditApp::MessageReceived(BMessage *message)
|
|||||||
void
|
void
|
||||||
StyledEditApp::OpenDocument()
|
StyledEditApp::OpenDocument()
|
||||||
{
|
{
|
||||||
|
cascade();
|
||||||
new StyledEditWindow(windowRect,fNext_Untitled_Window++,fOpenAsEncoding);
|
new StyledEditWindow(windowRect,fNext_Untitled_Window++,fOpenAsEncoding);
|
||||||
windowRect.OffsetBy(15,15); // TODO: wrap around screen
|
|
||||||
fWindowCount++;
|
fWindowCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
StyledEditApp::OpenDocument(entry_ref * ref)
|
StyledEditApp::OpenDocument(entry_ref * ref)
|
||||||
{
|
{
|
||||||
|
cascade();
|
||||||
new StyledEditWindow(windowRect,ref,fOpenAsEncoding);
|
new StyledEditWindow(windowRect,ref,fOpenAsEncoding);
|
||||||
windowRect.OffsetBy(15,15); // TODO: wrap around screen
|
|
||||||
fWindowCount++;
|
fWindowCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
StyledEditApp::CloseDocument()
|
StyledEditApp::CloseDocument()
|
||||||
{
|
{
|
||||||
|
uncascade();
|
||||||
fWindowCount--;
|
fWindowCount--;
|
||||||
windowRect.OffsetBy(-15,-15);
|
|
||||||
if (fWindowCount == 0) {
|
if (fWindowCount == 0) {
|
||||||
BAutolock lock(this);
|
BAutolock lock(this);
|
||||||
Quit();
|
Quit();
|
||||||
|
|||||||
Reference in New Issue
Block a user