From 9a18e28b6d460addae1a46309f639e66fd2d686b Mon Sep 17 00:00:00 2001 From: Matthew Wilber Date: Sat, 28 Dec 2002 04:09:38 +0000 Subject: [PATCH] added more attribute writing to BTranslationUtils::WriteStyledEditFile() to better match what Be's StyledEdit writes for attributes. The code is still missing "be:encoding" but I want to make sure that I understand it fully before I add it. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2312 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/translation/TranslationUtils.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/kits/translation/TranslationUtils.cpp b/src/kits/translation/TranslationUtils.cpp index cfcfbdc7dd..3f914da72a 100644 --- a/src/kits/translation/TranslationUtils.cpp +++ b/src/kits/translation/TranslationUtils.cpp @@ -693,6 +693,23 @@ BTranslationUtils::WriteStyledEditFile(BTextView *fromView, BFile *intoFile) amtWritten = intoFile->WriteAttr("BEOS:TYPE", 'MIMS', 0, "text/plain", 11); if ((size_t) amtWritten != 11) return B_ERROR; + + // wrap + // word wrap setting, turned on by default + int32 nwrap = ((fromView->DoesWordWrap()) ? 1 : 0); + amtWritten = intoFile->WriteAttr("wrap", B_INT32_TYPE, 0, + &nwrap, sizeof(int32)); + if (amtWritten != sizeof(int32)) + return B_ERROR; + + // alignment + // alignment, either B_ALIGN_LEFT, B_ALIGN_RIGHT or B_ALIGN_CENTER, + // default is B_ALIGN_LEFT + int32 nalignment = fromView->Alignment(); + amtWritten = intoFile->WriteAttr("alignment", B_INT32_TYPE, 0, + &nalignment, sizeof(int32)); + if (amtWritten != sizeof(int32)) + return B_ERROR; text_run_array *pRunArray = fromView->RunArray(0, fromView->TextLength()); if (pRunArray == NULL)