зеркало из https://github.com/mozilla/pjs.git
internet keyword tooltip a:don
This commit is contained in:
Родитель
6eb2d7b8f3
Коммит
29a2a5eac6
|
@ -31,6 +31,9 @@
|
|||
#endif /* MOZ_MAIL_NEWS */
|
||||
#include "prefapi.h"
|
||||
#include "fmabstra.h"
|
||||
extern "C" {
|
||||
#include "httpurl.h"
|
||||
}
|
||||
|
||||
#ifdef DEBUG_WHITEBOX
|
||||
#include "qa.h"
|
||||
|
@ -337,7 +340,7 @@ MWContext *FE_CreateNewEditWindow(MWContext *pContext, URL_Struct *pURL) {
|
|||
// If there was no URL specified to load, load what's in the history.
|
||||
// Only take URLs from a browser window.
|
||||
if(pURL == NULL) {
|
||||
// Load the oldest thing in it's history (most likely the home page).
|
||||
// Load the oldest thing in its history (most likely the home page).
|
||||
XP_List *pOldest = SHIST_GetList(pNewContext);
|
||||
History_entry *pEntry = (History_entry *)XP_ListNextObject(pOldest);
|
||||
if(pEntry == NULL) {
|
||||
|
@ -704,7 +707,7 @@ void CFE_FreeEmbedElement(MWContext *pContext, LO_EmbedStruct *pEmbed) {
|
|||
extern "C" void
|
||||
FE_FreeFormElement(MWContext *pContext, LO_FormElementData *pFormElement)
|
||||
{
|
||||
// Get our front end form element, and have it do it's thang.
|
||||
// Get our front end form element, and have it do its thang.
|
||||
CFormElement *pFormClass = CFormElement::GetFormElement(NULL, pFormElement);
|
||||
if(pFormClass != NULL)
|
||||
pFormClass->FreeFormElement(pFormElement);
|
||||
|
@ -1184,6 +1187,13 @@ void CFE_GetUrlExitRoutine(URL_Struct *pUrl, int iStatus, MWContext *pContext)
|
|||
ABSTRACTCX(pContext)->GetUrlExitRoutine(pUrl, iStatus, pContext);
|
||||
|
||||
if(iStatus != MK_CHANGING_CONTEXT) {
|
||||
|
||||
if (pContext->type == MWContextBrowser && !EDT_IS_EDITOR(pContext)) {
|
||||
char keyword[64];
|
||||
NET_getInternetKeyword(pUrl, keyword, sizeof(keyword));
|
||||
ABSTRACTCX(pContext)->SetInternetKeyword(keyword);
|
||||
}
|
||||
|
||||
// We autoproduce a title for those contexts which have none.
|
||||
// Message compose window title is set by msglib. We don't want to overwrite
|
||||
// it here. - kamal
|
||||
|
@ -1505,4 +1515,4 @@ void CFE_FreeBuiltinElement(MWContext *context, LO_BuiltinStruct *builtin_struct
|
|||
{
|
||||
return;
|
||||
}
|
||||
#endif //SHACK
|
||||
#endif //SHACK
|
||||
|
|
|
@ -102,6 +102,7 @@ public:
|
|||
virtual void Back();
|
||||
virtual void Forward();
|
||||
virtual void ImageComplete(NI_Pixmap* image) {;}
|
||||
virtual void SetInternetKeyword(const char *keyword) {}
|
||||
virtual BITMAPINFO* NewPixmap(NI_Pixmap* pImage, BOOL mask = FALSE) { return NULL;}
|
||||
|
||||
|
||||
|
|
|
@ -4627,11 +4627,29 @@ void CWinCX::SetDocTitle(MWContext *pContext, char *pTitle)
|
|||
}
|
||||
}
|
||||
|
||||
/* accept a new internet keyword. keyword must be a null-terminated string,
|
||||
or null. null and zero-length strings are taken to mean "no keyword". */
|
||||
void CWinCX::SetInternetKeyword(const char *keyword) {
|
||||
|
||||
// Guard against the case where our window has gone away and the
|
||||
// closing of the window causes the stream to complete which
|
||||
// causes us to get back in here with a half torn down window
|
||||
if( GetDocumentContext() == NULL )
|
||||
return;
|
||||
|
||||
// Only if we're the main context
|
||||
if( GetFrame()->GetMainContext() == this ) {
|
||||
CURLBar *urlBar = (CURLBar *) GetFrame()->GetChrome()->GetToolbar(ID_LOCATION_TOOLBAR);
|
||||
if (urlBar)
|
||||
urlBar->SetToolTip(keyword);
|
||||
}
|
||||
}
|
||||
|
||||
void CWinCX::ClearView(MWContext *pContext, int iView) {
|
||||
// Call the base.
|
||||
CDCCX::ClearView(pContext, iView);
|
||||
|
||||
// Have the view erase it's background to clear.
|
||||
// Have the view erase its background to clear.
|
||||
RECT crClear;
|
||||
::SetRect(&crClear, 0, 0, (int) GetWidth(), (int) GetHeight());
|
||||
if(GetPane()) {
|
||||
|
@ -4800,7 +4818,7 @@ void CWinCX::DisplayEdge(MWContext *pContext, int iLocation, LO_EdgeStruct *pEdg
|
|||
pEdge->FE_Data = pNewEdge;
|
||||
}
|
||||
else {
|
||||
// Update the object's idea of it's owner in case layout is swapping objects on us,
|
||||
// Update the object's idea of its owner in case layout is swapping objects on us,
|
||||
// this in turn causes the edge to display in a possibly new location.
|
||||
((CGridEdge *)pEdge->FE_Data)->UpdateEdge(pEdge);
|
||||
}
|
||||
|
|
|
@ -438,6 +438,7 @@ public:
|
|||
virtual void AllConnectionsComplete(MWContext *pContext);
|
||||
virtual void UpdateStopState(MWContext *pContext);
|
||||
virtual void SetDocTitle(MWContext *pContext, char *pTitle);
|
||||
virtual void SetInternetKeyword(const char *keyword);
|
||||
virtual void ClearView(MWContext *pContext, int iView);
|
||||
virtual void CreateEmbedWindow(MWContext *pContext, NPEmbeddedApp *pApp);
|
||||
virtual void SaveEmbedWindow(MWContext *pContext, NPEmbeddedApp *pApp);
|
||||
|
|
|
@ -499,6 +499,11 @@ void CURLBar::UpdateFields( const char * msg )
|
|||
m_nTextStatus = TRUE;
|
||||
}
|
||||
|
||||
void CURLBar::SetToolTip(const char *pTip)
|
||||
{
|
||||
m_pBox->SetToolTip(pTip);
|
||||
}
|
||||
|
||||
void CURLBar::OnEditCopy()
|
||||
{
|
||||
m_pBox->Copy();
|
||||
|
@ -605,11 +610,13 @@ CEditWnd::~CEditWnd()
|
|||
KillTimer(m_idTimer);
|
||||
if (m_pComplete)
|
||||
free(m_pComplete);
|
||||
delete m_ToolTip;
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CEditWnd,CGenericEdit)
|
||||
ON_WM_TIMER()
|
||||
ON_WM_MOUSEMOVE()
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
|
@ -803,6 +810,27 @@ void CEditWnd::UrlCompletion()
|
|||
}
|
||||
}
|
||||
|
||||
void CEditWnd::SetToolTip(const char *inTipStr)
|
||||
{
|
||||
// no tooltip created, and no tooltip to set. ok fine.
|
||||
if (!m_ToolTip && (!inTipStr || !*inTipStr))
|
||||
return;
|
||||
|
||||
if (!m_ToolTip) {
|
||||
m_ToolTip = new CNSToolTip2();
|
||||
if (m_ToolTip) {
|
||||
m_ToolTip->Create(this, TTS_ALWAYSTIP);
|
||||
m_ToolTip->SetDelayTime(200);
|
||||
m_ToolTip->AddTool(this, "");
|
||||
}
|
||||
}
|
||||
if (m_ToolTip)
|
||||
if (!inTipStr || !*inTipStr)
|
||||
m_ToolTip->UpdateTipText("", this);
|
||||
else
|
||||
m_ToolTip->UpdateTipText(inTipStr, this);
|
||||
}
|
||||
|
||||
void CEditWnd::DrawCompletion(CString & cs, char * pszResult)
|
||||
{
|
||||
if (pszResult)
|
||||
|
@ -862,6 +890,17 @@ void CEditWnd::OnTimer( UINT nIDEvent )
|
|||
}
|
||||
}
|
||||
|
||||
void CEditWnd::OnMouseMove(UINT nFlags, CPoint point)
|
||||
{
|
||||
CGenericEdit::OnMouseMove(nFlags, point);
|
||||
|
||||
if (m_ToolTip) {
|
||||
m_ToolTip->Activate(TRUE);
|
||||
MSG msg = *(GetCurrentMessage());
|
||||
m_ToolTip->RelayEvent(&msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// CProxySurroundWnd
|
||||
|
||||
|
|
|
@ -32,16 +32,19 @@ protected:
|
|||
BOOL m_bRestart;
|
||||
char * m_pComplete;
|
||||
BOOL m_Scroll;
|
||||
CWnd* m_pBar;
|
||||
CWnd* m_pBar;
|
||||
CNSToolTip2 *m_ToolTip;
|
||||
|
||||
public:
|
||||
CEditWnd(CWnd* bar) { m_pBar = bar; m_idTimer = 0; m_bRestart = TRUE; m_pComplete = NULL; m_Scroll = FALSE; }
|
||||
CEditWnd(CWnd* bar) { m_pBar = bar; m_ToolTip = 0; m_idTimer = 0; m_bRestart = TRUE; m_pComplete = NULL; m_Scroll = FALSE; }
|
||||
~CEditWnd();
|
||||
void UrlCompletion(void);
|
||||
void DrawCompletion(CString & cs, char * pszResult);
|
||||
void SetToolTip(const char *inTipStr);
|
||||
virtual BOOL PreTranslateMessage ( MSG * msg );
|
||||
virtual LRESULT DefWindowProc( UINT message, WPARAM wParam, LPARAM lParam );
|
||||
virtual afx_msg void OnTimer( UINT nIDEvent );
|
||||
virtual afx_msg void OnTimer( UINT nIDEvent );
|
||||
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
|
||||
DECLARE_MESSAGE_MAP();
|
||||
};
|
||||
|
||||
|
@ -141,6 +144,7 @@ public:
|
|||
LPMWCONTEXT GetContext() const { return m_pIMWContext; }
|
||||
|
||||
void UpdateFields( const char * msg);
|
||||
void SetToolTip(const char * inTip);
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
|
|
Загрузка…
Ссылка в новой задаче