зеркало из https://github.com/mozilla/gecko-dev.git
Redoing Ender toolbar
This commit is contained in:
Родитель
f9e7accc3b
Коммит
3dbadee7e4
|
@ -128,6 +128,7 @@ public:
|
|||
virtual void PutOnDuty(LCommander*);
|
||||
|
||||
Bool PtInSelectedRegion(SPoint32 cpPoint );
|
||||
virtual Boolean EstablishPort();
|
||||
virtual void DrawSelf( void );
|
||||
virtual void ActivateSelf();
|
||||
virtual void DeactivateSelf();
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "resgui.h" // cmd_FormatViewerFont, cmd_FormatFixedFont, FONT_MENU_BASE
|
||||
#include "macutil.h" // CMediatedWindow
|
||||
#include "edt.h"
|
||||
#include "mforms.h"
|
||||
|
||||
|
||||
|
||||
|
@ -47,16 +48,28 @@ MWContext *CFontMenuAttachment::GetTopWindowContext()
|
|||
CWindowIterator iter(WindowType_Any);
|
||||
iter.Next(topWin);
|
||||
|
||||
if (topWin == NULL
|
||||
|| ! (topWin->GetWindowType() == WindowType_Editor || topWin->GetWindowType() == WindowType_Compose) )
|
||||
return NULL;
|
||||
if (topWin == NULL) return NULL;
|
||||
|
||||
CEditView *editView = (CEditView *)(topWin->FindPaneByID(CEditView::pane_ID));
|
||||
if (topWin->GetWindowType() == WindowType_Editor || topWin->GetWindowType() == WindowType_Compose)
|
||||
{
|
||||
CEditView *editView = (CEditView *)(topWin->FindPaneByID(CEditView::pane_ID));
|
||||
|
||||
if (editView == NULL || editView->GetNSContext() == NULL)
|
||||
return NULL;
|
||||
|
||||
return editView->GetNSContext()->operator MWContext*();
|
||||
}
|
||||
else if (topWin->GetWindowType() == WindowType_Browser)
|
||||
{
|
||||
// we're in a browser window, so check for an htmlarea that has the focus
|
||||
LCommander *com = LCommander::GetTarget();
|
||||
CFormHTMLArea *ender = dynamic_cast<CFormHTMLArea*>(com);
|
||||
|
||||
if (editView == NULL || editView->GetNSContext() == NULL)
|
||||
return NULL;
|
||||
if (!ender) return NULL;
|
||||
|
||||
return editView->GetNSContext()->operator MWContext*();
|
||||
return ender->GetNSContext()->operator MWContext*();
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -124,63 +124,28 @@ void CFormattingToolBar::ListenToMessage( MessageT inMessage, void* ioParam )
|
|||
}
|
||||
|
||||
#ifdef ENDER
|
||||
LWindow* CFormattingToolFloatView::mFormatToolWin = 0;
|
||||
|
||||
// CFormattingToolFloatView is just a CFormattingToolBar for <htmlarea>
|
||||
// form widgets. CFormattingToolFloatView lives in a floating window
|
||||
// instead of in a toolbar in the browser window.
|
||||
// CHTMLAreaToolBar is just a CFormattingToolBar for <htmlarea>
|
||||
// form widgets.
|
||||
|
||||
CFormattingToolFloatView::CFormattingToolFloatView(LStream * inStream)
|
||||
CHTMLAreaToolBar::CHTMLAreaToolBar(LStream * inStream)
|
||||
: CFormattingToolBar(inStream)
|
||||
{
|
||||
mEditView = NULL;
|
||||
}
|
||||
|
||||
CFormattingToolFloatView::~CFormattingToolFloatView()
|
||||
CHTMLAreaToolBar::~CHTMLAreaToolBar()
|
||||
{
|
||||
}
|
||||
|
||||
void CFormattingToolFloatView::FinishCreateSelf()
|
||||
void CHTMLAreaToolBar::FinishCreateSelf()
|
||||
{
|
||||
UReanimator::LinkListenerToControls(this, this, 11616);
|
||||
UReanimator::LinkListenerToControls(this, this, 11617);
|
||||
}
|
||||
|
||||
void CFormattingToolFloatView::SetEditView(CEditView* inEditView)
|
||||
void CHTMLAreaToolBar::SetEditView(CEditView* inEditView)
|
||||
{
|
||||
mEditView = inEditView;
|
||||
}
|
||||
|
||||
// GetFloatingToolBar() [ static ]
|
||||
// lazy construction of floating formatting tool bar for Ender done here.
|
||||
CFormattingToolFloatView* CFormattingToolFloatView::GetFloatingToolBar(CEditView* inEditView)
|
||||
{
|
||||
if (!mFormatToolWin)
|
||||
{
|
||||
// time to build the floating formatting tool windoid
|
||||
mFormatToolWin = (URobustCreateWindow::CreateWindow(
|
||||
CFormattingToolFloatView::mToolWinResID,
|
||||
LCommander::GetTopCommander() ));
|
||||
// sanity check
|
||||
if (!mFormatToolWin) return 0;
|
||||
}
|
||||
CFormattingToolFloatView *theView =
|
||||
(CFormattingToolFloatView*)(mFormatToolWin->FindPaneByID( CFormattingToolFloatView::pane_ID ));
|
||||
Assert_(theView);
|
||||
theView->SetEditView(inEditView);
|
||||
return theView;
|
||||
}
|
||||
|
||||
// ShowFormatFloatTool() [ static ]
|
||||
// tool bar revealed - this is called from CHTMLView::BeTarget()
|
||||
void CFormattingToolFloatView::ShowFormatFloatTool()
|
||||
{
|
||||
if (mFormatToolWin) mFormatToolWin->Show();
|
||||
}
|
||||
|
||||
// HideFormatFloatTool() [ static ]
|
||||
// tool bar hidden - this is called from CHTMLView::DontBeTarget()
|
||||
void CFormattingToolFloatView::HideFormatFloatTool()
|
||||
{
|
||||
if (mFormatToolWin) mFormatToolWin->Hide();
|
||||
}
|
||||
#endif // ENDER
|
|
@ -41,22 +41,15 @@ protected:
|
|||
};
|
||||
|
||||
#ifdef ENDER
|
||||
class CFormattingToolFloatView : public CFormattingToolBar
|
||||
class CHTMLAreaToolBar : public CFormattingToolBar
|
||||
{
|
||||
public:
|
||||
enum { pane_ID = 'ftfv', class_ID = 'FoTV', mToolWinResID = 5252 };
|
||||
CFormattingToolFloatView(LStream * inStream);
|
||||
~CFormattingToolFloatView();
|
||||
enum { pane_ID = 'ftfv', class_ID = 'FoTV' };
|
||||
CHTMLAreaToolBar(LStream * inStream);
|
||||
~CHTMLAreaToolBar();
|
||||
|
||||
virtual void FinishCreateSelf();
|
||||
void SetEditView(CEditView* inEditView);
|
||||
|
||||
static CFormattingToolFloatView* GetFloatingToolBar(CEditView* inEditView);
|
||||
static void ShowFormatFloatTool();
|
||||
static void HideFormatFloatTool();
|
||||
|
||||
protected:
|
||||
|
||||
static LWindow* mFormatToolWin;
|
||||
};
|
||||
#endif // ENDER
|
Загрузка…
Ссылка в новой задаче