* Adapted to Ingo's suggestions: used a more descriptive attribute name,
got rid of the superfluous fSaveMessage check in LoadAttrs(). * Also made the attribute name a proper const variable, and renamed it to kInfoAttributeName. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36705 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -47,8 +47,8 @@ using namespace BPrivate;
|
|||||||
|
|
||||||
|
|
||||||
const float kLineViewWidth = 30.0;
|
const float kLineViewWidth = 30.0;
|
||||||
|
const char* kInfoAttributeName = "StyledEdit-info";
|
||||||
|
|
||||||
#define ATTRNAME_SE_INFO "se-info"
|
|
||||||
|
|
||||||
#undef TR_CONTEXT
|
#undef TR_CONTEXT
|
||||||
#define TR_CONTEXT "StyledEditWindow"
|
#define TR_CONTEXT "StyledEditWindow"
|
||||||
@@ -348,9 +348,6 @@ StyledEditWindow::InitWindow(uint32 encoding)
|
|||||||
void
|
void
|
||||||
StyledEditWindow::LoadAttrs()
|
StyledEditWindow::LoadAttrs()
|
||||||
{
|
{
|
||||||
if (!fSaveMessage)
|
|
||||||
return;
|
|
||||||
|
|
||||||
entry_ref dir;
|
entry_ref dir;
|
||||||
const char* name;
|
const char* name;
|
||||||
if (fSaveMessage->FindRef("directory", &dir) != B_OK
|
if (fSaveMessage->FindRef("directory", &dir) != B_OK
|
||||||
@@ -365,7 +362,7 @@ StyledEditWindow::LoadAttrs()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
BRect newFrame;
|
BRect newFrame;
|
||||||
ssize_t bytesRead = documentNode.ReadAttr(ATTRNAME_SE_INFO, B_RECT_TYPE,
|
ssize_t bytesRead = documentNode.ReadAttr(kInfoAttributeName, B_RECT_TYPE,
|
||||||
0, &newFrame, sizeof(BRect));
|
0, &newFrame, sizeof(BRect));
|
||||||
if (bytesRead != sizeof(BRect))
|
if (bytesRead != sizeof(BRect))
|
||||||
return;
|
return;
|
||||||
@@ -404,7 +401,7 @@ StyledEditWindow::SaveAttrs()
|
|||||||
BRect frame(Frame());
|
BRect frame(Frame());
|
||||||
swap_data(B_RECT_TYPE, &frame, sizeof(BRect), B_SWAP_HOST_TO_BENDIAN);
|
swap_data(B_RECT_TYPE, &frame, sizeof(BRect), B_SWAP_HOST_TO_BENDIAN);
|
||||||
|
|
||||||
documentNode.WriteAttr(ATTRNAME_SE_INFO, B_RECT_TYPE, 0, &frame,
|
documentNode.WriteAttr(kInfoAttributeName, B_RECT_TYPE, 0, &frame,
|
||||||
sizeof(BRect));
|
sizeof(BRect));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user