home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / winfe / edprops.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  43.8 KB  |  1,474 lines

  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18.  
  19. // edprops.h : header file
  20. //
  21. #ifdef EDITOR
  22. #ifndef _EDPROPS_H
  23. #define _EDPROPS_H
  24.  
  25. #include "edtrccln.h"
  26. #include "property.h"
  27.  
  28. // Tell color-picker to use page's background color as "default"
  29. #define BACKGROUND_COLORREF 0xFFFFFFFE
  30. // Note: other _COLORREF defines are in winproto.h for wider access
  31.  
  32. // Use by Property dialogs and Preference dialog
  33. BOOL wfe_ValidateImage(MWContext * pMWContext, CString& csImageURL, BOOL bCheckFileExists = FALSE);
  34.  
  35. //prototype used by editor DLL judge
  36. void wfe_GetLayoutViewSize(MWContext * pMWContext, int32 * pWidth, int32 * pHeight);
  37.  
  38. // For no-brainer setting and clearing of text format style bits
  39. #define FE_CLEAR_BIT(x,tf) x &= ~tf
  40. #define FE_SET_BIT(x,tf)   x |= tf
  41.  
  42. // Font shared by all comboboxes in dialogs and toolbars
  43. // Should be 1-pixel, 8pt MS Sans Serif or default GUI or font on foreing systems
  44. extern CFont * wfe_pFont;
  45.  
  46. extern int wfe_iFontHeight;
  47.  
  48. // Style states for m_iFontSizeMode
  49. enum {
  50.     ED_FONTSIZE_POINTS,         // Convert -2 to +4 into current point size (based on FontFace base size)
  51.     ED_FONTSIZE_RELATIVE,       // Show -2 to +4
  52.     ED_FONTSIZE_ADVANCED         // Show -2 to +4, and absolute point sizes for POINT-SIZE tag param
  53. };
  54. extern int32 wfe_iFontSizeMode;
  55. extern CFont wfe_pThinFont;
  56.  
  57. // iSize should be  1 to MAX_FONT_SIZE
  58. // String formated slightly different for menu:  "+1 (14pts)"
  59. // Returns pointer to static string - DON'T FREE RESULT!
  60. char * wfe_GetFontSizeString(MWContext * pMWContext, int iSize,  BOOL bFixedWidth = FALSE, BOOL bMenu = FALSE);
  61.  
  62. #define   MAX_TRUETYPE_FONTS  100
  63.  
  64. // Currently 10 columns of 7 colors each
  65. // Now defined in edttypes.h
  66. //#define   MAX_NS_COLORS        70
  67.  
  68. // Number of colors in custom palette
  69. #define   MAX_CUSTOM_COLORS    10
  70.  
  71. // Add 1 for Current, 1 for Last-Picked and 10 for custom color palette
  72. #define   MAX_COLORS         (MAX_NS_COLORS+MAX_CUSTOM_COLORS+2)
  73.  
  74. extern char **wfe_ppTrueTypeFonts; // The Sorted list of fonts in combobox or menu
  75. extern int wfe_iTrueTypeFontBase;
  76. extern int wfe_iTrueTypeFontCount;
  77.  
  78. // Build a sorted list of TrueType fonts
  79. // Should be done only ONCE per app since strings are static
  80. //   and used by all FontFace lists.
  81. // TODO: If we want to build new list (user installs new fonts),
  82. //       then we must call wfe_FillFaceCombo again for ALL windows
  83. extern int  wfe_InitTrueTypeArray(CDC *pDC);    
  84. extern void wfe_FreeTrueTypeArray();
  85.  
  86. // Global index within ppFontArray if "Other..." was needed (too many fonts)
  87. extern int wfe_iFontFaceOtherIndex;
  88.  
  89. // Global strings used in font attribute owner-draw listboxes
  90. extern char * ed_pOther;
  91. extern char * ed_pMixedFonts;
  92. extern char * ed_pDontChange;
  93.  
  94. // Fill the supplied combobox with Default, XP Font sets, and local Vector fonts
  95. // Sets values for wfe_iTrueTypeFontBase and wfe_iTrueTypeFontCount
  96. // Returns index to list where "Other..." is used instead of actual fonts (if too many fonts installed)
  97. // Optionally returns width of longest string found
  98. extern int wfe_FillFontComboBox(CComboBox * pCombo, int * pMaxWidth = NULL);
  99.  
  100. // Total font sizes with Netscape extension -- SHOULD GET THIS FROM A COMMON H FILE!
  101. #define      MAX_FONT_SIZE            7
  102.  
  103. // We map {-2 ... +4} onto absolute sizes {1 ... 7}
  104. // This is minimum of scale
  105. #define   MIN_FONT_SIZE_RELATIVE  -2
  106.  
  107. // Allocates a new LoColor structure if it does not exist
  108. // Set RGB values
  109. void wfe_SetLO_ColorPtr( COLORREF crColor, LO_Color **ppLoColor );
  110.  
  111. // Fill a LoColor structure
  112. void wfe_SetLO_Color( COLORREF crColor, LO_Color *pLoColor );
  113.  
  114. // Array of colors to show in common color dialog
  115. extern COLORREF wfe_CustomPalette[16];
  116. // Last-Picked color in color-picker: Saved in prefs
  117. extern COLORREF wfe_crLastColorPicked;
  118.  
  119. // Define makes more sense in some circumstances
  120. // We either don't want to show color because of mixed state in selection (in lists and comboboxes)
  121. //    or don't draw a color swatch or button
  122. #define NO_COLORREF  MIXED_COLORREF
  123.  
  124. char * wfe_GetDefaultColorString(COLORREF crDefColor);
  125.  
  126. /*convert image p_file (in URLFORM) and return the resultant filename, or null if failure/cancel*/
  127. char * wfe_ConvertImage(char *p_fileurl,void *p_parentwindow,MWContext *p_pMWContext);
  128.  
  129. /////////////////////////////////////////////////////////////////////////////
  130. // CColorButton
  131. // Simple button to draw color rect on surface for launching a color picker
  132.  
  133. class CColorButton : public CButton
  134. {
  135.     DECLARE_DYNAMIC(CColorButton)
  136. // Construction
  137. public:
  138.     CColorButton(COLORREF * pColorRef = NULL, COLORREF * pSetFocusColor = NULL);
  139.  
  140. // Attributes
  141. private:
  142.     // Point to color - owned by parent window
  143.     COLORREF  * m_pColorRef;
  144.     // If we set focus to ourselves, return the color here
  145.     COLORREF  * m_pSetFocusColor;
  146.     COLORREF    m_crDefaultColor;
  147.     HPALETTE    m_hPal;
  148.     BOOL        m_bColorSwatchMode;
  149.     char        m_pTipText[80];
  150.     CNSToolTip2 *m_pToolTip;
  151.  
  152. // Operations
  153. public:
  154. // Overrides
  155.     // ClassWizard generated virtual function overrides
  156.     //{{AFX_VIRTUAL(CColorButton)
  157.     //}}AFX_VIRTUAL
  158.  
  159. // Implementation
  160. public:
  161.     virtual ~CColorButton();
  162.  
  163.     //   pColorRef points to color we display on a button
  164.     // If bColorSwatchMode = TRUE, 
  165.     //    draw a shaded border that looks like a deppressed well like Window's color picker
  166.     // If FALSE, draw what looks like a Combobox: deppressed well with color 
  167.     //   and button with downward-pointing triangle
  168.     BOOL Create(RECT& rect, CWnd * pParentWnd, UINT nID, COLORREF * pColorRef, BOOL bColorSwatchMode = FALSE);
  169.     // Use this when button control already exists in a dialog template
  170.     //   (remember to set Owner-Draw style!)
  171.     BOOL Subclass(CWnd * pParentWnd, UINT nID, COLORREF * pColorRef, BOOL bColorSwatchMode = FALSE);
  172.     COLORREF GetColor() { return *m_pColorRef;}
  173.     
  174.     // Call when color has changed to redraw button and tooltip
  175.     void Update();
  176.  
  177. private:
  178.     // Add a tooltip to show color if in true "button" mode,
  179.     //   not "color swatch" mode
  180.     void AddToolTip();
  181.     
  182. #ifdef XP_WIN32
  183.     // OnNotifyEx handler to get tooltip text
  184.     BOOL OnToolTipNotify( UINT id, NMHDR * pNMHDR, LRESULT * pResult );
  185. #endif
  186.  
  187. protected:
  188.     virtual void DrawItem(LPDRAWITEMSTRUCT lpDIS);
  189.     virtual BOOL PreTranslateMessage(MSG* pMsg);
  190.  
  191.     // Generated message map functions
  192.     //{{AFX_MSG(CColorButton)
  193.     afx_msg void OnMouseMove(UINT nFlags, CPoint point);
  194.     afx_msg void OnSetFocus(CWnd* pOldWnd);
  195.     //}}AFX_MSG
  196.     DECLARE_MESSAGE_MAP()
  197. };
  198.  
  199. /////////////////////////////////////////////////////////////////////////////////
  200. // General User-draw Custom Combobox
  201. // Draws a separator under strings beginning with "_"
  202.  
  203. class CNSComboBox : public CComboBox
  204. {
  205. public:
  206.     CNSComboBox();
  207.     ~CNSComboBox() {XP_FREEIF(m_pNotInListText);}
  208.  
  209.     BOOL Create(RECT& rect, CWnd* pParentWnd, UINT nID);
  210.  
  211.     BOOL Subclass(CWnd* pParentWnd, UINT nID);
  212.     
  213.     // Clear search params - parent must call this in ON_CBN_DROPDOWN handler
  214.     //   to enable search feature
  215.     void InitSearch();
  216.     
  217.     // Find the supplied string and set selection to it,
  218.     //  if not found write text to closed listbox display
  219.     int FindSelectedOrSetText(char * pText, int iStartAt = 0);
  220.  
  221. private:
  222.     char        m_pSearchBuf[256];
  223.     int         m_iSearchPos;
  224.     BOOL        m_bAllowSearch;
  225.  
  226.     void MeasureItem(LPMEASUREITEMSTRUCT lpMIS);
  227.     void DrawItem(LPDRAWITEMSTRUCT lpDIS);
  228.     int  CompareItem(LPCOMPAREITEMSTRUCT lpCIS);
  229.  
  230.     DWORD   m_dwButtonDownTime;
  231.     BOOL    m_bCheckTime;
  232.     
  233.     char * m_pNotInListText;
  234.  
  235. protected:
  236.     // To trap button down/up messages to enforce "sticky" list
  237.     virtual BOOL PreTranslateMessage(MSG* pMsg);
  238.  
  239.     //{{AFX_MSG(CNSComboBox)
  240.     afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
  241.     //}}AFX_MSG
  242.     DECLARE_MESSAGE_MAP()
  243. };
  244.  
  245. // Font sizes are relative to current font base size,
  246. //  so we need to refill list before each showing
  247. // Returns index of current font size in list
  248. // bFixedWidth needed to get correct base size for default fixed-width font
  249. int wfe_FillFontSizeCombo(MWContext *pMWContext, CNSComboBox * pCombo, BOOL bFixedWidth = FALSE);
  250.  
  251. /////////////////////////////////////////////////////////////////////////////////
  252. // Custom Combobox for selecting colors
  253. class CColorComboBox : public CComboBox
  254. {
  255. public:
  256.     CColorComboBox();
  257.  
  258. // Attributes:
  259.     COLORREF   m_crColor;
  260.  
  261.     // Create combobox, fill with global Netscape color list
  262.     //   MWContext is need to access parent's palette
  263.     //   and display status messages
  264.     //   A 1-pixel MS Sans Serif font will be used if pFont is NULL
  265.     //  Returns number of items in color list
  266.     BOOL CreateAndFill(RECT& rect, CWnd* pParentWnd, 
  267.                        UINT nID, COLORREF crDefColor);
  268.  
  269.     // Use this with a CComboBox already created in a dialog template,
  270.     //  attaches dialog and our class to the dialog's combobox
  271.     //  Returns number of items in color list
  272.     int SubclassAndFill(CWnd* pParentWnd, UINT nID, COLORREF crDefColor);
  273.     
  274.     // Called by each of above to fill the list of colors
  275.     //  Returns number of items in color list
  276.     int FillList(COLORREF crDefColor);
  277.     
  278.     // Sets the selected color to display in combobox.
  279.     // Also find a match to color in color list
  280.     //  and set current combobox selection to the index of that color
  281.     int  SetColor(COLORREF cr);
  282.  
  283.     inline COLORREF GetColor() { return m_crColor; }
  284.  
  285. private:
  286.     HPALETTE    m_hPal;
  287.     CWnd *      m_pParent;
  288.     // Set only by SetColor when color was not found in our list...
  289.     BOOL    m_bCustomColor;
  290.     // ...or when we have a selection with > 1 colors
  291.     BOOL    m_bMixedColors;
  292.     BOOL    m_bOtherColor;
  293.     
  294.     void MeasureItem(LPMEASUREITEMSTRUCT lpMIS);
  295.     void DrawItem(LPDRAWITEMSTRUCT lpDIS);
  296.     int  CompareItem(LPCOMPAREITEMSTRUCT lpCIS);
  297.  
  298. protected:
  299.     // We trap all commands that might cause list to dropdown
  300.     // Generated message map functions
  301.     //{{AFX_MSG(CColorComboBox)
  302.     afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
  303.     afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
  304.     afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
  305. //}}AFX_MSG
  306.     DECLARE_MESSAGE_MAP()
  307. };
  308.  
  309. /////////////////////////////////////////////////////////////////////////////
  310. // CColorPicker 
  311.  
  312. class CColorPicker : public CWnd
  313. {
  314. // Construction
  315. public:
  316.     CColorPicker(CWnd * pParent, 
  317.               MWContext * pMWContext,
  318.               COLORREF    crCurrentColor,
  319.               COLORREF    crDefColor,           // Actual color or DEFAULT_COLORREF or BACKGROUND_COLORREF
  320.               UINT        nIDCaption = 0,       // Optional string ID for dialog caption
  321.               RECT      * pCallerRect = NULL);  // If null, normal centerred dialog,
  322.                                                 //  else positions like a dropdown from caller's rect
  323.  
  324. // Dialog Data
  325.     //{{AFX_DATA(CColorPicker)
  326.     enum { IDD = IDD_COLOR_DLG };
  327.     //}}AFX_DATA
  328.  
  329.     virtual ~CColorPicker();
  330.  
  331. private:    
  332.     RECT            m_CallerRect;
  333.     CWnd           *m_pParent;
  334.     UINT            m_nIDCaption;
  335.     COLORREF        m_crColors[MAX_COLORS];
  336.     CColorButton   *m_pColorButtons[MAX_COLORS];
  337.     CButton         m_DefaultButton;
  338.     CButton         m_OtherButton;
  339.     CButton         m_HelpButton;
  340.     CStatic         m_CurrentLabel;
  341.     CStatic         m_LastUsedLabel; //m_DefaultLabel;
  342.     CStatic         m_CustomColorsLabel;
  343.     CStatic         m_SaveColorLabel;
  344.     CStatic         m_CustomColorNumber[MAX_CUSTOM_COLORS];
  345.     BOOL            m_bColorChanged[MAX_CUSTOM_COLORS];
  346.     BOOL            m_bMouseDown;
  347.     int             m_iMouseDownColorIndex;
  348.     COLORREF        m_crDragColor;
  349.  
  350.     // Cache tooltip text to supply quicky OnTooltipNotify
  351.     char            m_ppTipText[MAX_COLORS][80];
  352.  
  353.     // Result is put here OnOK,
  354.     //  and returned via GetColor();
  355.     COLORREF        m_crColor;
  356.  
  357.     COLORREF        m_crCurrentColor;
  358.     COLORREF        m_crDefColor;
  359.     LO_Color        m_LoColor;
  360.  
  361.     MWContext * m_pMWContext;
  362.  
  363.     // Save state when button is pressed down
  364.     BOOL          m_bOtherDown;
  365.     BOOL          m_bAutoDown;
  366.     BOOL          m_bHelpDown;
  367.  
  368.     CNSToolTip2  *m_pToolTip;
  369.     
  370.     // Implementation 
  371. public:
  372.     // The one and only function to call after construction
  373.     // Works like CDialog:;DoModal() but automatically
  374.     //   exits if mouse clicked outside the picker
  375.     COLORREF GetColor(LO_Color * pLoColor = NULL);
  376.  
  377.     // Need this to pass on tool tip messages
  378.     virtual BOOL PreTranslateMessage(MSG* pMsg);
  379.  
  380. private:
  381. #ifdef XP_WIN32
  382.     // OnNotifyEx handler to get tooltip text
  383.     BOOL OnToolTipNotify( UINT id, NMHDR * pNMHDR, LRESULT * pResult );
  384. #endif
  385.  
  386.     // Stays TRUE while window is up.
  387.     // Set to FALSE to destroy window and return synchronously to caller
  388.     BOOL m_bRunning;
  389.     
  390.     // For suppessing color selection on first mouse up in Current Color button
  391.     BOOL m_bFirstMouseUp;
  392.  
  393. protected:
  394.     // Helpers for hit-testing during mouse management
  395.     BOOL IsMouseOverDlg(CPoint cPoint);
  396.     BOOL IsMouseOverButton(CPoint cPoint, UINT nID);
  397.     // Return index to color swatch, or -1 if not over one
  398.     int  GetMouseOverColorIndex(CPoint cPoint);
  399.     
  400.     void SetButtonState(CPoint cPoint, UINT nID, BOOL* pButtonDown);
  401.     
  402.     // Equivalent to OnOK() and OnCancel for a dialog
  403.     void SetColorAndExit();
  404.     void CancelAndExit();
  405.     void OnColorHelp();
  406.  
  407.     // Generated message map functions
  408.     //{{AFX_MSG(CColorPicker)
  409.     virtual void PostNcDestroy();
  410.     afx_msg void OnChooseColor();
  411.     afx_msg void OnDefaultColor();
  412.     afx_msg void OnMouseMove(UINT nFlags, CPoint point);
  413.     afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
  414.     afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
  415. //}}AFX_MSG
  416.     DECLARE_MESSAGE_MAP()
  417. };
  418.  
  419. /////////////////////////////////////////////////////////////////////////////
  420. // CTagDlg dialog -- Arbitrary tag editor
  421. class CTagDlg : public CDialog
  422. {
  423. // Construction
  424. public:
  425.     CTagDlg(CWnd* pParent,
  426.             MWContext* pMWContext,    // MUST be supplied!
  427.             char *pTagData = NULL);
  428.  
  429. // Dialog Data
  430.     //{{AFX_DATA(CTagDlg)
  431.     enum { IDD = IDD_PROPS_HTML_TAG };
  432.     CString m_csTagData;
  433.     //}}AFX_DATA
  434.  
  435. private:
  436.     BOOL              m_bInsert;
  437.     MWContext        *m_pMWContext;
  438.     BOOL  m_bValidTag;
  439.  
  440.     int32   m_iFullWidth;
  441.     int32   m_iFullHeight;
  442.  
  443.     // This will change resource hInstance to Editor dll (in constructor)
  444.     CEditorResourceSwitcher m_ResourceSwitcher;
  445.  
  446. // Overrides
  447.     // ClassWizard generated virtual function overrides
  448.     //{{AFX_VIRTUAL(CTagDlg)
  449.     protected:
  450.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  451.     //}}AFX_VIRTUAL
  452.  
  453. // Implementation
  454. protected:
  455.  
  456.     // Generated message map functions
  457.     //{{AFX_MSG(CTagDlg)
  458.     virtual BOOL OnInitDialog();
  459.     virtual void OnOK();
  460.     afx_msg void OnHelp();
  461.     afx_msg void OnVerifyHtml();
  462.     //}}AFX_MSG
  463. #ifdef XP_WIN32
  464.     afx_msg BOOL OnHelpInfo(HELPINFO *);
  465. #endif
  466.     DECLARE_MESSAGE_MAP()
  467. //  Tag templates not implemented:
  468. //    afx_msg void OnAddNewTag();
  469. //    afx_msg void OnSelchangeTagList();
  470.  
  471.     Bool DoVerifyTag( char* pTagString );
  472. };
  473.  
  474.  
  475. /////////////////////////////////////////////////////////////////////////////
  476. // CHRuleDlg dialog
  477.  
  478. class CHRuleDlg : public CDialog
  479. {
  480. // Construction
  481. public:
  482.     CHRuleDlg(CWnd* pParent, 
  483.               MWContext *pMWContext,         // MUST be supplied!
  484.               EDT_HorizRuleData* pData = NULL );    // Insert new if not supplied
  485. // Dialog Data
  486.     //{{AFX_DATA(CHRuleDlg)
  487.     enum { IDD = IDD_PROPS_HRULE };
  488.     int        m_nAlign;
  489.     BOOL    m_bShading;
  490.     int        m_iWidth;
  491.     int        m_iHeight;
  492.     int        m_iWidthType;
  493.     //}}AFX_DATA
  494.  
  495. private:    
  496.     BOOL               m_bInsert;
  497.     EDT_HorizRuleData *m_pData;
  498.     MWContext         *m_pMWContext;
  499.  
  500.     int32   m_iFullWidth;
  501.  
  502.     // This will change resource hInstance to Editor dll (in constructor)
  503.     CEditorResourceSwitcher m_ResourceSwitcher;
  504.  
  505. // Overrides
  506.     // ClassWizard generated virtual function overrides
  507.     //{{AFX_VIRTUAL(CHRuleDlg)
  508.     public:
  509.     virtual BOOL DestroyWindow();
  510.     protected:
  511.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  512.     //}}AFX_VIRTUAL
  513.  
  514. // Implementation
  515. protected:
  516.  
  517.     // Generated message map functions
  518.     //{{AFX_MSG(CHRuleDlg)
  519.     virtual BOOL OnInitDialog();
  520.     virtual void OnOK();
  521.     afx_msg void OnHelp();
  522.     afx_msg void OnExtraHTML();
  523.     //}}AFX_MSG
  524. #ifdef XP_WIN32
  525.     afx_msg BOOL OnHelpInfo(HELPINFO *);
  526. #endif
  527.     DECLARE_MESSAGE_MAP()
  528. };
  529.  
  530. typedef enum {
  531.     ED_BORDER_NONE,
  532.     ED_BORDER_BLACK,
  533.     ED_BORDER_WHITE,
  534.     ED_BORDER_RAISED,
  535.     ED_BORDER_LOWERED
  536. } ED_BorderStyle;
  537.  
  538.  
  539. /////////////////////////////////////////////////////////////////////////////
  540. // CTargetDlg dialog
  541.  
  542. class CTargetDlg : public CDialog
  543. {
  544. // Construction
  545. public:
  546.     CTargetDlg(CWnd* pParent,
  547.                MWContext* pMWContext, // MUST be supplied!
  548.                char *pName = NULL);          // Existing target, NULL for new
  549.  
  550. // Dialog Data
  551.     //{{AFX_DATA(CTargetDlg)
  552.     enum { IDD = IDD_PROPS_TARGET };
  553.     CString    m_csName;
  554.     //}}AFX_DATA
  555.  
  556. private:
  557.     MWContext *m_pMWContext;
  558.     BOOL       m_bInsert;
  559.     char      *m_pTargetList;
  560.  
  561.     // This will change resource hInstance to Editor dll (in constructor)
  562.     CEditorResourceSwitcher m_ResourceSwitcher;
  563.  
  564. // Overrides
  565.     // ClassWizard generated virtual function overrides
  566.     //{{AFX_VIRTUAL(CTargetDlg)
  567.     protected:
  568.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  569.     //}}AFX_VIRTUAL
  570.  
  571. // Implementation
  572. protected:
  573.  
  574.     // Generated message map functions
  575.     //{{AFX_MSG(CTargetDlg)
  576.     virtual BOOL OnInitDialog();
  577.     virtual void OnOK();
  578.     afx_msg void OnHelp();
  579.     afx_msg void OnChangeTargetName();
  580.     //}}AFX_MSG
  581. #ifdef XP_WIN32
  582.     afx_msg BOOL OnHelpInfo(HELPINFO *);
  583. #endif
  584.     DECLARE_MESSAGE_MAP()
  585. };
  586.  
  587. /////////////////////////////////////////////////////////////////////////////
  588. // Special class to control background color of static control
  589. // CColorStatic window
  590.  
  591. class CColorStatic : public CStatic
  592. {
  593. // Construction
  594. public:
  595.     CColorStatic(COLORREF crTextColor = RGB(0,0,0),        // Default is black text
  596.                  COLORREF crBackColor = RGB(192,192,192),   // on gray background
  597.                  ED_BorderStyle nStyle = ED_BORDER_NONE);
  598.  
  599. // Attributes
  600. private:
  601.     CBrush         m_brush;
  602.     COLORREF       m_crTextColor;
  603.     COLORREF       m_crBackColor;
  604.     ED_BorderStyle m_nBorderStyle;
  605.  
  606. public:
  607. // Overrides
  608.     // ClassWizard generated virtual function overrides
  609.     //{{AFX_VIRTUAL(CColorStatic)
  610.     BOOL OnChildNotify(UINT message, WPARAM wParam, LPARAM lParam,
  611.                        LRESULT* pLResult);    
  612.     //}}AFX_VIRTUAL
  613.  
  614. // Implementation
  615. public:
  616.     virtual ~CColorStatic();
  617.  
  618.     // Generated message map functions
  619. protected:
  620.     //{{AFX_MSG(CColorStatic)
  621.         // NOTE - the ClassWizard will add and remove member functions here.
  622.     //}}AFX_MSG
  623.  
  624.     DECLARE_MESSAGE_MAP()
  625. };
  626.  
  627. /////////////////////////////////////////////////////////////////////////////
  628. // Property page dialogs
  629. /////////////////////////////////////////////////////////////////////////////
  630. //
  631. // Document Properties
  632. // First page = general info
  633. //    "Fixed" Meta Tags we always include
  634. ///////////////////////////////////////////////////////
  635. class CDocInfoPage : public CNetscapePropertyPage
  636. {
  637. public:
  638.     CDocInfoPage(CWnd *pParent, MWContext * pMWContext = NULL,
  639.                  CEditorResourceSwitcher * pResourceSwitcher = NULL,
  640.                  EDT_PageData * pPageData = NULL);
  641.  
  642.     //{{AFX_DATA(CDocInfoPage)
  643.     enum { IDD = IDD_PAGE_DOC_INFO };
  644.     CString    m_csTitle;
  645.     CString    m_csURL;
  646.     CString    m_csAuthor;
  647.     CString    m_csDescription;
  648. // TODO: Add these to this page?
  649. //    CString    m_csCreateDate;
  650. //    CString    m_csUpdateDate;
  651.     CString    m_csKeyWords;
  652.     CString    m_csClassification;
  653.     //}}AFX_DATA
  654.     
  655.  
  656. // Implementation
  657. protected:              
  658.     BOOL m_bActivated;
  659.     MWContext * m_pMWContext;
  660.     EDT_PageData * m_pPageData;
  661.     int  m_iEquivCount;
  662.     int  m_iMetaCount;
  663.  
  664.     BOOL OnSetActive();
  665.     void OnOK();
  666.     void OnHelp();
  667.     void SetMetaData(char * pName, char * pValue);
  668.  
  669. private:
  670.     // This is used to change resource hInstance back to EXE
  671.     CEditorResourceSwitcher * m_pResourceSwitcher;
  672.  
  673. // Overrides
  674.     // ClassWizard generated virtual function overrides
  675.     //{{AFX_VIRTUAL(CDocInfoPage)
  676.     protected:
  677.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  678.     //}}AFX_VIRTUAL
  679.  
  680.     void EnableApply();
  681.  
  682.     // Generated message map functions
  683.     //{{AFX_MSG(CDocInfoPage)
  684.     //}}AFX_MSG
  685.     DECLARE_MESSAGE_MAP()
  686. };
  687.  
  688. // This should be moved to XP code in the future
  689. typedef struct _EDT_ColorSchemeData {
  690.     char *     pSchemeName;
  691.     LO_Color   ColorText;
  692.     LO_Color   ColorLink;
  693.     LO_Color   ColorActiveLink;
  694.     LO_Color   ColorFollowedLink;
  695.     LO_Color   ColorBackground;
  696.     char *     pBackgroundImage;
  697. } EDT_ColorSchemeData;
  698.  
  699.  
  700. /////////////////////////////////////////////////////////////////////////////
  701. // Document Color and Background Properties
  702. //
  703. class CDocColorPage : public CNetscapePropertyPage
  704. {
  705. public:
  706.     CDocColorPage(CWnd *pParent, 
  707.                   UINT nIDCaption = 0,             // Allows us to change tab text
  708.                   UINT nIDFocus = 0,
  709.                   MWContext * pMWContext = NULL,
  710.                   CEditorResourceSwitcher * pResourceSwitcher = NULL,
  711.                   EDT_PageData * pPageData = NULL);
  712.     ~CDocColorPage();
  713.  
  714.     void OnOK();
  715.     void OnHelp();
  716.  
  717.     //{{AFX_DATA(CDocColorPage)
  718.     enum { IDD = IDD_PAGE_DOC_COLORS };
  719.     CString    m_csBackgroundImage;
  720.     CString    m_csSelectedScheme;
  721.     BOOL    m_bNoSave;
  722.     //}}AFX_DATA
  723.  
  724.  
  725.     BOOL       m_bImageChanged;
  726.     BOOL       m_bValidImage;
  727.  
  728. private:
  729.     HPALETTE     m_hPal;
  730.     CColorButton m_TextColorButton;
  731.     CColorButton m_LinkColorButton;
  732.     CColorButton m_ActiveLinkColorButton;
  733.     CColorButton m_FollowedLinkColorButton;
  734.     CColorButton m_BackgroundColorButton;
  735.  
  736.     COLORREF   m_crBackground;
  737.     COLORREF   m_crText;
  738.     COLORREF   m_crLink;
  739.     COLORREF   m_crActiveLink;
  740.     COLORREF   m_crFollowedLink;
  741.     
  742.     // To save/restore current custom settings
  743.     //   when changing to/from Browser colors 
  744.     COLORREF   m_crCustomBackground;
  745.     COLORREF   m_crCustomText;
  746.     COLORREF   m_crCustomLink;
  747.     COLORREF   m_crCustomActiveLink;
  748.     COLORREF   m_crCustomFollowedLink;
  749.  
  750.     COLORREF   m_crBrowserBackground;
  751.     COLORREF   m_crBrowserText;
  752.     COLORREF   m_crBrowserLink;
  753.     COLORREF   m_crBrowserFollowedLink;
  754.     CString    m_csBrowserBackgroundImage;
  755.  
  756.        // True if we are setting any colors or 
  757.     //  background image. Following checkbox
  758.     //  reflects user's choice for this
  759.     BOOL       m_bCustomColors;
  760.     // Flag to store last state to avoid
  761.     //  unnessesary repainting
  762.     BOOL       m_bWasCustomColors;
  763.  
  764.     // Build a list of schemes from a file
  765.     //  with theire names and colors - 
  766.     //  put names in a listbox
  767.     XP_List  * m_pSchemeData;
  768.     CString    m_csSaveScheme;
  769.  
  770.     // This is used to change resource hInstance back to EXE
  771.     CEditorResourceSwitcher * m_pResourceSwitcher;
  772.  
  773. // Implementation
  774. public:
  775.     // Called after saving background image file to disk 
  776.     // Has new image path+name
  777.     void SetImageFileSaved(char * pImageURL);
  778.  
  779. protected:              
  780.     BOOL           m_bActivated;
  781.     MWContext    * m_pMWContext;
  782.     EDT_PageData * m_pPageData;
  783.     
  784.     BOOL OnSetActive();
  785.  
  786.     // Get a color using our CColorPicker color picker
  787.     //  Use string from nIDCaption for the dialog caption
  788.     //  Return TRUE if OK is pressed
  789.     BOOL ChooseColor(COLORREF * pColor, CColorButton * pButton, COLORREF crDefault);
  790.  
  791.     void UseBrowserColors(BOOL bRedraw = TRUE);
  792.     void UseCustomColors(BOOL bRedraw = TRUE, BOOL bUnselectScheme = TRUE);
  793.  
  794. // Overrides
  795.     // ClassWizard generated virtual function overrides
  796.     //{{AFX_VIRTUAL(CDocColorPage)
  797.     protected:
  798.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  799.     virtual BOOL OnKillActive();
  800.     //}}AFX_VIRTUAL
  801.  
  802.     // Generated message map functions
  803.     //{{AFX_MSG(CDocColorPage)
  804.     afx_msg void OnColorsRadioButtons();
  805.     afx_msg void OnUseBkgrndImage();
  806.     afx_msg void OnChooseBkgrndImage();
  807.     afx_msg void OnColorChoose();
  808.     afx_msg void OnRemoveScheme();
  809.     afx_msg void OnSaveScheme();
  810.     afx_msg void OnSelchangeSchemeList();
  811.     afx_msg void OnChangeBkgrndImage();
  812.     afx_msg void OnKillfocusBkgrndImage();
  813.     afx_msg void OnPaint();
  814.     afx_msg void OnChooseTextColor();
  815.     afx_msg void OnChooseLinkColor();
  816.     afx_msg void OnChooseActivelinkColor();
  817.     afx_msg void OnChooseFollowedlinkColor();
  818.     afx_msg void OnChooseBkgrndColor();
  819.     afx_msg void OnUseAsDefault();
  820.     afx_msg void OnNoSave();
  821.     //}}AFX_MSG
  822.     DECLARE_MESSAGE_MAP()
  823. };
  824.  
  825. //////////////////////////////////////////////////////
  826. // User-Named HTTP-EQUIV and META tags:
  827. ///////////////////////////////////////////////////////
  828. class CDocMetaPage : public CNetscapePropertyPage
  829. {
  830. public:
  831.     CDocMetaPage(CWnd *pParent, MWContext * pMWContext = NULL,
  832.                  CEditorResourceSwitcher * pResourceSwitcher = NULL);
  833.  
  834.     //{{AFX_DATA(CDocMetaPage)
  835.     enum { IDD = IDD_PAGE_DOC_ADVANCED };
  836.     //}}AFX_DATA
  837.  
  838. // Implementation
  839. protected:              
  840.     BOOL m_bActivated;
  841.     MWContext * m_pMWContext;
  842.     EDT_PageData * m_pPageData;
  843.     int  m_iEquivCount;
  844.     int  m_iMetaCount;
  845.  
  846.     BOOL OnSetActive();
  847.     void OnOK();
  848.     void OnHelp();
  849.     void EnableButtons(BOOL bEnable);
  850.     void GetMetaData();
  851.     void ClearNameAndValue();
  852.     void SetMetaData(BOOL bHttpEquiv, char * pName, char * pValue);
  853.  
  854. private:
  855.     // This is used to change resource hInstance back to EXE
  856.     CEditorResourceSwitcher * m_pResourceSwitcher;
  857.  
  858. // Overrides
  859.     // ClassWizard generated virtual function overrides
  860.     //{{AFX_VIRTUAL(CDocMetaPage)
  861.     protected:
  862.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  863.     //}}AFX_VIRTUAL
  864.  
  865.     // Generated message map functions
  866.     //{{AFX_MSG(CDocMetaPage)
  867.     afx_msg void OnSelchangeEquivList();
  868.     afx_msg void OnSelchangeMetaList();
  869.     afx_msg void OnVarSet();
  870.     afx_msg void OnVarDelete();
  871.     afx_msg void OnVarNew();
  872.     afx_msg void OnChangeVarNameOrValue();
  873.     afx_msg void OnSetfocusEquivList();
  874.     afx_msg void OnSetfocusMetaList();
  875.     //}}AFX_MSG
  876.     DECLARE_MESSAGE_MAP()
  877. };
  878.  
  879. //////////////////////////////////////////////////////
  880. // 3-Page Context properties pages
  881. //    First page = Character or Image
  882. //    2nd and 3rd are always Link, Paragraph
  883. //
  884. //////////////////////////////////////////////////////
  885. class CCharacterPage : public CNetscapePropertyPage
  886. {
  887. public:
  888.     CCharacterPage(CWnd *pParent,
  889.                    MWContext * pMWContext = NULL,     // MUST be supplied
  890.                    CEditorResourceSwitcher * pResourceSwitcher = NULL,
  891.                    EDT_CharacterData *pData = NULL);  // MUST be supplied
  892.  
  893.     void OnOK();
  894.     void OnHelp();
  895.  
  896.     //{{AFX_DATA(CCharacterPage)
  897.     enum { IDD = IDD_PAGE_CHARACTER };
  898.     //}}AFX_DATA
  899.  
  900. // Implementation
  901. protected:              
  902.     BOOL               m_bActivated;
  903.     MWContext         *m_pMWContext;
  904.     EDT_CharacterData *m_pData;
  905.     EDT_PageData      *m_pPageData;
  906.     COLORREF           m_crColor;
  907.     COLORREF           m_crDefault;
  908.     BOOL               m_bCustomColor;
  909.     int                m_iNoChangeFontFace;
  910.     int                m_iNoChangeFontSize;
  911.     int                m_iOtherIndex;    
  912.     BOOL               m_bMultipleFonts;
  913.     BOOL               m_bFixedWidth;
  914.     CColorButton       m_TextColorButton;
  915.     int                m_bUseDefault;
  916.  
  917.     BOOL OnSetActive();
  918.     
  919.     void InitCheckbox(CButton *pButton, ED_TextFormat tf);
  920.     void SetCharacterStyle(CButton *pButton, ED_TextFormat tf);
  921.     int  SetCheck(CButton *pButton, ED_TextFormat tf);
  922.     BOOL GetAndValidateFontSizes();
  923.     
  924.     CNSComboBox         m_FontSizeCombo;
  925. private:
  926.     // This is used to change resource hInstance back to EXE
  927.     CEditorResourceSwitcher * m_pResourceSwitcher;
  928.     
  929.     // We use our user-drawn FontFace combo
  930.     CNSComboBox  m_FontFaceCombo;
  931.  
  932.     // Display a message describing the current font face
  933.     void SetFontFaceMessage(int iSel);
  934.  
  935. // Overrides
  936.     // ClassWizard generated virtual function overrides
  937.     //{{AFX_VIRTUAL(CCharacterPage)
  938.     protected:
  939.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  940.     virtual BOOL OnKillActive();
  941.     //}}AFX_VIRTUAL
  942.  
  943.     void OnChooseLocalFont();
  944.     void EnableApply();
  945.     
  946.     // Generated message map functions
  947.     //{{AFX_MSG(CCharacterPage)
  948.     afx_msg void OnChooseColor();
  949.     afx_msg void OnSelchangeFontColor();
  950.     afx_msg void OnCheckSubscript();
  951.     afx_msg void OnCheckSuperscript();
  952.     afx_msg void OnClearAllStyles();
  953.     afx_msg void OnClearTextStyles();
  954.     afx_msg void OnSelchangeFontSize();
  955.     afx_msg void OnSelchangeFontFace();
  956.     afx_msg void OnChangeFontFace();
  957.     afx_msg void OnSelendokFontFace();
  958.     afx_msg void OnFontSizeDropdown();
  959.      afx_msg void OnClose();
  960.     //}}AFX_MSG
  961.     DECLARE_MESSAGE_MAP()
  962. };
  963.  
  964. ///////////////////////////////////////////////////////
  965. class CParagraphPage : public CNetscapePropertyPage
  966. {
  967. public:
  968.     CParagraphPage(CWnd *pParent, MWContext * pMWContext = NULL,
  969.                    CEditorResourceSwitcher * pResourceSwitcher = NULL);
  970.  
  971.     void OnOK();
  972.     void OnHelp();
  973.  
  974.     //{{AFX_DATA(CParagraphPage)
  975.     enum { IDD = IDD_PAGE_PARAGRAPH };
  976.     int        m_iStartNumber;
  977.     BOOL    m_bCompact;
  978.     //}}AFX_DATA
  979.  
  980. // Implementation
  981. protected:              
  982.     BOOL          m_bActivated;
  983.     MWContext    *m_pMWContext;
  984.     ED_Alignment  m_Align;
  985.     EDT_ListData *m_pListData;
  986.     TagType       m_ParagraphStyle;
  987.     
  988.     TagType       m_ParagraphFormat;
  989.     int           m_iParagraphStyle;
  990.     int           m_iContainerStyle;
  991.     int           m_iListStyle;
  992.     int           m_iBulletStyle;
  993.     int           m_iNumberStyle;
  994.     int           m_iMixedStyle;
  995.  
  996.     BOOL OnSetActive();
  997.  
  998.     void UpdateLists();
  999.  
  1000. private:
  1001.     // This is used to change resource hInstance back to EXE
  1002.     CEditorResourceSwitcher * m_pResourceSwitcher;
  1003.  
  1004. // Overrides
  1005.     // ClassWizard generated virtual function overrides
  1006.     //{{AFX_VIRTUAL(CParagraphPage)
  1007.     protected:
  1008.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  1009.     //}}AFX_VIRTUAL
  1010.  
  1011.     // Generated message map functions
  1012.     //{{AFX_MSG(CParagraphPage)
  1013.     afx_msg void OnAlignCenter();
  1014.     afx_msg void OnAlignLeft();
  1015.     afx_msg void OnAlignRight();
  1016.     afx_msg void OnSelchangeContainerStyle();
  1017.     afx_msg void OnSelchangeListItemStyle();
  1018.     afx_msg void OnChangeListStartNumber();
  1019.     afx_msg void OnSelchangeListStyles();
  1020.     afx_msg void OnSelchangeParagraphStyles();
  1021.     afx_msg void OnClose();
  1022.     //}}AFX_MSG
  1023.     DECLARE_MESSAGE_MAP()
  1024. };
  1025.  
  1026.  
  1027. /////////////////////////////////////////////////////////////////////////////
  1028. // CBitmapPushButton
  1029. // This extends MFC CBitmapButton so that it can retain a pushed-down state
  1030. //   to act like a toolbar button
  1031.  
  1032. class CBitmapPushButton : public CBitmapButton
  1033. {
  1034. // Construction
  1035. public:
  1036.     CBitmapPushButton(BOOL bNoBorder = FALSE);
  1037.  
  1038. // Attributes
  1039. private:
  1040.     // TRUE when button is pushed down
  1041.     BOOL      m_bDown;
  1042.     BOOL      m_bFocus;
  1043.     BOOL      m_bSelected;
  1044.     HPALETTE  m_hPal;
  1045.     // For "borderless" button style
  1046.     BOOL      m_bNoBorder;
  1047.  
  1048. // Operations
  1049. public:
  1050.    // Load a single bitmap to use for all button states,
  1051.    //  which we draw instead of using mutliple bitmaps
  1052.    BOOL LoadBitmap(UINT nBitmapID);
  1053.  
  1054. // Overrides
  1055.     // ClassWizard generated virtual function overrides
  1056.     //{{AFX_VIRTUAL(CBitmapPushButton)
  1057.     //}}AFX_VIRTUAL
  1058.  
  1059. // Implementation
  1060. public:
  1061.     virtual ~CBitmapPushButton();
  1062.     
  1063.     // This is analogous to Checkbox or Radio button SetCheck()
  1064.     void SetCheck(BOOL bCheck);
  1065.  
  1066.     // Generated message map functions
  1067. protected:
  1068.     //{{AFX_MSG(CBitmapPushButton)
  1069.         // NOTE - the ClassWizard will add and remove member functions here.
  1070.     afx_msg int OnCreate( LPCREATESTRUCT lpCreateStruct );
  1071.     //}}AFX_MSG
  1072.     DECLARE_MESSAGE_MAP()
  1073.  
  1074.     virtual void DrawItem(LPDRAWITEMSTRUCT lpDIS);
  1075.  
  1076.     // Allow access from our toolbar class
  1077.     friend class CDropdownToolbar;
  1078. };
  1079. //////////////////////////////////////////////////////////////////////////
  1080. // Include this in any dialog that can use the 
  1081. //   Alignment/Sizing/Border control set
  1082. //   Member variables are directly accessed by dialog,
  1083. //   but this handles the alignment BitmapButtons 
  1084. //
  1085. class CAlignControls {
  1086.  
  1087. // For simplicity, let owner dialog set/get data
  1088. //   directly from us
  1089. public:
  1090.     UINT           m_nIDAlign;        /* ID of current button that is down */
  1091.     ED_Alignment   m_EdAlign;         /* Align type used by edit core */
  1092.  
  1093. private:
  1094.     CWnd              *m_pParent;
  1095.     CBitmapPushButton  m_BtnAlignTop; 
  1096.     CBitmapPushButton  m_BtnAlignCenter; 
  1097.     CBitmapPushButton  m_BtnAlignCenterBaseline; 
  1098.     CBitmapPushButton  m_BtnAlignBottomBaseline; 
  1099.     CBitmapPushButton  m_BtnAlignBottom; 
  1100.     CBitmapPushButton  m_BtnAlignLeft; 
  1101.     CBitmapPushButton  m_BtnAlignRight; 
  1102.  
  1103. public:
  1104.     CAlignControls();
  1105.     BOOL Init(CWnd *pParent = NULL);
  1106.     BOOL OnAlignButtonClick(UINT nID);
  1107.     // Use member data to set dialog controls
  1108.     void SetAlignment();
  1109.     // Retrieve from controls
  1110.     ED_Alignment GetAlignment();
  1111. };
  1112.  
  1113.  
  1114. typedef struct {
  1115.     UINT                nCommandID;
  1116.     char              * pButtonName;
  1117.     UINT                nBitmapID;
  1118.     CBitmapPushButton * pButton;
  1119. } DropdownToolbarData;
  1120.  
  1121. /////////////////////////////////////////////////////////////////////////////
  1122. // CDropdownToolbar 
  1123. //   Popup window to give vertical fly-out 
  1124. //   ("sub-toolbar") appearance on toolbar
  1125.  
  1126. class CDropdownToolbar : public CWnd
  1127. {
  1128. // Construction
  1129. public:
  1130.     CDropdownToolbar(CWnd      * pParent = NULL, 
  1131.                      MWContext * pMWContext = NULL,     // Supply this to write status messages
  1132.                      RECT      * pCallerRect = NULL,  // If null, use mouse position to locate toolbar
  1133.                      UINT      nCallerID = 0,         // For tooltip over caller 
  1134.                      UINT      nInitialID = 0);
  1135.  
  1136.     virtual ~CDropdownToolbar();
  1137.  
  1138. private:    
  1139.     UINT      m_nButtonCount;
  1140.     UINT      m_nAllocatedCount;
  1141.     UINT      m_nInitialID;
  1142.     UINT      m_nCallerID;
  1143.     RECT      m_CallerRect;
  1144.     CWnd    * m_pParent;
  1145.     BOOL      m_bFirstButtonUp;
  1146.  
  1147.     MWContext * m_pMWContext;
  1148.     DropdownToolbarData * m_pData;
  1149.  
  1150.     CNSToolTip2 *m_pToolTip;
  1151.     
  1152.     // Implementation 
  1153. public:
  1154.     BOOL AddButton(LPSTR pButtonName, UINT nCommandID);
  1155.     BOOL AddButton(UINT nBitmapID, UINT nCommandID);
  1156.     void Show();
  1157.  
  1158.     // Need this to pass on tool tip messages
  1159.     virtual BOOL PreTranslateMessage(MSG* pMsg);
  1160.  
  1161. private:
  1162. #ifdef XP_WIN32
  1163.     // OnNotifyEx handler to get tooltip text
  1164.     BOOL OnToolTipNotify( UINT id, NMHDR * pNMHDR, LRESULT * pResult );
  1165. #endif
  1166.  
  1167. protected:
  1168.     // Generated message map functions
  1169.     //{{AFX_MSG(CDropdownToolbar)
  1170.     virtual void PostNcDestroy();
  1171.     afx_msg void OnMouseMove(UINT nFlags, CPoint point);
  1172.     afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
  1173.     afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
  1174.  
  1175. //}}AFX_MSG
  1176.     DECLARE_MESSAGE_MAP()
  1177. };
  1178.  
  1179. ///////////////////////////////////////////////////
  1180. class CImagePage : public CNetscapePropertyPage
  1181. {
  1182. public:
  1183.     CImagePage(CWnd *pParent, MWContext * pMWContext = NULL,
  1184.                CEditorResourceSwitcher * pResourceSwitcher = NULL,
  1185.                EDT_ImageData * pData = NULL, BOOL bInsert = FALSE);
  1186.  
  1187.     BOOL m_bActivated;
  1188.  
  1189.     void OnOK();
  1190.     void OnHelp();
  1191.     BOOL OnSetActive();
  1192.  
  1193.     //{{AFX_DATA(CImagePage)
  1194.     enum { IDD = IDD_PAGE_IMAGE };
  1195.     CString    m_csHref;
  1196.     CString    m_csImage;
  1197.     BOOL    m_bNoSave;
  1198.     BOOL    m_bSetAsBackground;
  1199.     int        m_iHeight;
  1200.     int        m_iWidth;
  1201.     int        m_iHSpace;
  1202.     int        m_iVSpace;
  1203.     int        m_iBorder;
  1204.     BOOL    m_bDefaultBorder;
  1205.     int        m_iHeightPixOrPercent;
  1206.     int        m_iWidthPixOrPercent;
  1207.     //}}AFX_DATA
  1208.     UINT    m_nIDBitmap;
  1209.  
  1210. private:
  1211.     // These are changed via CImageAltDlg dialog
  1212.     CString           m_csLowRes;
  1213.     CString           m_csAltText;
  1214.     
  1215.     MWContext     *m_pMWContext;
  1216.     EDT_ImageData *m_pData;
  1217.     BOOL           m_bInsert;
  1218.     UINT           m_IDBitmap;
  1219.     CString           m_csHrefStart;
  1220.  
  1221.     CString           m_csImageStart;
  1222.     CString        m_csLastValidImage;
  1223.     CString        m_csLastValidLowRes;
  1224.     BOOL           m_bValidImage;
  1225.     BOOL           m_bImageChanged;
  1226.     BOOL           m_bLockAspect;
  1227.     BOOL           m_bOriginalButtonPressed;
  1228.     int32          m_iOriginalWidth;
  1229.     int32          m_iOriginalHeight;
  1230.     int32          m_iFullWidth;
  1231.     int32          m_iFullHeight;
  1232.  
  1233.  
  1234. private:
  1235.     // This is used to change resource hInstance back to EXE
  1236.     CEditorResourceSwitcher * m_pResourceSwitcher;
  1237.  
  1238. // Overrides
  1239.     // ClassWizard generated virtual function overrides
  1240.     //{{AFX_VIRTUAL(CImagePage)
  1241.     protected:
  1242.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  1243.     virtual BOOL OnKillActive();
  1244.     //}}AFX_VIRTUAL
  1245.  
  1246. // Implementation
  1247. public:
  1248.     // Called after saving file to disk -- has new image path+name
  1249.     void SetImageFileSaved(char * pImageURL, BOOL bMainImage);
  1250.  
  1251. protected:
  1252.  
  1253.     void SetLockAspectEnable();
  1254.  
  1255.     // Controls common to Image, Java, Plugin property pages
  1256.     CAlignControls m_AlignControls;
  1257.  
  1258.     // Generated message map functions
  1259.     //{{AFX_MSG(CImagePage)
  1260.     afx_msg void OnImageFile();
  1261.     afx_msg void OnChangeImageURL();
  1262.     afx_msg void OnSetAsBackground();
  1263.     afx_msg void OnKillfocusImage();
  1264.     afx_msg void OnNoSave();
  1265.     afx_msg void OnRemoveIsmap();
  1266.     afx_msg void OnImageOriginalSize();
  1267.     afx_msg void OnEditImage();
  1268.     afx_msg void OnAltTextLowRes();
  1269.     afx_msg void OnAlignBaseline();
  1270.     afx_msg void OnAlignBottom();
  1271.     afx_msg void OnAlignCenter();
  1272.     afx_msg void OnAlignLeft();
  1273.     afx_msg void OnAlignRight();
  1274.     afx_msg void OnAlignTop();
  1275.     afx_msg void OnAlignCenterBaseline();
  1276.     afx_msg void OnChangeHeight();
  1277.     afx_msg void OnChangeWidth();
  1278.     afx_msg void OnSelchangeHeightPixOrPercent();
  1279.     afx_msg void OnSelchangeWidthPixOrPercent();
  1280.     afx_msg void OnChangeSpaceHoriz();
  1281.     afx_msg void OnChangeSpaceVert();
  1282.     afx_msg void OnChangeBorder();
  1283.     afx_msg void OnExtraHTML();
  1284.     afx_msg void OnLockAspect();
  1285.     //}}AFX_MSG
  1286.     DECLARE_MESSAGE_MAP()
  1287. };
  1288.  
  1289. /////////////////////////////////////////////////////////////////////////////
  1290. // CAltImageDlg dialog (modal popup over CImagePage for Alt text and Lowres Image)
  1291.  
  1292. class CImageAltDlg : public CDialog
  1293. {
  1294. // Construction
  1295. public:
  1296.     CImageAltDlg(CWnd *pParent, MWContext *pMWContext,
  1297.                  CString& csAltText, CString& csLowRes );
  1298.     ~CImageAltDlg();
  1299.  
  1300.  // Dialog Data
  1301.     //{{AFX_DATA(CImageAltDlg)
  1302.     enum { IDD = IDD_IMAGE_ALT };
  1303.     CString    m_csLowRes;
  1304.     CString    m_csAltText;
  1305.     //}}AFX_DATA
  1306.  
  1307.     MWContext     *m_pMWContext;
  1308.     BOOL           m_bImageChanged;
  1309.  
  1310. private:
  1311.     // This will change resource hInstance to Editor dll (in constructor)
  1312.     CEditorResourceSwitcher m_ResourceSwitcher;
  1313.  
  1314. // Overrides
  1315.     // ClassWizard generated virtual function overrides
  1316.     //{{AFX_VIRTUAL(CImageAltDlg)
  1317.     protected:
  1318.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  1319.     //}}AFX_VIRTUAL
  1320.  
  1321. // Implementation
  1322. protected:
  1323.  
  1324.     // Generated message map functions
  1325.     //{{AFX_MSG(CImageAltDlg)
  1326.     afx_msg void OnHelp();
  1327.     virtual void OnOK();
  1328.     virtual BOOL OnInitDialog();
  1329.     afx_msg void OnLowResFile();
  1330.     afx_msg void OnChangeLowResURL();
  1331.     afx_msg void OnEditImage();
  1332.     //}}AFX_MSG
  1333. #ifdef XP_WIN32
  1334.     afx_msg BOOL OnHelpInfo(HELPINFO *);
  1335. #endif
  1336.     DECLARE_MESSAGE_MAP()
  1337. };
  1338.  
  1339.  
  1340. /////////////////////////////////////////////////////////////////////////////
  1341. // CExtraHTMLDlg dialog (modal popup over CImagePage or CLinkPage for Extra HTML
  1342.  
  1343. class CExtraHTMLDlg : public CDialog
  1344. {
  1345. // Construction
  1346. public:
  1347.     CExtraHTMLDlg(CWnd *pParent, 
  1348.                   char **ppExtraHTML,   // existing string passed in; new string put here
  1349.                   UINT nIDTagType);     // ID for tag string (e.g, IMG or HRER)
  1350.     ~CExtraHTMLDlg();
  1351.  
  1352.  // Dialog Data
  1353.     //{{AFX_DATA(CExtraHTMLDlg)
  1354.     enum { IDD = IDD_EXTRA_HTML };
  1355.     CString    m_csExtraHTML;
  1356.     //}}AFX_DATA
  1357.  
  1358.     // A PropertyPage caller should check this after DoModal() 
  1359.     //  and call SetModified(TRUE) if data changed
  1360.     BOOL    m_bDataChanged;
  1361.  
  1362. private:
  1363.     char **m_ppExtraHTML;   // We return results here
  1364.     UINT   m_nIDTagType;
  1365.  
  1366.     // This will change resource hInstance to Editor dll (in constructor)
  1367.     CEditorResourceSwitcher m_ResourceSwitcher;
  1368.  
  1369. // Overrides
  1370.     // ClassWizard generated virtual function overrides
  1371.     //{{AFX_VIRTUAL(CExtraHTMLDlg)
  1372.     protected:
  1373.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  1374.     //}}AFX_VIRTUAL
  1375.  
  1376. // Implementation
  1377. protected:
  1378.  
  1379.     // Generated message map functions
  1380.     //{{AFX_MSG(CExtraHTMLDlg)
  1381.     afx_msg void OnHelp();
  1382.     virtual void OnOK();
  1383.     virtual BOOL OnInitDialog();
  1384.     //}}AFX_MSG
  1385. #ifdef XP_WIN32
  1386.     afx_msg BOOL OnHelpInfo(HELPINFO *);
  1387. #endif
  1388.     DECLARE_MESSAGE_MAP()
  1389. };
  1390. /////////////////////////////////////////////////////////////////////////////
  1391.  
  1392.  
  1393. class CLinkPage : public CNetscapePropertyPage
  1394. {
  1395. public:
  1396.     CLinkPage(CWnd *pParent, MWContext *pMWContext = NULL,
  1397.               CEditorResourceSwitcher * pResourceSwitcher = NULL,
  1398.               EDT_HREFData *pData = NULL, BOOL bInsert = FALSE,
  1399.               BOOL bMayHaveOtherLinks = FALSE, char **ppImage = NULL);
  1400.  
  1401.     ~CLinkPage();
  1402.  
  1403.     void OnOK();
  1404.     void OnHelp();
  1405.  
  1406.     //{{AFX_DATA(CLinkPage)
  1407.     enum { IDD = IDD_PAGE_LINK };   // Put Dialog ID here
  1408.     CString    m_csHref;
  1409.     CString    m_csAnchorEdit;
  1410.     CString    m_csAnchor;
  1411.     //}}AFX_DATA
  1412.  
  1413. private:
  1414.     BOOL          m_bActivated;
  1415.     MWContext    *m_pMWContext;
  1416.     EDT_HREFData *m_pData;
  1417.     BOOL          m_bInsert;
  1418.     CString          m_csLastValidHref;
  1419.     BOOL          m_bNewAnchorText;
  1420.     char         *m_szBaseDocument;
  1421.     char         *m_pTargetList;
  1422.     CString       m_csTargetFile;
  1423.     int           m_iTargetCount;
  1424.     char        **m_ppImage;
  1425.     BOOL          m_bHrefChanged;
  1426.     BOOL          m_bValidHref;
  1427.     BOOL          m_iCaretMovedBack;
  1428.  
  1429.     CNetscapeView *m_pView;
  1430.  
  1431.     // Selected text has link and other things,
  1432.     //  maybe other links. We use this
  1433.     //  to allow removing all links in selection
  1434.     BOOL           m_bMayHaveOtherLinks;    
  1435.  
  1436. // Implementation
  1437. protected:
  1438.     void ValidateHref();
  1439.     BOOL OnSetActive();
  1440.     int GetTargetsInDoc();
  1441.     int GetTargetsInFile();
  1442.     void SetHrefData();
  1443.  
  1444.  
  1445. private:
  1446.     // This is used to change resource hInstance back to EXE
  1447.     CEditorResourceSwitcher * m_pResourceSwitcher;
  1448.  
  1449. // Overrides
  1450.     // ClassWizard generated virtual function overrides
  1451.     //{{AFX_VIRTUAL(CLinkPage)
  1452.     protected:
  1453.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  1454.     virtual BOOL OnKillActive();
  1455.     //}}AFX_VIRTUAL
  1456.  
  1457.     // Generated message map functions
  1458.     //{{AFX_MSG(CLinkPage)
  1459.     afx_msg void OnHrefFile();
  1460.     afx_msg void OnHrefUnlink();
  1461.     afx_msg void OnSelchangeTargetList();
  1462.     afx_msg void OnChangeHrefUrl();
  1463.     afx_msg void OnKillfocusHrefUrl();
  1464.     afx_msg void OnTargetsInCurrentDoc();
  1465.     afx_msg void OnTargetsInFile();
  1466.     afx_msg void OnExtraHTML();
  1467.     //}}AFX_MSG
  1468.     DECLARE_MESSAGE_MAP()
  1469. };
  1470.  
  1471. ////////////////////////////////////////////////////////
  1472. #endif // _EDPROPS_H
  1473. #endif // EDITOR
  1474.