implement macfe of the encoding dialog

git-svn-id: svn://10.0.0.236/trunk@9247 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
clu%netscape.com
1998-09-03 21:34:40 +00:00
parent 86867b76dd
commit fd4b78e95d
5 changed files with 51 additions and 18 deletions

View File

@@ -3331,8 +3331,8 @@ void CEDParagraphContain::PrefsFromControls()
switch (fListStylePopup->GetValue()) {
case 1: list->iTagType = P_UNUM_LIST; break;
case 2: list->iTagType = P_NUM_LIST; break;
case 3: list->iTagType = P_DIRECTORY; break;
case 4: list->iTagType = P_MENU; break;
// case 3: list->iTagType = P_DIRECTORY; break;
// case 4: list->iTagType = P_MENU; break;
case 5: list->iTagType = P_DESC_LIST; break;
}
@@ -3410,8 +3410,8 @@ void CEDParagraphContain::ControlsFromPref()
switch (list->iTagType) {
case P_UNUM_LIST: fListStylePopup->SetValue(1); break;
case P_NUM_LIST: fListStylePopup->SetValue(2); break;
case P_DIRECTORY: fListStylePopup->SetValue(3); break;
case P_MENU: fListStylePopup->SetValue(4); break;
// case P_DIRECTORY: fListStylePopup->SetValue(3); break;
// case P_MENU: fListStylePopup->SetValue(4); break;
case P_DESC_LIST: fListStylePopup->SetValue(5); break;
default: fListStylePopup->SetValue(1); break; // assert?
}
@@ -3643,9 +3643,11 @@ void CEDLinkContain::Show()
void CEDLinkContain::Hide()
{
if ( *fLinkName )
XP_FREE( *fLinkName );
*fLinkName = fLinkedTextEdit->GetLongDescriptor();
if ( fLinkName )
{
XP_FREEIF( *fLinkName );
*fLinkName = fLinkedTextEdit->GetLongDescriptor();
}
CEditContain::Hide();
}

View File

@@ -376,7 +376,8 @@ public:
class CEditContain: public CEditorPrefContain, public LBroadcaster
{
public:
CEditContain(LStream* inStream): CEditorPrefContain( inStream ){ pExtra = NULL; }
CEditContain(LStream* inStream): CEditorPrefContain( inStream )
{ fContext = NULL; fLinkName = NULL; pExtra = NULL; } // initialize everything to NULL
~CEditContain(){ XP_FREEIF(pExtra); }
void SetContext(MWContext* context) {fContext = context;}

View File

@@ -248,18 +248,47 @@ void FE_FinishedSave( MWContext * /* pMWContext */, int /* status */, char * /*
{
}
ED_CharsetEncode FE_EncodingDialog( MWContext* pContext )
ED_CharsetEncode FE_EncodingDialog( MWContext* pContext, char *pCharset )
{
#if 0
switch (HandleModalDialog( EDITDLG_ENCODING, NULL, NULL ))
{
case ED_ENCODE_CANCEL: return ED_ENCODE_CANCEL;
case ED_ENCODE_CHANGE_CHARSET: return ED_ENCODE_CHANGE_CHARSET;
case ED_ENCODE_CHANGE_METATAG: return ED_ENCODE_CHANGE_METATAG;
}
#endif
StPrepareForDialog prepare;
StBlockingDialogHandler handler( EDITDLG_ENCODING, NULL );
LDialogBox* dialog = (LDialogBox *)handler.GetDialog();
LGARadioButton *change_charset = (LGARadioButton *)dialog->FindPaneByID( 'ccst' ); //radio button for Change Charset
LGARadioButton *change_metatag = (LGARadioButton *)dialog->FindPaneByID( 'cmta' ); //radio button for Change Meta-tag
LCaption *charset_capt = (LCaption *)dialog->FindPaneByID( 'cap1' );
LCaption *metatag_capt = (LCaption *)dialog->FindPaneByID( 'cap2' );
int iBufLen = 255;
char buf[256];
char *pCharsetMsg = NULL;
char *pMetatagMsg = NULL;
PR_snprintf(buf, iBufLen, "Convert the Current Page to \"%s\"", pCharset);
pCharsetMsg = PR_sprintf_append(pCharsetMsg, buf);
PR_snprintf(buf, iBufLen, "Change the Character Set Label to \"%s\"", pCharset);
pMetatagMsg = PR_sprintf_append(pMetatagMsg, buf);
change_charset->SetDescriptor ( (CStr255) pCharsetMsg );
change_metatag->SetDescriptor ( (CStr255) pMetatagMsg );
charset_capt->SetDescriptor ( (CStr255) XP_GetString(XP_EDT_CHARSET_CONVERT_PAGE) );
metatag_capt->SetDescriptor ( (CStr255) XP_GetString(XP_EDT_CHARSET_SET_METATAG) );
MessageT message;
do {
dialog->Show();
message = handler.DoDialog();
} while ( message == 0 || message == msg_ControlClicked );
// doesn't matter if the user merely switches between radio buttons (msg_ControlClicked)
// stop only when the message is msg_OK or msg_Cancel
return ED_ENCODE_CANCEL; // shouldn't get here...
switch (message)
{
case msg_OK:
if ( change_charset->GetValue() ) return ED_ENCODE_CHANGE_CHARSET;
else if ( change_metatag->GetValue() ) return ED_ENCODE_CHANGE_METATAG;
default: // only msg_Cancel should get here, since there is always one radio button selected at any given time
return ED_ENCODE_CANCEL;
}
}
// in xp_file.h

View File

@@ -828,6 +828,7 @@
#define EDITDLG_SAVE_BEFORE_QUIT 5109
#define EDITDLG_COPYRIGHT_WARNING 5110
#define EDITDLG_SAVE_BEFORE_BROWSE 5111
#define EDITDLG_ENCODING 5112
#define EDITDLG_UNKNOWN_TAG 5113
#define EDITDLG_TABLE 5116
#define EDITDLG_PUBLISH 5117