m_strVssPassword = theApp.GetProfileString(_T("Settings"), _T("VssPassword"), _T(""));
m_strVssPath = theApp.GetProfileString(_T("Settings"), _T("VssPath"), _T(""));
m_nTabSize = theApp.GetProfileInt(_T("Settings"), _T("TabSize"), 4);
+ m_nTabType = theApp.GetProfileInt(_T("Settings"), _T("TabType"), 0);
m_bIgnoreRegExp = theApp.GetProfileInt(_T("Settings"), _T("IgnoreRegExp"), FALSE);
m_sPattern = theApp.GetProfileString(_T("Settings"), _T("RegExps"), NULL);
return 0;
}
-
HMENU CMainFrame::NewDefaultMenu()
{
m_default.LoadMenu(IDR_MAINFRAME);
return(m_default.Detach());
}
-
-
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
DoFileOpen();
}
-
void CMainFrame::ShowMergeDoc(LPCTSTR szLeft, LPCTSTR szRight)
{
BOOL docNull = (m_pMergeDoc == NULL);
pf->SetHeaderText(1, szRight);
}
+ // Set tab type (tabs/spaces)
+ if ( m_nTabType == 0 )
+ {
+ m_pLeft->SetInsertTabs( TRUE );
+ m_pRight->SetInsertTabs( TRUE );
+ }
+ else
+ {
+ m_pLeft->SetInsertTabs( FALSE );
+ m_pRight->SetInsertTabs( FALSE );
+ }
}
else
{
}
}
-
-
void CMainFrame::OnOptionsShowDifferent()
{
m_bShowDiff = !m_bShowDiff;
pCmdUI->SetCheck(m_bShowUniqueRight);
}
-
-
void CMainFrame::OnHideBackupFiles()
{
m_bHideBak = ! m_bHideBak;
ShellExecute(NULL, _T("open"), _T("http://www.gnu.org/copyleft/gpl.html"), NULL, NULL, SW_SHOWNORMAL);
}
-
-
-
-
BOOL CMainFrame::CheckSavePath(CString& strSavePath)
{
BOOL needCheck;
theApp.WriteProfileString(_T("Settings"), _T("VssUser"), m_strVssUser);
theApp.WriteProfileString(_T("Settings"), _T("VssPassword"), m_strVssPassword);
-
IVSSDatabase vssdb;
IVSSItems m_vssis;
IVSSItem m_vssi;
-
COleException *eOleException = new COleException;
// BSP - Create the COM interface pointer to VSS
// BSP - Finally! Check out the file!
m_vssi.Checkout("", strSavePath, 0);
-
}
}
break;
gen.m_bEolSensitive = m_bEolSensitive;
gen.m_bScroll = m_bScrollToFirst;
gen.m_nTabSize = m_nTabSize;
+ gen.m_nTabType = m_nTabType;
gen.m_bDisableSplash = theApp.m_bDisableSplash;
syn.m_bHiliteSyntax = theApp.m_bHiliteSyntax;
m_bBackup = gen.m_bBackup;
m_bScrollToFirst = gen.m_bScroll;
m_nTabSize = gen.m_nTabSize;
+ m_nTabType = gen.m_nTabType;
theApp.m_bDisableSplash = gen.m_bDisableSplash;
m_nIgnoreWhitespace = gen.m_nIgnoreWhite;
theApp.WriteProfileInt(_T("Settings"), _T("BackupFile"), m_bBackup);
theApp.WriteProfileString(_T("Settings"), _T("VssPath"), m_strVssPath);
theApp.WriteProfileInt(_T("Settings"), _T("TabSize"), m_nTabSize);
+ theApp.WriteProfileInt(_T("Settings"), _T("TabType"), m_nTabType);
theApp.WriteProfileInt(_T("Settings"), _T("IgnoreBlankLines"), m_bIgnoreBlankLines);
theApp.WriteProfileInt(_T("Settings"), _T("IgnoreCase"), m_bIgnoreCase);
theApp.WriteProfileInt(_T("Settings"), _T("IgnoreRegExp"), m_bIgnoreRegExp);
// make an attempt at rescanning any open diff sessions
if (m_pLeft != NULL && m_pRight != NULL)
{
+ // Set tab type (tabs/spaces)
+ if (m_nTabType == 0)
+ {
+ m_pLeft->SetInsertTabs(TRUE);
+ m_pRight->SetInsertTabs(TRUE);
+ }
+ else
+ {
+ m_pLeft->SetInsertTabs(FALSE);
+ m_pRight->SetInsertTabs(FALSE);
+ }
+
if (m_pMergeDoc->SaveHelper())
{
- m_pLeft->GetDocument()->Rescan();
+ m_pMergeDoc->Rescan();
}
// mods have been made, so just warn
else
, m_nStatusLeftFileOnly, m_nStatusLeftDirOnly, m_nStatusRightFileOnly, m_nStatusRightDirOnly
, m_nStatusFileError);
m_wndStatusBar.SetPaneText(2, s);
-
}
BOOL CMainFrame::DoFileOpen(LPCTSTR pszLeft /*=NULL*/, LPCTSTR pszRight /*=NULL*/, BOOL bRecurse /*= FALSE*/)
addToMru(pszRight, _T("Files\\Right"));
}
-
// check to make sure they are same type
TCHAR name[MAX_PATH];
BOOL bLeftIsDir = GetFileAttributes(strLeft)&FILE_ATTRIBUTE_DIRECTORY;
m_pRight->UpdateResources();
}
-
void CMainFrame::OnHelpContents()
{
TCHAR path[MAX_PATH], temp[MAX_PATH];
CMDIFrameWnd::OnClose();
}
-
void CMainFrame::FreeRegExpList()
{
struct regexp_list *r;
free(ignore_regexp_list);
ignore_regexp_list = r;
}
-
}
-
void CMainFrame::RebuildRegExpList()
{
_TCHAR tmp[MAX_PATH];
{
ignore_some_changes = 1;
}
-
}
// Add the compiled form of regexp pattern to reglist
CMergeEditView *m_pLeft, *m_pRight;
CMergeDoc *m_pMergeDoc;
CDirDoc *m_pDirDoc;
+ UINT m_nTabType;
+
// Implementation data
protected:
int m_nStatusFileSame;
CAPTION "General"
FONT 8, "MS Sans Serif"
BEGIN
- GROUPBOX "Settings",IDC_STATIC,7,7,221,92
+ GROUPBOX "Settings",IDC_STATIC,7,7,242,92
CONTROL "&Backup original file",IDC_BACKUP_CHECK,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,17,21,75,10
CONTROL "Automatically &scroll to first difference",
BS_AUTORADIOBUTTON,128,69,83,10
GROUPBOX "Tabs",IDC_STATIC,7,105,221,30,WS_GROUP
LTEXT "&Tab size:",IDC_STATIC,15,119,30,8
- EDITTEXT IDC_TAB_EDIT,47,118,27,12,ES_AUTOHSCROLL
+ EDITTEXT IDC_TAB_EDIT,47,117,27,12,ES_AUTOHSCROLL
CONTROL "Sensitive to &EOL",IDC_EOL_SENSITIVE,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,17,68,69,10
+ CONTROL "Insert Tabs",IDC_PROP_INSERT_TABS,"Button",
+ BS_AUTORADIOBUTTON | WS_GROUP,99,112,51,10
+ CONTROL "Insert Spaces",IDC_PROP_INSERT_SPACES,"Button",
+ BS_AUTORADIOBUTTON,99,123,59,10
END
IDD_LANGUAGE_SELECT DIALOG DISCARDABLE 0, 0, 213, 111
WS_VSCROLL
END
+
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
BEGIN
IDR_MAINFRAME "WinMerge"
IDR_MERGETYPE "\nWinMerge\nWinMerge\n\n\nWinMerge.Document\nWinMerge Document"
+END
+
+STRINGTABLE PRELOAD DISCARDABLE
+BEGIN
IDS_VERSION_FMT "Version %1"
IDS_ALLFILES "All Files (*.*)|*.*||"
IDS_CONFIRM_ALL_LEFT "Are you sure you want to copy all differences to the left file?"
m_bEolSensitive = FALSE;
m_bDisableSplash = FALSE;
m_nIgnoreWhite = -1;
+ m_nTabType = 0;
//}}AFX_DATA_INIT
}
DDX_Check(pDX, IDC_EOL_SENSITIVE, m_bEolSensitive);
DDX_Check(pDX, IDC_DISABLE_SPLASH, m_bDisableSplash);
DDX_Radio(pDX, IDC_WHITESPACE, m_nIgnoreWhite);
+ DDX_Radio(pDX, IDC_PROP_INSERT_TABS, m_nTabType);
+ DDV_MinMaxInt( pDX, m_nTabSize, 0, 64 );
//}}AFX_DATA_MAP
}
BOOL m_bEolSensitive;
BOOL m_bDisableSplash;
int m_nIgnoreWhite;
+ int m_nTabType;
//}}AFX_DATA
static char THIS_FILE[] = __FILE__;
#endif
+static const unsigned int MAX_TAB_LEN = 64; // Same as in CrystalViewText.cpp
+
#define DRAG_BORDER_X 5
#define DRAG_BORDER_Y 5
CCrystalEditView::CCrystalEditView ()
{
AFX_ZERO_INIT_OBJECT (CCrystalTextView);
- m_bInsertTabs = TRUE;
m_bAutoIndent = TRUE;
m_mapExpand = new CMap<CString, LPCTSTR, CString, LPCTSTR> (10);
m_bMergeUndo = false;
DoSetTextType (TextDefinition *def)
{
m_CurSourceDef = def;
- SetInsertTabs ((def->flags & SRCOPT_INSERTTABS) != FALSE);
SetAutoIndent ((def->flags & SRCOPT_AUTOINDENT) != FALSE);
SetDisableBSAtSOL ((def->flags & SRCOPT_BSATBOL) == FALSE);
m_mapExpand->RemoveAll ();
if (IsSelection ())
{
GetSelection (ptSelStart, ptSelEnd);
- bTabify = ptSelStart.y != ptSelEnd.y;
- }
+
+ // If we have more than one line selected, tabify sel lines
+ if ( ptSelStart.y != ptSelEnd.y )
+ {
+ bTabify = TRUE;
+ }
+ }
CPoint ptCursorPos = GetCursorPos ();
ASSERT_VALIDTEXTPOS (ptCursorPos);
- static TCHAR pszText[32];
- if (m_bInsertTabs)
+ TCHAR pszText[MAX_TAB_LEN + 1] = {0};
+ // If inserting tabs, then initialize the text to a tab.
+ if (m_pTextBuffer->GetInsertTabs())
{
- *pszText = _T ('\t');
+ pszText[0] = _T ( '\t' );
pszText[1] = _T ('\0');
}
- else
+ else //...otherwise, built whitespace depending on the location and tab stops
{
int nTabSize = GetTabSize ();
int nChars = nTabSize - ptCursorPos.x % nTabSize;
pszText[nChars] = _T ('\0');
}
+ // Indent selected lines (multiple lines selected)
if (bTabify)
{
m_pTextBuffer->BeginUndoGroup ();
ptSelEnd.y++;
}
}
- else
+ else //...otherwise, do not indent the empty line.
nEndLine--;
SetSelection (ptSelStart, ptSelEnd);
SetCursorPos (ptSelEnd);
return;
}
+ // Overwrite mode, replace next char with tab/spaces
if (m_bOvrMode)
{
CPoint ptCursorPos = GetCursorPos ();
int nLineLength = GetLineLength (ptCursorPos.y);
LPCTSTR pszLineChars = GetLineChars (ptCursorPos.y);
+
+ // Not end of line
if (ptCursorPos.x < nLineLength)
{
int nTabSize = GetTabSize ();
- int nChars = nTabSize - CalculateActualOffset (ptCursorPos.y, ptCursorPos.x) % nTabSize;
+ int nChars = nTabSize - CalculateActualOffset(
+ ptCursorPos.y, ptCursorPos.x ) % nTabSize;
ASSERT (nChars > 0 && nChars <= nTabSize);
while (nChars > 0)
m_pTextBuffer->BeginUndoGroup ();
+ int x, y; // For cursor position
+
+ // Text selected, no overwrite mode, replace sel with tab
if (IsSelection ())
{
CPoint ptSelStart, ptSelEnd;
// [JRT]:
m_pTextBuffer->DeleteText (this, ptSelStart.y, ptSelStart.x, ptSelEnd.y, ptSelEnd.x, CE_ACTION_TYPING);
+ m_pTextBuffer->InsertText( this, ptSelStart.y, ptSelStart.x, pszText, y, x, CE_ACTION_TYPING );
+ }
+ // No selection, add tab
+ else
+ {
+ m_pTextBuffer->InsertText (this, ptCursorPos.y, ptCursorPos.x, pszText, y, x, CE_ACTION_TYPING); // [JRT]
}
-
- int x, y;
- m_pTextBuffer->InsertText (this, ptCursorPos.y, ptCursorPos.x, pszText, y, x, CE_ACTION_TYPING); // [JRT]
ptCursorPos.x = x;
ptCursorPos.y = y;
ptCursorPos = GetCursorPos ();
ASSERT_VALIDTEXTPOS (ptCursorPos);
- int x, y;
+ int x = 0;
+ int y = 0;
if (dwFlags & FIND_REGEXP)
{
LPTSTR lpszNewStr;
TCHAR *pszInsertStr;
if ((GetFlags () & (SRCOPT_BRACEGNU|SRCOPT_BRACEANSI)) && isopenbrace (pszLineChars[nLength - 1]))
{
- if (m_bInsertTabs)
+ if (m_pTextBuffer->GetInsertTabs())
{
pszInsertStr = (TCHAR *) _alloca (sizeof (TCHAR) * (nPos + 2));
_tcsncpy (pszInsertStr, pszLineChars, nPos);
TCHAR *pszInsertStr;
if ((GetFlags () & (SRCOPT_BRACEGNU|SRCOPT_BRACEANSI)) && isopenbrace (pszLineChars[nLength - 1]))
{
- if (m_bInsertTabs)
+ if (m_pTextBuffer->GetInsertTabs())
{
pszInsertStr = (TCHAR *) _alloca (sizeof (TCHAR) * 2);
pszInsertStr[nPos++] = _T ('\t');
if (nPos == nLength - 1)
{
TCHAR *pszInsertStr;
- if (m_bInsertTabs)
+ if (m_pTextBuffer->GetInsertTabs())
{
pszInsertStr = (TCHAR *) _alloca (sizeof (TCHAR) * 2);
*pszInsertStr = _T ('\t');
case _T ('t'):
{
static TCHAR szText[32];
- if (m_bInsertTabs)
+ if (m_pTextBuffer->GetInsertTabs())
{
*szText = _T ('\t');
szText[1] = _T ('\0');
BOOL m_bSelectionPushed;
CPoint m_ptSavedSelStart, m_ptSavedSelEnd;
BOOL m_bAutoIndent;
- BOOL m_bInsertTabs;
// [JRT]
BOOL m_bDisableBSAtSOL; // Disable BS At Start Of Line
public :
virtual void ResetView ();
protected :
+
+
+
+
CEditDropTargetImpl * m_pDropTarget;
virtual DROPEFFECT GetDropEffect ();
virtual void OnDropSource (DROPEFFECT de);
inline BOOL CCrystalEditView::GetInsertTabs ()
const
{
- return m_bInsertTabs;
+ return m_pTextBuffer->GetInsertTabs();
}
inline void CCrystalEditView::SetInsertTabs (BOOL bInsertTabs)
{
- m_bInsertTabs = bInsertTabs;
+ m_pTextBuffer->SetInsertTabs(bInsertTabs);
}
#endif
m_bModified = FALSE;
m_bCreateBackupFile = FALSE;
m_nUndoPosition = 0;
+ m_bInsertTabs = TRUE;
+ m_nTabSize = 4;
//BEGIN SW
m_ptLastChange.x = m_ptLastChange.y = -1;
//END SW
m_bReadOnly = FALSE;
m_nCRLFMode = nCrlfStyle;
m_bModified = FALSE;
+ m_bInsertTabs = TRUE;
+ m_nTabSize = 4;
m_nSyncPosition = m_nUndoPosition = 0;
m_bUndoGroup = m_bUndoBeginGroup = FALSE;
m_nUndoBufSize = UNDO_BUF_SIZE;
delete[] m_aLines[line].m_pcLine;
m_aLines.RemoveAt(line);
}
+
+int CCrystalTextBuffer::GetTabSize()
+{
+ ASSERT( m_nTabSize >= 0 && m_nTabSize <= 64 );
+ return m_nTabSize;
+}
+
+void CCrystalTextBuffer::SetTabSize(int nTabSize)
+{
+ ASSERT( nTabSize >= 0 && nTabSize <= 64 );
+ m_nTabSize = nTabSize;
+}
BOOL m_EolSensitive;
BOOL m_bCreateBackupFile;
int m_nUndoBufSize;
+ BOOL m_bInsertTabs;
+ int m_nTabSize;
int FindLineWithFlag (DWORD dwFlag);
protected :
void UpdateViews (CCrystalTextView * pSource, CUpdateContext * pContext,
DWORD dwUpdateFlags, int nLineIndex = -1);
+ // Tabs/space inserting
+ BOOL GetInsertTabs() const;
+ void SetInsertTabs(BOOL bInsertTabs);
+
+ // Tabbing
+ int GetTabSize();
+ void SetTabSize(int nTabSize);
+
// More bookmarks
int FindNextBookmarkLine (int nCurrentLine = 0);
int FindPrevBookmarkLine (int nCurrentLine = 0);
return m_bModified;
}
+inline BOOL CCrystalTextBuffer::GetInsertTabs() const //UPDATE-BEGIN
+{
+ return m_bInsertTabs;
+}
+
+inline void CCrystalTextBuffer::SetInsertTabs(BOOL bInsertTabs)
+{
+ m_bInsertTabs = bInsertTabs;
+}
+
#endif
#define SPACE_CHARACTER _T('\x95')
#define DEFAULT_PRINT_MARGIN 1000 // 10 millimeters
+const UINT MAX_TAB_LEN = 64;
#define SMOOTH_SCROLL_FACTOR 6
#pragma warning ( disable : 4100 )
}
if (m_pnActualLineLength != NULL)
{
- delete m_pnActualLineLength;
+ delete[] m_pnActualLineLength;
m_pnActualLineLength = NULL;
}
if (m_rxnode)
pdc->SetBkColor (crBkgnd);
if (crText != CLR_NONE)
pdc->SetTextColor (crText);
- BOOL bColorSet = FALSE;
+// BOOL bColorSet = FALSE;
//BEGIN SW
/*ORIGINAL
m_nOffsetChar = 0;
m_nLineHeight = -1;
m_nCharWidth = -1;
- m_nTabSize = 4;
m_nMaxLineLength = -1;
m_nScreenLines = -1;
m_nScreenChars = -1;
m_bBookmarkExist = FALSE; // More bookmarks
m_bMultipleSearch = FALSE; // More search
+ m_bViewTabs = FALSE;
}
if (m_bFocused && !m_bCursorHidden &&
CalculateActualOffset (m_ptCursorPos.y, m_ptCursorPos.x) >= m_nOffsetChar)
{
- CreateSolidCaret (2, GetLineHeight ());
+ if (m_bOverrideCaret) //UPDATE
+ CreateSolidCaret(GetCharWidth(), GetLineHeight());
+ else
+ CreateSolidCaret (2, GetLineHeight ());
+
SetCaretPos (TextToClient (m_ptCursorPos));
ShowCaret ();
}
int CCrystalTextView::
GetTabSize ()
{
- ASSERT (m_nTabSize >= 0 && m_nTabSize <= 64);
- return m_nTabSize;
+ if (m_pTextBuffer == NULL)
+ return 4;
+
+ return m_pTextBuffer->GetTabSize();
+
}
void CCrystalTextView::
SetTabSize (int nTabSize)
{
ASSERT (nTabSize >= 0 && nTabSize <= 64);
- if (m_nTabSize != nTabSize)
+ if (m_pTextBuffer == NULL)
+ return;
+
+ if (m_pTextBuffer->GetTabSize() != nTabSize)
{
- m_nTabSize = nTabSize;
+ m_pTextBuffer->SetTabSize( nTabSize );
+
if (m_pnActualLineLength != NULL)
{
- delete m_pnActualLineLength;
+ delete[] m_pnActualLineLength;
m_pnActualLineLength = NULL;
}
m_nActualLengthArraySize = 0;
BOOL CCrystalTextView::
OnEraseBkgnd (CDC * pdc)
{
+ UNREFERENCED_PARAMETER(pdc);
return TRUE;
}
OnMouseWheel (UINT nFlags, short zDelta, CPoint pt)
{
// -> HE
- int nPageLines = GetScreenLines();
+// int nPageLines = GetScreenLines();
int nSubLineCount = GetSubLineCount();
int nNewTopSubLine= m_nTopSubLine - zDelta / 40;
CPoint ptCursorPos = GetCursorPos ();
int nLength = m_pTextBuffer->GetLineLength (ptCursorPos.y);
LPCTSTR pszText = m_pTextBuffer->GetLineChars (ptCursorPos.y), pszEnd = pszText + ptCursorPos.x;
- bool bAfter;
+ bool bAfter = false;
int nType = 0;
if (ptCursorPos.x < nLength)
{
void CalcLineCharDim ();
// Text attributes
- int m_nTabSize;
BOOL m_bViewTabs;
BOOL m_bSelMargin;
DWORD m_dwFlags;
protected :
CPoint WordToRight (CPoint pt);
CPoint WordToLeft (CPoint pt);
+ BOOL m_bOverrideCaret;
bool m_bSingle;
CImageList * m_pIcons;
+2003-01-27
+ [ 668654 ] Tabtype selection feature
+
2003-01-21
[ 671037 ] Changes for MSVC.NET
[ 671810 ] Tempfiles to temp dir
#define IDC_DIFFERENCE_COLOR 1031
#define IDC_SEL_DIFFERENCE_COLOR 1032
#define IDC_EDIT1 1033
+#define IDC_PROP_INSERT_TABS 1034
+#define IDC_PROP_INSERT_SPACES 1035
#define IDR_MARGIN_CURSOR 22900
#define IDD_LANGUAGE_SELECT 30000
#define IDD_PROPSYNTAX 30001
#define _APS_3D_CONTROLS 1
#define _APS_NEXT_RESOURCE_VALUE 113
#define _APS_NEXT_COMMAND_VALUE 32817
-#define _APS_NEXT_CONTROL_VALUE 1034
+#define _APS_NEXT_CONTROL_VALUE 1036
#define _APS_NEXT_SYMED_VALUE 108
#endif
#endif