From 38daa5cd6e789ad5df2b719ad0843f3431f86854 Mon Sep 17 00:00:00 2001 From: Stefano Ceccherini Date: Mon, 13 Aug 2007 14:52:02 +0000 Subject: [PATCH] Also upload/download subpictures git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21926 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/ServerApp.cpp | 12 ++++++++++-- src/servers/app/ServerPicture.cpp | 17 +++++++++-------- src/servers/app/ServerWindow.cpp | 2 +- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/src/servers/app/ServerApp.cpp b/src/servers/app/ServerApp.cpp index e09db8996b..9256e4df11 100644 --- a/src/servers/app/ServerApp.cpp +++ b/src/servers/app/ServerApp.cpp @@ -694,9 +694,17 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link) STRACE(("ServerApp %s: Create Picture\n", Signature())); status_t status = B_ERROR; ServerPicture *picture = CreatePicture(); - if (picture != NULL) + if (picture != NULL) { + int32 subPicturesCount = 0; + link.Read(&subPicturesCount); + for (int32 c = 0; c < subPicturesCount; c++) { + int32 token = -1; + link.Read(&token); + if (ServerPicture *subPicture = FindPicture(token)) + picture->NestPicture(subPicture); + } status = picture->ImportData(link); - + } if (status == B_OK) { fLink.StartMessage(B_OK); fLink.Attach(picture->Token()); diff --git a/src/servers/app/ServerPicture.cpp b/src/servers/app/ServerPicture.cpp index 27ed94996b..2b4d6beef5 100644 --- a/src/servers/app/ServerPicture.cpp +++ b/src/servers/app/ServerPicture.cpp @@ -178,7 +178,6 @@ nop() static void move_pen_by(ViewLayer *view, BPoint delta) { -// view->CurrentState()->SetPenLocation(delta - view->CurrentState()->PenLocation()); ?!? view->CurrentState()->SetPenLocation(view->CurrentState()->PenLocation() + delta); } @@ -876,13 +875,7 @@ ServerPicture::DataLength() const status_t ServerPicture::ImportData(BPrivate::LinkReceiver &link) -{ - int32 subPicturesCount = 0; - link.Read(&subPicturesCount); - for (int32 c = 0; c < subPicturesCount; c++) { - // TODO: Support nested pictures - } - +{ int32 size = 0; link.Read(&size); @@ -919,7 +912,15 @@ ServerPicture::ExportData(BPrivate::PortLink &link) fData->Seek(0, SEEK_SET); int32 subPicturesCount = 0; + if (fPictures != NULL) + subPicturesCount = fPictures->CountItems(); link.Attach(subPicturesCount); + if (subPicturesCount > 0) { + for (int32 i = 0; i < subPicturesCount; i++) { + ServerPicture *subPic = static_cast(fPictures->ItemAtFast(i)); + link.Attach(subPic->Token()); + } + } off_t size = 0; fData->GetSize(&size); diff --git a/src/servers/app/ServerWindow.cpp b/src/servers/app/ServerWindow.cpp index 4f0726206c..4b4b645011 100644 --- a/src/servers/app/ServerWindow.cpp +++ b/src/servers/app/ServerWindow.cpp @@ -2711,7 +2711,7 @@ ServerWindow::_DispatchPictureMessage(int32 code, BPrivate::LinkReceiver &link) link.Read(&pictureToken); ServerPicture *appendPicture = App()->FindPicture(pictureToken); if (appendPicture) { - picture->SyncState(fCurrentLayer); + //picture->SyncState(fCurrentLayer); appendPicture->Usurp(picture); } fCurrentLayer->SetPicture(appendPicture);