зеркало из https://github.com/mozilla/pjs.git
view menu reflects configurable toolbar state
This commit is contained in:
Родитель
8872b96d2f
Коммит
86c510f45c
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,367 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
#ifndef _CSTTLBR2_H
|
||||
#define _CSTTLBR2_H
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "toolbar2.h"
|
||||
#include "animbar2.h"
|
||||
|
||||
#define CT_HIDETOOLBAR (WM_USER + 15)
|
||||
#define CT_DRAGTOOLBAR (WM_USER + 16)
|
||||
#define CT_DRAGTOOLBAR_OVER (WM_USER + 17)
|
||||
#define CT_CUSTOMIZE (WM_USER + 18)
|
||||
#define IDC_COLLAPSE (WM_USER + 19)
|
||||
|
||||
|
||||
typedef enum {eLARGE_HTAB, eSMALL_HTAB} HTAB_BITMAP;
|
||||
|
||||
class CCustToolbar;
|
||||
|
||||
#ifdef XP_WIN16
|
||||
|
||||
class CNetscapeControlBar : public CControlBar {
|
||||
|
||||
protected:
|
||||
|
||||
virtual LRESULT WindowProc(UINT nMsg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
// Class: CToolbarWindow
|
||||
//
|
||||
// The window that resides within the Tabbed toolbar. It holds the toolbar
|
||||
// passed in by the user of the customizable toolbar
|
||||
|
||||
class CToolbarWindow {
|
||||
|
||||
protected:
|
||||
CWnd *m_pToolbar; // the toolbar we're storing
|
||||
int m_nNoviceHeight; // the height when in novice mode
|
||||
int m_nAdvancedHeight; // the height when in advanced mode
|
||||
int m_nToolbarStyle; // is this pictures and text, pictures, or text
|
||||
HTAB_BITMAP m_nHTab; // Type of horizontal tab
|
||||
|
||||
public:
|
||||
CToolbarWindow(CWnd *pToolbar, int nToolbarStyle, int nNoviceHeight, int nAdvancedHeight,
|
||||
HTAB_BITMAP nHTab);
|
||||
~CToolbarWindow();
|
||||
CWnd *GetToolbar(void);
|
||||
|
||||
virtual CWnd* GetNSToolbar() { return NULL; }
|
||||
|
||||
// if bWindowHeight is TRUE then use toolbar's height, if FALSE use passed in height
|
||||
virtual int GetHeight(void);
|
||||
int GetNoviceHeight(void) { return m_nNoviceHeight; }
|
||||
int GetAdvancedHeight(void) { return m_nAdvancedHeight; }
|
||||
|
||||
virtual void SetToolbarStyle(int nToolbarStyle) { m_nToolbarStyle = nToolbarStyle;}
|
||||
int GetToolbarStyle(void) { return m_nToolbarStyle; }
|
||||
|
||||
HTAB_BITMAP GetHTab(void) { return m_nHTab; }
|
||||
|
||||
virtual void OnUpdateCmdUI( CFrameWnd* pTarget, BOOL bDisableIfNoHndler ){}
|
||||
virtual void UpdateURLBars(char* url) {}
|
||||
};
|
||||
|
||||
// Class: CButtonToolbarWindow
|
||||
//
|
||||
// The window that resides within the Tabbed toolbar. It MUST hold a CNSToolbar2.
|
||||
class CButtonToolbarWindow: public CToolbarWindow {
|
||||
|
||||
public:
|
||||
CButtonToolbarWindow(CWnd *pToolbar, int nToolbarStyle, int nNoviceHeight, int nAdvancedHeight,
|
||||
HTAB_BITMAP nHTab);
|
||||
|
||||
virtual void OnUpdateCmdUI( CFrameWnd* pTarget, BOOL bDisableIfNoHndler );
|
||||
virtual void UpdateURLBars(char* url);
|
||||
virtual void SetToolbarStyle(int nToolbarStyle);
|
||||
virtual int GetHeight(void);
|
||||
virtual CWnd* GetNSToolbar() { return GetToolbar(); }
|
||||
|
||||
|
||||
};
|
||||
|
||||
// Class: // Class: CControlBarToolbarWindow
|
||||
//
|
||||
// The window that resides within the Tabbed toolbar. It does not hold a CNSToolbar2.
|
||||
class CControlBarToolbarWindow: public CToolbarWindow {
|
||||
|
||||
public:
|
||||
CControlBarToolbarWindow(CWnd *pToolbar, int nToolbarStyle, int nNoviceHeight, int nAdvancedHeight,
|
||||
HTAB_BITMAP nHTab);
|
||||
|
||||
virtual void OnUpdateCmdUI( CFrameWnd* pTarget, BOOL bDisableIfNoHndler );
|
||||
virtual int GetHeight(void);
|
||||
};
|
||||
|
||||
|
||||
|
||||
class CDragToolbar : public CWnd {
|
||||
|
||||
protected:
|
||||
CToolbarWindow * m_pToolbar;
|
||||
BOOL m_bIsOpen;
|
||||
BOOL m_bIsShowing;
|
||||
CPoint m_mouseDownPoint;
|
||||
BOOL m_bDragging;
|
||||
BOOL m_bMouseDown;
|
||||
UINT m_nDragTimer;
|
||||
BOOL m_bMouseInTab;
|
||||
UINT m_nTabFocusTimer;
|
||||
CAnimationBar2* m_pAnimation;
|
||||
HTAB_BITMAP m_eHTabType;
|
||||
BOOL m_bEraseBackground;
|
||||
CString m_tabTip;
|
||||
int m_nToolID;
|
||||
CNSToolTip2 m_toolTip;
|
||||
UINT m_nToolbarID;
|
||||
public:
|
||||
CDragToolbar();
|
||||
~CDragToolbar();
|
||||
virtual int Create(CWnd *pParent, CToolbarWindow *pToolbar);
|
||||
|
||||
virtual BOOL ShouldClipChildren() { return TRUE; }
|
||||
|
||||
CWnd *GetToolbar(void);
|
||||
int GetToolbarHeight(void);
|
||||
int GetMouseOffsetWithinToolbar(void) { return m_mouseDownPoint.y; }
|
||||
void SetMouseOffsetWithinToolbar(int y) { m_mouseDownPoint.y = y; }
|
||||
void SetShowing(BOOL bIsShowing) { m_bIsShowing = bIsShowing; }
|
||||
BOOL GetShowing(void) { return m_bIsShowing; }
|
||||
virtual void SetOpen(BOOL bIsOpen);
|
||||
BOOL GetOpen(void) { return m_bIsOpen;}
|
||||
void SetTabTip(CString tabTip);
|
||||
CString &GetTabTip (void) { return m_tabTip; }
|
||||
void SetToolID(int nToolID) { m_nToolID = nToolID; }
|
||||
int GetToolID(void) { return m_nToolID; }
|
||||
void SetToolbarID(int nToolbarID) {m_nToolbarID = nToolbarID;}
|
||||
UINT GetToolbarID(void) { return m_nToolbarID;}
|
||||
void SetToolbarStyle(int nToolbarStyle);
|
||||
virtual void BeActiveToolbar() {}
|
||||
void SetAnimation(CAnimationBar2 *pAnimation);
|
||||
HTAB_BITMAP GetHTabType(void) { return m_eHTabType;}
|
||||
void OnUpdateCmdUI( CFrameWnd* pTarget, BOOL bDisableIfNoHndler );
|
||||
virtual void UpdateURLBars(char* url);
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CDragToolbar)
|
||||
afx_msg void OnSize( UINT nType, int cx, int cy );
|
||||
afx_msg void OnPaint(void);
|
||||
afx_msg void OnShowWindow( BOOL bShow, UINT nStatus );
|
||||
afx_msg BOOL OnEraseBkgnd( CDC* pDC );
|
||||
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
|
||||
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
|
||||
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
|
||||
virtual afx_msg void OnTimer( UINT nIDEvent );
|
||||
afx_msg void OnPaletteChanged( CWnd* pFocusWnd );
|
||||
afx_msg void OnSysColorChange();
|
||||
//}}AFX_MSG
|
||||
|
||||
|
||||
private:
|
||||
void ArrangeToolbar(int nWidth, int nHeight);
|
||||
void StopDragging(void);
|
||||
void CheckIfMouseInTab(CPoint point);
|
||||
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
|
||||
};
|
||||
|
||||
class CCustToolbarExternalTab {
|
||||
|
||||
private:
|
||||
CWnd * m_pOwner;
|
||||
HTAB_BITMAP m_eHTabType;
|
||||
CString m_tabTip;
|
||||
int m_nToolID;
|
||||
UINT m_nTabID;
|
||||
|
||||
public:
|
||||
CCustToolbarExternalTab(CWnd *pOwner, HTAB_BITMAP eHTabType, UINT nTipID, UINT nTabID);
|
||||
|
||||
CWnd *GetOwner(void);
|
||||
HTAB_BITMAP GetHTabType(void);
|
||||
CString &GetTabTip (void);
|
||||
void SetToolID(int nToolID) { m_nToolID = nToolID; }
|
||||
int GetToolID(void) { return m_nToolID; }
|
||||
UINT GetTabID(void);
|
||||
|
||||
|
||||
};
|
||||
|
||||
class CRDFToolbar;
|
||||
|
||||
class CCustToolbar : public CControlBar {
|
||||
|
||||
protected:
|
||||
CFrameWnd * m_pParent;
|
||||
CDragToolbar** m_pToolbarArray;
|
||||
CDragToolbar** m_pHiddenToolbarArray;
|
||||
int m_nNumToolbars;
|
||||
int m_nActiveToolbars;
|
||||
CAnimationBar2* m_pAnimation; //The Netscape Icon Animation
|
||||
int m_nAnimationPos;
|
||||
int m_nNumOpen;
|
||||
int m_nNumShowing;
|
||||
CPoint m_oldDragPoint;
|
||||
HBITMAP m_pHorizTabArray[4];
|
||||
BOOL m_bEraseBackground;
|
||||
CNSToolTip2 m_toolTip;
|
||||
BOOL m_bSaveToolbarInfo; // Do we save toolbar state
|
||||
UINT m_nTabHaveFocusTimer;
|
||||
int m_nMouseOverTab;
|
||||
CPtrArray m_externalTabArray;
|
||||
BOOL m_bBottomBorder;
|
||||
|
||||
enum HORIZTAB {LARGE_FIRST, LARGE_OTHER, SMALL_FIRST, SMALL_OTHER};
|
||||
|
||||
public:
|
||||
|
||||
//Construction/destruction
|
||||
CCustToolbar(int nNumToolbars);
|
||||
virtual ~CCustToolbar();
|
||||
|
||||
//Creation
|
||||
int Create(CFrameWnd* pParent, BOOL bHasAnimation);
|
||||
|
||||
void RemoveToolbarAtIndex(int index);
|
||||
|
||||
void AddNewWindowAtIndex(UINT nToolbarID, CToolbarWindow* pWindow, int nPosition, int nNoviceHeight, int nAdvancedHeight,
|
||||
UINT nTabBitmapIndex, CString tabTip, BOOL bIsNoviceMode);
|
||||
|
||||
inline void AddNewWindow(UINT nToolbarID, CToolbarWindow* pWindow, int nPosition, int nNoviceHeight, int nAdvancedHeight,
|
||||
UINT nTabBitmapIndex, CString tabTip, BOOL bIsNoviceMode, BOOL bIsOpen, BOOL bIsAnimation)
|
||||
{ AddNewWindowGuts(nToolbarID, pWindow, nPosition, tabTip, TRUE, bIsOpen); }
|
||||
inline void AddNewWindow(UINT nToolbarID, CToolbarWindow* pWindow, int nPosition, int nNoviceHeight, int nAdvancedHeight,
|
||||
UINT nTabBitmapIndex, CString tabTip, BOOL bIsNoviceMode, BOOL bIsAnimation)
|
||||
{ AddNewWindowGuts(nToolbarID, pWindow, nPosition, tabTip, FALSE, FALSE); }
|
||||
|
||||
// Call this function when you are finished adding the toolbars that go in the
|
||||
// customizable toolbar.
|
||||
void FinishedAddingNewWindows(void){}
|
||||
|
||||
CDragToolbar** GetVisibleToolbarArray() { return m_pToolbarArray; };
|
||||
|
||||
//Controlling the animated icon
|
||||
void StopAnimation();
|
||||
void StartAnimation();
|
||||
void SetToolbarStyle(int nToolbarStyle);
|
||||
void BeActiveToolbar();
|
||||
|
||||
BOOL IsWindowShowing(CWnd *pToolbar);
|
||||
BOOL IsWindowShowing(UINT nToolbarID);
|
||||
|
||||
BOOL IsWindowIconized(CWnd *pToolbar);
|
||||
int GetWindowPosition(CWnd *pToolbar);
|
||||
|
||||
void ShowToolbar(CWnd *pToolbar, BOOL bShow);
|
||||
void ShowToolbar(UINT nToolbarID, BOOL bShow);
|
||||
|
||||
void RenameToolbar(UINT nOldID, UINT nNewID, UINT nNewToolTipID);
|
||||
|
||||
CWnd *GetToolbar(UINT nToolbarID);
|
||||
|
||||
//Positioning/Resizing
|
||||
CSize CalcDynamicLayout(int nLength, DWORD dwMode );
|
||||
|
||||
virtual void OnUpdateCmdUI( CFrameWnd* pTarget, BOOL bDisableIfNoHndler );
|
||||
virtual void UpdateURLBars(char* url);
|
||||
|
||||
void Customize(CRDFToolbar *pRDFToolbar = NULL, int nSelectedButton = 0);
|
||||
BOOL GetSaveToolbarInfo(void);
|
||||
void SetSaveToolbarInfo(BOOL bSaveToolbarInfo);
|
||||
void SetNewParentFrame(CFrameWnd *pParent);
|
||||
|
||||
// Adding an external tab will cause the customizable toolbar to display
|
||||
// a tab of eHTabType in iconized form. If that tab is clicked, the tab
|
||||
// will be removed and a message will be sent to pOwner that the hidden
|
||||
// window should now be shown.
|
||||
void AddExternalTab(CWnd *pOwner, HTAB_BITMAP eHTabType, UINT nTipID, UINT nTabID);
|
||||
// Removing this tab will cause it to no longer be drawn and mouse clicks will no longer
|
||||
// be sent to pOwner.
|
||||
void RemoveExternalTab(UINT nTabID);
|
||||
|
||||
void SetBottomBorder(BOOL bBottomBorder);
|
||||
|
||||
int FindDragToolbarFromWindow(CWnd *pWindow, CDragToolbar **pToolbarArray);
|
||||
int FindDragToolbarFromID(UINT nToolbarID, CDragToolbar **pToolbarArray);
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CCustToolbar)
|
||||
afx_msg void OnSize( UINT nType, int cx, int cy );
|
||||
afx_msg void OnPaint(void);
|
||||
afx_msg void OnShowWindow( BOOL bShow, UINT nStatus );
|
||||
afx_msg BOOL OnEraseBkgnd( CDC* pDC );
|
||||
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
|
||||
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
|
||||
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
|
||||
afx_msg LRESULT OnHideToolbar(WPARAM, LPARAM);
|
||||
afx_msg LRESULT OnDragToolbar(WPARAM, LPARAM);
|
||||
afx_msg LRESULT OnDragToolbarOver(WPARAM wParam, LPARAM lParam);
|
||||
afx_msg LRESULT CCustToolbar::OnCustomize(WPARAM wParam, LPARAM lParam);
|
||||
#ifndef WIN32
|
||||
afx_msg LRESULT OnSizeParent(WPARAM wParam, LPARAM lParam);
|
||||
#endif
|
||||
virtual afx_msg void OnTimer( UINT nIDEvent );
|
||||
afx_msg void OnPaletteChanged( CWnd* pFocusWnd );
|
||||
|
||||
//}}AFX_MSG
|
||||
|
||||
protected:
|
||||
// virtual BOOL OnNotify( WPARAM wParam, LPARAM lParam, LRESULT* pResult );
|
||||
|
||||
void AddNewWindowGuts(UINT nToolbarID, CToolbarWindow* pWindow, int nPosition,
|
||||
CString tabTip, BOOL bForceOpen, BOOL bIsOpen);
|
||||
int CheckOpenButtons(CPoint point);
|
||||
int CheckClosedButtons(CPoint point);
|
||||
BOOL PointInClosedTab(CPoint point, HTAB_BITMAP tabType, int nNumClosedButtons, int nStartX,
|
||||
int nBottom);
|
||||
virtual void DrawSeparator(int i, HDC hDC, int nStartX, int nEndX, int nStartY, BOOL bToolbarSeparator = TRUE);
|
||||
void SwitchChildren(CDragToolbar *pOriginal, CDragToolbar *pSwitch, int dir, int yPoint);
|
||||
int FindIndex(CDragToolbar *pToolbar);
|
||||
CDragToolbar *FindToolbarFromPoint(CPoint point, CDragToolbar *pIgnore);
|
||||
int FindFirstShowingToolbar(int nIndex);
|
||||
HBITMAP GetClosedButtonBitmap(HTAB_BITMAP tabType, int nNumClosedButtons);
|
||||
int GetNextClosedButtonX(HTAB_BITMAP tabType, int nNumClosedButtons, int nClosedStartX);
|
||||
void GetClosedButtonRegion(HTAB_BITMAP tabType, int nNumClosedButtons, CRgn &rgn);
|
||||
HBITMAP CreateHorizTab(UINT nID);
|
||||
void ShowDragToolbar(int nIndex, BOOL bShow);
|
||||
void OpenDragToolbar(int nIndex);
|
||||
void OpenExternalTab(int nIndex);
|
||||
void CheckAnimationChangedToolbar(CDragToolbar *pToolbar, int nIndex, BOOL bOpen);
|
||||
void ChangeToolTips(int nHeight);
|
||||
void FindToolRect(CRect & toolRect, HTAB_BITMAP eTabType, int nStartX, int nStartY, int nButtonNum);
|
||||
int FindFirstAvailablePosition(void);
|
||||
void DrawClosedTab(HDC hCompatibleDC, HDC hDestDC, HTAB_BITMAP tabType, int nNumClosedButtons,
|
||||
BOOL bMouseOver, int nStartX, int nBottom);
|
||||
|
||||
virtual CDragToolbar* CreateDragBar();
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
|
@ -1,959 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
// mainfrm.cpp : implementation of the CMainFrame class
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "dialog.h"
|
||||
#include "mainfrm.h"
|
||||
#include "netsvw.h"
|
||||
#include "toolbar.cpp"
|
||||
#include "usertlbr.h"
|
||||
#include "urlbar.h"
|
||||
#include "prefapi.h"
|
||||
#include "csttlbr2.h"
|
||||
#include "prefinfo.h"
|
||||
#include "libevent.h"
|
||||
#include "navfram.h"
|
||||
#include "edview.h"
|
||||
#include "vocab.h"
|
||||
|
||||
#ifdef ENDER
|
||||
#include "editfloat.h"
|
||||
#include "edframe.h" //for the WM_TOOLBARCONTROLER define
|
||||
#endif //ENDER
|
||||
|
||||
#ifdef _DEBUG
|
||||
#undef THIS_FILE
|
||||
static char BASED_CODE THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CMainFrame
|
||||
|
||||
#ifndef _AFXDLL
|
||||
#undef new
|
||||
#endif
|
||||
IMPLEMENT_DYNCREATE(CMainFrame, CGenericFrame)
|
||||
#ifndef _AFXDLL
|
||||
#define new DEBUG_NEW
|
||||
#endif
|
||||
|
||||
const UINT NEAR msg_RegistrationComplete = RegisterWindowMessage("NetscapeRegistrationComplete");
|
||||
const UINT NEAR msg_AbortRegistration = RegisterWindowMessage("NetscapeAbortRegistration");
|
||||
|
||||
#define FILEMENU 0
|
||||
#define EDITMENU 1
|
||||
#define VIEWMENU 2
|
||||
#define GOMENU 3
|
||||
|
||||
BEGIN_MESSAGE_MAP(CMainFrame, CGenericFrame)
|
||||
//{{AFX_MSG_MAP(CMainFrame)
|
||||
ON_WM_INITMENUPOPUP()
|
||||
ON_WM_MENUSELECT()
|
||||
ON_WM_SHOWWINDOW()
|
||||
ON_WM_ACTIVATE()
|
||||
ON_COMMAND(ID_OPTIONS_TITLELOCATION_BAR, OnOptionsTitlelocationBar)
|
||||
ON_UPDATE_COMMAND_UI(ID_OPTIONS_TITLELOCATION_BAR, OnUpdateOptionsTitlelocationBar)
|
||||
ON_WM_TIMER()
|
||||
ON_WM_WINDOWPOSCHANGED()
|
||||
ON_WM_CREATE()
|
||||
ON_WM_DESTROY()
|
||||
ON_COMMAND(ID_OPTIONS_TOGGLENETDEBUG, OnOptionsTogglenetdebug)
|
||||
ON_COMMAND(ID_OPTIONS_TOGGLEPROFILE, OnOptionsToggleProfile)
|
||||
ON_UPDATE_COMMAND_UI(ID_OPTIONS_LOADINLINEDIMAGES, OnUpdateToggleImageLoad)
|
||||
ON_COMMAND(ID_HOTLIST_MCOM, OnNetscapeHome)
|
||||
ON_COMMAND(ID_PLACES, OnGuide)
|
||||
ON_COMMAND(ID_OPTIONS_FLUSHCACHE, OnFlushCache)
|
||||
ON_COMMAND(ID_OPTIONS_SHOWFTPFILEINFORMATION, OnToggleFancyFtp)
|
||||
ON_UPDATE_COMMAND_UI(ID_OPTIONS_SHOWFTPFILEINFORMATION, OnUpdateToggleFancyFtp)
|
||||
ON_UPDATE_COMMAND_UI(ID_OPTIONS_SHOWSTARTERBUTTONS, OnUpdateOptionsShowstarterbuttons)
|
||||
ON_UPDATE_COMMAND_UI(ID_EDIT_UNDO, OnUpdateEditUndo)
|
||||
ON_WM_CLOSE()
|
||||
ON_WM_DROPFILES()
|
||||
ON_COMMAND(ID_HELP_SECURITY, OnHelpSecurity)
|
||||
ON_WM_SYSCOMMAND()
|
||||
ON_WM_SETFOCUS()
|
||||
ON_COMMAND(ID_VIEW_TOOLBAR, OnOptionsViewToolBar)
|
||||
#ifdef ENDER
|
||||
ON_MESSAGE(WM_TOOLCONTROLLER,OnToolController)
|
||||
#endif
|
||||
ON_COMMAND(ID_OPTIONS_LOADINLINEDIMAGES, OnToggleImageLoad)
|
||||
ON_COMMAND(ID_OPTIONS_SHOWSTARTERBUTTONS, OnOptionsShowstarterbuttons)
|
||||
ON_COMMAND(ID_OPEN_MAIL_WINDOW, OnOpenMailWindow)
|
||||
ON_COMMAND(ID_COMMAND_HELPINDEX, OnHelpMenu)
|
||||
ON_MESSAGE(NSBUTTONMENUOPEN, OnButtonMenuOpen)
|
||||
ON_MESSAGE(TB_FILLINTOOLTIP, OnFillInToolTip)
|
||||
ON_MESSAGE(TB_FILLINSTATUS, OnFillInToolbarButtonStatus)
|
||||
ON_COMMAND(ID_VIEW_INCREASEFONT, OnIncreaseFont)
|
||||
ON_COMMAND(ID_VIEW_DECREASEFONT, OnDecreaseFont)
|
||||
ON_UPDATE_COMMAND_UI(ID_NETSEARCH, OnUpdateNetSearch)
|
||||
ON_COMMAND(ID_NETSEARCH, OnNetSearch)
|
||||
ON_UPDATE_COMMAND_UI(ID_SECURITY, OnUpdateSecurity)
|
||||
ON_UPDATE_COMMAND_UI(IDS_SECURITY_STATUS, OnUpdateSecurityStatus)
|
||||
ON_UPDATE_COMMAND_UI(ID_VIEW_COMMANDTOOLBAR, OnUpdateViewCommandToolbar)
|
||||
ON_UPDATE_COMMAND_UI(ID_VIEW_LOCATIONTOOLBAR, OnUpdateViewLocationToolbar)
|
||||
ON_UPDATE_COMMAND_UI(ID_VIEW_CUSTOMTOOLBAR, OnUpdateViewCustomToolbar)
|
||||
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
#ifndef _AFXDLL
|
||||
#define new DEBUG_NEW // MSVC Debugging new...goes to regular new in release mode
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CMainFrame construction/destruction
|
||||
CMainFrame::CMainFrame()
|
||||
{
|
||||
m_pNext = NULL;
|
||||
m_pHistoryWindow = NULL;
|
||||
m_pDocInfoWindow = NULL;
|
||||
m_barLocation = NULL;
|
||||
m_barLinks = NULL;
|
||||
m_pCommandToolbar = NULL;
|
||||
#ifdef ENDER
|
||||
m_pToolBarController = NULL;
|
||||
#endif
|
||||
|
||||
m_tabFocusInMainFrm = TAB_FOCUS_IN_NULL ;
|
||||
m_SrvrItemCount = 0;
|
||||
m_bAutoMenuEnable = FALSE; // enable all items by default -- needed for hotlist/etc which have no handler
|
||||
}
|
||||
|
||||
CMainFrame::~CMainFrame()
|
||||
{
|
||||
if(m_barLinks)
|
||||
delete m_barLinks;
|
||||
|
||||
if(m_barLocation)
|
||||
delete m_barLocation;
|
||||
|
||||
if(m_pCommandToolbar)
|
||||
delete m_pCommandToolbar;
|
||||
|
||||
#ifdef ENDER
|
||||
if (m_pToolBarController)
|
||||
delete m_pToolBarController;
|
||||
#endif //ENDER
|
||||
}
|
||||
|
||||
|
||||
#ifdef ENDER
|
||||
CComboToolBar *
|
||||
CMainFrame::getComposeToolBar()
|
||||
{
|
||||
return m_pToolBarController->GetCharacterBar();
|
||||
}
|
||||
#endif //ENDER
|
||||
|
||||
//
|
||||
// Create the ledges
|
||||
//
|
||||
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext *pContext)
|
||||
{
|
||||
// Call the base, have it do the creation magic.
|
||||
BOOL bRetval = CGenericFrame::OnCreateClient(lpcs, pContext);
|
||||
if(bRetval == TRUE) {
|
||||
// Context Forever
|
||||
// We know that the view that was made for the frame was the very last one
|
||||
// created, use it to construct the context.
|
||||
// Create a grid for each initial view.
|
||||
CWnd *pView = GetDescendantWindow(AFX_IDW_PANE_FIRST, TRUE);
|
||||
ASSERT(pView);
|
||||
CWinCX *pDontCare = new CWinCX((CGenericDoc *)pContext->m_pCurrentDoc,
|
||||
this, (CGenericView *)pView);
|
||||
SetMainContext(pDontCare); // This is the main context.
|
||||
SetActiveContext(pDontCare); // And the active one
|
||||
|
||||
// cmanske: The following SetFocus() causes trouble for the Editor!
|
||||
// We don't have our pMWContext->is_editor flag set yet
|
||||
// and we have problems with JavaScript message processing
|
||||
// caused by the SetFocus message.
|
||||
// So test for Edit frame and set the context flag now
|
||||
#ifdef EDITOR
|
||||
if( IsEditFrame() && pDontCare->GetContext() ) {
|
||||
pDontCare->GetContext()->is_editor = TRUE;
|
||||
}
|
||||
|
||||
#endif //EDITOR
|
||||
// mwh - CDCCX::Initialize() will initialize the color palette, but we have to make sure we have
|
||||
// the focus first for realizePalette() to work.
|
||||
::SetFocus(pView->m_hWnd);
|
||||
RECT rect;
|
||||
GetClientRect(&rect);
|
||||
pDontCare->Initialize(pDontCare->CDCCX::IsOwnDC(), &rect);
|
||||
|
||||
#pragma message(__FILE__ ": move all this into the context constructor")
|
||||
pDontCare->GetContext()->fancyFTP = TRUE;
|
||||
pDontCare->GetContext()->fancyNews = TRUE;
|
||||
pDontCare->GetContext()->intrupt = FALSE;
|
||||
pDontCare->GetContext()->reSize = FALSE;
|
||||
}
|
||||
return bRetval;
|
||||
}
|
||||
|
||||
int CMainFrame::m_FirstFrame = 1;
|
||||
|
||||
// Read the initial sizes out of preferences file
|
||||
//
|
||||
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
|
||||
{
|
||||
int16 iLeft,iRight,iTop,iBottom;
|
||||
PREF_GetRectPref("browser.window_rect", &iLeft, &iTop, &iRight, &iBottom);
|
||||
|
||||
if (iLeft != -1) {
|
||||
cs.x = iLeft;
|
||||
cs.y = iTop;
|
||||
cs.cx = iRight - cs.x;
|
||||
cs.cy = iBottom - cs.y;
|
||||
}
|
||||
|
||||
if(theApp.m_iCmdLnCX != -1) {
|
||||
cs.cx = theApp.m_iCmdLnCX;
|
||||
}
|
||||
if(theApp.m_iCmdLnCY != -1) {
|
||||
cs.cy = theApp.m_iCmdLnCY;
|
||||
}
|
||||
// no menu in kiosk mode. duh.
|
||||
if (theApp.m_bKioskMode || theApp.m_ParentAppWindow)
|
||||
cs.hMenu = NULL;
|
||||
|
||||
return(CGenericFrame::PreCreateWindow(cs));
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Initialize the Frame window
|
||||
//
|
||||
//#define DONT_DO_ANIM_PAL
|
||||
#ifndef DONT_DO_ANIM_PAL
|
||||
IL_RGB animationPalette[] =
|
||||
{ // R G B
|
||||
{255,255,204,0},
|
||||
{204,153,102,0},
|
||||
{255,102,51, 0},
|
||||
{ 66,154,167,0},
|
||||
{ 0, 55, 60,0},
|
||||
{ 0,153,255,0},
|
||||
{ 51, 51,102,0},
|
||||
{128, 0, 0,0},
|
||||
{255,102,204,0},
|
||||
{153, 0,102,0},
|
||||
{153,102,204,0},
|
||||
{ 34, 34 ,34,0},
|
||||
{204,204,255,0},
|
||||
{153,153,255,0},
|
||||
{102,102,204,0},
|
||||
{ 51,255,153,0}
|
||||
};
|
||||
|
||||
int iLowerSystemColors = 10;
|
||||
// int iLowerAnimationColors = 12;
|
||||
int iLowerAnimationColors = 16;
|
||||
int iLowerColors = 26; // iLowerSystemColors + iLowerAnimationColors;
|
||||
int colorCubeSize = 216;
|
||||
|
||||
#endif
|
||||
|
||||
// Toolbar width and heights.
|
||||
#define MIXED_HEIGHT 32
|
||||
#define MIXED_WIDTH 40
|
||||
#define PICT_HEIGHT 21
|
||||
#define PICT_WIDTH 23
|
||||
#ifdef XP_WIN32
|
||||
#define TEXT_HEIGHT 14
|
||||
#define TEXT_WIDTH 42
|
||||
#else
|
||||
#define TEXT_HEIGHT 14
|
||||
#define TEXT_WIDTH 49
|
||||
#endif
|
||||
|
||||
// The Event Handler for the top-level bookmarks menu in a frame.
|
||||
static void qfNotifyProcedure (HT_Notification ns, HT_Resource n, HT_Event whatHappened,
|
||||
void *token, uint32 tokenType)
|
||||
{
|
||||
if (whatHappened == HT_EVENT_NODE_OPENCLOSE_CHANGED)
|
||||
{
|
||||
// The node was opened.
|
||||
PRBool openState;
|
||||
HT_GetOpenState(n, &openState);
|
||||
if (openState)
|
||||
{
|
||||
CGenericFrame* pFrame = (CGenericFrame*)ns->data;
|
||||
pFrame->FinishMenuExpansion(n);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
|
||||
{
|
||||
|
||||
if (CGenericFrame::OnCreate(lpCreateStruct) == -1)
|
||||
return -1;
|
||||
|
||||
if( IsEditFrame() ){
|
||||
// Note: Don't create the Browser toolbars in Editor frame,
|
||||
// except for the status bar
|
||||
LPNSSTATUSBAR pIStatusBar = NULL;
|
||||
GetChrome()->QueryInterface( IID_INSStatusBar, (LPVOID *) &pIStatusBar );
|
||||
if ( pIStatusBar ) {
|
||||
pIStatusBar->Create( this );
|
||||
pIStatusBar->Release();
|
||||
}
|
||||
|
||||
if (!theApp.m_bInGetCriticalFiles)
|
||||
{
|
||||
// Get the top level menu going.
|
||||
// Construct the notification struct used by HT
|
||||
HT_Notification ns = new HT_NotificationStruct;
|
||||
XP_BZERO(ns, sizeof(HT_NotificationStruct));
|
||||
ns->notifyProc = qfNotifyProcedure;
|
||||
ns->data = this;
|
||||
m_BookmarkMenuPane = theApp.m_bInGetCriticalFiles ? NULL : HT_NewQuickFilePane(ns);
|
||||
}
|
||||
} else {
|
||||
|
||||
LPNSSTATUSBAR pIStatusBar = NULL;
|
||||
GetChrome()->QueryInterface( IID_INSStatusBar, (LPVOID *) &pIStatusBar );
|
||||
if( pIStatusBar )
|
||||
{
|
||||
pIStatusBar->Create( this );
|
||||
pIStatusBar->Release();
|
||||
if (theApp.m_ParentAppWindow || theApp.m_bKioskMode)
|
||||
pIStatusBar->Show(FALSE);
|
||||
}
|
||||
|
||||
if(!IsEditFrame())
|
||||
{
|
||||
AddToMenuMap(FILEMENU, IDM_MAINFRAMEFILEMENU);
|
||||
AddToMenuMap(EDITMENU, IDM_MAINFRAMEEDITMENU);
|
||||
AddToMenuMap(VIEWMENU, IDM_MAINFRAMEVIEWMENU);
|
||||
AddToMenuMap(GOMENU, IDM_MAINFRAMEGOMENU);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Turn off widgets on demand
|
||||
|
||||
m_iCSID = INTL_DefaultDocCharSetID(0); // Set Global default.
|
||||
|
||||
m_iCSID = INTL_DefaultDocCharSetID(0); // Set Global default.
|
||||
|
||||
// Success so far. Also, accept drag and drop files from
|
||||
// the file manager.
|
||||
//
|
||||
DragAcceptFiles();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CMainFrame::CreateLocationBar()
|
||||
{
|
||||
/*
|
||||
>>>>>>> 3.3.2.11
|
||||
m_barLocation=new CURLBar();
|
||||
|
||||
if (!m_barLocation->Create(this, CURLBar::IDD, CBRS_TOP,CURLBar::IDD)) {
|
||||
return FALSE;
|
||||
}
|
||||
CToolbarWindow *pWindow = new CToolbarWindow(m_barLocation, theApp.m_pToolbarStyle, 23, 23, eSMALL_HTAB);
|
||||
|
||||
BOOL bOpen, bShowing;
|
||||
int32 nPos;
|
||||
|
||||
//I'm hardcoding because I don't want this translated
|
||||
GetChrome()->LoadToolbarConfiguration(ID_LOCATION_TOOLBAR, CString("Location_Toolbar"), nPos, bOpen, bShowing);
|
||||
|
||||
if(PREF_PrefIsLocked("browser.chrome.show_url_bar"))
|
||||
{
|
||||
bShowing = m_bLocationBar;
|
||||
}
|
||||
|
||||
GetChrome()->GetCustomizableToolbar()->AddNewWindow(ID_LOCATION_TOOLBAR, pWindow, nPos, 21, 21, 3, CString(szLoadString(ID_LOCATION_TOOLBAR)), theApp.m_pToolbarStyle, bOpen, FALSE);
|
||||
if (theApp.m_ParentAppWindow || theApp.m_bKioskMode)
|
||||
GetChrome()->ShowToolbar(ID_LOCATION_TOOLBAR, FALSE);
|
||||
else
|
||||
GetChrome()->ShowToolbar(ID_LOCATION_TOOLBAR, bShowing);
|
||||
|
||||
m_barLocation->SetContext((LPUNKNOWN)GetMainContext());
|
||||
|
||||
RecalcLayout();
|
||||
*/
|
||||
return TRUE;
|
||||
|
||||
}
|
||||
|
||||
int CMainFrame::CreateLinkBar(void)
|
||||
{
|
||||
m_barLinks = CRDFToolbar::CreateUserToolbar(NULL, this);
|
||||
|
||||
CButtonToolbarWindow *pWindow = new CButtonToolbarWindow(m_barLinks, theApp.m_pToolbarStyle, 43, 27, eSMALL_HTAB);
|
||||
|
||||
BOOL bOpen, bShowing;
|
||||
|
||||
int32 nPos;
|
||||
|
||||
//I'm hardcoding because I don't want this translated
|
||||
GetChrome()->LoadToolbarConfiguration(ID_PERSONAL_TOOLBAR, CString("Personal_Toolbar"), nPos, bOpen, bShowing);
|
||||
|
||||
if(PREF_PrefIsLocked("browser.chrome.show_directory_buttons"))
|
||||
{
|
||||
bShowing = m_bStarter;
|
||||
}
|
||||
|
||||
GetChrome()->GetCustomizableToolbar()->AddNewWindow(ID_PERSONAL_TOOLBAR, pWindow, nPos, 43, 27, 1, CString(szLoadString(ID_PERSONAL_TOOLBAR)),theApp.m_pToolbarStyle, bOpen, FALSE);
|
||||
if (theApp.m_ParentAppWindow || theApp.m_bKioskMode)
|
||||
GetChrome()->ShowToolbar(ID_PERSONAL_TOOLBAR, FALSE);
|
||||
else
|
||||
GetChrome()->ShowToolbar(ID_PERSONAL_TOOLBAR, bShowing);
|
||||
|
||||
RecalcLayout();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int CMainFrame::CreateMainToolbar(void)
|
||||
{
|
||||
|
||||
m_pCommandToolbar =new CCommandToolbar(15, theApp.m_pToolbarStyle, 43, 27, 27);
|
||||
|
||||
|
||||
|
||||
if (!m_pCommandToolbar->Create(this))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
m_pCommandToolbar->SetBitmap(IDB_PICTURES);
|
||||
|
||||
CButtonToolbarWindow *pWindow = new CButtonToolbarWindow(m_pCommandToolbar, theApp.m_pToolbarStyle, 43, 27, eLARGE_HTAB);
|
||||
|
||||
|
||||
CString statusStr, toolTipStr, textStr;
|
||||
int nBitmapIndex = 0;
|
||||
|
||||
int nCount = theApp.m_bShowNetscapeButton ? sizeof(buttons)/sizeof(UINT) : (sizeof(buttons)/sizeof(UINT)) - 1;
|
||||
|
||||
for(int i = 0; i < nCount; i++)
|
||||
{
|
||||
CCommandToolbarButton *pCommandButton = new CCommandToolbarButton;
|
||||
|
||||
WFE_ParseButtonString(buttons[i], statusStr, toolTipStr, textStr);
|
||||
|
||||
DWORD dwButtonStyle = 0;
|
||||
|
||||
if(buttons[i] == ID_NAVIGATE_FORWARD || buttons[i] == ID_NAVIGATE_BACK)
|
||||
{
|
||||
dwButtonStyle = TB_HAS_TIMED_MENU | TB_DYNAMIC_TOOLTIP;
|
||||
}
|
||||
else if(buttons[i] == ID_GO_HOME)
|
||||
{
|
||||
dwButtonStyle = TB_DYNAMIC_TOOLTIP;
|
||||
}
|
||||
else if(buttons[i] == ID_FILE_PRINT)
|
||||
{
|
||||
dwButtonStyle = TB_DYNAMIC_TOOLTIP | TB_DYNAMIC_STATUS;
|
||||
}
|
||||
else if(buttons[i] == ID_PLACES)
|
||||
{
|
||||
dwButtonStyle = TB_HAS_TIMED_MENU;
|
||||
}
|
||||
else if(buttons[i]== ID_NAVIGATE_INTERRUPT)
|
||||
{
|
||||
toolTipStr.LoadString(IDS_BROWSER_STOP_TIP);
|
||||
}
|
||||
|
||||
pCommandButton->Create(m_pCommandToolbar, theApp.m_pToolbarStyle, CSize(44, 37), CSize(25, 25),
|
||||
(const char*) textStr,(const char*) toolTipStr, (const char*) statusStr,
|
||||
0, nBitmapIndex, CSize(23,21), buttons[i], -1, dwButtonStyle);
|
||||
|
||||
pCommandButton->SetBitmap(m_pCommandToolbar->GetBitmap(), TRUE);
|
||||
|
||||
m_pCommandToolbar->AddButton(pCommandButton, i);
|
||||
if(buttons[i] == ID_FILE_PRINT)
|
||||
nBitmapIndex+=2;
|
||||
|
||||
nBitmapIndex++;
|
||||
}
|
||||
|
||||
|
||||
if(prefInfo.m_bAutoLoadImages)
|
||||
{
|
||||
m_pCommandToolbar->HideButtonByCommand(ID_VIEW_LOADIMAGES);
|
||||
}
|
||||
BOOL bOpen, bShowing;
|
||||
|
||||
int32 nPos;
|
||||
|
||||
//I'm hardcoding because I don't want this translated
|
||||
GetChrome()->LoadToolbarConfiguration(ID_NAVIGATION_TOOLBAR, CString("Navigation_Toolbar"), nPos, bOpen, bShowing);
|
||||
|
||||
if(PREF_PrefIsLocked("browser.chrome.show_toolbar"))
|
||||
{
|
||||
bShowing = m_bShowToolbar;
|
||||
}
|
||||
GetChrome()->GetCustomizableToolbar()->AddNewWindow(ID_NAVIGATION_TOOLBAR, pWindow,nPos, 50, 37, 0, CString(szLoadString(ID_NAVIGATION_TOOLBAR)),theApp.m_pToolbarStyle, bOpen, FALSE);
|
||||
|
||||
if (theApp.m_ParentAppWindow || theApp.m_bKioskMode)
|
||||
GetChrome()->ShowToolbar(ID_NAVIGATION_TOOLBAR, FALSE);
|
||||
else
|
||||
GetChrome()->ShowToolbar(ID_NAVIGATION_TOOLBAR, bShowing);
|
||||
|
||||
|
||||
RecalcLayout();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void CMainFrame::BeginStreamingOfRDFToolbars()
|
||||
{
|
||||
GetChrome()->CreateRDFToolbar("Browser", 5, TRUE);
|
||||
|
||||
if (!theApp.m_bInGetCriticalFiles)
|
||||
{
|
||||
// Get the top level menu going.
|
||||
// Construct the notification struct used by HT
|
||||
HT_Notification ns = new HT_NotificationStruct;
|
||||
XP_BZERO(ns, sizeof(HT_NotificationStruct));
|
||||
ns->notifyProc = qfNotifyProcedure;
|
||||
ns->data = this;
|
||||
m_BookmarkMenuPane = theApp.m_bInGetCriticalFiles ? NULL : HT_NewQuickFilePane(ns);
|
||||
}
|
||||
/*
|
||||
if (!theApp.m_bInGetCriticalFiles && AllowDocking() &&
|
||||
!theApp.m_ParentAppWindow && !theApp.m_bKioskMode)
|
||||
{
|
||||
// Show the selector if the pref says we should.
|
||||
BOOL bSelVisible;
|
||||
PREF_GetBoolPref(gPrefSelectorVisible, &bSelVisible);
|
||||
if (bSelVisible)
|
||||
theApp.CreateNewNavCenter(this);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CMainFrame::OnShowWindow (BOOL bShow, UINT nStatus)
|
||||
{
|
||||
CGenericFrame::OnShowWindow(bShow,nStatus);
|
||||
// We don't seem to draw correctly as a child window on the initial pass.
|
||||
if(theApp.m_bChildWindow)
|
||||
RecalcLayout();
|
||||
}
|
||||
|
||||
void CMainFrame::OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized)
|
||||
{
|
||||
CGenericFrame::OnActivate(nState, pWndOther, bMinimized);
|
||||
IChrome *chrome = GetChrome();
|
||||
if (chrome)
|
||||
chrome->ToolbarActivation();
|
||||
}
|
||||
|
||||
// returns TRUE if something was added to the folder, false otherwise
|
||||
BOOL CMainFrame::FileBookmark(HT_Resource pFolder)
|
||||
{
|
||||
|
||||
History_entry *pHistEnt = SHIST_GetCurrent( &(GetMainContext()->GetContext()->hist) );
|
||||
|
||||
if(pHistEnt)
|
||||
{
|
||||
|
||||
HT_AddToContainer(pFolder, GetMainContext()->GetContext()->title, pHistEnt->address);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//
|
||||
// The window has been created and activated so the user can
|
||||
// see it. Only now is it safe to load the home page
|
||||
//
|
||||
void CMainFrame::OnLoadHomePage()
|
||||
{
|
||||
// Sometimes on startup the hourglass will remain if we use a blank
|
||||
// page as the home page.
|
||||
// We can avoid this by simply sticking the arrow in. If we do load
|
||||
// a page, the hourglass will appear again in GetUrl, and stay
|
||||
// around until LayoutNewDocument.
|
||||
HCURSOR hCurrent = ::GetCursor();
|
||||
if(hCurrent) {
|
||||
HCURSOR hWait = ::LoadCursor(NULL, IDC_WAIT);
|
||||
if(hCurrent == hWait) {
|
||||
HCURSOR hArrow = ::LoadCursor(NULL, IDC_ARROW);
|
||||
if(hArrow) {
|
||||
::SetCursor(hArrow);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef EDITOR
|
||||
if ( IsEditFrame() )
|
||||
{
|
||||
if ( theApp.m_CmdLineLoadURL ) {
|
||||
// Load command line URL, FALSE = do NOT start new window
|
||||
LoadUrlEditor(theApp.m_CmdLineLoadURL, FALSE);
|
||||
// The filename supplied with the -EDIT switch
|
||||
// should NOT be stored as the "home page",
|
||||
// load it only once then remove the URL
|
||||
XP_FREE(theApp.m_CmdLineLoadURL);
|
||||
theApp.m_CmdLineLoadURL = NULL;
|
||||
} else {
|
||||
// Start new doc with URL
|
||||
GetMainContext()->NormalGetUrl("about:editfilenew");
|
||||
}
|
||||
return;
|
||||
}
|
||||
#endif /* EDITOR */
|
||||
|
||||
LPCSTR lpszHomePage = (LPCSTR)theApp.m_pHomePage;
|
||||
int32 nStartup = 1; // 0 = blank, 1 = home, 2 = last
|
||||
CString strLastURL;
|
||||
CString csTmp;
|
||||
char *tmpBuf;
|
||||
XP_Bool bOverride = FALSE;
|
||||
|
||||
PREF_GetBoolPref("browser.startup.homepage_override",&bOverride);
|
||||
|
||||
if (bOverride) {
|
||||
// if the over-ride preference is set, use that instead
|
||||
tmpBuf = NULL;
|
||||
int iError = PREF_CopyConfigString("startup.homepage_override_url",&tmpBuf);
|
||||
if (PREF_ERROR != iError && tmpBuf && tmpBuf[0]) {
|
||||
csTmp = tmpBuf;
|
||||
lpszHomePage = csTmp;
|
||||
XP_FREE(tmpBuf);
|
||||
}
|
||||
PREF_SetBoolPref("browser.startup.homepage_override",FALSE);
|
||||
}
|
||||
|
||||
// If the user has specified a URL on the command line assume they want
|
||||
// to load it; otherwise don't load the homepage if the autoload entry
|
||||
// isn't "yes"
|
||||
if (theApp.m_CmdLineLoadURL && theApp.m_nChangeHomePage) {
|
||||
lpszHomePage = (LPCSTR)theApp.m_CmdLineLoadURL;
|
||||
|
||||
} else {
|
||||
// There was neither a command line home page nor an Initial Home
|
||||
// Page entry so see if the user wants to load their default
|
||||
// home page or not
|
||||
if (theApp.m_bDontLoadHome)
|
||||
nStartup = 0;
|
||||
else
|
||||
PREF_GetIntPref("browser.startup.page", &nStartup);
|
||||
}
|
||||
|
||||
// See if they want us to load the last page they viewed
|
||||
if (nStartup == 2) {
|
||||
if (GH_GetMRUPage(strLastURL.GetBufferSetLength(1024), 1024) > 0)
|
||||
lpszHomePage = (LPCSTR)strLastURL;
|
||||
}
|
||||
|
||||
// If there is a home page location put it in the URL bar only if we
|
||||
// autoload
|
||||
if (lpszHomePage) {
|
||||
if (nStartup != 0){
|
||||
GetMainContext()->NormalGetUrl(lpszHomePage);
|
||||
|
||||
GetChrome()->UpdateURLBars((char*)lpszHomePage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void CMainFrame::OnDestroy()
|
||||
{
|
||||
// The maps should be empty, because the dynamic menu items are
|
||||
// freed when the pop-up menus go away
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Clean up the location/starter button bars
|
||||
CGenericFrame::OnDestroy();
|
||||
}
|
||||
|
||||
|
||||
void CMainFrame::OnClose()
|
||||
{
|
||||
// Purpose: Close a window.
|
||||
// Arguments: void
|
||||
// Return Value: void
|
||||
// Comments: Wrap up any processing of frame that
|
||||
// needs to be handled, such as
|
||||
// shutting down print preview.
|
||||
// Revision History:
|
||||
// 11-06-94 created GAB
|
||||
//
|
||||
// This frame still begin used by OLE server.
|
||||
if (HasSrvrItem()) {
|
||||
return;
|
||||
}
|
||||
// See if the document will allow closing.
|
||||
// Do not only query the active document as MFC does.
|
||||
// Instead, query the main context document, and it will check children also.
|
||||
CDocument* pDocument = NULL;
|
||||
if(GetMainWinContext()) {
|
||||
pDocument = (CDocument *)GetMainWinContext()->GetDocument();
|
||||
}
|
||||
if (pDocument != NULL && !pDocument->CanCloseFrame(this))
|
||||
{
|
||||
// document can't close right now -- don't close it
|
||||
return;
|
||||
}
|
||||
|
||||
// Only save the window position if we're an browser context and the size wasn't chrome specified.
|
||||
// This blocks saving the size/pos on things like html dialogs,
|
||||
// view source, and document info.
|
||||
if(GetMainWinContext() && GetMainWinContext()->GetContext()->type == MWContextBrowser &&
|
||||
GetMainWinContext()->m_bSizeIsChrome == FALSE) {
|
||||
WINDOWPLACEMENT wp;
|
||||
FEU_InitWINDOWPLACEMENT(GetSafeHwnd(), &wp);
|
||||
|
||||
PREF_SetRectPref("browser.window_rect", (int)wp.rcNormalPosition.left,
|
||||
(int)wp.rcNormalPosition.top, (int)wp.rcNormalPosition.right,
|
||||
(int)wp.rcNormalPosition.bottom);
|
||||
|
||||
//I'm hardcoding because I don't want this translated
|
||||
GetChrome()->SaveToolbarConfiguration(ID_NAVIGATION_TOOLBAR, CString("Navigation_Toolbar"));
|
||||
GetChrome()->SaveToolbarConfiguration(ID_LOCATION_TOOLBAR, CString("Location_Toolbar"));
|
||||
GetChrome()->SaveToolbarConfiguration(ID_PERSONAL_TOOLBAR, CString("Personal_Toolbar"));
|
||||
PREF_SetIntPref("browser.wfe.show_value",(int)wp.showCmd);
|
||||
}
|
||||
|
||||
// Tell our views to get rid of their contexts.
|
||||
if(GetMainWinContext()) {
|
||||
GetMainWinContext()->GetView()->FrameClosing();
|
||||
}
|
||||
|
||||
// Call base to close.
|
||||
//
|
||||
|
||||
CGenericFrame::OnClose();
|
||||
}
|
||||
|
||||
typedef struct drop_files_closure {
|
||||
HDROP hDropInfo;
|
||||
CMainFrame * pMain;
|
||||
char ** urlArray;
|
||||
} drop_files_closure;
|
||||
|
||||
/* Mocha has processed the event handler for the drop event. Now come back and execute
|
||||
* the drop files call if EVENT_OK or cleanup and go away.
|
||||
*/
|
||||
static void
|
||||
win_drop_files_callback(MWContext * pContext, LO_Element * pEle, int32 event,
|
||||
void * pObj, ETEventStatus status)
|
||||
{
|
||||
HDROP hDropInfo;
|
||||
|
||||
drop_files_closure * pClose = (drop_files_closure *) pObj;
|
||||
hDropInfo = pClose->hDropInfo;
|
||||
|
||||
// make sure document hasn't gone away or event cancelled
|
||||
if(status == EVENT_PANIC || status == EVENT_CANCEL) {
|
||||
int i_loop=0;
|
||||
while ((pClose->urlArray)[i_loop])
|
||||
XP_FREE((pClose->urlArray)[i_loop++]);
|
||||
XP_FREE(pClose->urlArray);
|
||||
XP_FREE(pClose);
|
||||
::DragFinish(hDropInfo);
|
||||
return;
|
||||
}
|
||||
|
||||
// find out who we are
|
||||
CMainFrame * pMain = pClose->pMain;
|
||||
|
||||
// First, check the number of files dropped.
|
||||
//
|
||||
auto int i_num = ::DragQueryFile(hDropInfo, (UINT)-1, NULL, 0);
|
||||
|
||||
// Get the current history entry
|
||||
History_entry * his = SHIST_GetCurrent(&(pMain->GetMainContext()->GetContext()->hist));
|
||||
|
||||
// If we got a history entry, see if it's an
|
||||
// FTP directory listing. If it is then lets ask the
|
||||
// user if they want to upload the dropped files.
|
||||
if(his
|
||||
&& !strncasecomp(his->address, "ftp", 3)
|
||||
&& his->address[strlen(his->address)-1] == '/'
|
||||
&& FE_Confirm(pMain->GetMainContext()->GetContext(), szLoadString(IDS_UPLOAD_FILES)))
|
||||
{
|
||||
// If the user wants to upload them, stuff the files
|
||||
// in the URL struct and start the load
|
||||
URL_Struct * URL_s = NET_CreateURLStruct(his->address, NET_SUPER_RELOAD);
|
||||
|
||||
if(!URL_s)
|
||||
goto clean_up;
|
||||
|
||||
URL_s->method = URL_POST_METHOD;
|
||||
URL_s->files_to_post = (char **)XP_ALLOC((i_num+1) * sizeof(char*));
|
||||
|
||||
if(!URL_s->files_to_post)
|
||||
{
|
||||
NET_FreeURLStruct(URL_s);
|
||||
goto clean_up;
|
||||
}
|
||||
|
||||
// load the file names into the files_to_post array
|
||||
auto char ca_drop[_MAX_PATH];
|
||||
for(auto int i_loop = 0; i_loop < i_num; i_loop++)
|
||||
{
|
||||
::DragQueryFile(hDropInfo, i_loop, ca_drop, _MAX_PATH);
|
||||
|
||||
URL_s->files_to_post[i_loop] = XP_STRDUP((const char*)ca_drop);
|
||||
}
|
||||
URL_s->files_to_post[i_loop] = NULL; // terminate array
|
||||
|
||||
pMain->GetMainContext()->GetUrl(URL_s, FO_CACHE_AND_PRESENT);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Loop through them, each doing a load.
|
||||
// This should be insane fun with external viewers.
|
||||
//
|
||||
auto char ca_drop[_MAX_PATH];
|
||||
CString csUrl;
|
||||
for(auto int i_loop = 0; i_loop < i_num; i_loop++) {
|
||||
::DragQueryFile(hDropInfo, i_loop, ca_drop, _MAX_PATH);
|
||||
|
||||
// Convert to an acceptable URL.
|
||||
// It always has the full path!
|
||||
//
|
||||
WFE_ConvertFile2Url(csUrl, ca_drop);
|
||||
|
||||
pMain->GetMainContext()->NormalGetUrl(csUrl);
|
||||
|
||||
// Block until load is complete, if they did multiple
|
||||
// files.
|
||||
//
|
||||
if(i_loop != i_num - 1) {
|
||||
auto int net_ret = 1;
|
||||
winfeInProcessNet = TRUE;
|
||||
while(net_ret) {
|
||||
net_ret = NET_ProcessNet(NULL, NET_EVERYTIME_TYPE);
|
||||
}
|
||||
winfeInProcessNet = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
clean_up:
|
||||
// Clean up
|
||||
//
|
||||
// Free mocha closure obj
|
||||
int i_loop=0;
|
||||
while ((pClose->urlArray)[i_loop])
|
||||
XP_FREE((pClose->urlArray)[i_loop++]);
|
||||
XP_FREE(pClose->urlArray);
|
||||
XP_FREE(pClose);
|
||||
::DragFinish(hDropInfo);
|
||||
|
||||
// Don't call this, or GPF, since we do it all anyways....
|
||||
//
|
||||
//CGenericFrame::OnDropFiles(hDropInfo);
|
||||
|
||||
}
|
||||
|
||||
void CMainFrame::OnDropFiles(HDROP hDropInfo)
|
||||
{
|
||||
#ifdef MOZ_NGLAYOUT
|
||||
XP_ASSERT(0);
|
||||
#else
|
||||
// TODO: Add your message handler code here and/or call default
|
||||
//
|
||||
|
||||
// Make sure we have a main context.
|
||||
if(GetMainContext() == NULL) {
|
||||
return;
|
||||
}
|
||||
#ifdef EDITOR
|
||||
// The view handles all dragNdrop in editor
|
||||
if( IsEditFrame() ){
|
||||
CWnd * pWnd = FromHandle(GetMainWinContext()->GetPane());
|
||||
if( pWnd ){
|
||||
((CNetscapeEditView*)pWnd)->DropFiles(hDropInfo, TRUE);
|
||||
}
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
// First, check the number of files dropped.
|
||||
//
|
||||
auto int i_num = ::DragQueryFile(hDropInfo, (UINT)-1, NULL, 0);
|
||||
|
||||
// Mocha sends an event here now to allow cancellation of OnDropFiles message.
|
||||
auto char ca_drop[_MAX_PATH];
|
||||
CString csUrl;
|
||||
int size = sizeof(char*) * (i_num + 1);
|
||||
char ** urlArray = (char**)XP_ALLOC(size);
|
||||
XP_ASSERT(urlArray);
|
||||
|
||||
int i_loop;
|
||||
for(i_loop = 0; i_loop < i_num; i_loop++) {
|
||||
::DragQueryFile(hDropInfo, i_loop, ca_drop, _MAX_PATH);
|
||||
|
||||
// Convert to an acceptable URL.
|
||||
// It always has the full path!
|
||||
//
|
||||
WFE_ConvertFile2Url(csUrl, ca_drop);
|
||||
urlArray[i_loop] = XP_STRDUP(csUrl);
|
||||
}
|
||||
urlArray[i_loop] = 0;
|
||||
|
||||
drop_files_closure * pClosure = XP_NEW_ZAP(drop_files_closure);
|
||||
pClosure->pMain = this;
|
||||
pClosure->hDropInfo = hDropInfo;
|
||||
pClosure->urlArray = urlArray;
|
||||
|
||||
// Get mouse at time of drop
|
||||
POINT pointDrop;
|
||||
|
||||
::DragQueryPoint( hDropInfo, &pointDrop);
|
||||
|
||||
ClientToScreen( &pointDrop );
|
||||
|
||||
JSEvent *event;
|
||||
event = XP_NEW_ZAP(JSEvent);
|
||||
event->type = EVENT_DRAGDROP;
|
||||
event->screenx = pointDrop.x;
|
||||
event->screeny = pointDrop.y;
|
||||
event->modifiers = (GetKeyState(VK_SHIFT) < 0 ? EVENT_SHIFT_MASK : 0)
|
||||
| (GetKeyState(VK_CONTROL) < 0 ? EVENT_CONTROL_MASK : 0)
|
||||
| (GetKeyState(VK_MENU) < 0 ? EVENT_ALT_MASK : 0);
|
||||
event->data = (void *)urlArray;
|
||||
event->dataSize = i_num;
|
||||
|
||||
ET_SendEvent(GetMainContext()->GetContext(), 0, event, win_drop_files_callback, pClosure);
|
||||
return;
|
||||
|
||||
//Mocha will handle cleanup and DragFinish when it calls back in.
|
||||
#endif /* MOZ_NGLAYOUT */
|
||||
}
|
||||
|
||||
|
||||
#ifdef ENDER
|
||||
LONG CMainFrame::OnToolController(UINT,LONG)
|
||||
{
|
||||
return (LONG)m_pToolBarController;
|
||||
}
|
||||
#endif //ENDER
|
|
@ -1474,6 +1474,50 @@ void CGenericFrame::BuildHelpMenu(CMenu * pMenu)
|
|||
pMenu->InsertMenu(idx,MF_BYPOSITION | MF_STRING,ID_COMMAND_ABOUT, aboutCommunicator);
|
||||
}
|
||||
|
||||
void CGenericFrame::BuildViewMenu(CMenu *pMenu)
|
||||
{
|
||||
if (GetMainContext() == NULL)
|
||||
return;
|
||||
|
||||
pMenu->DeleteMenu(0, MF_BYPOSITION); // kill the placeholder
|
||||
|
||||
CRDFToolbarHolder *bars;
|
||||
HT_Pane rootPane;
|
||||
uint barCtr;
|
||||
uint32 barCount;
|
||||
IChrome *chrome = GetChrome();
|
||||
|
||||
// get the RDF toolbar holder. exit on failure.
|
||||
bars = NULL;
|
||||
if (chrome) {
|
||||
CCustToolbar *basicBars = chrome->GetCustomizableToolbar();
|
||||
if (basicBars->IsKindOf(RUNTIME_CLASS(CRDFToolbarHolder)))
|
||||
bars = (CRDFToolbarHolder *) basicBars;
|
||||
}
|
||||
if (!bars)
|
||||
return;
|
||||
|
||||
// insert a show/hide menu item for each toolbar
|
||||
rootPane = bars->GetHTPane();
|
||||
barCount = HT_GetViewListCount(rootPane);
|
||||
if (barCount > ID_VIEW_LASTTOOLBAR - ID_VIEW_FIRSTTOOLBAR + 1)
|
||||
barCount = ID_VIEW_LASTTOOLBAR - ID_VIEW_FIRSTTOOLBAR + 1;
|
||||
for (barCtr = 0; barCtr < barCount; barCtr++) {
|
||||
HT_View view = HT_GetNthView(rootPane, barCtr);
|
||||
CRDFToolbar *bar = (CRDFToolbar *) HT_GetViewFEData(view);
|
||||
char *name = HT_GetViewName(view);
|
||||
if (!name)
|
||||
name = "";
|
||||
CString menuText;
|
||||
if (bars->IsWindowShowing(bar))
|
||||
menuText.Format(IDS_HIDETOOLBARMENUITEM, name);
|
||||
else
|
||||
menuText.Format(IDS_SHOWTOOLBARMENUITEM, name);
|
||||
pMenu->InsertMenu(barCtr, MF_BYPOSITION | MF_STRING, ID_VIEW_FIRSTTOOLBAR+barCtr,
|
||||
menuText);
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
* CGenericFrame::OnToolsWeb
|
||||
|
@ -1853,7 +1897,9 @@ void CGenericFrame::OnInitMenuPopup(CMenu * pPopup, UINT nIndex, BOOL bSysMenu)
|
|||
else if (pPopup->GetMenuItemID(0) == IDC_FIRST_HELP_MENU_ID)
|
||||
{
|
||||
BuildHelpMenu(pPopup);
|
||||
}
|
||||
}
|
||||
else if (pPopup->GetMenuItemID(0) == ID_VIEW_FIRSTTOOLBAR)
|
||||
BuildViewMenu(pPopup);
|
||||
else
|
||||
{
|
||||
HT_Resource pEntry;
|
||||
|
@ -3052,11 +3098,16 @@ BOOL CGenericFrame::OnCommand(UINT wParam,LONG lParam)
|
|||
#endif
|
||||
|
||||
UINT nID = LOWORD(wParam);
|
||||
if( nID >= ID_OPTIONS_ENCODING_1 && nID <= ID_OPTIONS_ENCODING_70)
|
||||
{
|
||||
if( nID >= ID_OPTIONS_ENCODING_1 && nID <= ID_OPTIONS_ENCODING_70) {
|
||||
OnToggleEncoding( nID );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (nID >= ID_VIEW_FIRSTTOOLBAR && nID <= ID_VIEW_LASTTOOLBAR) {
|
||||
ToggleToolbarVisibility(nID - ID_VIEW_FIRSTTOOLBAR);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (m_bDisableHotkeys && nCode==1) {
|
||||
switch (LOWORD(wParam)) {
|
||||
case ID_SECURITY:
|
||||
|
@ -3119,6 +3170,33 @@ BOOL CGenericFrame::OnCommand(UINT wParam,LONG lParam)
|
|||
return CommonCommand(wParam, lParam);
|
||||
}
|
||||
|
||||
void CGenericFrame::ToggleToolbarVisibility(UINT toolbarIndex)
|
||||
{
|
||||
CRDFToolbarHolder *bars;
|
||||
HT_Pane rootPane;
|
||||
IChrome *chrome = GetChrome();
|
||||
|
||||
// get the RDF toolbar holder. exit on failure.
|
||||
bars = NULL;
|
||||
if (chrome) {
|
||||
CCustToolbar *basicBars = chrome->GetCustomizableToolbar();
|
||||
if (basicBars->IsKindOf(RUNTIME_CLASS(CRDFToolbarHolder)))
|
||||
bars = (CRDFToolbarHolder *) basicBars;
|
||||
}
|
||||
if (!bars)
|
||||
return;
|
||||
|
||||
// assume menu item order is the same as RDF view order. toggle visibility
|
||||
// for the nth RDF view. (this is a decent assumption, since the view menu
|
||||
// is rebuilt each time it's pulled down, and it's build from the RDF views)
|
||||
rootPane = bars->GetHTPane();
|
||||
if (toolbarIndex < HT_GetViewListCount(rootPane)) {
|
||||
HT_View view = HT_GetNthView(rootPane, toolbarIndex);
|
||||
CRDFToolbar *bar = (CRDFToolbar *) HT_GetViewFEData(view);
|
||||
bars->ShowToolbar(bar, !bars->IsWindowShowing(bar));
|
||||
}
|
||||
}
|
||||
|
||||
// returns TRUE if something was added to the folder, false otherwise
|
||||
BOOL CGenericFrame::FileBookmark(HT_Resource pFolder)
|
||||
{
|
||||
|
|
|
@ -1,439 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef __GenericFrame_H
|
||||
#define __GenericFrame_H
|
||||
|
||||
// genframe.h : header file
|
||||
//
|
||||
#include "frameglu.h"
|
||||
#include "htrdf.h"
|
||||
|
||||
#define WIN_ANIMATE_ICON_TIMER 4
|
||||
#define MSG_TASK_NOTIFY (WM_USER + 1)
|
||||
|
||||
// Longest menu item length for Composer's last-edited history submenus
|
||||
#define MAX_MENU_ITEM_LENGTH 45
|
||||
|
||||
//cmanske: As much as I dislike assume fixed menu positions,
|
||||
// it infinitely simplifies finding submenus when building menus at runtime
|
||||
enum {
|
||||
ED_MENU_FILE,
|
||||
ED_MENU_EDIT,
|
||||
ED_MENU_VIEW,
|
||||
ED_MENU_INSERT,
|
||||
ED_MENU_FORMAT,
|
||||
ED_MENU_TABLE,
|
||||
ED_MENU_TOOLS,
|
||||
ED_MENU_COMMUNICATOR,
|
||||
ED_MENU_HELP
|
||||
};
|
||||
|
||||
// Load a URL into a new Browser window
|
||||
// This simply creates the URL struct and calls CFE_CreateNewDocWindow
|
||||
MWContext * wfe_CreateNavigator(char * pURL = NULL);
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CGenericFrame frame
|
||||
|
||||
class CNSGenFrame : public CFrameWnd
|
||||
{
|
||||
DECLARE_DYNCREATE(CNSGenFrame)
|
||||
public:
|
||||
CNSNavFrame* GetDockedNavCenter();
|
||||
virtual BOOL AllowDocking();
|
||||
protected:
|
||||
afx_msg void OnActivate( UINT nState, CWnd* pWndOther, BOOL bMinimized);
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
class CGenericFrame : public CNSGenFrame, public CFrameGlue
|
||||
{
|
||||
DECLARE_DYNCREATE(CGenericFrame)
|
||||
protected:
|
||||
CGenericFrame(); // protected constructor used by dynamic creation
|
||||
BOOL m_bPreCreated;
|
||||
|
||||
CTreeMenu *m_pBookmarksMenu;
|
||||
CTreeMenu *m_pFileBookmarkMenu;
|
||||
CTreeItemList *m_BookmarksGarbageList;
|
||||
CTreeItemList *m_OriginalBookmarksGarbageList;
|
||||
CBitmap *m_pBookmarkBitmap;
|
||||
CBitmap *m_pBookmarkFolderBitmap;
|
||||
CBitmap *m_pBookmarkFolderOpenBitmap;
|
||||
|
||||
CTreeMenu* m_pCachedTreeMenu;
|
||||
int m_nCachedStartPoint;
|
||||
|
||||
HT_Pane m_BookmarkMenuPane; // Added for Aurora (Dave Hyatt 2/12/97)
|
||||
|
||||
void BuildBookmarkMenu(CTreeMenu* pMenu, HT_Resource pRoot, int nStart = 0);
|
||||
|
||||
void BuildFileBookmarkMenu(CTreeMenu* pMenu, HT_Resource pRoot);
|
||||
void BuildDirectoryMenu(CMenu* pMenu);
|
||||
|
||||
//Returns TRUE if pFolder is changed, FALSE otherwise
|
||||
virtual BOOL FileBookmark(HT_Resource pFolder);
|
||||
void InitFileBookmarkMenu(void);
|
||||
void LoadBookmarkMenuBitmaps(void);
|
||||
|
||||
// Menu Map
|
||||
// Everything below is for the case where a frame wants to dynamically load its
|
||||
// menus. This is done to save user resources in Win16.
|
||||
protected:
|
||||
#ifdef _WIN32
|
||||
CMapPtrToPtr *m_pMenuMap;
|
||||
#else
|
||||
CMapWordToPtr *m_pMenuMap;
|
||||
#endif
|
||||
|
||||
void AddToMenuMap(int nIndex, UINT nID);
|
||||
virtual void LoadFrameMenu(CMenu *pPopup, UINT nIndex);
|
||||
void DeleteFrameMenu(HMENU hMenu);
|
||||
void DeleteMenuMapMenus(void);
|
||||
void DeleteMenuMapIDs(void);
|
||||
|
||||
|
||||
public:
|
||||
CTreeMenu * GetBookmarksMenu(void) { return m_pBookmarksMenu; }
|
||||
void FinishMenuExpansion(HT_Resource pRoot);
|
||||
|
||||
|
||||
#ifdef XP_WIN32
|
||||
// jliu added the following to support CJK caption print
|
||||
virtual int16 GetTitleWinCSID();
|
||||
#endif
|
||||
|
||||
|
||||
public:
|
||||
// ugh this should really be private
|
||||
CGenericFrame * m_pNext; // the next frame in the theApp.m_pFrameList
|
||||
// Use only by editor to avoid double-prompting for saving changes
|
||||
// when we call CGenericDoc::CanCloseFrame followed by frame's OnClose()
|
||||
BOOL m_bSkipSaveEditChanges;
|
||||
BOOL m_isClosing;
|
||||
BOOL m_DockOrientation;
|
||||
|
||||
// CFrameGlue required overrides
|
||||
public:
|
||||
virtual CFrameWnd *GetFrameWnd();
|
||||
virtual void UpdateHistoryDialog();
|
||||
void BuildHelpMenu(CMenu * pMenu);
|
||||
|
||||
// override this only if you want to
|
||||
virtual void OnConstructWindowMenu ( CMenu * pMenu );
|
||||
void OnSaveConfiguration();
|
||||
|
||||
// Attributes
|
||||
public:
|
||||
// Used for bookmark menu items and history menu items
|
||||
int m_nBookmarkItems; // current number of bookmark menu items
|
||||
int m_nFileBookmarkItems;
|
||||
#ifdef XP_WIN32
|
||||
CMapPtrToPtr* m_pSubmenuMap; // HMENU -> BM_Entry*
|
||||
#else
|
||||
CMapWordToPtr* m_pSubmenuMap; // HMENU -> BM_Entry*
|
||||
#endif
|
||||
|
||||
#ifdef XP_WIN32
|
||||
CMapPtrToPtr* m_pFileSubmenuMap; // HMENU -> BM_Entry*
|
||||
#else
|
||||
CMapWordToPtr* m_pFileSubmenuMap; // HMENU -> BM_Entry*
|
||||
#endif
|
||||
|
||||
CMapWordToPtr* m_pHotlistMenuMap; // command ID -> URL and
|
||||
// command ID -> History_Entry*
|
||||
|
||||
// We may or may not allow the window to resize.
|
||||
private:
|
||||
BOOL m_bCanResize;
|
||||
CRect m_crMinMaxRect;
|
||||
BOOL m_bZOrderLocked;
|
||||
BOOL m_bBottommost;
|
||||
BOOL m_bDisableHotkeys;
|
||||
DWORD m_wAddedExStyles;
|
||||
DWORD m_wRemovedExStyles;
|
||||
|
||||
#ifdef XP_WIN32
|
||||
// jliu added the following to support CJK caption print
|
||||
void SetupCapFont( int16 csid, BOOL force = FALSE );
|
||||
UINT capStyle;
|
||||
BOOL m_bActive;
|
||||
CFont hCapFont;
|
||||
int16 m_csid; // WinCSID of current document
|
||||
#endif
|
||||
|
||||
HWND m_hPopupParent;
|
||||
BOOL m_bConference;
|
||||
|
||||
|
||||
public:
|
||||
void EnableResize(BOOL bEnable = TRUE);
|
||||
BOOL CanResize(){ return m_bCanResize; }
|
||||
void SetZOrder(BOOL bZLock = FALSE, BOOL bBottommost = FALSE);
|
||||
BOOL IsZOrderLocked(){ return m_bZOrderLocked; }
|
||||
BOOL IsBottommost(){ return m_bBottommost; }
|
||||
void DisableHotkeys(BOOL bDisable = FALSE);
|
||||
BOOL HotkeysDisabled(){ return m_bDisableHotkeys; }
|
||||
#ifdef WIN32
|
||||
void SetExStyles(DWORD wAddedExStyles, DWORD wRemovedExStyles);
|
||||
DWORD GetRemovedExStyles();
|
||||
#endif
|
||||
void SetAsPopup(HWND hPopupParent);
|
||||
|
||||
// Operations
|
||||
public:
|
||||
|
||||
// Some static public data, initialized in genframe.cpp
|
||||
// used to offset frame windows from one another
|
||||
static int m_FirstFrame;
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CGenericFrame)
|
||||
public:
|
||||
virtual void RecalcLayout( BOOL bNotify = TRUE );
|
||||
virtual BOOL PreTranslateMessage(MSG *pMsg);
|
||||
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
|
||||
virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo);
|
||||
protected:
|
||||
virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
public:
|
||||
// assorted people can cause us to open windows. Make these public so we
|
||||
// can try to localize the functionality
|
||||
afx_msg void OnOpenMailWindow();
|
||||
afx_msg void OnOpenInboxWindow();
|
||||
afx_msg void OnOpenNewsWindow();
|
||||
afx_msg void OnToolsWeb();
|
||||
afx_msg void OnOpenComposerWindow(); // Implemented in edframe.cpp
|
||||
|
||||
|
||||
afx_msg void OnToggleEncoding(UINT nID);
|
||||
afx_msg void OnUpdateEncoding(CCmdUI* pCmdUI);
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
|
||||
virtual ~CGenericFrame();
|
||||
virtual void GetMessageString( UINT nID, CString& rMessage ) const;
|
||||
|
||||
// Generated message map functions
|
||||
afx_msg void OnEnterIdle(UINT nWhy, CWnd* pWho );
|
||||
afx_msg void OnInitMenuPopup(CMenu * pPopup, UINT nIndex, BOOL bSysMenu);
|
||||
afx_msg void OnMenuSelect( UINT nItemID, UINT nFlags, HMENU hSysMenu );
|
||||
afx_msg void OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct);
|
||||
afx_msg LRESULT OnMenuChar( UINT nChar, UINT nFlags, CMenu* pMenu );
|
||||
afx_msg LRESULT OnSetMessageString(WPARAM wParam, LPARAM lParam);
|
||||
afx_msg void OnClose();
|
||||
afx_msg void OnDestroy();
|
||||
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
|
||||
afx_msg void OnSysColorChange();
|
||||
afx_msg BOOL OnQueryNewPalette();
|
||||
afx_msg void OnPaletteChanged(CWnd* pFocusWnd);
|
||||
|
||||
afx_msg void OnNewFrame();
|
||||
afx_msg void OnUpdateNewFrame(CCmdUI* pCmdUI);
|
||||
afx_msg void OnFileOpenurl();
|
||||
afx_msg void OnUpdateFileOpenurl(CCmdUI* pCmdUI);
|
||||
afx_msg void OnHotlistAddcurrenttohotlist();
|
||||
afx_msg void OnUpdateHotlistAddcurrenttohotlist(CCmdUI* pCmdUI);
|
||||
afx_msg void OnHotlistAddcurrenttotoolbar();
|
||||
afx_msg void OnUpdateHotlistAddcurrenttotoolbar(CCmdUI* pCmdUI);
|
||||
afx_msg void OnUpdateOpenMailWindow(CCmdUI* pCmdUI);
|
||||
afx_msg void OnUpdateOpenNewsWindow(CCmdUI* pCmdUI);
|
||||
afx_msg void OnUpdateTaskbar(CCmdUI *pCmdUI);
|
||||
afx_msg void OnAbout();
|
||||
afx_msg void OnDocumentTop();
|
||||
afx_msg void OnDocumentBottom();
|
||||
afx_msg void OnFishCam();
|
||||
afx_msg void OnShowBookmarkWindow();
|
||||
afx_msg void OnShowAddressBookWindow();
|
||||
#ifdef MOZ_MAIL_NEWS
|
||||
afx_msg void OnMigrationTools();
|
||||
afx_msg void OnUpdateMigrationTools(CCmdUI* pCmdUI);
|
||||
#endif //MOZ_MAIL_NEWS
|
||||
#if defined(JAVA) || defined(OJI)
|
||||
afx_msg void OnToggleJavaConsole();
|
||||
afx_msg void OnUpdateJavaConsole(CCmdUI* pCmdUI);
|
||||
#endif
|
||||
|
||||
afx_msg void OnTogglePrivacyAnonymous();
|
||||
afx_msg void OnUpdatePrivacyAnonymous(CCmdUI* pCmdUI);
|
||||
afx_msg void OnTogglePrivacyReceipt();
|
||||
afx_msg void OnUpdatePrivacyReceipt(CCmdUI* pCmdUI);
|
||||
afx_msg void OnDisplayPrivacyPolicy();
|
||||
afx_msg void OnUpdatePrivacyPolicy(CCmdUI* pCmdUI);
|
||||
afx_msg void OnDisplayPrivacyCookies();
|
||||
afx_msg void OnDisplayPrivacySignons();
|
||||
afx_msg void OnDisplayPrivacyReceipts();
|
||||
afx_msg void OnDisplayPrivacySiteInfo();
|
||||
afx_msg void OnDisplayPrivacyTutorial();
|
||||
|
||||
afx_msg void OnSecurity();
|
||||
afx_msg void OnUpdateSecurity(CCmdUI *pCmdUI);
|
||||
#ifdef MOZ_OFFLINE
|
||||
afx_msg void OnUpdateOnlineStatus(CCmdUI *pCmdUI);
|
||||
#endif //MOZ_OFFLINE
|
||||
afx_msg void OnViewCommandToolbar();
|
||||
afx_msg void OnUpdateViewCommandToolbar(CCmdUI* pCmdUI);
|
||||
afx_msg void OnViewLocationToolbar();
|
||||
afx_msg void OnUpdateViewLocationToolbar(CCmdUI* pCmdUI);
|
||||
afx_msg void OnViewCustomToolbar();
|
||||
afx_msg void OnUpdateViewCustomToolbar(CCmdUI* pCmdUI);
|
||||
afx_msg void OnUpdatePlaces(CCmdUI* pCmdUI);
|
||||
afx_msg void OnUpdateCustomizeToolbar(CCmdUI *pCmdUI);
|
||||
afx_msg void OnCustomizeToolbar();
|
||||
afx_msg void OnIncreaseFont();
|
||||
afx_msg void OnDecreaseFont();
|
||||
afx_msg void OnGoHistory();
|
||||
afx_msg void OnFileMailNew();
|
||||
afx_msg void OnTaskbar();
|
||||
afx_msg void OnUpdateLiveCall(CCmdUI *pCmdUI);
|
||||
afx_msg void OnLiveCall();
|
||||
afx_msg void OnCalendar();
|
||||
afx_msg void OnIBMHostOnDemand();
|
||||
afx_msg void OnNetcaster();
|
||||
afx_msg void OnAim();
|
||||
afx_msg void OnDisplayPreferences();
|
||||
afx_msg void OnPrefsGeneral();
|
||||
afx_msg void OnPrefsMailNews();
|
||||
afx_msg void OnPrefsNetwork();
|
||||
afx_msg void OnPrefsSecurity();
|
||||
afx_msg void OnAnimationBonk();
|
||||
afx_msg void OnUpdateFileRoot(CCmdUI* pCmdUI);
|
||||
afx_msg void OnGoOffline();
|
||||
afx_msg void OnUpdateGoOffline(CCmdUI* pCmdUI);
|
||||
#ifdef MOZ_MAIL_NEWS
|
||||
afx_msg void OnSynchronize();
|
||||
afx_msg void OnUpdateSynchronize(CCmdUI* pCmdUI);
|
||||
#endif
|
||||
afx_msg void OnDoneGoingOffline();
|
||||
#ifdef FORTEZZA
|
||||
afx_msg void OnStartFortezzaCard();
|
||||
afx_msg void OnStartFortezzaChange();
|
||||
afx_msg void OnStartFortezzaView();
|
||||
afx_msg void OnDoFortezzaInfo();
|
||||
afx_msg void OnDoFortezzaLog();
|
||||
#endif
|
||||
afx_msg void OnFrameExit();
|
||||
afx_msg void OnSetFocus(CWnd* pOldWnd);
|
||||
afx_msg void OnWindowPosChanged(WINDOWPOS* lpwndpos);
|
||||
afx_msg void OnWindowPosChanging(WINDOWPOS* lpwndpos);
|
||||
afx_msg void OnSize(UINT nType, int cx, int cy);
|
||||
afx_msg void OnSizing(UINT nSide, LPRECT lpRect);
|
||||
afx_msg void OnNextWindow();
|
||||
afx_msg void OnSaveOptions();
|
||||
afx_msg LRESULT OnFindReplace(WPARAM wParam, LPARAM lParam);
|
||||
afx_msg LRESULT OnHelpMsg(WPARAM wParam, LPARAM lParam);
|
||||
afx_msg void OnMove(int x, int y);
|
||||
afx_msg void OnFilePageSetup();
|
||||
afx_msg void OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI);
|
||||
afx_msg LONG OnTaskNotify(WPARAM wParam, LPARAM lParam);
|
||||
afx_msg void OnShowAdvanced();
|
||||
afx_msg void OnUpdateShowAdvanced( CCmdUI *pCmdUI );
|
||||
afx_msg void OnHelpMenu();
|
||||
afx_msg void OnLDAPSearch();
|
||||
afx_msg void OnPageFromWizard();
|
||||
#ifdef EDITOR
|
||||
afx_msg void OnEditNewBlankDocument();
|
||||
afx_msg void OnActivateSiteManager();
|
||||
afx_msg void OnUpdateActivateSiteManager(CCmdUI* pCmdUI);
|
||||
// Response to Registered messages to detect 1st instance
|
||||
afx_msg LRESULT OnNetscapeGoldIsActive(WPARAM wParam, LPARAM lParam);
|
||||
// Response to Registered messages to open Editor or Navigator
|
||||
// from attempted 2nd instance or Site Manager
|
||||
afx_msg LRESULT OnOpenEditor(WPARAM wParam, LPARAM lParam);
|
||||
afx_msg LRESULT OnOpenNavigator(WPARAM wParam, LPARAM lParam);
|
||||
#ifdef XP_WIN32
|
||||
afx_msg LRESULT OnSiteMgrMessage(WPARAM wParam, LPARAM lParam);
|
||||
#endif
|
||||
// These are hooked up to menu commands...
|
||||
afx_msg void OnNavigateToEdit();
|
||||
afx_msg void OnEditFrame();
|
||||
// ...and call this after setting appropriate m_iLoadUrlEditorState
|
||||
void OpenEditorWindow(int iStyle);
|
||||
|
||||
// This is used for all of above - prevent interaction
|
||||
// with menus when no context, edit buffer, etc exists
|
||||
afx_msg void OnUpdateCanInteract(CCmdUI* pCmdUI);
|
||||
afx_msg void OnUpdateEditFrame(CCmdUI* pCmdUI);
|
||||
afx_msg void OnEditNewDocFromTemplate();
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
afx_msg LONG OnHackedMouseWheel(WPARAM wParam, LPARAM lParam);
|
||||
// jliu added the following to support CJK caption print
|
||||
afx_msg void OnNcPaint();
|
||||
afx_msg BOOL OnNcActivate( BOOL );
|
||||
afx_msg LRESULT OnSetText(WPARAM wParam, LPARAM lParam);
|
||||
afx_msg LRESULT OnSettingChange(WPARAM, LPARAM);
|
||||
#endif
|
||||
afx_msg void OnActivate( UINT nState, CWnd* pWndOther, BOOL bMinimized);
|
||||
#ifdef DEBUG_WHITEBOX
|
||||
afx_msg void OnWhiteBox();
|
||||
#endif
|
||||
afx_msg void OnToggleFreezeFrame();
|
||||
afx_msg void OnUpdateToggleFreezeFrame( CCmdUI *pCmdUI );
|
||||
DECLARE_MESSAGE_MAP()
|
||||
|
||||
public:
|
||||
BOOL IsFrozenFrame() {return m_bFreezeFrame; }
|
||||
private:
|
||||
BOOL m_bFreezeFrame;
|
||||
|
||||
#ifdef EDITOR
|
||||
public:
|
||||
// Load a URL into a new edit window,
|
||||
// OR the existing window if bNewWindow is FALSE
|
||||
// (used only when Composer is first window)
|
||||
void LoadUrlEditor(char * pURL = NULL,
|
||||
BOOL bNewWindow = TRUE,
|
||||
int iLoadStyle = 0,
|
||||
MWContext * pCopyHistoryContext = NULL);
|
||||
|
||||
// Called from Edit view only after CheckAndSaveDocument
|
||||
void OpenNavigatorWindow(MWContext * pMWContext);
|
||||
|
||||
// Currently used only when canceling an already-loaded URL
|
||||
// in editor and user doesn't want to save to disk
|
||||
// (replaces editor with a browser with the same URL)
|
||||
void EditToNavigate(MWContext * pEditContext, BOOL bNewDocument );
|
||||
|
||||
// Put all Composer-only code here - called only from CGenericFrame::OnMenuSelect()
|
||||
void OnMenuSelectComposer(UINT nItemID, UINT nFlags, HMENU hSysMenu);
|
||||
BOOL m_bCloseFrame;
|
||||
|
||||
#endif
|
||||
|
||||
virtual void RefreshNewEncoding(int16 csid, BOOL bIgnore=TRUE);
|
||||
};
|
||||
|
||||
#ifdef EDITOR
|
||||
// Global helpers so CEditFrame and CComposeFrame (mail message) can share
|
||||
// dynamic menu functionality
|
||||
BOOL edt_GetMessageString(CView *pView, UINT MenuId, CString& Message);
|
||||
BOOL edt_IsEditorDynamicMenu(WPARAM wParam);
|
||||
#endif
|
||||
|
||||
CGenericFrame *wfe_FrameFromXPContext(MWContext * pXPCX);
|
||||
|
||||
extern UINT NEAR WM_FINDREPLACE;
|
||||
extern UINT NEAR WM_HELPMSG;
|
||||
#endif
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
4100
cmd/winfe/resource.h
4100
cmd/winfe/resource.h
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,417 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef _USERTLBR_H
|
||||
#define _USERTLBR_H
|
||||
|
||||
#include <afxwin.h>
|
||||
#include <afxext.h>
|
||||
#include <afxpriv.h>
|
||||
#include <afxole.h>
|
||||
#include <afxdisp.h>
|
||||
#include <afxodlgs.h>
|
||||
#ifdef _WIN32
|
||||
#include <afxcmn.h>
|
||||
#endif
|
||||
|
||||
#include "tlbutton.h"
|
||||
#include "toolbar2.h"
|
||||
#include "rdfacc.h"
|
||||
#include "cxicon.h"
|
||||
|
||||
#define CRDFToolbarButtonDropTargetBase CToolbarButtonDropTarget
|
||||
|
||||
class CRDFToolbarButtonDropTarget : public CRDFToolbarButtonDropTargetBase
|
||||
{
|
||||
public:
|
||||
CRDFToolbarButtonDropTarget(){m_pButton = NULL;}
|
||||
protected:
|
||||
virtual DROPEFFECT ProcessDragEnter(CWnd *pWnd, COleDataObject *pDataObject,
|
||||
DWORD dwKeyState, CPoint point);
|
||||
virtual DROPEFFECT ProcessDragOver(CWnd *pWnd, COleDataObject *pDataObject,
|
||||
DWORD dwKeyState, CPoint point);
|
||||
virtual BOOL ProcessDrop(CWnd *pWnd, COleDataObject *pDataObject,
|
||||
DROPEFFECT dropEffect, CPoint point);
|
||||
|
||||
};
|
||||
|
||||
#define CRDFToolbarButtonBase CDragableToolbarButton
|
||||
|
||||
class CRDFToolbarButton: public CRDFToolbarButtonBase, public CCustomImageObject
|
||||
{
|
||||
protected:
|
||||
HT_Resource m_Node; // The resource corresponding to the RDF node
|
||||
BOOKMARKITEM m_bookmark;
|
||||
UINT m_uCurBMID;
|
||||
CMapWordToPtr m_BMMenuMap; // Maps the bookmark menu IDs
|
||||
int currentRow; // The row of the personal toolbar this button resides on.
|
||||
CDropMenu* m_pCachedDropMenu; // A pointer to a drop menu that is tracked across
|
||||
// node opening (HT) callbacks
|
||||
CNSNavFrame* m_pTreeView; // A pointer to a tree popup that is tracked.
|
||||
BOOL m_bShouldShowRMMenu; // Set to TRUE by default. Quickfile/Breadcrumbs set it to FALSE.
|
||||
|
||||
CRDFCommandMap m_MenuCommandMap; // Command map for back-end generated right mouse menu commands.
|
||||
|
||||
int m_nActualBitmapHeight; // The actual bitmap's height.
|
||||
|
||||
CString m_BorderStyle; // Solid, beveled, or none.
|
||||
|
||||
public:
|
||||
CRDFToolbarButton();
|
||||
~CRDFToolbarButton();
|
||||
|
||||
virtual int Create(CWnd *pParent, int nToolbarStyle, CSize noviceButtonSize, CSize advancedButtonSize,
|
||||
LPCTSTR pButtonText, LPCTSTR pToolTipText,
|
||||
LPCTSTR pStatusText,
|
||||
CSize bitmapSize, int nMaxTextChars, int nMinTextChars, BOOKMARKITEM bookmark,
|
||||
HT_Resource pNode, DWORD dwButtonStyle = 0);
|
||||
|
||||
int GetRow() { return currentRow; }
|
||||
void SetRow(int i) { currentRow = i; }
|
||||
|
||||
virtual BOOL foundOnRDFToolbar() { return TRUE; } // RDF Buttons must ALWAYS reside on RDF toolbars. (Derived
|
||||
// classes could have different behavior, but base-class buttons
|
||||
// make the assumption that they sit on an RDF toolbar.
|
||||
|
||||
CNSNavFrame* GetTreeView() { return m_pTreeView; }
|
||||
|
||||
virtual void OnAction(void);
|
||||
virtual CSize GetButtonSizeFromChars(CString s, int c);
|
||||
virtual CSize GetMinimalButtonSize();
|
||||
virtual CSize GetMaximalButtonSize();
|
||||
|
||||
virtual BOOL IsSpring() { return FALSE; } // Whether or not the button will expand to consume
|
||||
// all remaining space on a row.
|
||||
|
||||
virtual BOOL UseLargeIcons() { return FALSE; }
|
||||
virtual void UpdateIconInfo();
|
||||
HT_IconType TranslateButtonState();
|
||||
|
||||
virtual void DrawButtonBitmap(HDC hDC, CRect rcImg);
|
||||
|
||||
virtual void FillInOleDataSource(COleDataSource *pDataSource);
|
||||
|
||||
BOOKMARKITEM GetBookmarkItem();
|
||||
HT_Resource GetNode(void) { return m_Node;}
|
||||
void SetNode(HT_Resource pBookmark, BOOL bAddRef = TRUE);
|
||||
void SetBookmarkItem(BOOKMARKITEM bookmark);
|
||||
virtual void EditTextChanged(char *pText);
|
||||
void SetTextWithoutResize(CString text);
|
||||
|
||||
virtual UINT GetBitmapID(void);
|
||||
virtual UINT GetBitmapIndex(void);
|
||||
|
||||
void FillInMenu(HT_Resource pNode);
|
||||
void LoadComplete(HT_Resource r);
|
||||
virtual void DrawCustomIcon(HDC hDC, int x, int y);
|
||||
virtual void DrawLocalIcon(HDC hDC, int x, int y);
|
||||
virtual void DrawUpButton(HDC hDC, CRect & rect);
|
||||
virtual void DrawDownButton(HDC hDC, CRect & rect);
|
||||
virtual void DrawCheckedButton(HDC hDC, CRect & rect);
|
||||
|
||||
virtual HT_View GetHTView() { return HT_GetView(m_Node); }
|
||||
|
||||
virtual BOOL NeedsUpdate();
|
||||
|
||||
// button mode is defined solely in the RDF
|
||||
virtual void SetPicturesOnly(int bPicturesOnly);
|
||||
virtual void SetButtonMode(int nToolbarStyle);
|
||||
int GetButtonMode(void);
|
||||
|
||||
protected:
|
||||
virtual void DrawPicturesAndTextMode(HDC hDC, CRect rect);
|
||||
virtual BOOL CreateRightMouseMenu(void);
|
||||
virtual CWnd* GetMenuParent(void);
|
||||
virtual void GetPicturesAndTextModeTextRect(CRect &rect);
|
||||
virtual void GetPicturesModeTextRect(CRect &rect);
|
||||
virtual void DrawButtonText(HDC hDC, CRect rcTxt, CSize sizeTxt, CString strTxt);
|
||||
|
||||
|
||||
virtual HFONT GetFont(HDC hDC);
|
||||
virtual int DrawText(HDC hDC, LPCSTR lpString, int nCount, LPRECT lpRect, UINT uFormat);
|
||||
virtual BOOL GetTextExtentPoint32(HDC hDC, LPCSTR lpString, int nCount, LPSIZE lpSize);
|
||||
|
||||
protected:
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CRDFToolbarButton)
|
||||
afx_msg LRESULT OnDragMenuOpen(WPARAM, LPARAM);
|
||||
afx_msg BOOL OnCommand(UINT wParam,LONG lParam);
|
||||
afx_msg LRESULT OnDropMenuDropOccurred(WPARAM, LPARAM);
|
||||
afx_msg LRESULT OnDropMenuDraggingOccurred(WPARAM, LPARAM);
|
||||
afx_msg LRESULT OnDropMenuClosed(WPARAM, LPARAM);
|
||||
afx_msg LRESULT OnFillInMenu(WPARAM wParam, LPARAM lParam);
|
||||
afx_msg void OnSysColorChange( );
|
||||
afx_msg void OnPaint();
|
||||
afx_msg int OnMouseActivate( CWnd* pDesktopWnd, UINT nHitTest, UINT message );
|
||||
|
||||
//}}AFX_MSG
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
|
||||
|
||||
};
|
||||
|
||||
void toolbarNotifyProcedure (HT_Notification ns, HT_Resource n, HT_Event whatHappened);
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
* Class: CRDFSeparatorButton
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
class CRDFSeparatorButton : public CRDFToolbarButton
|
||||
{
|
||||
protected:
|
||||
|
||||
public:
|
||||
virtual CSize GetButtonSizeFromChars(CString s, int c);
|
||||
// Overridden to handle special width/height requirements.
|
||||
|
||||
virtual void DrawButtonBitmap(HDC hDC, CRect rcImg);
|
||||
virtual void DrawButtonText(HDC hDC, CRect rcTxt, CSize sizeTxt, CString strTxt) {};
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CRDFSeparatorButton)
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
* Class: CRDFToolbarDropTarget
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* This class provides a drag-drop target for the bookmark quick file
|
||||
* button.
|
||||
*
|
||||
****************************************************************************/
|
||||
class CRDFToolbar;
|
||||
|
||||
class CRDFToolbarDropTarget : public COleDropTarget
|
||||
{
|
||||
private:
|
||||
CRDFToolbar *m_pToolbar;
|
||||
|
||||
public:
|
||||
CRDFToolbarDropTarget() {m_pToolbar = NULL;}
|
||||
void Toolbar(CRDFToolbar *pToolbar);
|
||||
|
||||
protected:
|
||||
|
||||
virtual DROPEFFECT OnDragEnter(CWnd * pWnd,
|
||||
COleDataObject * pDataObject, DWORD dwKeyState, CPoint point);
|
||||
virtual DROPEFFECT OnDragOver(CWnd * pWnd,
|
||||
COleDataObject * pDataObject, DWORD dwKeyState, CPoint point );
|
||||
virtual BOOL OnDrop(CWnd * pWnd, COleDataObject * pDataObject,
|
||||
DROPEFFECT dropEffect, CPoint point);
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
class CRDFToolbar : public CNSToolbar2, public CCustomImageObject {
|
||||
|
||||
private:
|
||||
CRDFToolbarDropTarget m_DropTarget;
|
||||
HT_View m_ToolbarView;
|
||||
CRDFCommandMap m_MenuCommandMap; // Command map for back-end generated right mouse menu commands.
|
||||
|
||||
int m_nNumberOfRows;
|
||||
int m_nRowHeight;
|
||||
|
||||
CRDFToolbarButton* m_pDragButton;
|
||||
int m_iDragFraction;
|
||||
|
||||
COLORREF m_BackgroundColor;
|
||||
COLORREF m_ForegroundColor;
|
||||
COLORREF m_RolloverColor;
|
||||
COLORREF m_PressedColor;
|
||||
COLORREF m_DisabledColor;
|
||||
COLORREF m_ShadowColor;
|
||||
COLORREF m_HighlightColor;
|
||||
|
||||
CRDFImage* m_pBackgroundImage;
|
||||
|
||||
static int m_nMinToolbarButtonChars;
|
||||
static int m_nMaxToolbarButtonChars;
|
||||
|
||||
public:
|
||||
|
||||
// toolbar style descriptors for translating between our superclass' idea of style
|
||||
// and HT's idea, an intersection occupied by this class
|
||||
// (see HTDescriptorFromStyle()).
|
||||
enum StyleType {
|
||||
nPicAndTextStyle = 0,
|
||||
nPicStyle,
|
||||
nTextStyle
|
||||
};
|
||||
|
||||
CRDFToolbar(HT_View theView, int nMaxButtons, int nToolbarStyle, int nPicturesAndTextHeight, int nPicturesHeight,
|
||||
int nTextHeight);
|
||||
~CRDFToolbar();
|
||||
|
||||
// Used to create toolbars
|
||||
static CRDFToolbar* CreateUserToolbar(HT_View theView, CWnd* pParent);
|
||||
|
||||
int Create(CWnd *pParent);
|
||||
virtual int GetHeight(void);
|
||||
virtual int GetRowWidth();
|
||||
|
||||
// Override layout scheme to dynamically resize buttons.
|
||||
void LayoutButtons(int nIndex); // Index will be ignored by this version of the function
|
||||
// since adding/deleting buttons may cause all buttons to resize
|
||||
|
||||
// Toolbar's event handler.
|
||||
void HandleEvent(HT_Notification ns, HT_Resource n, HT_Event whatHappened);
|
||||
|
||||
void AddHTButton(HT_Resource n); // Called to add a new button to the toolbar
|
||||
|
||||
void SetMinimumRows(int rowWidth); // Called to determine and set the # of rows required by the toolbar.
|
||||
|
||||
int GetRows() { return m_nNumberOfRows; }
|
||||
void SetRows(int i) { m_nNumberOfRows = i; }
|
||||
|
||||
void WidthChanged(int width); // Inherited from toolbar. Called when width changes, e.g. window resize or animation placed on toolbar.
|
||||
|
||||
void FillInToolbar(); // Called to create and place the buttons on the toolbar
|
||||
int GetDisplayMode(void);
|
||||
|
||||
HT_View GetHTView() { return m_ToolbarView; } // Returns the HT-View for this toolbar.
|
||||
void SetHTView(HT_View v) { m_ToolbarView = v; }
|
||||
|
||||
void SetDragFraction(int i) { m_iDragFraction = i; }
|
||||
int GetDragFraction() { return m_iDragFraction; }
|
||||
|
||||
void SetDragButton(CRDFToolbarButton* pButton) { m_pDragButton = pButton; }
|
||||
CRDFToolbarButton* GetDragButton() { return m_pDragButton; }
|
||||
|
||||
void SetRowHeight(int i) { m_nRowHeight = i; }
|
||||
int GetRowHeight() { return m_nRowHeight; }
|
||||
|
||||
// Color/background customizability stuff
|
||||
|
||||
COLORREF GetBackgroundColor() { return m_BackgroundColor; }
|
||||
COLORREF GetForegroundColor() { return m_ForegroundColor; }
|
||||
COLORREF GetRolloverColor() { return m_RolloverColor; }
|
||||
COLORREF GetPressedColor() { return m_PressedColor; }
|
||||
COLORREF GetDisabledColor() { return m_DisabledColor; }
|
||||
COLORREF GetShadowColor() { return m_ShadowColor; }
|
||||
COLORREF GetHighlightColor() { return m_HighlightColor; }
|
||||
|
||||
void ComputeColorsForSeparators();
|
||||
|
||||
CRDFImage* GetBackgroundImage() { return m_pBackgroundImage; }
|
||||
void SetBackgroundColor(COLORREF c) { m_BackgroundColor = c; }
|
||||
void SetForegroundColor(COLORREF c) { m_ForegroundColor = c; }
|
||||
void SetRolloverColor(COLORREF c) { m_RolloverColor = c; }
|
||||
void SetPressedColor(COLORREF c) { m_PressedColor = c; }
|
||||
void SetDisabledColor(COLORREF c) { m_DisabledColor = c; }
|
||||
void SetShadowColor(COLORREF c) { m_ShadowColor = c; }
|
||||
void SetHighlightColor(COLORREF c) { m_HighlightColor = c; }
|
||||
|
||||
void SetBackgroundImage(CRDFImage* p) { m_pBackgroundImage = p; }
|
||||
|
||||
void LoadComplete(HT_Resource r);
|
||||
|
||||
void ChangeButtonSizes(void); // Overridden to prevent separators and url bars from changing size.
|
||||
|
||||
virtual void SetToolbarStyle(int nToolbarStyle);
|
||||
|
||||
// returns the HT string descriptor corresponding to the toolbar style.
|
||||
static const char * HTDescriptorFromStyle(int style);
|
||||
// returns the toolbar style corresponding to the HT string descriptor.
|
||||
// returns < 0 if no corresponding style is found
|
||||
static int StyleFromHTDescriptor(const char *descriptor);
|
||||
|
||||
protected:
|
||||
// Helper function used in conjunction with LayoutButtons
|
||||
void ComputeLayoutInfo(CRDFToolbarButton* pButton, int numChars, int rowWidth, int& usedSpace);
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CRDFToolbar)
|
||||
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
|
||||
afx_msg BOOL OnCommand( WPARAM wParam, LPARAM lParam );
|
||||
afx_msg void OnPaint(void);
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
|
||||
|
||||
};
|
||||
|
||||
class CRDFDragToolbar : public CDragToolbar
|
||||
{
|
||||
public:
|
||||
|
||||
virtual int Create(CWnd *pParent, CToolbarWindow *pToolbar);
|
||||
virtual void SetOpen(BOOL bIsOpen);
|
||||
virtual void BeActiveToolbar();
|
||||
|
||||
protected:
|
||||
void CopySettingsToRDF(void);
|
||||
|
||||
public:
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CDragToolbar)
|
||||
afx_msg void OnPaint(void);
|
||||
//}}AFX_MSG
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
class CRDFToolbarHolder : public CCustToolbar
|
||||
{
|
||||
protected:
|
||||
HT_Pane m_ToolbarPane;
|
||||
CFrameWnd* m_pCachedParentWindow;
|
||||
CRDFToolbarButton* m_pCurrentDockedButton;
|
||||
CRDFToolbarButton* m_pCurrentPopupButton;
|
||||
|
||||
public:
|
||||
CRDFToolbarHolder(int maxToolbars, CFrameWnd* pParent);
|
||||
virtual ~CRDFToolbarHolder();
|
||||
|
||||
CRDFToolbarButton* GetCurrentButton(int state)
|
||||
{
|
||||
if (state == HT_POPUP_WINDOW)
|
||||
return m_pCurrentPopupButton;
|
||||
else return m_pCurrentDockedButton;
|
||||
}
|
||||
|
||||
void SetCurrentButton(CRDFToolbarButton* button, int state)
|
||||
{
|
||||
if (state == HT_POPUP_WINDOW)
|
||||
m_pCurrentPopupButton = button;
|
||||
else m_pCurrentDockedButton = button;
|
||||
}
|
||||
|
||||
HT_Pane GetHTPane() { return m_ToolbarPane; }
|
||||
void SetHTPane(HT_Pane p) { m_ToolbarPane = p; }
|
||||
CFrameWnd* GetCachedParentWindow() { return m_pCachedParentWindow; }
|
||||
void InitializeRDFData();
|
||||
|
||||
virtual CDragToolbar* CreateDragBar()
|
||||
{
|
||||
return new CRDFDragToolbar();
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void DrawSeparator(int i, HDC hDC, int nStartX, int nEndX, int nStartY, BOOL bToolbarSeparator = TRUE);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
Загрузка…
Ссылка в новой задаче