Fixed Table Editing bugs in Composer

This commit is contained in:
cmanske 1998-04-17 21:34:20 +00:00
Родитель 07b0d91875
Коммит fd0f0cb2ec
9 изменённых файлов: 222 добавлений и 89 удалений

Просмотреть файл

@ -175,7 +175,6 @@ BEGIN
"U", ID_FORMAT_CHAR_UNDERLINE, VIRTKEY, CONTROL, NOINVERT
VK_APPS, ID_LOCAL_POPUP, VIRTKEY, NOINVERT
VK_BACK, ID_EDIT_UNDO, VIRTKEY, ALT, NOINVERT
VK_ESCAPE, ID_NAVIGATE_INTERRUPT, VIRTKEY, NOINVERT
VK_F10, ID_LOCAL_POPUP, VIRTKEY, SHIFT, NOINVERT
VK_F2, ID_LOCATION_FOCUS, VIRTKEY, NOINVERT
VK_F3, ID_EDIT_FINDAGAIN, VIRTKEY, NOINVERT
@ -249,7 +248,6 @@ BEGIN
"U", ID_FORMAT_CHAR_UNDERLINE, VIRTKEY, CONTROL, NOINVERT
VK_APPS, ID_LOCAL_POPUP, VIRTKEY, NOINVERT
VK_BACK, ID_EDIT_UNDO, VIRTKEY, ALT, NOINVERT
VK_ESCAPE, ID_NAVIGATE_INTERRUPT, VIRTKEY, NOINVERT
VK_F10, ID_LOCAL_POPUP, VIRTKEY, SHIFT, NOINVERT
VK_F2, ID_LOCATION_FOCUS, VIRTKEY, NOINVERT
VK_F3, ID_EDIT_FINDAGAIN, VIRTKEY, NOINVERT

Просмотреть файл

@ -368,7 +368,7 @@ FE_DestroyCaret(MWContext * context)
CNetscapeEditView * pView = (CNetscapeEditView *)WINCX(context)->GetView();
if(!context || pView->GetFocus() != pView ){
TRACE0( "FE_DestroyCaret called, but CNetscapeEditView does not have focus\n");
// TRACE0( "FE_DestroyCaret called, but CNetscapeEditView does not have focus\n");
return;
}

Просмотреть файл

@ -228,17 +228,19 @@ CTablePage::CTablePage(CWnd *pParent, MWContext * pMWContext,
EDT_TableData * pTableData)
: CNetscapePropertyPage(CTablePage::IDD),
m_bActivated(0),
m_bModified(0),
m_pMWContext(pMWContext),
m_pResourceSwitcher(pResourceSwitcher),
m_pTableData(pTableData),
m_pTableData(0 /*pTableData*/),
m_bCustomColor(0),
m_crColor(DEFAULT_COLORREF),
m_iParentWidth(0),
m_iParentHeight(0),
m_bInternalChangeEditbox(0)
m_bInternalChangeEditbox(0),
m_iStartColumns(0),
m_iStartRows(0)
{
ASSERT(pMWContext);
ASSERT(pTableData);
//{{AFX_DATA_INIT(CPage)
m_iRows = 0;
m_iColumns = 0;
@ -256,8 +258,7 @@ CTablePage::CTablePage(CWnd *pParent, MWContext * pMWContext,
m_iWidthType = 0;
m_bRowHeader = FALSE;
m_iWidth = 1;
m_bUseCols = TRUE;
m_csBackgroundImage = _T("");
m_csBackgroundImage = _T("");
m_bNoSave = 0;
m_bBorderWidthDefined = FALSE;
//}}AFX_DATA_INIT
@ -268,15 +269,18 @@ CTablePage::CTablePage(CWnd *pParent, MWContext * pMWContext,
#endif
}
CTablePage::~CTablePage()
{
if( m_pTableData )
EDT_FreeTableData(m_pTableData);
}
void CTablePage::DoDataExchange(CDataExchange* pDX)
{
CPropertyPage::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CTablePage)
DDX_Text(pDX, IDC_ROWS, m_iRows);
DDV_MinMaxInt(pDX, m_iRows, 1, MAX_TABLE_ROWS);
DDX_Text(pDX, IDC_COLUMNS, m_iColumns);
DDV_MinMaxInt(pDX, m_iColumns, 1, MAX_TABLE_COLUMNS);
DDX_CBIndex(pDX, IDC_TABLE_ALIGN, m_iAlign);
DDX_CBIndex(pDX, IDC_TABLE_CAPTION, m_iCaption);
DDX_Text(pDX, IDC_BORDER, m_iBorderWidth);
@ -290,7 +294,6 @@ void CTablePage::DoDataExchange(CDataExchange* pDX)
DDX_Check(pDX, IDC_OVERRIDE_WIDTH, m_bUseWidth);
DDX_CBIndex(pDX, IDC_WIDTH_PIX_OR_PERCENT, m_iWidthType);
DDX_CBIndex(pDX, IDC_HEIGHT_PIX_OR_PERCENT, m_iHeightType);
DDX_Check(pDX, IDC_USE_COLS, m_bUseCols);
DDX_Text(pDX, IDC_BKGRND_IMAGE, m_csBackgroundImage);
DDX_Check(pDX, IDC_NO_SAVE_IMAGE, m_bNoSave);
DDX_Check(pDX, IDC_USE_BORDER, m_bBorderWidthDefined);
@ -334,12 +337,44 @@ BOOL CTablePage::OnSetActive()
// We must be sure we have switched
// the first time here - before dialog creation
m_pResourceSwitcher->switchResources();
// This is usually supplied, but lets be sure
if( !m_pTableData )
m_pTableData = EDT_GetTableData(m_pMWContext);
if( !m_pTableData )
return FALSE;
// Save these as the bottom limit when changing table size
m_iStartColumns = m_pTableData->iColumns;
m_iStartRows = m_pTableData->iRows;
}
if(!CPropertyPage::OnSetActive())
return(FALSE);
if(m_bActivated)
{
// We are activating the pane after switching to cell tab and back again
// Refresh table data to get possibly-changed width and/or height
EDT_FreeTableData(m_pTableData);
m_pTableData = EDT_GetTableData(m_pMWContext);
m_iWidth = CASTINT(m_pTableData->iWidth);
m_iHeight = CASTINT(m_pTableData->iHeight);
m_iWidthType = m_pTableData->bWidthPercent ? ED_PERCENT : ED_PIXELS;
m_iHeightType = m_pTableData->bHeightPercent ? ED_PERCENT : ED_PIXELS;
m_bUseWidth = m_pTableData->bWidthDefined;
m_bUseHeight = m_pTableData->bHeightDefined;
// We don't use DDX with these so we don't get "not-integer" error messages
// Set flag to prevent changing the associated checkbox
m_bInternalChangeEditbox = TRUE;
UpdateWidthAndHeight(this, m_iWidth, m_iHeight);
m_bInternalChangeEditbox = FALSE;
UpdateData(FALSE);
return(TRUE);
}
m_bActivated = TRUE;
@ -364,12 +399,14 @@ BOOL CTablePage::OnSetActive()
m_iBorderWidth = CASTINT(m_pTableData->iBorderWidth);
m_iCellSpacing = CASTINT(m_pTableData->iCellSpacing);
m_iCellPadding = CASTINT(m_pTableData->iCellPadding);
m_iAlign = GetTableAlign(m_pTableData);
m_iWidth = CASTINT(m_pTableData->iWidth);
m_iHeight = CASTINT(m_pTableData->iHeight);
m_iWidthType = m_pTableData->bWidthPercent ? ED_PERCENT : ED_PIXELS;
m_iHeightType = m_pTableData->bHeightPercent ? ED_PERCENT : ED_PIXELS;
m_iAlign = GetTableAlign(m_pTableData);
m_bUseCols = m_pTableData->bUseCols;
m_bUseWidth = m_pTableData->bWidthDefined;
m_bUseHeight = m_pTableData->bHeightDefined;
GetColorHelper(m_pTableData->pColorBackground, m_bUseColor, m_crColor);
@ -440,16 +477,51 @@ BOOL CTablePage::OnSetActive()
BOOL CTablePage::OnKillActive()
{
// never visited this page or no change -- don't bother
if(!m_bActivated ||
!IS_APPLY_ENABLED(this))
{
if(!m_bActivated || !m_bModified )
return TRUE;
}
if ( !UpdateData(TRUE) ||
!ValidateWidthAndHeight(this, &m_iWidth, &m_iHeight, m_iWidthType, m_iHeightType) )
{
return FALSE;
}
char szMessage[256];
CEdit *pEditbox;
UINT nID = 0;
// Don't let the user enter fewer rows or columns than already exist
if( m_iColumns < m_iStartColumns )
{
// Construct a string showing correct range
wsprintf( szMessage, szLoadString(IDS_INTEGER_RANGE_ERROR), m_iStartColumns, MAX_TABLE_COLUMNS);
nID = IDC_COLUMNS;
// Fix value - put inside allowable range
m_iColumns = min(MAX_TABLE_COLUMNS, max(m_iStartColumns, m_iColumns));
}
if( m_iRows < m_iStartRows )
{
wsprintf( szMessage, szLoadString(IDS_INTEGER_RANGE_ERROR), m_iStartRows, MAX_TABLE_ROWS);
nID = IDC_ROWS;
m_iRows = min(MAX_TABLE_COLUMNS, max(m_iStartRows, m_iRows));
}
if( nID )
{
// Notify user with similar message to the DDV_ validation system
MessageBox(szMessage, szLoadString(AFX_IDS_APP_TITLE), MB_ICONEXCLAMATION | MB_OK);
// Put focus in the offending control
// And select all text, just like DDV functions
pEditbox = (CEdit*)GetDlgItem(nID);
pEditbox->SetFocus();
pEditbox->SetSel(0, -1, TRUE);
// Write fixed value back to editbox
UpdateData(FALSE);
return FALSE;
}
if ( !m_csBackgroundImage.IsEmpty() )
{
if ( m_bImageChanged && !m_bValidImage )
@ -490,7 +562,6 @@ BOOL CTablePage::OnKillActive()
return FALSE;
}
}
return TRUE;
}
@ -499,13 +570,19 @@ void CTablePage::OnHelp()
NetHelp(HELP_TABLE_PROPS_TABLE);
}
void CTablePage::SetModified(BOOL bModified)
{
m_bModified = bModified;
// Set state of Apply button
CPropertyPage::SetModified(bModified);
}
void CTablePage::OnOK()
{
// never visited this page or no change -- don't bother
if(!m_bActivated ||
!IS_APPLY_ENABLED(this)){
if(!m_bActivated || !m_bModified )
return;
}
EDT_BeginBatchChanges(m_pMWContext);
@ -535,7 +612,6 @@ void CTablePage::OnOK()
m_pTableData->bHeightDefined = m_bUseHeight;
m_pTableData->bHeightPercent = m_iHeightType == ED_PERCENT;
m_pTableData->iHeight = m_iHeight;
m_pTableData->bUseCols = m_bUseCols;
SetTableAlign(m_pTableData, m_iAlign);
SetColorHelper(m_bUseColor, m_crColor, &m_pTableData->pColorBackground);
@ -564,6 +640,8 @@ void CTablePage::OnOK()
m_bInternalChangeEditbox = TRUE;
UpdateWidthAndHeight(this, m_iWidth, m_iHeight);
m_bInternalChangeEditbox = FALSE;
m_bModified = FALSE;
}
void CTablePage::OnExtraHTML()
@ -777,7 +855,6 @@ CTableCellPage::CTableCellPage(CWnd *pParent, MWContext * pMWContext,
m_bInternalChangeEditbox(0)
{
ASSERT(pMWContext);
ASSERT(pCellData);
//{{AFX_DATA_INIT(CPage)
m_iAlign = -1;
m_iVAlign = -1;
@ -802,6 +879,12 @@ CTableCellPage::CTableCellPage(CWnd *pParent, MWContext * pMWContext,
#endif
}
CTableCellPage::~CTableCellPage()
{
if( m_pCellData )
EDT_FreeTableCellData(m_pCellData);
}
void CTableCellPage::DoDataExchange(CDataExchange* pDX)
{
CPropertyPage::DoDataExchange(pDX);
@ -860,13 +943,40 @@ BOOL CTableCellPage::OnSetActive()
// We must be sure we have switched
// the first time here - before dialog creation
m_pResourceSwitcher->switchResources();
// This is usually supplied, but lets be sure
if( !m_pCellData )
m_pCellData = EDT_GetTableCellData(m_pMWContext);
if( !m_pCellData )
return FALSE;
}
if(!CPropertyPage::OnSetActive())
return(FALSE);
return FALSE;
if(m_bActivated)
if( m_bActivated )
{
// We are activating the pane after switching to table tab and back again
// Refresh cell data to get possibly-changed width and/or height
EDT_FreeTableCellData(m_pCellData);
m_pCellData = EDT_GetTableCellData(m_pMWContext);
m_iWidth = CASTINT(m_pCellData->iWidth);
m_iHeight = CASTINT(m_pCellData->iHeight);
m_iWidthType = m_pCellData->bWidthPercent ? ED_PERCENT : ED_PIXELS;
m_iHeightType = m_pCellData->bHeightPercent ? ED_PERCENT : ED_PIXELS;
m_iUseWidth = InitCheckbox(IDC_OVERRIDE_WIDTH, CF_WIDTH, m_pCellData->bWidthDefined);
m_iUseHeight = InitCheckbox(IDC_OVERRIDE_HEIGHT, CF_HEIGHT, m_pCellData->bHeightDefined);
// We don't use DDX with these so we don't get "not-integer" error messages
// Set flag to prevent changing the associated checkbox
m_bInternalChangeEditbox = TRUE;
UpdateWidthAndHeight(this, m_iWidth, m_iHeight);
m_bInternalChangeEditbox = FALSE;
UpdateData(FALSE);
return(TRUE);
}
m_bActivated = TRUE;
// Get these strings from the editor resource dll before we switch back
@ -1089,11 +1199,9 @@ int CTableCellPage::InitCheckbox(UINT nIDCheckbox, ED_CellFormat cf, BOOL bSetSt
BOOL CTableCellPage::OnKillActive()
{
// never visited this page or no change -- don't bother
if(!m_bActivated ||
!IS_APPLY_ENABLED(this))
{
if(!m_bActivated || !m_bModified )
return TRUE;
}
if ( !UpdateData(TRUE) ||
!ValidateWidthAndHeight(this, &m_iWidth, &m_iHeight, m_iWidthType, m_iHeightType) )
{
@ -1143,20 +1251,19 @@ BOOL CTableCellPage::OnKillActive()
return TRUE;
}
void CTableCellPage::SetModified(BOOL bModified)
{
m_bModified = bModified;
// Change state of Apply button
CPropertyPage::SetModified(bModified);
}
void CTableCellPage::OnOK()
{
// never visited this page or no change -- don't bother
if(!m_bActivated ||
!IS_APPLY_ENABLED(this))
{
if(!m_bActivated || !m_bModified )
return;
}
if ( !UpdateData(TRUE) ||
!ValidateWidthAndHeight(this, &m_iWidth, &m_iHeight, m_iWidthType, m_iHeightType) )
{
return;
}
// Use checkbox states and set/clear mask bits and data appropriately
@ -1265,6 +1372,8 @@ void CTableCellPage::OnOK()
m_bInternalChangeEditbox = TRUE;
UpdateWidthAndHeight(this, m_iWidth, m_iHeight);
m_bInternalChangeEditbox = FALSE;
m_bModified = FALSE;
}
void CTableCellPage::OnChangeSelectionType()

Просмотреть файл

@ -40,6 +40,8 @@ public:
CTablePage(CWnd *pParent, MWContext * pMWContext = NULL,
CEditorResourceSwitcher * pResourceSwitcher = NULL,
EDT_TableData * pTableData = NULL);
~CTablePage();
void OnOK();
//{{AFX_DATA(CTablePage)
@ -58,7 +60,6 @@ public:
int m_iHeightType;
BOOL m_bRowHeader;
int m_iWidthType;
BOOL m_bUseCols;
CString m_csBackgroundImage;
BOOL m_bNoSave;
BOOL m_bBorderWidthDefined;
@ -70,6 +71,7 @@ protected:
CColorButton m_ChooseColorButton;
BOOL m_bActivated;
BOOL m_bModified;
BOOL OnSetActive();
int m_iWidth;
int m_iHeight;
@ -86,6 +88,8 @@ private:
BOOL m_bCustomColor;
int32 m_iParentWidth;
int32 m_iParentHeight;
int m_iStartColumns;
int m_iStartRows;
// Set before calling UpdateWidthAndHeight()
// to not set the associated checkbox
@ -126,6 +130,8 @@ private:
afx_msg void EnableApplyButton();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
void SetModified(BOOL bModified);
};
class CTableCellPage : public CNetscapePropertyPage
@ -136,6 +142,8 @@ public:
EDT_TableCellData * pCellData = NULL,
UINT nIDCaption = 0);
~CTableCellPage();
void OnOK();
//{{AFX_DATA(CTableCellPage)
@ -159,6 +167,7 @@ public:
protected:
CColorButton m_ChooseColorButton;
BOOL m_bActivated;
BOOL m_bModified;
int m_iWidth;
int m_iHeight;
BOOL OnSetActive();
@ -238,6 +247,8 @@ private:
// Init controls separated from OnInitDialog()
// to allow switching cells while within the dialog
void InitPageData();
void SetModified(BOOL bModified);
};
#endif // _EDTABLE_H

Просмотреть файл

@ -583,44 +583,41 @@ STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
CAPTION "Table"
FONT 8, "MS Sans Serif"
BEGIN
GROUPBOX "Number of ",IDC_STATIC,7,3,245,25
RTEXT "Col&umns:",IDC_STATIC,18,13,60,8
EDITTEXT IDC_COLUMNS,81,11,24,13
RTEXT "&Rows:",IDC_STATIC,114,13,48,8
EDITTEXT IDC_ROWS,166,11,24,13
GROUPBOX "Size ",IDC_STATIC,7,30,245,52
GROUPBOX "Number of ",IDC_STATIC,7,3,245,28
RTEXT "Col&umns:",IDC_STATIC,18,15,60,8
EDITTEXT IDC_COLUMNS,81,13,24,13
RTEXT "&Rows:",IDC_STATIC,114,15,48,8
EDITTEXT IDC_ROWS,166,13,24,13
GROUPBOX "Size ",IDC_STATIC,7,33,245,43
CONTROL "&Width",IDC_OVERRIDE_WIDTH,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,16,40,69,10
EDITTEXT IDC_WIDTH,16,52,24,13
COMBOBOX IDC_WIDTH_PIX_OR_PERCENT,43,52,74,64,CBS_DROPDOWNLIST |
WS_TABSTOP,16,44,69,10
EDITTEXT IDC_WIDTH,16,56,24,13
COMBOBOX IDC_WIDTH_PIX_OR_PERCENT,43,56,74,64,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
CONTROL "Minimum &Height",IDC_OVERRIDE_HEIGHT,"Button",
BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,139,40,75,10
EDITTEXT IDC_HEIGHT,139,52,24,13
COMBOBOX IDC_HEIGHT_PIX_OR_PERCENT,166,52,74,64,CBS_DROPDOWNLIST |
BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,139,44,75,10
EDITTEXT IDC_HEIGHT,139,56,24,13
COMBOBOX IDC_HEIGHT_PIX_OR_PERCENT,166,56,74,64,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
CONTROL "Determine column widths from cells in first row only",
IDC_USE_COLS,"Button",BS_AUTOCHECKBOX | WS_GROUP |
WS_TABSTOP,16,69,226,10
GROUPBOX "Borders and Spacing ",IDC_STATIC,7,84,245,43
GROUPBOX "Borders and Spacing ",IDC_STATIC,7,79,245,46
CONTROL "&Border width",IDC_USE_BORDER,"Button",BS_AUTOCHECKBOX |
WS_GROUP | WS_TABSTOP,16,96,55,10
EDITTEXT IDC_BORDER,15,109,24,13
LTEXT "pixels",IDC_STATIC,42,111,31,8
RTEXT "&Spacing:",IDC_STATIC,93,95,41,8
EDITTEXT IDC_CELL_SPACING,139,93,24,13
LTEXT "pixels between cells",IDC_STATIC,165,95,82,8
RTEXT "&Padding:",IDC_STATIC,93,111,41,8
EDITTEXT IDC_CELL_PADDING,139,109,24,13
WS_GROUP | WS_TABSTOP,16,93,55,10
EDITTEXT IDC_BORDER,15,106,24,13
LTEXT "pixels",IDC_STATIC,42,108,31,8
RTEXT "&Spacing:",IDC_STATIC,93,92,41,8
EDITTEXT IDC_CELL_SPACING,139,90,24,13
LTEXT "pixels between cells",IDC_STATIC,165,92,82,8
RTEXT "&Padding:",IDC_STATIC,93,108,41,8
EDITTEXT IDC_CELL_PADDING,139,106,24,13
LTEXT "pixels between border and cell contents",IDC_STATIC,165,
107,82,16
GROUPBOX "Table Alignment ",IDC_STATIC,7,129,79,30,WS_GROUP
COMBOBOX IDC_TABLE_ALIGN,14,140,65,77,CBS_DROPDOWNLIST |
104,82,16
GROUPBOX "Table Alignment ",IDC_STATIC,7,127,79,30,WS_GROUP
COMBOBOX IDC_TABLE_ALIGN,14,138,65,77,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
GROUPBOX "Caption ",IDC_STATIC,94,129,79,30
COMBOBOX IDC_TABLE_CAPTION,100,140,65,77,CBS_DROPDOWNLIST |
GROUPBOX "Caption ",IDC_STATIC,94,127,79,30
COMBOBOX IDC_TABLE_CAPTION,100,138,65,77,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "E&xtra HTML...",IDC_EXTRA_HTML,181,140,62,14
PUSHBUTTON "E&xtra HTML...",IDC_EXTRA_HTML,180,138,62,14
GROUPBOX "Background ",IDC_STATIC,7,160,245,56
CONTROL "&Color",IDC_OVERRIDE_COLOR,"Button",BS_AUTO3STATE |
WS_GROUP | WS_TABSTOP,16,173,48,10
@ -641,10 +638,10 @@ CAPTION "Cell"
FONT 8, "MS Sans Serif"
BEGIN
GROUPBOX "Change Selection ",IDC_STATIC,7,3,184,33
PUSHBUTTON "&Previous",IDC_PREVIOUS,14,15,50,14
PUSHBUTTON "&Next",IDC_NEXT,70,15,50,14
COMBOBOX IDC_TABLE_SELECTION_TYPE,126,15,58,53,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "&Previous",IDC_PREVIOUS,14,15,50,14
PUSHBUTTON "&Next",IDC_NEXT,70,15,50,14
PUSHBUTTON "In&sert...",IDC_INSERT,200,7,52,13
PUSHBUTTON "&Delete...",IDC_DELETE,200,24,52,13
GROUPBOX "Size ",IDC_STATIC,7,38,245,43

Просмотреть файл

@ -1132,7 +1132,7 @@ BOOL CNetscapeEditView::PreTranslateMessage(MSG * pMsg)
{
// Process Ctrl+equals keydown -- for some bizarre reason,
// we don't get an OnKeyDown call for this message
if( pMsg->wParam == 17 )
if( pMsg->wParam == VK_CONTROL )
{
UpdateCursor();
}
@ -1150,7 +1150,7 @@ BOOL CNetscapeEditView::PreTranslateMessage(MSG * pMsg)
return TRUE;
}
} else if( pMsg->message == WM_KEYUP &&
pMsg->wParam == 17 )
pMsg->wParam == VK_CONTROL )
{
UpdateCursor();
}
@ -1199,6 +1199,9 @@ void CNetscapeEditView::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
break;
case VK_ESCAPE:
{
// NOTE: Don't put VK_ESCAPE in the frame's accelerator table
// else we don't get here!
// Cancel an Object Sizing operation
if( EDT_IsSizing(pMWContext) )
GetContext()->CancelSizing();
@ -1209,6 +1212,8 @@ void CNetscapeEditView::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
EDT_PasteStyle(pMWContext, FALSE);
UpdateCursor();
}
// Call the CGenericView's interrupt function
OnNavigateInterrupt();
// Continue to do other actions on Esc key
break;

Просмотреть файл

@ -3299,7 +3299,8 @@ void CNetscapeEditView::OnTableProperties(int iStartPage)
if( !pTableData )
return;
// Get the cell data
// Get the cell data. This will be NULL if caret is
// in a table caption. If it is, then do not add the Cell page
EDT_TableCellData* pCellData = EDT_GetTableCellData(pMWContext);
CNetscapePropertySheet PropsDlg( szLoadString(IDS_PROPS_TABLE_CAPTION),
@ -3358,9 +3359,10 @@ void CNetscapeEditView::OnTableProperties(int iStartPage)
EDT_ClearSpecialCellSelection(pMWContext);
}
EDT_FreeTableData(pTableData);
if( pCellData ) EDT_FreeTableCellData(pCellData);
// NOTE: DO NOT CALL EDT_FreeTableData OR EDT_FreeTableCellData here
// because prop pages may be freeing/replacing their data when table
// and/or cell sizes change. Freeing is done in destructors of the
// property pages
if( pCellPage ) delete pCellPage;
delete pTablePage;

Просмотреть файл

@ -347,14 +347,6 @@ struct _EDT_TableData {
typedef struct _EDT_TableData EDT_TableData;
/* iTableMode param for SetTableMode() */
#define ED_TABLE_PERCENT 0x0001 /* Convert table and all cells to use % of parent width */
#define ED_TABLE_PIXELS 0x0002 /* Convert table and all cells to use absolute pixels */
#define ED_TABLE_USE_CELL_WIDTH 0x0004 /* Set WIDTH param for all cells (facilitates table resizing) */
#define ED_TABLE_NO_CELL_WIDTH 0x0008 /* Remove WIDTH param for all cells */
#define ED_TABLE_USE_COLS 0x0010 /* Set COLS param for table (use only 1st row for column widths) */
#define ED_TABLE_NO_COLS 0x0020 /* Remove COLS param for table (all cell widths used) */
/*--------------------------- TableCaptionData --------------------------------*/
struct _EDT_TableCaptionData {

Просмотреть файл

@ -98,13 +98,32 @@ public:
return m_iSize++;
}
int Insert(void* newElement, int nIndex){
GuaranteeSize(m_iSize+1);
if( nIndex < m_iSize )
{
/* Shuffle pointers at and above insert index up */
for( int i = m_iSize; i > nIndex; i-- )
{
m_pData[i] = m_pData[i-1];
}
/* Overwrite pointer at designated location */
m_pData[nIndex] = newElement;
} else {
/* nIndex is too large - just add at end */
m_pData[m_iSize] = newElement;
}
/* Return index to last item in list */
return m_iSize++;
}
int Delete( int nIndex ){
if( nIndex < m_iSize )
{
/* Shuffle remaining pointers down */
for( int i = nIndex; i < m_iSize-1; i++ )
{
/* Suffle remaining pointers down */
m_pData[nIndex] = m_pData[nIndex+1];
m_pData[i] = m_pData[i+1];
}
m_iSize--;
}