OSDN Git Service

[ 668654 ] Tabtype selection feature
authorChristian List <list1974@hotmail.com>
Mon, 27 Jan 2003 19:55:25 +0000 (19:55 +0000)
committerChristian List <list1974@hotmail.com>
Mon, 27 Jan 2003 19:55:25 +0000 (19:55 +0000)
15 files changed:
Src/MainFrm.cpp
Src/MainFrm.h
Src/Merge.rc
Src/PropGeneral.cpp
Src/PropGeneral.h
Src/editlib/ccrystaleditview.cpp
Src/editlib/ccrystaleditview.h
Src/editlib/ccrystaleditview.inl
Src/editlib/ccrystaltextbuffer.cpp
Src/editlib/ccrystaltextbuffer.h
Src/editlib/ccrystaltextbuffer.inl
Src/editlib/ccrystaltextview.cpp
Src/editlib/ccrystaltextview.h
Src/readme.txt
Src/resource.h

index 2c1f92e..4b9133c 100644 (file)
@@ -130,6 +130,7 @@ CMainFrame::CMainFrame()
        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);
 
@@ -208,7 +209,6 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
        return 0;
 }
 
-
 HMENU CMainFrame::NewDefaultMenu()
 {
        m_default.LoadMenu(IDR_MAINFRAME);
@@ -216,8 +216,6 @@ HMENU CMainFrame::NewDefaultMenu()
        return(m_default.Detach());
 }
 
-
-
 BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
 {
        // TODO: Modify the Window class or styles here by modifying
@@ -250,7 +248,6 @@ void CMainFrame::OnFileOpen()
        DoFileOpen();
 }
 
-
 void CMainFrame::ShowMergeDoc(LPCTSTR szLeft, LPCTSTR szRight)
 {
        BOOL docNull = (m_pMergeDoc == NULL);
@@ -305,6 +302,17 @@ void CMainFrame::ShowMergeDoc(LPCTSTR szLeft, LPCTSTR szRight)
                                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
                {
@@ -315,8 +323,6 @@ void CMainFrame::ShowMergeDoc(LPCTSTR szLeft, LPCTSTR szRight)
        }
 }
 
-
-
 void CMainFrame::OnOptionsShowDifferent() 
 {
        m_bShowDiff = !m_bShowDiff;
@@ -369,8 +375,6 @@ void CMainFrame::OnUpdateOptionsShowuniqueright(CCmdUI* pCmdUI)
        pCmdUI->SetCheck(m_bShowUniqueRight);
 }
 
-
-
 void CMainFrame::OnHideBackupFiles() 
 {
        m_bHideBak = ! m_bHideBak;
@@ -398,10 +402,6 @@ void CMainFrame::OnHelpGnulicense()
                ShellExecute(NULL, _T("open"), _T("http://www.gnu.org/copyleft/gpl.html"), NULL, NULL, SW_SHOWNORMAL);
 }
 
-
-
-
-
 BOOL CMainFrame::CheckSavePath(CString& strSavePath)
 {
        BOOL needCheck;
@@ -492,12 +492,10 @@ BOOL CMainFrame::CheckSavePath(CString& strSavePath)
                                                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
@@ -537,7 +535,6 @@ BOOL CMainFrame::CheckSavePath(CString& strSavePath)
 
                         // BSP - Finally! Check out the file!
                                                m_vssi.Checkout("", strSavePath, 0);
-
                                        }
                                }
                                break;
@@ -628,6 +625,7 @@ void CMainFrame::OnProperties()
        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;
@@ -642,6 +640,7 @@ void CMainFrame::OnProperties()
                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;
@@ -666,6 +665,7 @@ void CMainFrame::OnProperties()
                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);
@@ -680,9 +680,21 @@ void CMainFrame::OnProperties()
                // 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
@@ -748,7 +760,6 @@ void CMainFrame::rptStatus(BYTE code)
                , 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*/)
@@ -782,7 +793,6 @@ BOOL CMainFrame::DoFileOpen(LPCTSTR pszLeft /*=NULL*/, LPCTSTR pszRight /*=NULL*
                addToMru(pszRight, _T("Files\\Right"));
        }
 
-
        // check to make sure they are same type
        TCHAR name[MAX_PATH];
        BOOL bLeftIsDir = GetFileAttributes(strLeft)&FILE_ATTRIBUTE_DIRECTORY;
@@ -1130,7 +1140,6 @@ void CMainFrame::UpdateResources()
                m_pRight->UpdateResources();
 }
 
-
 void CMainFrame::OnHelpContents() 
 {
        TCHAR path[MAX_PATH], temp[MAX_PATH];
@@ -1213,7 +1222,6 @@ void CMainFrame::OnClose()
        CMDIFrameWnd::OnClose();
 }
 
-
 void CMainFrame::FreeRegExpList()
 {
        struct regexp_list *r;
@@ -1228,10 +1236,8 @@ void CMainFrame::FreeRegExpList()
                free(ignore_regexp_list);
                ignore_regexp_list = r;
        }
-
 }
 
-
 void CMainFrame::RebuildRegExpList()
 {
        _TCHAR tmp[MAX_PATH];
@@ -1260,7 +1266,6 @@ void CMainFrame::RebuildRegExpList()
        {
                ignore_some_changes = 1;
        }
-
 }
 
 // Add the compiled form of regexp pattern to reglist
index ed80231..8b73603 100644 (file)
@@ -103,6 +103,8 @@ public:
        CMergeEditView *m_pLeft, *m_pRight;
        CMergeDoc *m_pMergeDoc;
        CDirDoc *m_pDirDoc;
+       UINT m_nTabType;
+
 // Implementation data
 protected:
        int m_nStatusFileSame;
index 24b5298..b3a403b 100644 (file)
@@ -290,7 +290,7 @@ STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
 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",
@@ -310,9 +310,13 @@ BEGIN
                     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
@@ -388,6 +392,7 @@ BEGIN
                     WS_VSCROLL
 END
 
+
 #ifndef _MAC
 /////////////////////////////////////////////////////////////////////////////
 //
@@ -606,6 +611,10 @@ STRINGTABLE PRELOAD DISCARDABLE
 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?"
index 22edd6f..d147ae1 100644 (file)
@@ -47,6 +47,7 @@ CPropGeneral::CPropGeneral() : CPropertyPage(CPropGeneral::IDD)
        m_bEolSensitive = FALSE;
        m_bDisableSplash = FALSE;
        m_nIgnoreWhite = -1;
+       m_nTabType = 0;
        //}}AFX_DATA_INIT
 }
 
@@ -66,6 +67,8 @@ void CPropGeneral::DoDataExchange(CDataExchange* pDX)
        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
 }
 
index 9b4c01e..e61b769 100644 (file)
@@ -30,6 +30,7 @@ public:
        BOOL    m_bEolSensitive;
        BOOL    m_bDisableSplash;
        int             m_nIgnoreWhite;
+       int             m_nTabType;
        //}}AFX_DATA
 
 
index eed5128..a4fca76 100644 (file)
@@ -83,6 +83,8 @@
 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
 
@@ -116,7 +118,6 @@ IMPLEMENT_DYNCREATE (CCrystalEditView, CCrystalTextView)
 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;
@@ -131,7 +132,6 @@ bool CCrystalEditView::
 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 ();
@@ -649,19 +649,25 @@ OnEditTab ()
   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;
@@ -669,6 +675,7 @@ OnEditTab ()
       pszText[nChars] = _T ('\0');
     }
 
+  // Indent selected lines (multiple lines selected)
   if (bTabify)
     {
       m_pTextBuffer->BeginUndoGroup ();
@@ -688,7 +695,7 @@ OnEditTab ()
               ptSelEnd.y++;
             }
         }
-      else
+      else  //...otherwise, do not indent the empty line.
         nEndLine--;
       SetSelection (ptSelStart, ptSelEnd);
       SetCursorPos (ptSelEnd);
@@ -709,6 +716,7 @@ OnEditTab ()
       return;
     }
 
+  // Overwrite mode, replace next char with tab/spaces
   if (m_bOvrMode)
     {
       CPoint ptCursorPos = GetCursorPos ();
@@ -716,10 +724,13 @@ OnEditTab ()
 
       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)
@@ -747,6 +758,9 @@ OnEditTab ()
 
   m_pTextBuffer->BeginUndoGroup ();
 
+  int x, y;    // For cursor position
+
+  // Text selected, no overwrite mode, replace sel with tab
   if (IsSelection ())
     {
       CPoint ptSelStart, ptSelEnd;
@@ -759,10 +773,13 @@ OnEditTab ()
 
       // [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;
@@ -1331,7 +1348,8 @@ ReplaceSelection (LPCTSTR pszNewText, DWORD dwFlags)
     ptCursorPos = GetCursorPos ();
   ASSERT_VALIDTEXTPOS (ptCursorPos);
 
-  int x, y;
+  int x = 0;
+  int y = 0;
   if (dwFlags & FIND_REGEXP)
     {
       LPTSTR lpszNewStr;
@@ -1564,7 +1582,7 @@ OnEditOperation (int nAction, LPCTSTR pszText)
               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);
@@ -1606,7 +1624,7 @@ OnEditOperation (int nAction, LPCTSTR pszText)
               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');
@@ -1673,7 +1691,7 @@ OnEditOperation (int nAction, LPCTSTR pszText)
           if (nPos == nLength - 1)
             {
               TCHAR *pszInsertStr;
-              if (m_bInsertTabs)
+              if (m_pTextBuffer->GetInsertTabs())
                 {
                   pszInsertStr = (TCHAR *) _alloca (sizeof (TCHAR) * 2);
                   *pszInsertStr = _T ('\t');
@@ -1959,7 +1977,7 @@ OnEditAutoExpand ()
                       case _T ('t'):
                         {
                           static TCHAR szText[32];
-                          if (m_bInsertTabs)
+                          if (m_pTextBuffer->GetInsertTabs())
                             {
                               *szText = _T ('\t');
                               szText[1] = _T ('\0');
index b999c1a..1fd99e1 100644 (file)
@@ -72,7 +72,6 @@ private :
     BOOL m_bSelectionPushed;
     CPoint m_ptSavedSelStart, m_ptSavedSelEnd;
     BOOL m_bAutoIndent;
-    BOOL m_bInsertTabs;
 
     //  [JRT]
     BOOL m_bDisableBSAtSOL;       // Disable BS At Start Of Line
@@ -81,6 +80,10 @@ private :
 public :
     virtual void ResetView ();
 protected :
+
+
+
+
     CEditDropTargetImpl * m_pDropTarget;
     virtual DROPEFFECT GetDropEffect ();
     virtual void OnDropSource (DROPEFFECT de);
index f4528f2..3577d06 100644 (file)
@@ -61,12 +61,12 @@ inline void CCrystalEditView::SetAutoIndent (BOOL bAutoIndent)
 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
index e91d493..af075c1 100644 (file)
@@ -180,6 +180,8 @@ CCrystalTextBuffer::CCrystalTextBuffer ()
   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
@@ -297,6 +299,8 @@ InitNew (int nCrlfStyle /*= CRLF_STYLE_DOS*/ )
   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;
@@ -1505,3 +1509,15 @@ void CCrystalTextBuffer::DeleteLine(int line)
        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;
+}
index e0ecc46..ef5003a 100644 (file)
@@ -121,6 +121,8 @@ protected :
        BOOL m_EolSensitive;
     BOOL m_bCreateBackupFile;
     int m_nUndoBufSize;
+    BOOL m_bInsertTabs;
+    int  m_nTabSize;
     int FindLineWithFlag (DWORD dwFlag);
 
 protected :
@@ -306,6 +308,14 @@ public :
     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);
index 4a9212b..cf81ac8 100644 (file)
@@ -35,4 +35,14 @@ const
   return m_bModified;
 }
 
+inline BOOL CCrystalTextBuffer::GetInsertTabs() const          //UPDATE-BEGIN
+{
+    return m_bInsertTabs;
+}
+
+inline void CCrystalTextBuffer::SetInsertTabs(BOOL bInsertTabs)
+{
+    m_bInsertTabs = bInsertTabs;
+}
+
 #endif
index 23cfd9a..8deedf9 100644 (file)
@@ -107,6 +107,7 @@ static char THIS_FILE[] = __FILE__;
 #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 )
@@ -484,7 +485,7 @@ CCrystalTextView::~CCrystalTextView ()
        }
        if (m_pnActualLineLength != NULL)
        {
-               delete m_pnActualLineLength;
+               delete[] m_pnActualLineLength;
                m_pnActualLineLength = NULL;
        }
        if (m_rxnode)
@@ -1212,7 +1213,7 @@ DrawSingleLine (CDC * pdc, const CRect & rc, int nLineIndex)
   pdc->SetBkColor (crBkgnd);
   if (crText != CLR_NONE)
     pdc->SetTextColor (crText);
-       BOOL bColorSet = FALSE;
+// BOOL bColorSet = FALSE;
 
        //BEGIN SW
        /*ORIGINAL
@@ -1557,7 +1558,6 @@ ResetView ()
   m_nOffsetChar = 0;
   m_nLineHeight = -1;
   m_nCharWidth = -1;
-  m_nTabSize = 4;
   m_nMaxLineLength = -1;
   m_nScreenLines = -1;
   m_nScreenChars = -1;
@@ -1606,6 +1606,7 @@ ResetView ()
   m_bBookmarkExist = FALSE;     // More bookmarks
 
   m_bMultipleSearch = FALSE;    // More search
+  m_bViewTabs = FALSE;
 
 }
 
@@ -1616,7 +1617,11 @@ UpdateCaret ()
   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 ();
     }
@@ -1648,20 +1653,27 @@ SetCRLFMode (int nCRLFMode)
 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;
@@ -2480,6 +2492,7 @@ OnDestroy ()
 BOOL CCrystalTextView::
 OnEraseBkgnd (CDC * pdc)
 {
+  UNREFERENCED_PARAMETER(pdc);
   return TRUE;
 }
 
@@ -4558,7 +4571,7 @@ BOOL CCrystalTextView::
 OnMouseWheel (UINT nFlags, short zDelta, CPoint pt)
 {
        // -> HE
-       int nPageLines = GetScreenLines();
+// int nPageLines = GetScreenLines();
        int nSubLineCount = GetSubLineCount();
 
        int nNewTopSubLine= m_nTopSubLine - zDelta / 40;
@@ -4616,7 +4629,7 @@ OnMatchBrace ()
   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)
     {
index a7ee1c8..0a7396a 100644 (file)
@@ -91,7 +91,6 @@ private :
     void CalcLineCharDim ();
 
     //  Text attributes
-    int m_nTabSize;
     BOOL m_bViewTabs;
     BOOL m_bSelMargin;
     DWORD m_dwFlags;
@@ -156,6 +155,7 @@ public :
 protected :
     CPoint WordToRight (CPoint pt);
     CPoint WordToLeft (CPoint pt);
+    BOOL           m_bOverrideCaret;
 
     bool m_bSingle;
     CImageList * m_pIcons;
index 054184d..7964f09 100644 (file)
@@ -1,3 +1,6 @@
+2003-01-27
+ [ 668654 ] Tabtype selection feature
+
 2003-01-21
  [ 671037 ] Changes for MSVC.NET
  [ 671810 ] Tempfiles to temp dir
index c588fbe..5e4fe02 100644 (file)
 #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