Redoing the Ender toolbar

This commit is contained in:
jfrancis%netscape.com 1998-09-18 01:22:28 +00:00
parent 238f96eccb
commit 180a8caacf
4 changed files with 40 additions and 35 deletions

View File

@ -382,7 +382,7 @@ void CEditorWindow::RegisterViewTypes()
RegisterClass_( CTarget);
RegisterClass_( CLineProp);
RegisterClass_( CFormattingToolBar);
RegisterClass_( CFormattingToolFloatView);
RegisterClass_( CHTMLAreaToolBar);
RegisterClass_( CToolbarPopup); // newer, better class?
RegisterClass_( CIconToolbarPopup); // newer, better class?

View File

@ -598,8 +598,9 @@ LPane* UFormElementFactory::MakeHTMLArea(
{
if (!formElem->element_data)
return nil;
CHyperScroller * theScroller = NULL;
CFormHTMLArea * theHTMLAreaView = NULL;
CHyperScroller *theScroller = NULL;
LView *theView = NULL;
CFormHTMLArea *theHTMLAreaView = NULL;
FontInfo fontInfo;
if (!HasFormWidget(formElem)) // If there is no form, create it
{
@ -609,12 +610,12 @@ LPane* UFormElementFactory::MakeHTMLArea(
LCommander::SetDefaultCommander(inHTMLView);
LView::SetDefaultView(inHTMLView);
theScroller = (CHyperScroller *)UReanimator::ReadObjects('PPob', formHTMLArea);
ThrowIfNil_(theScroller);
theScroller->FinishCreate();
theScroller->PutInside(inHTMLView);
theView = (LView *)UReanimator::ReadObjects('PPob', formHTMLArea);
ThrowIfNil_(theView);
theView->FinishCreate();
theView->PutInside(inHTMLView);
theHTMLAreaView = (CFormHTMLArea*)theScroller->FindPaneByID(formHTMLAreaID);
theHTMLAreaView = (CFormHTMLArea*)theView->FindPaneByID(formHTMLAreaID);
ThrowIfNil_(theHTMLAreaView);
URL_Struct* url = 0;
@ -638,21 +639,21 @@ LPane* UFormElementFactory::MakeHTMLArea(
short wantedWidth = htmlAreaData->cols * ::CharWidth('M') + 8;
short wantedHeight = htmlAreaData->rows * (fontInfo.ascent + fontInfo.descent + fontInfo.leading) + 8;
theScroller->ResizeFrameTo(wantedWidth + 16 + BigTextLeftIndent + BigTextRightIndent,
theView->ResizeFrameTo(wantedWidth + 16 + BigTextLeftIndent + BigTextRightIndent,
wantedHeight + 16 + BigTextTopIndent + BigTextBottomIndent,
FALSE);
// Set the default values.
ResetFormElement(formElem, FALSE, InitFE_Data((MWContext*)*inNSContext, formElem, theScroller, theHTMLAreaView, theHTMLAreaView));
ResetFormElement(formElem, FALSE, InitFE_Data((MWContext*)*inNSContext, formElem, theView, theHTMLAreaView, theHTMLAreaView));
theScroller->Show();
theView->Show();
}
else
{
theScroller = (CHyperScroller*)FEDATAPANE;
if (!theScroller)
theView = (LView*)FEDATAPANE;
if (!theView)
return NULL;
theHTMLAreaView = (CFormHTMLArea*)theScroller->FindPaneByID(formHTMLAreaID);
theHTMLAreaView = (CFormHTMLArea*)theView->FindPaneByID(formHTMLAreaID);
theHTMLAreaView->FocusDraw();
//
@ -665,12 +666,12 @@ LPane* UFormElementFactory::MakeHTMLArea(
}
SDimension16 size;
theScroller->GetFrameSize(size);
theView->GetFrameSize(size);
width = size.width + textLeftExtra + textRightExtra;;
height = size.height + textTopExtra + textBottomExtra;;
baseline = fontInfo.ascent + 2;
return theScroller;
return theView;
}
// Creates a button
@ -1956,8 +1957,7 @@ void UFormElementFactory::ResetFormElementData(
}
else
{
// moose: this is probably all wrong... revisit.
EDT_ReadFromBuffer( pContext, (XP_HUGE_CHAR_PTR)htmlAreaData->current_text );
EDT_SetDefaultHTML( pContext, (char*)(htmlAreaData->current_text) );
}
if ( redraw )
htmlEdit->Refresh();

View File

@ -814,26 +814,32 @@ Boolean CFormHTMLArea::ObeyCommand( CommandT inCommand, void *ioParam )
void CFormHTMLArea::BeTarget()
{
// I tried to do this stuff in FinishCreateSelf(), but the UReanimator class
// (which streams in these objects, including the tool windoid) is not
// reintrant. ugh.
LView *view = CFormattingToolFloatView::GetFloatingToolBar(this);
Assert_(view);
if (!mParagraphToolbarPopup)
{
// lazy initialization of pointers to toolbar controls
LView *view = GetSuperView(); // parent
view = view->GetSuperView(); // grandparent
view = view->GetSuperView(); // greatgrandparent
Assert_(view);
mParagraphToolbarPopup = (LGAPopup *)view->FindPaneByID( cmd_Paragraph_Hierarchical_Menu );
mSizeToolbarPopup = (LGAPopup *)view->FindPaneByID( cmd_Font_Size_Hierarchical_Menu );
mAlignToolbarPopup = (CPatternButtonPopup *)view->FindPaneByID( cmd_Align_Hierarchical_Menu );
mFontToolbarPopup = (CFontMenuPopup *)view->FindPaneByID( 'Font' );
mColorPopup = (CColorPopup *)view->FindPaneByID( 'Colr' );
CFormattingToolFloatView::ShowFormatFloatTool();
// implicit assumption that formatting controls are somewhere in the greatgrandparent view.
// if we switch around the formatting interface for htmlareas this code may need
// to be updated.
mParagraphToolbarPopup = (LGAPopup *)view->FindPaneByID( cmd_Paragraph_Hierarchical_Menu );
mSizeToolbarPopup = (LGAPopup *)view->FindPaneByID( cmd_Font_Size_Hierarchical_Menu );
mAlignToolbarPopup = (CPatternButtonPopup *)view->FindPaneByID( cmd_Align_Hierarchical_Menu );
mFontToolbarPopup = (CFontMenuPopup *)view->FindPaneByID( 'Font' );
mColorPopup = (CColorPopup *)view->FindPaneByID( 'Colr' );
// Also, tell the toolbar about us.
CHTMLAreaToolBar *toolbar = (CHTMLAreaToolBar *)view->FindPaneByID( 'ftfv' );
Assert_(toolbar);
toolbar->SetEditView(this);
}
inherited::BeTarget();
}
void CFormHTMLArea::DontBeTarget()
{
inherited::DontBeTarget();
CFormattingToolFloatView::HideFormatFloatTool();
}
#pragma mark == CFormList ==

View File

@ -336,7 +336,6 @@ public:
virtual Boolean ObeyCommand( CommandT inCommand, void *ioParam );
virtual void BeTarget();
virtual void DontBeTarget();
};