From fc8169360fc1769242136b575ca126d139ba1224 Mon Sep 17 00:00:00 2001 From: "ramiro%netscape.com" Date: Mon, 12 Oct 1998 14:28:42 +0000 Subject: [PATCH] Move getStringFromResource() to XFE_RDFUtils. --- cmd/xfe/src/RDFMenuToolbarBase.cpp | 20 -------------------- cmd/xfe/src/RDFMenuToolbarBase.h | 1 - cmd/xfe/src/RDFToolbar.cpp | 21 ++++++++++++++------- cmd/xfe/src/RDFUtils.cpp | 17 +++++++++++++++++ cmd/xfe/src/RDFUtils.h | 4 ++++ 5 files changed, 35 insertions(+), 28 deletions(-) diff --git a/cmd/xfe/src/RDFMenuToolbarBase.cpp b/cmd/xfe/src/RDFMenuToolbarBase.cpp index a57ce930eb96..f69a7825c0ee 100644 --- a/cmd/xfe/src/RDFMenuToolbarBase.cpp +++ b/cmd/xfe/src/RDFMenuToolbarBase.cpp @@ -1111,26 +1111,6 @@ XFE_RDFMenuToolbarBase::setItemLabelString(Widget item,HT_Resource entry) } } ////////////////////////////////////////////////////////////////////////// - -XmString -XFE_RDFMenuToolbarBase::getStringFromResource(HT_Resource entry) -{ - - XmString xmname; - - XP_ASSERT( entry != NULL ); - - MWContext * context = _frame->getContext(); - INTL_CharSetInfo charSetInfo = - LO_GetDocumentCharacterSetInfo(context); - - // Create am XmString from the entry - xmname = XFE_RDFUtils::entryToXmString(entry, charSetInfo); - - return(xmname); - -} -////////////////////////////////////////////////////////////////////////// void XFE_RDFMenuToolbarBase::getStyleAndLayout(HT_Resource entry, int32 * toolbar_style, unsigned char * layout) { diff --git a/cmd/xfe/src/RDFMenuToolbarBase.h b/cmd/xfe/src/RDFMenuToolbarBase.h index ee9d0e574ed4..cbb5a16b53cf 100644 --- a/cmd/xfe/src/RDFMenuToolbarBase.h +++ b/cmd/xfe/src/RDFMenuToolbarBase.h @@ -145,7 +145,6 @@ protected: XP_Bool getOnlyHeaders (); void setItemLabelString (Widget menu, HT_Resource entry); - XmString getStringFromResource(HT_Resource ); void getStyleAndLayout(HT_Resource , int32 *, unsigned char * ); // Item callbacks diff --git a/cmd/xfe/src/RDFToolbar.cpp b/cmd/xfe/src/RDFToolbar.cpp index f34b041a5904..3a3382da090b 100644 --- a/cmd/xfe/src/RDFToolbar.cpp +++ b/cmd/xfe/src/RDFToolbar.cpp @@ -24,6 +24,7 @@ #include "RDFToolbar.h" #include "Logo.h" #include "MozillaApp.h" +#include "RDFUtils.h" #include "prefapi.h" #include "felocale.h" @@ -655,8 +656,11 @@ XFE_RDFToolbar::tooltipCB(Widget w, XtPointer client_data, XmString * string_ret *string_return = str; *need_to_free_string = True; } - else { - *string_return = obj->getStringFromResource(entry); + else + { + MWContext * context = (obj->getFrame())->getContext(); + + *string_return = XFE_RDFUtils::getStringFromResource(context,entry); *need_to_free_string = True; } @@ -692,12 +696,15 @@ XFE_RDFToolbar::docStringSetCB(Widget w, XtPointer client_data, XmString * strin *string_return = str; *need_to_free_string = True; } - else { + else + { + + Boolean isContainer = HT_IsContainer(entry); + MWContext * context = (obj->getFrame())->getContext(); + + *string_return = XFE_RDFUtils::getStringFromResource(context,entry); - Boolean isContainer = HT_IsContainer(entry); - - *string_return = obj->getStringFromResource(entry); - *need_to_free_string = True; + *need_to_free_string = True; } } diff --git a/cmd/xfe/src/RDFUtils.cpp b/cmd/xfe/src/RDFUtils.cpp index eb26447f6f68..454d5972123c 100644 --- a/cmd/xfe/src/RDFUtils.cpp +++ b/cmd/xfe/src/RDFUtils.cpp @@ -369,3 +369,20 @@ XFE_RDFUtils::formatItem(HT_Resource entry,int16 charset) return (xmstring); } ////////////////////////////////////////////////////////////////////////// +/* static */ XmString +XFE_RDFUtils::getStringFromResource(MWContext * context, + HT_Resource entry) +{ + XmString xmname; + + XP_ASSERT( context != NULL ); + XP_ASSERT( entry != NULL ); + + INTL_CharSetInfo charSetInfo = LO_GetDocumentCharacterSetInfo(context); + + // Create am XmString from the entry + xmname = XFE_RDFUtils::entryToXmString(entry, charSetInfo); + + return xmname; +} +////////////////////////////////////////////////////////////////////////// diff --git a/cmd/xfe/src/RDFUtils.h b/cmd/xfe/src/RDFUtils.h index 75d8deb151f2..9bf590141bb5 100644 --- a/cmd/xfe/src/RDFUtils.h +++ b/cmd/xfe/src/RDFUtils.h @@ -95,6 +95,10 @@ public: static XmString entryToXmString (HT_Resource entry, INTL_CharSetInfo char_set_info); + + static XmString getStringFromResource (MWContext * context, + HT_Resource entry); + }; #endif // _xfe_rdf_utils_h_