// $Id: 7zCommon.cpp 7169 2010-05-16 14:44:19Z jtuc $
#include "stdafx.h"
+#include "7zCommon.h"
+#include <afxinet.h>
+#include <shlwapi.h>
+#include <paths.h>
#include "OptionsDef.h"
+#include "OptionsMgr.h"
#include "Merge.h" // DirDocFilter theApp GetOptionsMgr()
#include "resource.h"
#include "DirDoc.h"
-#include "MainFrm.h"
-#include "7zCommon.h"
//#include "ExternalArchiveFormat.h"
#include "version.h"
-#include <afxinet.h>
-#include <shlwapi.h>
-#include <paths.h>
#include "Environment.h"
#ifdef _DEBUG
#include "dllpstub.h"
#include "../ArchiveSupport/Merge7z/Merge7z.h"
-#include "DiffContext.h"
#include "DirView.h"
#include <list>
// $Id: AboutDlg.cpp 6380 2009-01-25 22:13:36Z kimmov $
#include "stdafx.h"
+#include "AboutDlg.h"
#include "Constants.h"
#include "Merge.h"
-#include "AboutDlg.h"
#include "version.h"
#include "paths.h"
#include "Environment.h"
// $Id$
#include "stdafx.h"
-#include "merge.h"
#include "CCPrompt.h"
+#include "Merge.h"
#ifdef _DEBUG
#define new DEBUG_NEW
// $Id: ChildFrm.cpp 7075 2009-12-30 22:57:20Z kimmov $
#include "stdafx.h"
-#include "Merge.h"
-
#include "ChildFrm.h"
+#include "Merge.h"
#include "MainFrm.h"
+#include "MergeDoc.h"
#include "MergeEditView.h"
#include "LocationView.h"
#include "DiffViewBar.h"
#include "charsets.h"
#include "OptionsDef.h"
+#include "OptionsMgr.h"
#ifdef _DEBUG
#define new DEBUG_NEW
// $Id$
#include "StdAfx.h"
+#include "Bitmap.h"
#include <math.h>
#include <boost/scoped_array.hpp>
-#include "Bitmap.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#include "StdAfx.h"
-
+#include "CMoveConstraint.h"
#include <afxtempl.h> // MFC template collection classes
#include <afxext.h> // needed for CFormView
-#include "CMoveConstraint.h"
-
#ifndef NOSUBCLASS
#include "CSubclass.h"
#endif // NOSUBCLASS
#include "DragDrop.h"
-#include "paths.h"
#include <boost/scoped_array.hpp>
+#include "paths.h"
//
// OnDropFiles code from CDropEdit
// ID line follows -- this is updated by SVN
// $Id: $
+#include "ExConverter.h"
#include <windows.h>
#include <mlang.h>
#include <boost/scoped_array.hpp>
-#include "ExConverter.h"
#include "unicoder.h"
#include "codepage.h"
// $Id: LanguageSelect.cpp 6499 2009-02-25 13:31:52Z kimmov $
#include "StdAfx.h"
+#include "LanguageSelect.h"
+#include <locale.h>
+#include <sstream>
#include "OptionsDef.h"
+#include "OptionsMgr.h"
#include "Merge.h"
#include "version.h"
#include "resource.h"
-#include "LanguageSelect.h"
#include "BCMenu.h"
#include "MainFrm.h"
#include "OpenFrm.h"
#include "DirFrame.h"
#include "paths.h"
#include "Environment.h"
-#include <locale.h>
-#include <sstream>
// Escaped character constants in range 0x80-0xFF are interpreted in current codepage
// Using C locale gets us direct mapping to Unicode codepoints
if (SetLanguage(lang))
GetOptionsMgr()->SaveOption(OPT_SELECTED_LANGUAGE, (int)lang);
- CMainFrame *pMainFrame = static_cast<CMainFrame *>(AfxGetApp()->m_pMainWnd);
- pMainFrame->UpdateCodepageModule();
+ theApp.UpdateCodepageModule();
// Update status bar inicator texts
- SetIndicators(pMainFrame->m_wndStatusBar, 0, 0);
+ SetIndicators(GetMainFrame()->m_wndStatusBar, 0, 0);
// Update the current menu
if (m_bReloadMenu)
{
TranslateDialog(m_hWnd);
CDialog::OnInitDialog();
-
- CMainFrame::SetMainIcon(this);
// setup handler for resizing this dialog
m_constraint.InitializeCurrentSize(this);
m_constraint.SubclassWnd(); // install subclassing
m_constraint.LoadPosition(_T("ResizeableDialogs"), _T("LanguageSelectDlg"), false); // persist size via registry
- GetMainFrame()->CenterToMainFrame(this);
+ AfxGetMainWnd()->CenterWindow(this);
LoadAndDisplayLanguages();
// Set tabsize = 3 in your editor.
//
#include "StdAfx.h"
-#include <afxpriv2.h>
#include "Picture.h"
+#include <afxpriv2.h>
#ifdef _DEBUG
#define new DEBUG_NEW
// $Id$
#include "StdAfx.h"
+#include "PreferencesDlg.h"
#include "resource.h"
#include "UnicodeString.h"
#include "OptionsDef.h"
#include "OptionsMgr.h"
#include "SyntaxColors.h"
-#include "PreferencesDlg.h"
-#include "MainFrm.h"
#include "Merge.h"
#include "paths.h" //paths_SplitFilename()
#include "FileOrFolderSelect.h"
void CPreferencesDlg::OnHelpButton()
{
- GetMainFrame()->ShowHelp(OptionsHelpLocation);
+ theApp.ShowHelp(OptionsHelpLocation);
}
void CPreferencesDlg::AddPage(CPropertyPage* pPage, UINT nResourceID)
// $Id$
#define NOMINMAX
-#include <windows.h>
#include "RegKey.h"
+#include <windows.h>
#include <cassert>
#include "UnicodeString.h"
#include "coretypes.h"
// ID line follows -- this is updated by SVN
// $Id$
+#include <Windows.h>
#include "UnicodeString.h"
/**
// ID line follows -- this is updated by SVN
// $Id$
-#include <windows.h>
#include "RegOptionsMgr.h"
+#include <windows.h>
#include <tchar.h>
#include <vector>
#include "varprop.h"
#ifndef _REG_OPTIONSMGR_H_
#define _REG_OPTIONSMGR_H_
+#include <Windows.h>
#include "OptionsMgr.h"
class COptionsMgr;
// ID line follows -- this is updated by SVN
// $Id$
+#include "ShellFileOperations.h"
#include <windows.h>
#include <tchar.h>
#include <shlwapi.h>
#include <vector>
#include <shellapi.h>
#include "UnicodeString.h"
-#include "ShellFileOperations.h"
using std::vector;
#define _SHELL_FILE_OPERATIONS_H_
#include <vector>
+#include <Windows.h>
+#include "UnicodeString.h"
/**
* @brief A wrapper class for SHFileOperation().
#include "StdAfx.h"
#include "SuperComboBox.h"
-#include "DragDrop.h"
-
#include <shlwapi.h>
#include <vector>
+#include "DragDrop.h"
#ifdef _DEBUG
#define new DEBUG_NEW
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#include <windows.h>
#include "unicoder.h"
+#include <windows.h>
#include <tchar.h>
#include <cassert>
#include <boost/scoped_array.hpp>
#include "ConfigLog.h"
#include <cassert>
-#include <boost/scoped_array.hpp>
#include <windows.h>
#include <mbctype.h>
+#include <boost/scoped_array.hpp>
#include "Constants.h"
#include "version.h"
#include "UniFile.h"
// $Id$
#include "stdafx.h"
-#include "Merge.h"
#include "ConfirmFolderCopyDlg.h"
+#include "Merge.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#include "paths.h"
#include "Merge.h"
#include "OptionsDef.h"
+#include "OptionsMgr.h"
#include "Environment.h"
#include "MergeLineFlags.h"
#include "MergeDoc.h"
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
-#include "Merge.h"
-
-#include "ChildFrm.h"
#include "DiffViewBar.h"
+#include "Merge.h"
+#include "SplitterWndEx.h"
#ifdef _DEBUG
#undef THIS_FILE
#include "sizecbar.h"
#include "scbarcf.h"
-#include "SplitterWndEx.h"
+
+class CSplitterWndEx;
// You must #define this for viewbar to compile properly
#define TViewBarBase CSizingControlBarCF
#ifndef _DIFFWRAPPER_H
#define _DIFFWRAPPER_H
+#include <boost/scoped_ptr.hpp>
#include "diff.h"
#include "FileLocation.h"
#include "PathContext.h"
#include "CompareOptions.h"
#include "DiffList.h"
#include "UnicodeString.h"
-#include <boost/scoped_ptr.hpp>
class CDiffContext;
class PrediffingInfo;
#include "UnicodeString.h"
#include "DirView.h"
#include "DirDoc.h"
-#include "MainFrm.h"
#include "coretools.h"
#include "paths.h"
#include "7zCommon.h"
#include "IntToIntMap.h"
#include "FileOrFolderSelect.h"
#include "ConfirmFolderCopyDlg.h"
+#include "OptionsMgr.h"
#ifdef _DEBUG
#define new DEBUG_NEW
/**
* @brief Perform an array of actions
* @note There can be only COPY or DELETE actions, not both!
- * @sa CMainFrame::SaveToVersionControl()
- * @sa CMainFrame::SyncFilesToVCS()
+ * @sa MergeApp::SaveToVersionControl()
+ * @sa MergeApp::SyncFilesToVCS()
*/
void CDirView::PerformActionList(FileActionScript & actionScript)
{
// Reset suppressing VSS dialog for multiple files.
// Set in CMainFrame::SaveToVersionControl().
- GetMainFrame()->m_CheckOutMulti = false;
- GetMainFrame()->m_bVssSuppressPathCheck = false;
+ theApp.m_CheckOutMulti = false;
+ theApp.m_bVssSuppressPathCheck = false;
// Check option and enable putting deleted items to Recycle Bin
if (GetOptionsMgr()->GetBool(OPT_USE_RECYCLE_BIN))
// Synchronized items may need VCS operations
if (act.UIResult == FileActionItem::UI_SYNC)
{
- if (GetMainFrame()->m_bCheckinVCS)
- GetMainFrame()->CheckinToClearCase(act.dest);
+ if (theApp.m_bCheckinVCS)
+ theApp.CheckinToClearCase(act.dest);
}
// Update UI
String file = GetSelectedFileName(stype);
if (file.empty()) return;
- GetMainFrame()->OpenFileToExternalEditor(file);
+ theApp.OpenFileToExternalEditor(file);
}
/**
//
#include "stdafx.h"
-#include "Coretools.h"
#include "DirCmpReportDlg.h"
+#include "Coretools.h"
#include "DirReportTypes.h"
#include "paths.h"
#include "FileOrFolderSelect.h"
#include "Merge.h"
-#include "DirCmpReportDlg.h"
IMPLEMENT_DYNAMIC(DirCmpReportDlg, CDialog)
#include "stdafx.h"
-#include "merge.h"
#include "DirColsDlg.h"
#include <algorithm>
+#include "Merge.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#include "stdafx.h"
#include "DirCompProgressBar.h"
#include "Merge.h"
-#include "DirDoc.h"
#include "CompareStats.h"
#ifdef _DEBUG
//
#include "StdAfx.h"
+#include "DirDoc.h"
#include <shlwapi.h> // PathFindFileName()
#include <Poco/StringTokenizer.h>
#include "Merge.h"
+#include "MergeDoc.h"
#include "HexMergeDoc.h"
#include "UnicodeString.h"
#include "CompareStats.h"
#include "FilterList.h"
#include "DirView.h"
-#include "DirDoc.h"
#include "DirFrame.h"
-#include "MainFrm.h"
#include "coretools.h"
#include "paths.h"
#include "WaitStatusCursor.h"
#include "7zCommon.h"
#include "OptionsDef.h"
+#include "OptionsMgr.h"
#include "OptionsDiffOptions.h"
#include "FileActionScript.h"
#include "LineFiltersList.h"
+#include "FileFilterHelper.h"
#include "unicoder.h"
#ifdef _DEBUG
ASSERT(m_pCtxt);
BOOL bFilters = GetOptionsMgr()->GetBool(OPT_LINEFILTER_ENABLED);
- String filters = GetMainFrame()->m_pLineFilters->GetAsString();
+ String filters = theApp.m_pLineFilters->GetAsString();
if (!bFilters || filters.empty())
{
m_pCtxt->m_pFilterList.reset();
pf->GetHeaderInterface()->Resize();
// Make sure filters are up-to-date
- theApp.m_globalFileFilter.ReloadUpdatedFilters();
- m_pCtxt->m_piFilterGlobal = &theApp.m_globalFileFilter;
+ theApp.m_pGlobalFileFilter->ReloadUpdatedFilters();
+ m_pCtxt->m_piFilterGlobal = theApp.m_pGlobalFileFilter.get();
// Show active filter name in statusbar
- pf->SetFilterStatusDisplay(theApp.m_globalFileFilter.GetFilterNameOrMask().c_str());
+ pf->SetFilterStatusDisplay(theApp.m_pGlobalFileFilter->GetFilterNameOrMask().c_str());
// Folder names to compare are in the compare context
m_diffThread.SetContext(m_pCtxt.get());
return FALSE;
// result filters
- if (di.diffcode.isResultError() && !GetMainFrame()->m_bShowErrors)
+ if (di.diffcode.isResultError())
return FALSE;
}
else // recursive mode (including tree-mode)
if (GetOptionsMgr()->GetBool(OPT_TREE_MODE))
{
// result filters
- if (di.diffcode.isResultError() && !GetMainFrame()->m_bShowErrors)
+ if (di.diffcode.isResultError())
return FALSE;
// result filters
// result filters
if (di.diffcode.isResultSame() && !GetOptionsMgr()->GetBool(OPT_SHOW_IDENTICAL))
return FALSE;
- if (di.diffcode.isResultError() && !GetMainFrame()->m_bShowErrors)
+ if (di.diffcode.isResultError())
return FALSE;
if (di.diffcode.isResultDiff() && !GetOptionsMgr()->GetBool(OPT_SHOW_DIFFERENT))
return FALSE;
// $Id: DirFrame.cpp 4739 2007-11-12 20:41:16Z jtuc $
#include "stdafx.h"
-#include "Merge.h"
#include "DirFrame.h"
-#include "FilepathEdit.h"
-#include "DirDoc.h"
+#include "Merge.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#ifndef _DIR_ITEM_H_INCLUDED
#define _DIR_ITEM_H_INCLUDED
-#include "UnicodeString.h"
-#include "FileVersion.h"
#define POCO_NO_UNWINDOWS 1
#include <Poco/Types.h>
#include <Poco/File.h>
#include <Poco/Timestamp.h>
#include <boost/flyweight.hpp>
+#include "UnicodeString.h"
+#include "FileVersion.h"
/**
* @brief Class for fileflags.
// $Id: DirView.cpp 7063 2009-12-27 15:28:16Z kimmov $
#include "StdAfx.h"
+#include "DirView.h"
#include "Constants.h"
#include "Merge.h"
#include "ClipBoard.h"
-#include "DirView.h"
#include "DirFrame.h" // StatePane
#include "DirDoc.h"
+#include "MergeDoc.h"
#include "HexMergeFrm.h"
#include "HexMergeDoc.h"
#include "MainFrm.h"
#include "paths.h"
#include "7zCommon.h"
#include "OptionsDef.h"
+#include "OptionsMgr.h"
#include "BCMenu.h"
#include "DirCmpReport.h"
#include "DirCompProgressBar.h"
FileLocation fileloc[3];
if (pDoc->m_nDirs < 3)
{
- GetMainFrame()->m_strDescriptions[0].erase();
- GetMainFrame()->m_strDescriptions[1].erase();
+ theApp.m_strDescriptions[0].erase();
+ theApp.m_strDescriptions[1].erase();
if (di1 == di2 && !di1->diffcode.isExists(0))
{
paths[0] = _T("");
- GetMainFrame()->m_strDescriptions[0] = theApp.LoadString(IDS_EMPTY_LEFT_FILE);
+ theApp.m_strDescriptions[0] = theApp.LoadString(IDS_EMPTY_LEFT_FILE);
}
if (di1 == di2 && !di1->diffcode.isExists(1))
{
paths[1] = _T("");
- GetMainFrame()->m_strDescriptions[1] = theApp.LoadString(IDS_EMPTY_RIGHT_FILE);
+ theApp.m_strDescriptions[1] = theApp.LoadString(IDS_EMPTY_RIGHT_FILE);
}
}
else
{
- GetMainFrame()->m_strDescriptions[0].erase();
- GetMainFrame()->m_strDescriptions[1].erase();
- GetMainFrame()->m_strDescriptions[2].erase();
+ theApp.m_strDescriptions[0].erase();
+ theApp.m_strDescriptions[1].erase();
+ theApp.m_strDescriptions[2].erase();
if (di1 == di2 && di1 == di3 && !di1->diffcode.isExists(0))
{
paths[0] = _T("");
- GetMainFrame()->m_strDescriptions[0] = theApp.LoadString(IDS_EMPTY_LEFT_FILE);
+ theApp.m_strDescriptions[0] = theApp.LoadString(IDS_EMPTY_LEFT_FILE);
}
if (di1 == di2 && di1 == di3 && !di1->diffcode.isExists(1))
{
paths[1] = _T("");
- GetMainFrame()->m_strDescriptions[1] = theApp.LoadString(IDS_EMPTY_MIDDLE_FILE);
+ theApp.m_strDescriptions[1] = theApp.LoadString(IDS_EMPTY_MIDDLE_FILE);
}
if (di1 == di2 && di1 == di3 && !di1->diffcode.isExists(2))
{
paths[2] = _T("");
- GetMainFrame()->m_strDescriptions[2] = theApp.LoadString(IDS_EMPTY_RIGHT_FILE);
+ theApp.m_strDescriptions[2] = theApp.LoadString(IDS_EMPTY_RIGHT_FILE);
}
}
m_pDirView->OpenSelection();
CFrameWnd * pFrame = GetMainFrame()->GetActiveFrame();
- if (GetMainFrame()->GetFrameType(pFrame) == FRAME_FILE)
+ if (GetMainFrame()->GetFrameType(pFrame) == CMainFrame::FRAME_FILE)
{
CMergeDoc * pMergeDoc = (CMergeDoc *) pFrame->GetActiveDocument();
pMergeDoc->GenerateReport(paths_ConcatPath(sDestDir, sLinkPath).c_str());
/** @brief Open help from mainframe when user presses F1*/
void CDirView::OnHelp()
{
- GetMainFrame()->ShowHelp(DirViewHelpLocation);
+ theApp.ShowHelp(DirViewHelpLocation);
}
/**
#include <afxcview.h>
#include <map>
#include <boost/scoped_ptr.hpp>
+#define POCO_NO_UNWINDOWS 1
#include <Poco/Types.h>
#include "OptionsDiffColors.h"
#include "SortHeaderCtrl.h"
#include "StdAfx.h"
-#include "Merge.h"
#include "DirView.h"
+#include "Merge.h"
#include "DirDoc.h"
#include "resource.h"
#include "coretools.h"
#include "stdafx.h"
+#include "DirViewColItems.h"
#include <shlwapi.h>
#include <Poco/Timestamp.h>
#include "UnicodeString.h"
#include "Merge.h"
#include "DirView.h"
#include "DirDoc.h"
-#include "MainFrm.h"
#include "resource.h"
-#include "DirViewColItems.h"
#include "locality.h"
#include "unicoder.h"
#include "coretools.h"
// $Id: EditorFilepathBar.cpp 5401 2008-05-30 12:09:27Z kimmov $
#include "stdafx.h"
-#include "Merge.h"
#include "EditorFilepathBar.h"
#ifdef _DEBUG
//
#include "stdafx.h"
-#include "Merge.h"
-#include "resource.h"
#include "EncodingErrorBar.h"
+#include "Merge.h"
#ifdef _DEBUG
#define new DEBUG_NEW
// $Id$
#include "stdafx.h"
+#include "FileActionScript.h"
#include <vector>
#include "UnicodeString.h"
#include "Merge.h"
#include "OptionsDef.h"
+#include "OptionsMgr.h"
#include "MainFrm.h"
-#include "FileActionScript.h"
#include "ShellFileOperations.h"
#include "paths.h"
return retVal;
// TODO: First param is not used!
- int nRetVal = GetMainFrame()->SyncFileToVCS(path.c_str(), bApplyToAll, strErr);
+ int nRetVal = theApp.SyncFileToVCS(path.c_str(), bApplyToAll, strErr);
if (nRetVal == -1)
{
retVal = SCRIPT_FAIL; // So we exit without file operations done
if (bContinue)
{
- if (!GetMainFrame()->CreateBackup(TRUE, (*iter).dest.c_str()))
+ if (!theApp.CreateBackup(TRUE, (*iter).dest.c_str()))
{
String strErr = theApp.LoadString(IDS_ERROR_BACKUP);
AfxMessageBox(strErr.c_str(), MB_OK | MB_ICONERROR);
// ID line follows -- this is updated by SVN
// $Id$
-#include <vector>
#include "FileFilter.h"
+#include <vector>
using std::vector;
#define __FILEFILTER_H__
#include <vector>
-#include "UnicodeString.h"
#define POCO_NO_UNWINDOWS 1
#include <Poco/RegularExpression.h>
#include <boost/shared_ptr.hpp>
+#include "UnicodeString.h"
/**
* @brief FileFilter rule.
// $Id$
#include "stdafx.h"
+#include "FileFiltersDlg.h"
#include <vector>
#include "UnicodeString.h"
-#include "merge.h"
-#include "MainFrm.h"
-#include "FileFiltersDlg.h"
+#include "Merge.h"
#include "FileFilterMgr.h"
+#include "FileFilterHelper.h"
#include "paths.h"
#include "SharedFilterDlg.h"
#include "TestFilterDlg.h"
*/
void FileFiltersDlg::EditFileFilter(LPCTSTR path)
{
- CMainFrame::OpenFileToExternalEditor(path);
+ theApp.OpenFileToExternalEditor(path);
}
/**
m_sFileFilterPath = m_listFilters.GetItemText(sel, 2);
// Ensure filter is up-to-date (user probably just edited it)
- theApp.m_globalFileFilter.ReloadUpdatedFilters();
+ theApp.m_pGlobalFileFilter->ReloadUpdatedFilters();
- FileFilterMgr *pMgr = theApp.m_globalFileFilter.GetManager();
+ FileFilterMgr *pMgr = theApp.m_pGlobalFileFilter->GetManager();
FileFilter * pFileFilter = pMgr->GetFilterByPath(m_sFileFilterPath);
if (!pFileFilter)
return;
*/
void FileFiltersDlg::OnBnClickedFilterfileNewbutton()
{
- String globalPath = theApp.m_globalFileFilter.GetGlobalFilterPathWithCreate();
- String userPath = theApp.m_globalFileFilter.GetUserFilterPathWithCreate();
+ String globalPath = theApp.m_pGlobalFileFilter->GetGlobalFilterPathWithCreate();
+ String userPath = theApp.m_pGlobalFileFilter->GetUserFilterPathWithCreate();
if (globalPath.empty() && userPath.empty())
{
return;
}
EditFileFilter(s.c_str());
- FileFilterMgr *pMgr = theApp.m_globalFileFilter.GetManager();
+ FileFilterMgr *pMgr = theApp.m_pGlobalFileFilter->GetManager();
int retval = pMgr->AddFilter(s.c_str());
if (retval == FILTER_OK)
{
// Remove all from filterslist and re-add so we can update UI
String selected;
m_Filters->clear();
- theApp.m_globalFileFilter.LoadAllFileFilters();
- theApp.m_globalFileFilter.GetFileFilters(m_Filters, selected);
+ theApp.m_pGlobalFileFilter->LoadAllFileFilters();
+ theApp.m_pGlobalFileFilter->GetFileFilters(m_Filters, selected);
UpdateFiltersList();
}
{
if (DeleteFile(path))
{
- FileFilterMgr *pMgr = theApp.m_globalFileFilter.GetManager();
+ FileFilterMgr *pMgr = theApp.m_pGlobalFileFilter->GetManager();
pMgr->RemoveFilter((LPCTSTR)path);
// Remove all from filterslist and re-add so we can update UI
String selected;
m_Filters->clear();
- theApp.m_globalFileFilter.GetFileFilters(m_Filters, selected);
+ theApp.m_pGlobalFileFilter->GetFileFilters(m_Filters, selected);
UpdateFiltersList();
}
*/
void FileFiltersDlg::OnHelp()
{
- GetMainFrame()->ShowHelp(FilterHelpLocation);
+ theApp.ShowHelp(FilterHelpLocation);
}
/**
{
String s;
String path;
- String userPath = theApp.m_globalFileFilter.GetUserFilterPathWithCreate();
+ String userPath = theApp.m_pGlobalFileFilter->GetUserFilterPathWithCreate();
if (SelectFile(GetSafeHwnd(), s, path.c_str(), IDS_FILEFILTER_INSTALL, IDS_FILEFILTER_FILEMASK,
TRUE))
}
else
{
- FileFilterMgr *pMgr = theApp.m_globalFileFilter.GetManager();
+ FileFilterMgr *pMgr = theApp.m_pGlobalFileFilter->GetManager();
pMgr->AddFilter(userPath.c_str());
// Remove all from filterslist and re-add so we can update UI
String selected;
m_Filters->clear();
- theApp.m_globalFileFilter.GetFileFilters(m_Filters, selected);
+ theApp.m_pGlobalFileFilter->GetFileFilters(m_Filters, selected);
UpdateFiltersList();
}
#include <vector>
+struct FileFilterInfo;
+
/**
* @brief Class for dialog allowing user to select
* and edit used file filters
// $Id: FileOrFolderSelect.cpp 6569 2009-03-15 14:33:03Z kimmov $
#include <windows.h>
+#include "FileOrFolderSelect.h"
#include <shlobj.h>
#include <sys/stat.h>
-#include "UnicodeString.h"
#include "Environment.h"
-#include "FileOrFolderSelect.h"
#include "paths.h"
#include "MergeApp.h"
#include "resource.h"
#ifndef _FILE_OR_FOLDER_SELECTION_H_
#define _FILE_OR_FOLDER_SELECTION_H_
+#include "UnicodeString.h"
BOOL SelectFile(HWND parent, String& path, LPCTSTR initialPath = NULL,
UINT titleid = 0, UINT filterid = 0,
// $Id: FilepathEdit.cpp 6500 2009-02-25 13:36:26Z kimmov $
#include "stdafx.h"
+#include "FilepathEdit.h"
#include "Merge.h"
#include "BCMenu.h"
-#include "FilepathEdit.h"
#include "ClipBoard.h"
#include "Shlwapi.h"
#include <vector>
#include <string>
-#include "codepage.h"
#define POCO_NO_UNWINDOWS 1
#include <Poco/RegularExpression.h>
#include <boost/shared_ptr.hpp>
+#include "codepage.h"
/**
* @brief Container for one filtering rule / compiled expression.
// $Id: GhostTextBuffer.cpp 6878 2009-06-29 09:28:13Z kimmov $
#include "StdAfx.h"
-#include <vector>
#include "GhostTextBuffer.h"
#ifdef _DEBUG
// $Id: HexMergeDoc.cpp 7166 2010-05-16 12:05:13Z jtuc $
#include "stdafx.h"
+#include "HexMergeDoc.h"
#include <afxinet.h>
#include "UnicodeString.h"
#include "FileTextEncoding.h"
#include "Merge.h"
-#include "HexMergeDoc.h"
#include "HexMergeFrm.h"
#include "HexMergeView.h"
#include "DiffItem.h"
#include "FolderCmp.h"
-#include "MainFrm.h"
#include "Environment.h"
#include "diffcontext.h" // FILE_SAME
#include "dirdoc.h"
#include "paths.h"
#include "OptionsMgr.h"
#include "FileOrFolderSelect.h"
+#include "DiffWrapper.h"
#ifdef _DEBUG
#define new DEBUG_NEW
id = IDS_SAVE_RIGHT_AS;
else
id = IDS_SAVE_MIDDLE_AS;
- if (SelectFile(GetMainFrame()->GetSafeHwnd(), strPath, path.c_str(), id, NULL, FALSE))
+ if (SelectFile(AfxGetMainWnd()->GetSafeHwnd(), strPath, path.c_str(), id, NULL, FALSE))
{
if (Try(m_pView[nBuffer]->SaveFile(strPath.c_str())) == IDCANCEL)
return;
m_pView[index]->SetReadOnly(readOnly);
m_filePaths.SetPath(index, filename);
ASSERT(m_nBufferType[index] == BUFFER_NORMAL); // should have been initialized to BUFFER_NORMAL in constructor
- String strDesc = GetMainFrame()->m_strDescriptions[index];
+ String strDesc = theApp.m_strDescriptions[index];
if (!strDesc.empty())
{
m_strDesc[index] = strDesc;
else
{
m_nBufferType[index] = BUFFER_UNNAMED;
- m_strDesc[index] = GetMainFrame()->m_strDescriptions[index];
+ m_strDesc[index] = theApp.m_strDescriptions[index];
}
UpdateHeaderPath(index);
*/
class CHexMergeDoc : public CDocument
{
+public:
+ enum BUFFERTYPE
+ {
+ BUFFER_NORMAL = 0, /**< Normal, file loaded from disk */
+ BUFFER_NORMAL_NAMED, /**< Normal, description given */
+ BUFFER_UNNAMED, /**< Empty, created buffer */
+ BUFFER_UNNAMED_SAVED, /**< Empty buffer saved with filename */
+ };
+
// Attributes
public:
static int m_nBuffersTemp;
// $Id: HexMergeFrm.cpp 7166 2010-05-16 12:05:13Z jtuc $
#include "stdafx.h"
-#include "Merge.h"
-#include "MainFrm.h"
#include "HexMergeFrm.h"
+#include "Merge.h"
#include "HexMergeDoc.h"
#include "HexMergeView.h"
#include "OptionsDef.h"
+#include "OptionsMgr.h"
#ifdef _DEBUG
#define new DEBUG_NEW
// $Id: HexMergeView.cpp 7165 2010-05-15 14:04:43Z jtuc $
#include "stdafx.h"
+#include "HexMergeFrm.h"
#include "Merge.h"
#include "MainFrm.h"
-#include "HexMergeFrm.h"
#include "HexMergeView.h"
#include "OptionsDef.h"
+#include "OptionsMgr.h"
#include "Environment.h"
#ifdef _DEBUG
// Ask user what to do about FILE_ATTRIBUTE_READONLY
String strPath = path;
BOOL bApplyToAll = FALSE;
- if (GetMainFrame()->HandleReadonlySave(strPath, FALSE, bApplyToAll) == IDCANCEL)
+ if (theApp.HandleReadonlySave(strPath, FALSE, bApplyToAll) == IDCANCEL)
return S_OK;
path = strPath.c_str();
// Take a chance to create a backup
- if (!GetMainFrame()->CreateBackup(FALSE, path))
+ if (!theApp.CreateBackup(FALSE, path))
return S_OK;
// Write data to an intermediate file
String tempPath = env_GetTempPath();
// $Id$
#include "stdafx.h"
-#include "merge.h"
#include "LineFiltersList.h"
-#include "MainFrm.h"
+#include "Merge.h"
#include "LineFiltersDlg.h"
#ifdef _DEBUG
*/
void LineFiltersDlg::OnHelp()
{
- GetMainFrame()->ShowHelp(FilterHelpLocation);
+ theApp.ShowHelp(FilterHelpLocation);
}
/**
// $Id: LoadSaveCodepageDlg.cpp 5394 2008-05-29 09:47:36Z kimmov $
#include "stdafx.h"
+#include "LoadSaveCodepageDlg.h"
#include "Merge.h"
-#include "MainFrm.h"
#include "resource.h"
-#include "LoadSaveCodepageDlg.h"
#include "unicoder.h"
#include "ExConverter.h"
theApp.TranslateDialog(m_hWnd);
CDialog::OnInitDialog();
- CMainFrame::SetMainIcon(this);
-
// setup handler for resizing this dialog
m_constraint.InitializeCurrentSize(this);
// configure how individual controls adjust when dialog resizes
combo.Detach();
}
- CMainFrame::CenterToMainFrame(this);
+ AfxGetMainWnd()->CenterWindow(this);
SetDlgItemText(IDC_LEFT_FILES_LABEL, m_sAffectsLeftString);
SetDlgItemText(IDC_MIDDLE_FILES_LABEL, m_sAffectsMiddleString);
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
-#include "Merge.h"
-
-#include "ChildFrm.h"
#include "LocationBar.h"
+#include "Merge.h"
#ifdef _DEBUG
#undef THIS_FILE
// $Id: LocationView.cpp 7127 2010-03-10 21:03:58Z kimmov $
#include "StdAfx.h"
+#include "LocationView.h"
#include <vector>
#include "Merge.h"
#include "OptionsMgr.h"
#include "MergeEditView.h"
-#include "LocationView.h"
#include "MergeDoc.h"
#include "BCMenu.h"
#include "OptionsDef.h"
-#include "MergeLineFlags.h"
#include "Bitmap.h"
#include "memdc.h"
#include "SyntaxColors.h"
#include <vector>
#include <boost/scoped_ptr.hpp>
+class CMergeDoc;
+class CMergeEditView;
+
/**
* @brief Status for display moved block
*/
// $Id: MainFrm.cpp 7063 2009-12-27 15:28:16Z kimmov $
#include "StdAfx.h"
+#include "MainFrm.h"
#include <vector>
-#include <htmlhelp.h> // From HTMLHelp Workshop (incl. in Platform SDK)
#include <shlwapi.h>
+#include <Poco/Exception.h>
#include "Constants.h"
#include "Merge.h"
+#include "FileFilterHelper.h"
#include "UnicodeString.h"
#include "BCMenu.h"
-#include "MainFrm.h"
#include "OpenFrm.h"
#include "DirFrame.h" // Include type information
#include "ChildFrm.h"
#include "DirDoc.h"
#include "OpenDoc.h"
#include "OpenView.h"
+#include "MergeDoc.h"
#include "MergeEditView.h"
#include "HexMergeDoc.h"
-#include "LocationView.h"
-#include "SyntaxColors.h"
#include "LineFiltersList.h"
#include "ConflictFileParser.h"
#include "Splash.h"
#include "OptionsDef.h"
#include "codepage_detect.h"
#include "unicoder.h"
-#include "VSSHelper.h"
#include "codepage.h"
#include "PreferencesDlg.h"
#include "ProjectFilePathsDlg.h"
-#include "MergeCmdLineInfo.h"
#include "FileOrFolderSelect.h"
-#include "PropBackups.h"
#include "unicoder.h"
#include "PluginsListDlg.h"
#include "stringdiffs.h"
#include "MergeCmdLineInfo.h"
-#include "OptionsSyntaxColors.h"
#include "OptionsFont.h"
#include "TFile.h"
#include "JumpList.h"
#include "DragDrop.h"
-#include <Poco/Exception.h>
using std::vector;
/** @brief Timeout for window flashing timer, in milliseconds. */
static const UINT WINDOW_FLASH_TIMEOUT = 500;
-/** @brief Backup file extension. */
-static const TCHAR BACKUP_FILE_EXT[] = _T("bak");
-
/**
* @brief Return a const reference to a CMultiDocTemplate's list of documents.
*/
CMainFrame::CMainFrame()
: m_bFlashing(FALSE)
, m_bFirstTime(TRUE)
-, m_bEscShutdown(FALSE)
-, m_bClearCaseTool(FALSE)
-, m_bExitIfNoDiff(MergeCmdLineInfo::Disabled)
-, m_bShowErrors(TRUE)
-, m_CheckOutMulti(FALSE)
-, m_bVCProjSync(FALSE)
-, m_bVssSuppressPathCheck(FALSE)
-, m_pLineFilters(new LineFiltersList())
-, m_pSyntaxColors(new SyntaxColors())
{
ZeroMemory(&m_pMenus[0], sizeof(m_pMenus));
- UpdateCodepageModule();
-
- InitializeSourceControlMembers();
- g_bUnpackerMode = theApp.GetProfileInt(_T("Settings"), _T("UnpackerMode"), PLUGIN_MANUAL);
- g_bPredifferMode = theApp.GetProfileInt(_T("Settings"), _T("PredifferMode"), PLUGIN_MANUAL);
-
- if (m_pSyntaxColors)
- Options::SyntaxColors::Load(m_pSyntaxColors.get());
-
- if (m_pLineFilters)
- m_pLineFilters->Initialize(GetOptionsMgr());
-
- // If there are no filters loaded, and there is filter string in previous
- // option string, import old filters to new place.
- if (m_pLineFilters->GetCount() == 0)
- {
- String oldFilter = theApp.GetProfileString(_T("Settings"), _T("RegExps"));
- if (!oldFilter.empty())
- m_pLineFilters->Import(oldFilter);
- }
-
- // Check if filter folder is set, and create it if not
- String pathMyFolders = GetOptionsMgr()->GetString(OPT_FILTER_USERPATH);
- if (pathMyFolders.empty())
- {
- // No filter path, set it to default and make sure it exists.
- String pathFilters = theApp.GetDefaultFilterUserPath(TRUE);
- GetOptionsMgr()->SaveOption(OPT_FILTER_USERPATH, pathFilters);
- theApp.m_globalFileFilter.SetFileFilterPath(pathFilters.c_str());
- }
-
- sd_Init(); // String diff init
- sd_SetBreakChars(GetOptionsMgr()->GetString(OPT_BREAK_SEPARATORS).c_str());
}
CMainFrame::~CMainFrame()
void CMainFrame::OnHelpGnulicense()
{
const String spath = env_GetProgPath() + LicenseFile;
- OpenFileOrUrl(spath.c_str(), LicenceUrl);
-}
-
-/**
- * @brief Checks if path (file/folder) is read-only and asks overwriting it.
- *
- * @param strSavePath [in,out] Path where to save (file or folder)
- * @param bMultiFile [in] Single file or multiple files/folder
- * @param bApplyToAll [in,out] Apply last user selection for all items?
- * @return Users selection:
- * - IDOK: Item was not readonly, no actions
- * - IDYES/IDYESTOALL: Overwrite readonly item
- * - IDNO: User selected new filename (single file) or user wants to skip
- * - IDCANCEL: Cancel operation
- * @sa CMainFrame::SyncFileToVCS()
- * @sa CMergeDoc::DoSave()
- */
-int CMainFrame::HandleReadonlySave(String& strSavePath, BOOL bMultiFile,
- BOOL &bApplyToAll)
-{
- CFileStatus status;
- UINT userChoice = 0;
- int nRetVal = IDOK;
- BOOL bFileRO = FALSE;
- BOOL bFileExists = FALSE;
- String s;
- String str;
- CString title;
- int nVerSys = 0;
-
- try
- {
- TFile file(strSavePath);
- bFileExists = file.exists();
- if (bFileExists)
- bFileRO = !file.canWrite();
- }
- catch (...)
- {
- }
- nVerSys = GetOptionsMgr()->GetInt(OPT_VCS_SYSTEM);
-
- if (bFileExists && bFileRO)
- {
- // Version control system used?
- // Checkout file from VCS and modify, don't ask about overwriting
- // RO files etc.
- if (nVerSys != VCS_NONE)
- {
- BOOL bRetVal = SaveToVersionControl(strSavePath);
- if (bRetVal)
- return IDYES;
- else
- return IDCANCEL;
- }
-
- // Don't ask again if its already asked
- if (bApplyToAll)
- userChoice = IDYES;
- else
- {
- // Prompt for user choice
- if (bMultiFile)
- {
- // Multiple files or folder
- str = LangFormatString1(IDS_SAVEREADONLY_MULTI, strSavePath.c_str());
- userChoice = AfxMessageBox(str.c_str(), MB_YESNOCANCEL |
- MB_ICONWARNING | MB_DEFBUTTON3 | MB_DONT_ASK_AGAIN |
- MB_YES_TO_ALL, IDS_SAVEREADONLY_MULTI);
- }
- else
- {
- // Single file
- str = LangFormatString1(IDS_SAVEREADONLY_FMT, strSavePath.c_str());
- userChoice = AfxMessageBox(str.c_str(), MB_YESNOCANCEL |
- MB_ICONWARNING | MB_DEFBUTTON2 | MB_DONT_ASK_AGAIN,
- IDS_SAVEREADONLY_FMT);
- }
- }
- switch (userChoice)
- {
- // Overwrite read-only file
- case IDYESTOALL:
- bApplyToAll = TRUE; // Don't ask again (no break here)
- case IDYES:
- CFile::GetStatus(strSavePath.c_str(), status);
- status.m_mtime = 0; // Avoid unwanted changes
- status.m_attribute &= ~CFile::readOnly;
- CFile::SetStatus(strSavePath.c_str(), status);
- nRetVal = IDYES;
- break;
-
- // Save to new filename (single) /skip this item (multiple)
- case IDNO:
- if (!bMultiFile)
- {
- if (SelectFile(GetSafeHwnd(), s, strSavePath.c_str(), IDS_SAVE_AS_TITLE, NULL, FALSE))
- {
- strSavePath = s;
- nRetVal = IDNO;
- }
- else
- nRetVal = IDCANCEL;
- }
- else
- nRetVal = IDNO;
- break;
-
- // Cancel saving
- case IDCANCEL:
- nRetVal = IDCANCEL;
- break;
- }
- }
- return nRetVal;
+ theApp.OpenFileOrUrl(spath.c_str(), LicenceUrl);
}
/// Wrapper to set the global option 'm_bAllowMixedEol'
void CMainFrame::OnOptions()
{
// Using singleton shared syntax colors
- CPreferencesDlg dlg(GetOptionsMgr(), m_pSyntaxColors.get());
+ CPreferencesDlg dlg(GetOptionsMgr(), theApp.GetMainSyntaxColors());
int rv = dlg.DoModal();
if (rv == IDOK)
{
// Set new filterpath
String filterPath = GetOptionsMgr()->GetString(OPT_FILTER_USERPATH);
- theApp.m_globalFileFilter.SetUserFilterPath(filterPath);
+ theApp.m_pGlobalFileFilter->SetUserFilterPath(filterPath);
- UpdateCodepageModule();
+ theApp.UpdateCodepageModule();
// Call the wrapper to set m_bAllowMixedEol (the wrapper updates the registry)
SetEOLMixed(GetOptionsMgr()->GetBool(OPT_ALLOW_MIXED_EOL));
// exception. There is no point in checking return value.
pDirDoc->InitCompare(files, bRecurse, pTempPathContext);
- pDirDoc->SetDescriptions(m_strDescriptions);
+ pDirDoc->SetDescriptions(theApp.m_strDescriptions);
pDirDoc->SetTitle(NULL);
for (int nIndex = 0; nIndex < files.GetSize(); nIndex++)
{
pDirDoc->SetReadOnly(nIndex, bRO[nIndex]);
- m_strDescriptions[nIndex].erase();
+ theApp.m_strDescriptions[nIndex].erase();
}
pDirDoc->Rescan();
return TRUE;
}
-/**
- * @brief Creates backup before file is saved or copied over.
- * This function handles formatting correct path and filename for
- * backup file. Formatting is done based on several options available
- * for users in Options/Backups dialog. After path is formatted, file
- * is simply just copied. Not much error checking, just if copying
- * succeeded or failed.
- * @param [in] bFolder Are we creating backup in folder compare?
- * @param [in] pszPath Full path to file to backup.
- * @return TRUE if backup succeeds, or isn't just done.
- */
-BOOL CMainFrame::CreateBackup(BOOL bFolder, const String& pszPath)
-{
- // If user doesn't want to backups in folder compare, return
- // success so operations don't abort.
- if (bFolder && !(GetOptionsMgr()->GetBool(OPT_BACKUP_FOLDERCMP)))
- return TRUE;
- // Likewise if user doesn't want backups in file compare
- else if (!bFolder && !(GetOptionsMgr()->GetBool(OPT_BACKUP_FILECMP)))
- return TRUE;
-
- // create backup copy of file if destination file exists
- if (paths_DoesPathExist(pszPath) == IS_EXISTING_FILE)
- {
- String bakPath;
- String path;
- String filename;
- String ext;
-
- paths_SplitFilename(pszPath, &path, &filename, &ext);
-
- // Determine backup folder
- if (GetOptionsMgr()->GetInt(OPT_BACKUP_LOCATION) ==
- PropBackups::FOLDER_ORIGINAL)
- {
- // Put backups to same folder than original file
- bakPath = path;
- }
- else if (GetOptionsMgr()->GetInt(OPT_BACKUP_LOCATION) ==
- PropBackups::FOLDER_GLOBAL)
- {
- // Put backups to global folder defined in options
- bakPath = GetOptionsMgr()->GetString(OPT_BACKUP_GLOBALFOLDER);
- if (bakPath.empty())
- bakPath = path;
- else
- bakPath = paths_GetLongPath(bakPath);
- }
- else
- {
- _RPTF0(_CRT_ERROR, "Unknown backup location!");
- }
-
- BOOL success = FALSE;
- if (GetOptionsMgr()->GetBool(OPT_BACKUP_ADD_BAK))
- {
- // Don't add dot if there is no existing extension
- if (ext.size() > 0)
- ext += _T(".");
- ext += BACKUP_FILE_EXT;
- }
-
- // Append time to filename if wanted so
- // NOTE just adds timestamp at the moment as I couldn't figure out
- // nice way to add a real time (invalid chars etc).
- if (GetOptionsMgr()->GetBool(OPT_BACKUP_ADD_TIME))
- {
- struct tm *tm;
- time_t curtime = 0;
- time(&curtime);
- tm = localtime(&curtime);
- CString timestr;
- timestr.Format(_T("%04d%02d%02d%02d%02d%02d"), tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec);
- filename += _T("-");
- filename += timestr;
- }
-
- // Append filename and extension (+ optional .bak) to path
- if ((bakPath.length() + filename.length() + ext.length())
- < MAX_PATH)
- {
- success = TRUE;
- if (!paths_EndsWithSlash(bakPath))
- bakPath += _T("\\");
- bakPath = paths_ConcatPath(bakPath, filename);
- bakPath += _T(".");
- bakPath += ext;
- }
-
- if (success)
- success = CopyFile(pszPath.c_str(), bakPath.c_str(), FALSE);
-
- if (!success)
- {
- if (ResMsgBox1(IDS_BACKUP_FAILED_PROMPT, pszPath.c_str(),
- MB_YESNO | MB_ICONWARNING | MB_DONT_ASK_AGAIN,
- IDS_BACKUP_FAILED_PROMPT) != IDYES)
- return FALSE;
- }
- return TRUE;
- }
-
- // we got here because we're either not backing up of there was nothing to backup
- return TRUE;
-}
-
-/**
- * @brief Sync file to Version Control System
- * @param pszDest [in] Where to copy (incl. filename)
- * @param bApplyToAll [in,out] Apply user selection to all items
- * @param psError [out] Error string that can be shown to user in caller func
- * @return User selection or -1 if error happened
- * @sa CMainFrame::HandleReadonlySave()
- * @sa CDirView::PerformActionList()
- */
-int CMainFrame::SyncFileToVCS(const String& pszDest, BOOL &bApplyToAll,
- String& sError)
-{
- String sActionError;
- String strSavePath(pszDest);
- int nVerSys = 0;
-
- nVerSys = GetOptionsMgr()->GetInt(OPT_VCS_SYSTEM);
-
- int nRetVal = HandleReadonlySave(strSavePath, TRUE, bApplyToAll);
- if (nRetVal == IDCANCEL || nRetVal == IDNO)
- return nRetVal;
-
- // If VC project opened from VSS sync and version control used
- if ((nVerSys == VCS_VSS4 || nVerSys == VCS_VSS5) && m_bVCProjSync)
- {
- if (!m_vssHelper.ReLinkVCProj(strSavePath, sError))
- nRetVal = -1;
- }
- return nRetVal;
-}
-
void CMainFrame::UpdateFont(FRAMETYPE frame)
{
if (frame == FRAME_FOLDER)
}
/**
- * @brief Open file, if it exists, else open url
- */
-void CMainFrame::OpenFileOrUrl(LPCTSTR szFile, LPCTSTR szUrl)
-{
- if (paths_DoesPathExist(szFile) == IS_EXISTING_FILE)
- ShellExecute(m_hWnd, _T("open"), _T("notepad.exe"), szFile, NULL, SW_SHOWNORMAL);
- else
- ShellExecute(NULL, _T("open"), szUrl, NULL, NULL, SW_SHOWNORMAL);
-}
-
-/**
* @brief Open WinMerge help.
*
* If local HTMLhelp file is found, open it, otherwise open HTML page from web.
*/
void CMainFrame::OnHelpContents()
{
- String sPath = env_GetProgPath();
- LANGID LangId = theApp.GetLangId();
- if (PRIMARYLANGID(LangId) == LANG_JAPANESE)
- sPath += DocsPath_ja;
- else
- sPath += DocsPath;
- if (paths_DoesPathExist(sPath) == IS_EXISTING_FILE)
- ::HtmlHelp(NULL, sPath.c_str(), HH_DISPLAY_TOC, NULL);
- else
- ShellExecute(NULL, _T("open"), DocsURL, NULL, NULL, SW_SHOWNORMAL);
+ theApp.ShowHelp();
}
/**
}
// Save last selected filter
- String filter = theApp.m_globalFileFilter.GetFilterNameOrMask();
+ String filter = theApp.m_pGlobalFileFilter->GetFilterNameOrMask();
GetOptionsMgr()->SaveOption(OPT_FILEFILTER_CURRENT, filter);
// save main window position
{
if (patcher.GetOpenToEditor())
{
- OpenFileToExternalEditor(patcher.GetPatchFile().c_str());
+ theApp.OpenFileToExternalEditor(patcher.GetPatchFile().c_str());
}
}
}
}
/**
- * @brief Open given file to external editor specified in options.
- * @param [in] file Full path to file to open.
- *
- * Opens file to defined (in Options/system), Notepad by default,
- * external editor. Path is decorated with quotation marks if needed
- * (contains spaces). Also '$file' in editor path is replaced by
- * filename to open.
- * @param [in] file Full path to file to open.
- * @param [in] nLineNumber Line number to go to.
- */
-void CMainFrame::OpenFileToExternalEditor(const String& file, int nLineNumber/* = 1*/)
-{
- String sCmd = GetOptionsMgr()->GetString(OPT_EXT_EDITOR_CMD);
- String sFile(file);
- string_replace(sCmd, _T("$linenum"), string_format(_T("%d"), nLineNumber));
-
- int nIndex = sCmd.find(_T("$file"));
- if (nIndex > -1)
- {
- sFile.insert(0, _T("\""));
- string_replace(sCmd, _T("$file"), sFile);
- nIndex = sCmd.find(' ', nIndex + sFile.length());
- if (nIndex > -1)
- sCmd.insert(nIndex, _T("\""));
- else
- sCmd += '"';
- }
- else
- {
- sCmd += _T(" \"");
- sCmd += sFile;
- sCmd += _T("\"");
- }
-
- BOOL retVal = FALSE;
- STARTUPINFO stInfo = {0};
- stInfo.cb = sizeof(STARTUPINFO);
- PROCESS_INFORMATION processInfo;
-
- retVal = CreateProcess(NULL, (LPTSTR)sCmd.c_str(),
- NULL, NULL, FALSE, CREATE_DEFAULT_ERROR_MODE, NULL, NULL,
- &stInfo, &processInfo);
-
- if (!retVal)
- {
- // Error invoking external editor
- ResMsgBox1(IDS_ERROR_EXECUTE_FILE, sCmd.c_str(), MB_ICONSTOP);
- }
- else
- {
- CloseHandle(processInfo.hThread);
- CloseHandle(processInfo.hProcess);
- }
-}
-
-/**
* @brief Save WinMerge configuration and info to file
*/
void CMainFrame::OnSaveConfigData()
if (configLog.WriteLogFile(sError))
{
String sFileName = configLog.GetFileName();
- OpenFileToExternalEditor(sFileName);
+ theApp.OpenFileToExternalEditor(sFileName);
}
else
{
FileLocation fileloc[3];
if (nPanes == 2)
{
- m_strDescriptions[0] = theApp.LoadString(IDS_EMPTY_LEFT_FILE);
- m_strDescriptions[1] = theApp.LoadString(IDS_EMPTY_RIGHT_FILE);
+ theApp.m_strDescriptions[0] = theApp.LoadString(IDS_EMPTY_LEFT_FILE);
+ theApp.m_strDescriptions[1] = theApp.LoadString(IDS_EMPTY_RIGHT_FILE);
fileloc[0].encoding.SetCodepage(ucr::getDefaultCodepage());
fileloc[1].encoding.SetCodepage(ucr::getDefaultCodepage());
ShowMergeDoc(pDirDoc, 2, fileloc, dwFlags);
}
else
{
- m_strDescriptions[0] = theApp.LoadString(IDS_EMPTY_LEFT_FILE);
- m_strDescriptions[1] = theApp.LoadString(IDS_EMPTY_MIDDLE_FILE);
- m_strDescriptions[2] = theApp.LoadString(IDS_EMPTY_RIGHT_FILE);
+ theApp.m_strDescriptions[0] = theApp.LoadString(IDS_EMPTY_LEFT_FILE);
+ theApp.m_strDescriptions[1] = theApp.LoadString(IDS_EMPTY_MIDDLE_FILE);
+ theApp.m_strDescriptions[2] = theApp.LoadString(IDS_EMPTY_RIGHT_FILE);
fileloc[0].encoding.SetCodepage(ucr::getDefaultCodepage());
fileloc[1].encoding.SetCodepage(ucr::getDefaultCodepage());
fileloc[2].encoding.SetCodepage(ucr::getDefaultCodepage());
}
// Empty descriptors now that docs are open
- m_strDescriptions[0].erase();
- m_strDescriptions[1].erase();
- m_strDescriptions[2].erase();
+ theApp.m_strDescriptions[0].erase();
+ theApp.m_strDescriptions[1].erase();
+ theApp.m_strDescriptions[2].erase();
}
/**
vector<FileFilterInfo> fileFilters;
boost::scoped_ptr<LineFiltersList> lineFilters(new LineFiltersList());
String selectedFilter;
- const String origFilter = theApp.m_globalFileFilter.GetFilterNameOrMask();
+ const String origFilter = theApp.m_pGlobalFileFilter->GetFilterNameOrMask();
sht.AddPage(&fileFiltersDlg);
sht.AddPage(&lineFiltersDlg);
sht.m_psh.dwFlags |= PSH_NOAPPLYNOW; // Hide 'Apply' button since we don't need it
// Make sure all filters are up-to-date
- theApp.m_globalFileFilter.ReloadUpdatedFilters();
+ theApp.m_pGlobalFileFilter->ReloadUpdatedFilters();
- theApp.m_globalFileFilter.GetFileFilters(&fileFilters, selectedFilter);
+ theApp.m_pGlobalFileFilter->GetFileFilters(&fileFilters, selectedFilter);
fileFiltersDlg.SetFilterArray(&fileFilters);
fileFiltersDlg.SetSelected(selectedFilter);
const BOOL lineFiltersEnabledOrig = GetOptionsMgr()->GetBool(OPT_LINEFILTER_ENABLED);
lineFiltersDlg.m_bIgnoreRegExp = lineFiltersEnabledOrig;
- lineFilters->CloneFrom(m_pLineFilters.get());
+ lineFilters->CloneFrom(theApp.m_pLineFilters.get());
lineFiltersDlg.SetList(lineFilters.get());
if (sht.DoModal() == IDOK)
if (path.find(strNone) != String::npos)
{
// Don't overwrite mask we already have
- if (!theApp.m_globalFileFilter.IsUsingMask())
+ if (!theApp.m_pGlobalFileFilter->IsUsingMask())
{
String sFilter(_T("*.*"));
- theApp.m_globalFileFilter.SetFilter(sFilter);
+ theApp.m_pGlobalFileFilter->SetFilter(sFilter);
GetOptionsMgr()->SaveOption(OPT_FILEFILTER_CURRENT, sFilter);
}
}
else
{
- theApp.m_globalFileFilter.SetFileFilterPath(path);
- theApp.m_globalFileFilter.UseMask(FALSE);
- String sFilter = theApp.m_globalFileFilter.GetFilterNameOrMask();
+ theApp.m_pGlobalFileFilter->SetFileFilterPath(path);
+ theApp.m_pGlobalFileFilter->UseMask(FALSE);
+ String sFilter = theApp.m_pGlobalFileFilter->GetFilterNameOrMask();
GetOptionsMgr()->SaveOption(OPT_FILEFILTER_CURRENT, sFilter);
}
BOOL linefiltersEnabled = lineFiltersDlg.m_bIgnoreRegExp;
if (frame == FRAME_FILE)
{
if (lineFiltersEnabledOrig != linefiltersEnabled ||
- !m_pLineFilters->Compare(lineFilters.get()))
+ !theApp.m_pLineFilters->Compare(lineFilters.get()))
{
bFileCompareRescan = TRUE;
}
}
else if (frame == FRAME_FOLDER)
{
- const String newFilter = theApp.m_globalFileFilter.GetFilterNameOrMask();
+ const String newFilter = theApp.m_pGlobalFileFilter->GetFilterNameOrMask();
if (lineFiltersEnabledOrig != linefiltersEnabled ||
- !m_pLineFilters->Compare(lineFilters.get()) || origFilter != newFilter)
+ !theApp.m_pLineFilters->Compare(lineFilters.get()) || origFilter != newFilter)
{
int res = LangMessageBox(IDS_FILTERCHANGED, MB_ICONWARNING | MB_YESNO);
if (res == IDYES)
}
// Save new filters before (possibly) rescanning
- m_pLineFilters->CloneFrom(lineFilters.get());
- m_pLineFilters->SaveFilters();
+ theApp.m_pLineFilters->CloneFrom(lineFilters.get());
+ theApp.m_pLineFilters->SaveFilters();
if (bFileCompareRescan)
{
const HexMergeDocList &hexDocs = GetAllHexMergeDocs();
const DirDocList &dirDocs = GetAllDirDocs();
- if (m_bEscShutdown)
+ if (theApp.m_bEscShutdown)
{
if (openDocs.GetCount() + hexDocs.GetCount() + dirDocs.GetCount() <= 1)
{
}
/**
- * @brief Shows VSS error from exception and writes log.
- */
-void CMainFrame::ShowVSSError(CException *e, const String& strItem)
-{
- TCHAR errStr[1024] = {0};
- if (e->GetErrorMessage(errStr, 1024))
- {
- String errMsg = theApp.LoadString(IDS_VSS_ERRORFROM);
- String logMsg = errMsg;
- errMsg += _T("\n");
- errMsg += errStr;
- logMsg += _T(" ");
- logMsg += errStr;
- if (!strItem.empty())
- {
- errMsg += _T("\n\n");
- errMsg += strItem;
- logMsg += _T(": ");
- logMsg += strItem;
- }
- LogErrorString(logMsg);
- AfxMessageBox(errMsg.c_str(), MB_ICONSTOP);
- }
- else
- {
- LogErrorString(_T("VSSError (unable to GetErrorMessage)"));
- e->ReportError(MB_ICONSTOP, IDS_VSS_RUN_ERROR);
- }
-}
-
-/**
- * @brief Show Help - this is for opening help from outside mainframe.
- * @param [in] helpLocation Location inside help, if NULL main help is opened.
- */
-void CMainFrame::ShowHelp(LPCTSTR helpLocation /*= NULL*/)
-{
- if (helpLocation == NULL)
- {
- OnHelpContents();
- }
- else
- {
- String sPath = env_GetProgPath();
- LANGID LangId = GetUserDefaultLangID();
- if (PRIMARYLANGID(LangId) == LANG_JAPANESE)
- sPath += DocsPath_ja;
- else
- sPath += DocsPath;
- if (paths_DoesPathExist(sPath) == IS_EXISTING_FILE)
- {
- sPath += helpLocation;
- ::HtmlHelp(NULL, sPath.c_str(), HH_DISPLAY_TOPIC, NULL);
- }
- }
-}
-
-/**
* @brief Tell user why archive support is not available.
*/
void CMainFrame::OnHelpMerge7zmismatch()
}
/**
- * @brief Send current option settings into codepage module
- */
-void CMainFrame::UpdateCodepageModule()
-{
- // Get current codepage settings from the options module
- // and push them into the codepage module
- theApp.UpdateDefaultCodepage(GetOptionsMgr()->GetInt(OPT_CP_DEFAULT_MODE), GetOptionsMgr()->GetInt(OPT_CP_DEFAULT_CUSTOM));
-}
-
-/**
* @brief Handle timer events.
* @param [in] nIDEvent Timer that timed out.
*/
return pMainframe;
}
-/**
- * @brief Access to the singleton set of syntax colors
- */
-SyntaxColors * GetMainSyntaxColors()
-{
- return GetMainFrame()->GetMainSyntaxColors();
-}
-
-/**
- * @brief Move dialog to center of MainFrame
- */
-void CMainFrame::CenterToMainFrame(CDialog * dlg)
-{
- CRect rectFrame;
- CRect rectBar;
- AfxGetMainWnd()->GetWindowRect(&rectFrame);
- dlg->GetClientRect(&rectBar);
- // Middlepoint of MainFrame
- int x = rectFrame.left + (rectFrame.right - rectFrame.left) / 2;
- int y = rectFrame.top + (rectFrame.bottom - rectFrame.top) / 2;
- // Reduce by half of dialog's size
- x -= rectBar.right / 2;
- y -= rectBar.bottom / 2;
-
- // This refreshes dialog size after m_constraint rezizing dialog so we get
- // correct dialog positioning
- dlg->CenterWindow();
-
- // Calculate real desktop coordinates (if we have multiple monitors or
- // virtual desktops
- CRect dsk_rc;
- dsk_rc.left = ::GetSystemMetrics(SM_XVIRTUALSCREEN);
- dsk_rc.top = ::GetSystemMetrics(SM_YVIRTUALSCREEN);
- dsk_rc.right = dsk_rc.left + ::GetSystemMetrics(SM_CXVIRTUALSCREEN);
- dsk_rc.bottom = dsk_rc.top + ::GetSystemMetrics(SM_CYVIRTUALSCREEN);
-
- // Only move Open-dialog if its fully visible in new position
- CPoint ptLeftTop(x, y);
- CPoint ptRightBottom(x + rectBar.right, y + rectBar.bottom);
- if (dsk_rc.PtInRect(ptLeftTop) && dsk_rc.PtInRect(ptRightBottom))
- {
- dlg->SetWindowPos(&CWnd::wndTop, x, y, rectBar.right,
- rectBar.bottom, SWP_NOOWNERZORDER | SWP_NOSIZE );
- }
-}
-
-/**
- * @brief Assign the main WinMerge 16x16 icon to dialog
- */
-void CMainFrame::SetMainIcon(CDialog * dlg)
-{
- // Note: LoadImage gets shared icon, don't need to destroy
- HICON hMergeIcon = (HICON) LoadImage(AfxGetInstanceHandle(),
- MAKEINTRESOURCE(IDR_MAINFRAME), IMAGE_ICON, 16, 16,
- LR_DEFAULTSIZE | LR_SHARED);
- dlg->SetIcon(hMergeIcon, TRUE);
-}
-
/**
* @brief Opens dialog for user to Load, edit and save project files.
* This dialog gets current compare paths and filter (+other properties
pathsDlg.m_bRightPathReadOnly = pDoc->GetReadOnly(pDoc->m_nDirs - 1);
}
- String filterNameOrMask = theApp.m_globalFileFilter.GetFilterNameOrMask();
+ String filterNameOrMask = theApp.m_pGlobalFileFilter->GetFilterNameOrMask();
pathsDlg.m_sFilter = filterNameOrMask.c_str();
sht.DoModal();
}
{
// Open two parsed files to WinMerge, telling WinMerge to
// save over original file (given as third filename).
- m_strSaveAsPath = conflictFile.c_str();
+ theApp.m_strSaveAsPath = conflictFile.c_str();
String theirs = LoadResString(IDS_CONFLICT_THEIRS_FILE);
String my = LoadResString(IDS_CONFLICT_MINE_FILE);
- m_strDescriptions[0] = theirs;
- m_strDescriptions[1] = my;
+ theApp.m_strDescriptions[0] = theirs;
+ theApp.m_strDescriptions[1] = my;
DWORD dwFlags[2] = {FFILEOPEN_READONLY | FFILEOPEN_NOMRU, FFILEOPEN_NOMRU | FFILEOPEN_MODIFIED};
conflictCompared = DoFileOpen(&PathContext(revFile, workFile),
* @param [in] pFrame Pointer to frame to check.
* @return FRAMETYPE of the given frame.
*/
-FRAMETYPE CMainFrame::GetFrameType(const CFrameWnd * pFrame) const
+CMainFrame::FRAMETYPE CMainFrame::GetFrameType(const CFrameWnd * pFrame) const
{
BOOL bMergeFrame = pFrame->IsKindOf(RUNTIME_CLASS(CChildFrame));
BOOL bDirFrame = pFrame->IsKindOf(RUNTIME_CLASS(CDirFrame));
#include <boost/shared_ptr.hpp>
#include "ToolBarXPThemes.h"
#include "MDITabBar.h"
-#include "OptionsMgr.h"
-#include "VSSHelper.h"
#include "PathContext.h"
-#include "MergeCmdLineInfo.h"
-
-/**
- * @brief Supported versioncontrol systems.
- */
-enum
-{
- VCS_NONE = 0,
- VCS_VSS4,
- VCS_VSS5,
- VCS_CLEARCASE,
-};
-
-/**
- * @brief Frame/View/Document types.
- */
-enum FRAMETYPE
-{
- FRAME_FOLDER, /**< Folder compare frame. */
- FRAME_FILE, /**< File compare frame. */
- FRAME_OTHER, /**< No frame? */
-};
-
-enum { WM_NONINTERACTIVE = 888 }; // timer value
class BCMenu;
class CDiffView;
friend CLanguageSelect;
DECLARE_DYNAMIC(CMainFrame)
public:
+ /**
+ * @brief Frame/View/Document types.
+ */
+ enum FRAMETYPE
+ {
+ FRAME_FOLDER, /**< Folder compare frame. */
+ FRAME_FILE, /**< File compare frame. */
+ FRAME_OTHER, /**< No frame? */
+ };
+
+ enum { WM_NONINTERACTIVE = 888 }; // timer value
+
CMainFrame();
// Attributes
HMENU GetPrediffersSubmenu(HMENU mainMenu);
void UpdatePrediffersMenu();
- BOOL SyncFileToVCS(const String& pszDest, BOOL &bApplyToAll, String& psError);
BOOL DoFileOpen(PathContext *pFiles = NULL,
DWORD dwFlags[] = NULL, bool bRecurse = false, CDirDoc *pDirDoc = NULL, String prediffer = _T(""), PackingInfo * infoUnpacker = NULL);
int ShowMergeDoc(CDirDoc * pDirDoc, int nFiles, const FileLocation fileloc[],
void ShowHexMergeDoc(CDirDoc * pDirDoc,
const PathContext &paths, bool bRO[]);
void UpdateResources();
- BOOL CreateBackup(BOOL bFolder, const String& pszPath);
- int HandleReadonlySave(String& strSavePath, BOOL bMultiFile, BOOL &bApplyToAll);
CString SetStatus(LPCTSTR status);
void ClearStatusbarItemCount();
void ApplyViewWhitespace();
void SetEOLMixed(BOOL bAllow);
void SelectFilter();
- void ShowVSSError(CException *e, const String& strItem);
- void ShowHelp(LPCTSTR helpLocation = NULL);
- void UpdateCodepageModule();
- void CheckinToClearCase(const String& strDestinationPath);
- static void CenterToMainFrame(CDialog * dlg);
- static void SetMainIcon(CDialog * dlg);
void StartFlashing();
bool AskCloseConfirmation();
BOOL DoOpenConflict(const String& conflictFile, bool checked = false);
FRAMETYPE GetFrameType(const CFrameWnd * pFrame) const;
- static void OpenFileToExternalEditor(const String& file, int nLineNumber = 1);
-
// Overrides
virtual void GetMessageString(UINT nID, CString& rMessage) const;
// ClassWizard generated virtual function overrides
// Implementation methods
protected:
virtual ~CMainFrame();
-// Implementation in SourceControl.cpp
- void InitializeSourceControlMembers();
- BOOL SaveToVersionControl(const String& strSavePath);
-// End SourceControl.cpp
-
// Public implementation data
public:
BOOL m_bFirstTime; /**< If first time frame activated, get pos from reg */
- CString m_strSaveAsPath; /**< "3rd path" where output saved if given */
- BOOL m_bEscShutdown; /**< If commandline switch -e given ESC closes appliction */
- VSSHelper m_vssHelper; /**< Helper class for VSS integration */
- SyntaxColors * GetMainSyntaxColors() { return m_pSyntaxColors.get(); }
- BOOL m_bClearCaseTool; /**< WinMerge is executed as an external Rational ClearCase compare/merge tool. */
BOOL m_bFlashing; /**< Window is flashing. */
- MergeCmdLineInfo::ExitNoDiff m_bExitIfNoDiff; /**< Exit if files are identical? */
- boost::scoped_ptr<LineFiltersList> m_pLineFilters; /**< List of linefilters */
-
- /**
- * @name Version Control System (VCS) integration.
- */
- /*@{*/
-protected:
- CString m_strVssUser; /**< Visual Source Safe User ID */
- CString m_strVssPassword; /**< Visual Source Safe Password */
- CString m_strVssDatabase; /**< Visual Source Safe database */
- CString m_strCCComment; /**< ClearCase comment */
-public:
- BOOL m_bCheckinVCS; /**< TRUE if files should be checked in after checkout */
- BOOL m_CheckOutMulti; /**< Suppresses VSS int. code asking checkout for every file */
- BOOL m_bVCProjSync; /**< VC project opened from VSS sync? */
- BOOL m_bVssSuppressPathCheck; /**< Suppresses VSS int code asking about different path */
- /*@}*/
-
- /**
- * @name Textual labels/descriptors
- * These descriptors overwrite dir/filename usually shown in headerbar
- * and can be given from command-line. For example version control
- * system can set these to "WinMerge v2.1.2.0" and "WinMerge 2.1.4.0"
- * which is more pleasant and informative than temporary paths.
- */
- /*@{*/
- String m_strDescriptions[3];
- /*@}*/
/** @brief Possible toolbar image sizes. */
enum TOOLBAR_SIZE
static const MENUITEM_ICON m_MenuIcons[];
boost::scoped_ptr<BCMenu> m_pMenus[MENU_COUNT]; /**< Menus for different views */
- boost::scoped_ptr<SyntaxColors> m_pSyntaxColors; /**< Syntax color container */
std::vector<TempFilePtr> m_tempFiles; /**< List of possibly needed temp files. */
// Generated message map functions
CHexMergeDoc * GetHexMergeDocToShow(int nDirs, CDirDoc * pDirDoc, BOOL * pNew);
CDirDoc * GetDirDocToShow(int nDirs, BOOL * pNew);
void UpdateFont(FRAMETYPE frame);
- void OpenFileOrUrl(LPCTSTR szFile, LPCTSTR szUrl);
BOOL CreateToobar();
CMergeEditView * GetActiveMergeEditView();
void LoadToolbarImages();
};
CMainFrame * GetMainFrame(); // access to the singleton main frame object
-SyntaxColors * GetMainSyntaxColors(); // access to the singleton set of syntax colors
/////////////////////////////////////////////////////////////////////////////
// $Id: Merge.cpp 6861 2009-06-25 12:11:07Z kimmov $
#include "stdafx.h"
+#include "Merge.h"
#include "Constants.h"
#include "UnicodeString.h"
#include "unicoder.h"
#include "Environment.h"
#include "OptionsMgr.h"
-#include "Merge.h"
+#include "RegOptionsMgr.h"
#include "OpenDoc.h"
#include "OpenFrm.h"
#include "OpenView.h"
#include "DirDoc.h"
#include "DirView.h"
#include "Splash.h"
+#include "PropBackups.h"
+#include "FileOrFolderSelect.h"
#include "paths.h"
#include "FileFilterHelper.h"
+#include "LineFiltersList.h"
+#include "SyntaxColors.h"
+#include "OptionsSyntaxColors.h"
#include "Plugins.h"
#include "ProjectFile.h"
#include "MergeEditView.h"
#include "ConflictFileParser.h"
#include "codepage.h"
#include "JumpList.h"
+#include "stringdiffs.h"
+#include "TFile.h"
+#include "VSSHelper.h"
// For shutdown cleanup
#include "charsets.h"
// registry dir to WinMerge
static String f_RegDir = _T("Software\\Thingamahoochie\\WinMerge");
+/** @brief Backup file extension. */
+static const TCHAR BACKUP_FILE_EXT[] = _T("bak");
+
#ifndef WIN64
/**
* @brief Turn STL exceptions into MFC exceptions.
, m_nLastCompareResult(0)
, m_bNonInteractive(false)
, m_pOptions(new CRegOptionsMgr())
+, m_pGlobalFileFilter(new FileFilterHelper())
, m_nActiveOperations(0)
, m_pLangDlg(new CLanguageSelect(IDR_MAINFRAME, IDR_MAINFRAME))
+, m_bEscShutdown(FALSE)
+, m_bClearCaseTool(FALSE)
+, m_bExitIfNoDiff(MergeCmdLineInfo::Disabled)
+, m_pLineFilters(new LineFiltersList())
+, m_pSyntaxColors(new SyntaxColors())
+, m_pVssHelper(new VSSHelper())
+, m_CheckOutMulti(FALSE)
+, m_bVCProjSync(FALSE)
+, m_bVssSuppressPathCheck(FALSE)
{
// add construction code here,
// Place all significant initialization in InitInstance
CMergeApp::~CMergeApp()
{
+ sd_Close();
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CMergeApp object
// Read last used filter from registry
// If filter fails to set, reset to default
const String filterString = m_pOptions->GetString(OPT_FILEFILTER_CURRENT);
- BOOL bFilterSet = theApp.m_globalFileFilter.SetFilter(filterString.c_str());
+ BOOL bFilterSet = m_pGlobalFileFilter->SetFilter(filterString.c_str());
if (!bFilterSet)
{
- String filter = theApp.m_globalFileFilter.GetFilterNameOrMask();
+ String filter = m_pGlobalFileFilter->GetFilterNameOrMask();
m_pOptions->SaveOption(OPT_FILEFILTER_CURRENT, filter);
}
+ UpdateCodepageModule();
+
+ InitializeSourceControlMembers();
+ g_bUnpackerMode = theApp.GetProfileInt(_T("Settings"), _T("UnpackerMode"), PLUGIN_MANUAL);
+ g_bPredifferMode = theApp.GetProfileInt(_T("Settings"), _T("PredifferMode"), PLUGIN_MANUAL);
+
+ if (m_pSyntaxColors)
+ Options::SyntaxColors::Load(m_pSyntaxColors.get());
+
+ if (m_pLineFilters)
+ m_pLineFilters->Initialize(GetOptionsMgr());
+
+ // If there are no filters loaded, and there is filter string in previous
+ // option string, import old filters to new place.
+ if (m_pLineFilters->GetCount() == 0)
+ {
+ String oldFilter = theApp.GetProfileString(_T("Settings"), _T("RegExps"));
+ if (!oldFilter.empty())
+ m_pLineFilters->Import(oldFilter);
+ }
+
+ // Check if filter folder is set, and create it if not
+ String pathMyFolders = GetOptionsMgr()->GetString(OPT_FILTER_USERPATH);
+ if (pathMyFolders.empty())
+ {
+ // No filter path, set it to default and make sure it exists.
+ String pathFilters = GetDefaultFilterUserPath(TRUE);
+ GetOptionsMgr()->SaveOption(OPT_FILTER_USERPATH, pathFilters);
+ theApp.m_pGlobalFileFilter->SetFileFilterPath(pathFilters.c_str());
+ }
+
+ sd_Init(); // String diff init
+ sd_SetBreakChars(GetOptionsMgr()->GetString(OPT_BREAK_SEPARATORS).c_str());
+
CSplashWnd::EnableSplashScreen(!bDisableSplash && !bCommandLineInvoke);
// Initialize i18n (multiple language) support
if (!filterPath.IsEmpty())
{
- m_globalFileFilter.SetUserFilterPath((LPCTSTR)filterPath);
+ m_pGlobalFileFilter->SetUserFilterPath((LPCTSTR)filterPath);
}
- m_globalFileFilter.LoadAllFileFilters();
+ m_pGlobalFileFilter->LoadAllFileFilters();
}
/** @brief Read command line arguments and open files for comparison.
// Set the global file filter.
if (!cmdInfo.m_sFileFilter.empty())
{
- m_globalFileFilter.SetFilter(cmdInfo.m_sFileFilter.c_str());
+ m_pGlobalFileFilter->SetFilter(cmdInfo.m_sFileFilter.c_str());
}
// Set codepage.
// comparison.
if (cmdInfo.m_bShowUsage)
{
- pMainFrame->ShowHelp(CommandLineHelpLocation);
+ ShowHelp(CommandLineHelpLocation);
}
else
{
// Set the required information we need from the command line:
- pMainFrame->m_bClearCaseTool = cmdInfo.m_bClearCaseTool;
- pMainFrame->m_bExitIfNoDiff = cmdInfo.m_bExitIfNoDiff;
- pMainFrame->m_bEscShutdown = cmdInfo.m_bEscShutdown;
+ m_bClearCaseTool = cmdInfo.m_bClearCaseTool;
+ m_bExitIfNoDiff = cmdInfo.m_bExitIfNoDiff;
+ m_bEscShutdown = cmdInfo.m_bEscShutdown;
- pMainFrame->m_strSaveAsPath = cmdInfo.m_sOutputpath.c_str();
+ m_strSaveAsPath = cmdInfo.m_sOutputpath.c_str();
- pMainFrame->m_strDescriptions[0] = cmdInfo.m_sLeftDesc;
+ m_strDescriptions[0] = cmdInfo.m_sLeftDesc;
if (cmdInfo.m_Files.GetSize() < 3)
{
- pMainFrame->m_strDescriptions[1] = cmdInfo.m_sRightDesc;
+ m_strDescriptions[1] = cmdInfo.m_sRightDesc;
}
else
{
- pMainFrame->m_strDescriptions[1] = cmdInfo.m_sMiddleDesc;
- pMainFrame->m_strDescriptions[2] = cmdInfo.m_sRightDesc;
+ m_strDescriptions[1] = cmdInfo.m_sMiddleDesc;
+ m_strDescriptions[2] = cmdInfo.m_sRightDesc;
}
if (cmdInfo.m_Files.GetSize() > 2)
break;
case 1:
TCHAR buff[32];
- wLangId = theApp.GetLangId();
+ wLangId = GetLangId();
if (GetLocaleInfo(wLangId, LOCALE_IDEFAULTANSICODEPAGE, buff, sizeof(buff)/sizeof(buff[0])))
ucr::setDefaultCodepage(_ttol(buff));
else
}
}
+/**
+ * @brief Send current option settings into codepage module
+ */
+void CMergeApp::UpdateCodepageModule()
+{
+ // Get current codepage settings from the options module
+ // and push them into the codepage module
+ UpdateDefaultCodepage(GetOptionsMgr()->GetInt(OPT_CP_DEFAULT_MODE), GetOptionsMgr()->GetInt(OPT_CP_DEFAULT_CUSTOM));
+}
/** @brief Open help from mainframe when user presses F1*/
void CMergeApp::OnHelp()
{
- GetMainFrame()->ShowHelp();
+ ShowHelp();
+}
+
+/**
+ * @brief Open given file to external editor specified in options.
+ * @param [in] file Full path to file to open.
+ *
+ * Opens file to defined (in Options/system), Notepad by default,
+ * external editor. Path is decorated with quotation marks if needed
+ * (contains spaces). Also '$file' in editor path is replaced by
+ * filename to open.
+ * @param [in] file Full path to file to open.
+ * @param [in] nLineNumber Line number to go to.
+ */
+void CMergeApp::OpenFileToExternalEditor(const String& file, int nLineNumber/* = 1*/)
+{
+ String sCmd = GetOptionsMgr()->GetString(OPT_EXT_EDITOR_CMD);
+ String sFile(file);
+ string_replace(sCmd, _T("$linenum"), string_format(_T("%d"), nLineNumber));
+
+ int nIndex = sCmd.find(_T("$file"));
+ if (nIndex > -1)
+ {
+ sFile.insert(0, _T("\""));
+ string_replace(sCmd, _T("$file"), sFile);
+ nIndex = sCmd.find(' ', nIndex + sFile.length());
+ if (nIndex > -1)
+ sCmd.insert(nIndex, _T("\""));
+ else
+ sCmd += '"';
+ }
+ else
+ {
+ sCmd += _T(" \"");
+ sCmd += sFile;
+ sCmd += _T("\"");
+ }
+
+ BOOL retVal = FALSE;
+ STARTUPINFO stInfo = {0};
+ stInfo.cb = sizeof(STARTUPINFO);
+ PROCESS_INFORMATION processInfo;
+
+ retVal = CreateProcess(NULL, (LPTSTR)sCmd.c_str(),
+ NULL, NULL, FALSE, CREATE_DEFAULT_ERROR_MODE, NULL, NULL,
+ &stInfo, &processInfo);
+
+ if (!retVal)
+ {
+ // Error invoking external editor
+ ResMsgBox1(IDS_ERROR_EXECUTE_FILE, sCmd.c_str(), MB_ICONSTOP);
+ }
+ else
+ {
+ CloseHandle(processInfo.hThread);
+ CloseHandle(processInfo.hProcess);
+ }
+}
+
+/**
+ * @brief Open file, if it exists, else open url
+ */
+void CMergeApp::OpenFileOrUrl(LPCTSTR szFile, LPCTSTR szUrl)
+{
+ if (paths_DoesPathExist(szFile) == IS_EXISTING_FILE)
+ ShellExecute(NULL, _T("open"), _T("notepad.exe"), szFile, NULL, SW_SHOWNORMAL);
+ else
+ ShellExecute(NULL, _T("open"), szUrl, NULL, NULL, SW_SHOWNORMAL);
+}
+
+/**
+ * @brief Show Help - this is for opening help from outside mainframe.
+ * @param [in] helpLocation Location inside help, if NULL main help is opened.
+ */
+void CMergeApp::ShowHelp(LPCTSTR helpLocation /*= NULL*/)
+{
+ String sPath = env_GetProgPath();
+ LANGID LangId = GetLangId();
+ if (PRIMARYLANGID(LangId) == LANG_JAPANESE)
+ sPath += DocsPath_ja;
+ else
+ sPath += DocsPath;
+ if (helpLocation == NULL)
+ {
+ if (paths_DoesPathExist(sPath) == IS_EXISTING_FILE)
+ ::HtmlHelp(NULL, sPath.c_str(), HH_DISPLAY_TOC, NULL);
+ else
+ ShellExecute(NULL, _T("open"), DocsURL, NULL, NULL, SW_SHOWNORMAL);
+ }
+ else
+ {
+ if (paths_DoesPathExist(sPath) == IS_EXISTING_FILE)
+ {
+ sPath += helpLocation;
+ ::HtmlHelp(NULL, sPath.c_str(), HH_DISPLAY_TOPIC, NULL);
+ }
+ }
+}
+
+/**
+ * @brief Creates backup before file is saved or copied over.
+ * This function handles formatting correct path and filename for
+ * backup file. Formatting is done based on several options available
+ * for users in Options/Backups dialog. After path is formatted, file
+ * is simply just copied. Not much error checking, just if copying
+ * succeeded or failed.
+ * @param [in] bFolder Are we creating backup in folder compare?
+ * @param [in] pszPath Full path to file to backup.
+ * @return TRUE if backup succeeds, or isn't just done.
+ */
+BOOL CMergeApp::CreateBackup(BOOL bFolder, const String& pszPath)
+{
+ // If user doesn't want to backups in folder compare, return
+ // success so operations don't abort.
+ if (bFolder && !(GetOptionsMgr()->GetBool(OPT_BACKUP_FOLDERCMP)))
+ return TRUE;
+ // Likewise if user doesn't want backups in file compare
+ else if (!bFolder && !(GetOptionsMgr()->GetBool(OPT_BACKUP_FILECMP)))
+ return TRUE;
+
+ // create backup copy of file if destination file exists
+ if (paths_DoesPathExist(pszPath) == IS_EXISTING_FILE)
+ {
+ String bakPath;
+ String path;
+ String filename;
+ String ext;
+
+ paths_SplitFilename(pszPath, &path, &filename, &ext);
+
+ // Determine backup folder
+ if (GetOptionsMgr()->GetInt(OPT_BACKUP_LOCATION) ==
+ PropBackups::FOLDER_ORIGINAL)
+ {
+ // Put backups to same folder than original file
+ bakPath = path;
+ }
+ else if (GetOptionsMgr()->GetInt(OPT_BACKUP_LOCATION) ==
+ PropBackups::FOLDER_GLOBAL)
+ {
+ // Put backups to global folder defined in options
+ bakPath = GetOptionsMgr()->GetString(OPT_BACKUP_GLOBALFOLDER);
+ if (bakPath.empty())
+ bakPath = path;
+ else
+ bakPath = paths_GetLongPath(bakPath);
+ }
+ else
+ {
+ _RPTF0(_CRT_ERROR, "Unknown backup location!");
+ }
+
+ BOOL success = FALSE;
+ if (GetOptionsMgr()->GetBool(OPT_BACKUP_ADD_BAK))
+ {
+ // Don't add dot if there is no existing extension
+ if (ext.size() > 0)
+ ext += _T(".");
+ ext += BACKUP_FILE_EXT;
+ }
+
+ // Append time to filename if wanted so
+ // NOTE just adds timestamp at the moment as I couldn't figure out
+ // nice way to add a real time (invalid chars etc).
+ if (GetOptionsMgr()->GetBool(OPT_BACKUP_ADD_TIME))
+ {
+ struct tm *tm;
+ time_t curtime = 0;
+ time(&curtime);
+ tm = localtime(&curtime);
+ CString timestr;
+ timestr.Format(_T("%04d%02d%02d%02d%02d%02d"), tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec);
+ filename += _T("-");
+ filename += timestr;
+ }
+
+ // Append filename and extension (+ optional .bak) to path
+ if ((bakPath.length() + filename.length() + ext.length())
+ < MAX_PATH)
+ {
+ success = TRUE;
+ if (!paths_EndsWithSlash(bakPath))
+ bakPath += _T("\\");
+ bakPath = paths_ConcatPath(bakPath, filename);
+ bakPath += _T(".");
+ bakPath += ext;
+ }
+
+ if (success)
+ success = CopyFile(pszPath.c_str(), bakPath.c_str(), FALSE);
+
+ if (!success)
+ {
+ if (ResMsgBox1(IDS_BACKUP_FAILED_PROMPT, pszPath.c_str(),
+ MB_YESNO | MB_ICONWARNING | MB_DONT_ASK_AGAIN,
+ IDS_BACKUP_FAILED_PROMPT) != IDYES)
+ return FALSE;
+ }
+ return TRUE;
+ }
+
+ // we got here because we're either not backing up of there was nothing to backup
+ return TRUE;
+}
+
+/**
+ * @brief Sync file to Version Control System
+ * @param pszDest [in] Where to copy (incl. filename)
+ * @param bApplyToAll [in,out] Apply user selection to all items
+ * @param psError [out] Error string that can be shown to user in caller func
+ * @return User selection or -1 if error happened
+ * @sa CMainFrame::HandleReadonlySave()
+ * @sa CDirView::PerformActionList()
+ */
+int CMergeApp::SyncFileToVCS(const String& pszDest, BOOL &bApplyToAll,
+ String& sError)
+{
+ String sActionError;
+ String strSavePath(pszDest);
+ int nVerSys = 0;
+
+ nVerSys = GetOptionsMgr()->GetInt(OPT_VCS_SYSTEM);
+
+ int nRetVal = HandleReadonlySave(strSavePath, TRUE, bApplyToAll);
+ if (nRetVal == IDCANCEL || nRetVal == IDNO)
+ return nRetVal;
+
+ // If VC project opened from VSS sync and version control used
+ if ((nVerSys == VCS_VSS4 || nVerSys == VCS_VSS5) && m_bVCProjSync)
+ {
+ if (!m_pVssHelper->ReLinkVCProj(strSavePath, sError))
+ nRetVal = -1;
+ }
+ return nRetVal;
+}
+
+/**
+ * @brief Checks if path (file/folder) is read-only and asks overwriting it.
+ *
+ * @param strSavePath [in,out] Path where to save (file or folder)
+ * @param bMultiFile [in] Single file or multiple files/folder
+ * @param bApplyToAll [in,out] Apply last user selection for all items?
+ * @return Users selection:
+ * - IDOK: Item was not readonly, no actions
+ * - IDYES/IDYESTOALL: Overwrite readonly item
+ * - IDNO: User selected new filename (single file) or user wants to skip
+ * - IDCANCEL: Cancel operation
+ * @sa CMainFrame::SyncFileToVCS()
+ * @sa CMergeDoc::DoSave()
+ */
+int CMergeApp::HandleReadonlySave(String& strSavePath, BOOL bMultiFile,
+ BOOL &bApplyToAll)
+{
+ CFileStatus status;
+ UINT userChoice = 0;
+ int nRetVal = IDOK;
+ BOOL bFileRO = FALSE;
+ BOOL bFileExists = FALSE;
+ String s;
+ String str;
+ CString title;
+ int nVerSys = 0;
+
+ try
+ {
+ TFile file(strSavePath);
+ bFileExists = file.exists();
+ if (bFileExists)
+ bFileRO = !file.canWrite();
+ }
+ catch (...)
+ {
+ }
+ nVerSys = GetOptionsMgr()->GetInt(OPT_VCS_SYSTEM);
+
+ if (bFileExists && bFileRO)
+ {
+ // Version control system used?
+ // Checkout file from VCS and modify, don't ask about overwriting
+ // RO files etc.
+ if (nVerSys != VCS_NONE)
+ {
+ BOOL bRetVal = SaveToVersionControl(strSavePath);
+ if (bRetVal)
+ return IDYES;
+ else
+ return IDCANCEL;
+ }
+
+ // Don't ask again if its already asked
+ if (bApplyToAll)
+ userChoice = IDYES;
+ else
+ {
+ // Prompt for user choice
+ if (bMultiFile)
+ {
+ // Multiple files or folder
+ str = LangFormatString1(IDS_SAVEREADONLY_MULTI, strSavePath.c_str());
+ userChoice = AfxMessageBox(str.c_str(), MB_YESNOCANCEL |
+ MB_ICONWARNING | MB_DEFBUTTON3 | MB_DONT_ASK_AGAIN |
+ MB_YES_TO_ALL, IDS_SAVEREADONLY_MULTI);
+ }
+ else
+ {
+ // Single file
+ str = LangFormatString1(IDS_SAVEREADONLY_FMT, strSavePath.c_str());
+ userChoice = AfxMessageBox(str.c_str(), MB_YESNOCANCEL |
+ MB_ICONWARNING | MB_DEFBUTTON2 | MB_DONT_ASK_AGAIN,
+ IDS_SAVEREADONLY_FMT);
+ }
+ }
+ switch (userChoice)
+ {
+ // Overwrite read-only file
+ case IDYESTOALL:
+ bApplyToAll = TRUE; // Don't ask again (no break here)
+ case IDYES:
+ CFile::GetStatus(strSavePath.c_str(), status);
+ status.m_mtime = 0; // Avoid unwanted changes
+ status.m_attribute &= ~CFile::readOnly;
+ CFile::SetStatus(strSavePath.c_str(), status);
+ nRetVal = IDYES;
+ break;
+
+ // Save to new filename (single) /skip this item (multiple)
+ case IDNO:
+ if (!bMultiFile)
+ {
+ if (SelectFile(AfxGetMainWnd()->GetSafeHwnd(), s, strSavePath.c_str(), IDS_SAVE_AS_TITLE, NULL, FALSE))
+ {
+ strSavePath = s;
+ nRetVal = IDNO;
+ }
+ else
+ nRetVal = IDCANCEL;
+ }
+ else
+ nRetVal = IDNO;
+ break;
+
+ // Cancel saving
+ case IDCANCEL:
+ nRetVal = IDCANCEL;
+ break;
+ }
+ }
+ return nRetVal;
+}
+
+/**
+ * @brief Shows VSS error from exception and writes log.
+ */
+void CMergeApp::ShowVSSError(CException *e, const String& strItem)
+{
+ TCHAR errStr[1024] = {0};
+ if (e->GetErrorMessage(errStr, 1024))
+ {
+ String errMsg = theApp.LoadString(IDS_VSS_ERRORFROM);
+ String logMsg = errMsg;
+ errMsg += _T("\n");
+ errMsg += errStr;
+ logMsg += _T(" ");
+ logMsg += errStr;
+ if (!strItem.empty())
+ {
+ errMsg += _T("\n\n");
+ errMsg += strItem;
+ logMsg += _T(": ");
+ logMsg += strItem;
+ }
+ LogErrorString(logMsg);
+ AfxMessageBox(errMsg.c_str(), MB_ICONSTOP);
+ }
+ else
+ {
+ LogErrorString(_T("VSSError (unable to GetErrorMessage)"));
+ e->ReportError(MB_ICONSTOP, IDS_VSS_RUN_ERROR);
+ }
}
/**
}
catch (Poco::Exception& e)
{
- String sErr = theApp.LoadString(IDS_UNK_ERROR_READING_PROJECT);
+ String sErr = LoadString(IDS_UNK_ERROR_READING_PROJECT);
sErr += ucr::toTString(e.displayText());
String msg = LangFormatString2(IDS_ERROR_FILEOPEN, sProject.c_str(), sErr.c_str());
AfxMessageBox(msg.c_str(), MB_ICONSTOP);
}
catch (Poco::Exception& e)
{
- String sErr = theApp.LoadString(IDS_UNK_ERROR_SAVING_PROJECT);
+ String sErr = LoadString(IDS_UNK_ERROR_SAVING_PROJECT);
sErr += ucr::toTString(e.displayText());
String msg = LangFormatString2(IDS_ERROR_FILEOPEN, sProject.c_str(), sErr.c_str());
AfxMessageBox(msg.c_str(), MB_ICONSTOP);
{
String filter = project.GetFilter();
filter = string_trim_ws(filter);
- m_globalFileFilter.SetFilter(filter);
+ m_pGlobalFileFilter->SetFilter(filter);
}
if (project.HasSubfolders())
bRecursive = project.GetSubfolders() > 0;
#endif
#include <boost/scoped_ptr.hpp>
+#include "MergeCmdLineInfo.h"
#include "resource.h" // main symbols
-#include "MergeApp.h"
-#include "MergeDoc.h"
-#include "OptionsMgr.h"
-#include "RegOptionsMgr.h"
-#include "FileFilterHelper.h"
struct FileFilter;
+class FileFilterHelper;
class CAssureScriptsForThread;
class CMainFrame;
class CLanguageSelect;
class MergeCmdLineInfo;
class ProjectFile;
+class COptionsMgr;
+class LineFiltersList;
+class SyntaxColors;
+class VSSHelper;
/////////////////////////////////////////////////////////////////////////////
// CMergeApp:
enum { IDLE_TIMER = 9754 };
+/**
+ * @brief Supported versioncontrol systems.
+ */
+enum
+{
+ VCS_NONE = 0,
+ VCS_VSS4,
+ VCS_VSS5,
+ VCS_CLEARCASE,
+};
+
/**
* @brief WinMerge application class
*/
CMultiDocTemplate* m_pHexMergeTemplate;
CMultiDocTemplate* m_pDirTemplate;
boost::scoped_ptr<CLanguageSelect> m_pLangDlg;
- FileFilterHelper m_globalFileFilter;
+ boost::scoped_ptr<FileFilterHelper> m_pGlobalFileFilter;
+ boost::scoped_ptr<SyntaxColors> m_pSyntaxColors; /**< Syntax color container */
+ boost::scoped_ptr<VSSHelper> m_pVssHelper; /**< Helper class for VSS integration */
+ CString m_strSaveAsPath; /**< "3rd path" where output saved if given */
+ BOOL m_bEscShutdown; /**< If commandline switch -e given ESC closes appliction */
+ SyntaxColors * GetMainSyntaxColors() { return m_pSyntaxColors.get(); }
+ BOOL m_bClearCaseTool; /**< WinMerge is executed as an external Rational ClearCase compare/merge tool. */
+ MergeCmdLineInfo::ExitNoDiff m_bExitIfNoDiff; /**< Exit if files are identical? */
+ boost::scoped_ptr<LineFiltersList> m_pLineFilters; /**< List of linefilters */
+
+ /**
+ * @name Version Control System (VCS) integration.
+ */
+ /*@{*/
+protected:
+ CString m_strVssUser; /**< Visual Source Safe User ID */
+ CString m_strVssPassword; /**< Visual Source Safe Password */
+ CString m_strVssDatabase; /**< Visual Source Safe database */
+ CString m_strCCComment; /**< ClearCase comment */
+public:
+ BOOL m_bCheckinVCS; /**< TRUE if files should be checked in after checkout */
+ BOOL m_CheckOutMulti; /**< Suppresses VSS int. code asking checkout for every file */
+ BOOL m_bVCProjSync; /**< VC project opened from VSS sync? */
+ BOOL m_bVssSuppressPathCheck; /**< Suppresses VSS int code asking about different path */
+ /*@}*/
+
+ /**
+ * @name Textual labels/descriptors
+ * These descriptors overwrite dir/filename usually shown in headerbar
+ * and can be given from command-line. For example version control
+ * system can set these to "WinMerge v2.1.2.0" and "WinMerge 2.1.4.0"
+ * which is more pleasant and informative than temporary paths.
+ */
+ /*@{*/
+ String m_strDescriptions[3];
+ /*@}*/
WORD GetLangId() const;
void SetIndicators(CStatusBar &, const UINT *, int) const;
String GetDefaultFilterUserPath(BOOL bCreate = FALSE);
COptionsMgr * GetMergeOptionsMgr() { return static_cast<COptionsMgr *> (m_pOptions.get()); }
+ FileFilterHelper * GetGlobalFileFilter() { return m_pGlobalFileFilter.get(); }
void OptionsInit();
void ResetOptions() { OptionsInit(); }
void SetFontDefaults();
+ void ShowHelp(LPCTSTR helpLocation = NULL);
+ void OpenFileToExternalEditor(const String& file, int nLineNumber = 1);
+ void OpenFileOrUrl(LPCTSTR szFile, LPCTSTR szUrl);
+ void ShowVSSError(CException *e, const String& strItem);
+ void CheckinToClearCase(const String& strDestinationPath);
+// Implementation in SourceControl.cpp
+ void InitializeSourceControlMembers();
+ BOOL SaveToVersionControl(const String& strSavePath);
+// End SourceControl.cpp
+ BOOL CreateBackup(BOOL bFolder, const String& pszPath);
+ int HandleReadonlySave(String& strSavePath, BOOL bMultiFile, BOOL &bApplyToAll);
+ BOOL SyncFileToVCS(const String& pszDest, BOOL &bApplyToAll, String& psError);
// Implementation
protected:
void InitializeFileFilters();
BOOL ParseArgsAndDoOpen(MergeCmdLineInfo& cmdInfo, CMainFrame* pMainFrame);
void UpdateDefaultCodepage(int cpDefaultMode, int cpCustomCodepage);
+ void UpdateCodepageModule();
// End MergeArgs.cpp
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
- boost::scoped_ptr<CRegOptionsMgr> m_pOptions;
+ boost::scoped_ptr<COptionsMgr> m_pOptions;
CAssureScriptsForThread * m_mainThreadScripts;
int m_nLastCompareResult;
bool m_bNonInteractive;
<ClCompile Include="FolderCmp.cpp">\r
<Filter>Source Files</Filter>\r
</ClCompile>\r
- <ClCompile Include="LineFiltersList.cpp">\r
- <Filter>Source Files</Filter>\r
- </ClCompile>\r
<ClCompile Include="locality.cpp">\r
<Filter>Source Files</Filter>\r
</ClCompile>\r
<ClCompile Include="Splash.cpp">\r
<Filter>MFCGui\Source Files</Filter>\r
</ClCompile>\r
+ <ClCompile Include="LineFiltersList.cpp">\r
+ <Filter>MFCGui\Source Files</Filter>\r
+ </ClCompile>\r
</ItemGroup>\r
<ItemGroup>\r
<ClInclude Include="charsets.h">\r
<ClInclude Include="FileOrFolderSelect.h">\r
<Filter>MFCGui\Header Files</Filter>\r
</ClInclude>\r
- <ClInclude Include="7zCommon.h">\r
- <Filter>MFCGui\Header Files</Filter>\r
- </ClInclude>\r
<ClInclude Include="BCMenu.h">\r
<Filter>MFCGui\Header Files</Filter>\r
</ClInclude>\r
<ClInclude Include="Common\DragDrop.h">\r
<Filter>Header Files</Filter>\r
</ClInclude>\r
+ <ClInclude Include="7zCommon.h">\r
+ <Filter>MFCGui\Source Files</Filter>\r
+ </ClInclude>\r
</ItemGroup>\r
<ItemGroup>\r
<None Include="res\binarydiff.ico">\r
#include "StdAfx.h"
#include "MergeApp.h"
#include "Merge.h"
+#include "unicoder.h"
// Get user language description of error, if available
String GetSysError(int nerr /* =-1 */)
#include "UnicodeString.h"
class COptionsMgr;
+class FileFilterHelper;
/** @brief Retrieve error description from Windows; uses FormatMessage */
String GetSysError(int nerr = -1);
// $Id: MergeDoc.cpp 7107 2010-01-14 21:43:14Z kimmov $
#include "StdAfx.h"
+#include "MergeDoc.h"
#include <shlwapi.h> // PathCompactPathEx()
#include <io.h>
#include <Poco/Timestamp.h>
+#include <Poco/Exception.h>
#include "UnicodeString.h"
#include "Merge.h"
#include "MainFrm.h"
#include "EncodingErrorBar.h"
#include "MergeCmdLineInfo.h"
#include "TFile.h"
-#include <Poco/Exception.h>
#ifdef _DEBUG
#define new DEBUG_NEW
if (GetOptionsMgr()->GetBool(OPT_LINEFILTER_ENABLED))
{
- m_diffWrapper.SetFilterList(GetMainFrame()->m_pLineFilters->GetAsString());
+ m_diffWrapper.SetFilterList(theApp.m_pLineFilters->GetAsString());
}
else
{
{
UINT nFlags = MB_ICONINFORMATION | MB_DONT_DISPLAY_AGAIN;
- if (GetMainFrame()->m_bExitIfNoDiff == MergeCmdLineInfo::Exit)
+ if (theApp.m_bExitIfNoDiff == MergeCmdLineInfo::Exit)
{
// Show the "files are identical" for basic "exit no diff" flag
// If user don't want to see the message one uses the quiet version
nFlags &= ~MB_DONT_DISPLAY_AGAIN;
}
- if (GetMainFrame()->m_bExitIfNoDiff != MergeCmdLineInfo::ExitQuiet)
+ if (theApp.m_bExitIfNoDiff != MergeCmdLineInfo::ExitQuiet)
LangMessageBox(IDS_FILESSAME, nFlags);
// Exit application if files are identical.
- if (GetMainFrame()->m_bExitIfNoDiff == MergeCmdLineInfo::Exit ||
- GetMainFrame()->m_bExitIfNoDiff == MergeCmdLineInfo::ExitQuiet)
+ if (theApp.m_bExitIfNoDiff == MergeCmdLineInfo::Exit ||
+ theApp.m_bExitIfNoDiff == MergeCmdLineInfo::ExitQuiet)
{
- GetMainFrame()->PostMessage(WM_COMMAND, ID_APP_EXIT);
+ AfxGetMainWnd()->PostMessage(WM_COMMAND, ID_APP_EXIT);
}
}
}
bSaveSuccess = false;
// Check third arg possibly given from command-line
- if (!GetMainFrame()->m_strSaveAsPath.IsEmpty())
+ if (!theApp.m_strSaveAsPath.IsEmpty())
{
- if (paths_DoesPathExist((const TCHAR *)GetMainFrame()->m_strSaveAsPath) == IS_EXISTING_DIR)
+ if (paths_DoesPathExist((const TCHAR *)theApp.m_strSaveAsPath) == IS_EXISTING_DIR)
{
// third arg was a directory, so get append the filename
String sname;
paths_SplitFilename(szPath, 0, &sname, 0);
- strSavePath = GetMainFrame()->m_strSaveAsPath;
- if (GetMainFrame()->m_strSaveAsPath.Right(1) != _T('\\'))
+ strSavePath = theApp.m_strSaveAsPath;
+ if (theApp.m_strSaveAsPath.Right(1) != _T('\\'))
strSavePath += _T('\\');
strSavePath += sname;
}
else
- strSavePath = GetMainFrame()->m_strSaveAsPath;
+ strSavePath = theApp.m_strSaveAsPath;
}
- nRetVal = GetMainFrame()->HandleReadonlySave(strSavePath, false, bApplyToAll);
+ nRetVal = theApp.HandleReadonlySave(strSavePath, false, bApplyToAll);
if (nRetVal == IDCANCEL)
return false;
- if (!GetMainFrame()->CreateBackup(false, strSavePath))
+ if (!theApp.CreateBackup(false, strSavePath))
return false;
// false as long as the user is not satisfied
dlg.m_bDisableCancel = true;
if (!m_filePaths.GetLeft().empty())
{
- if (GetMainFrame()->m_strSaveAsPath.IsEmpty())
+ if (theApp.m_strSaveAsPath.IsEmpty())
dlg.m_sLeftFile = m_filePaths.GetLeft().c_str();
else
- dlg.m_sLeftFile = GetMainFrame()->m_strSaveAsPath;
+ dlg.m_sLeftFile = theApp.m_strSaveAsPath;
}
else
dlg.m_sLeftFile = m_strDesc[0].c_str();
{
if (!m_filePaths.GetMiddle().empty())
{
- if (GetMainFrame()->m_strSaveAsPath.IsEmpty())
+ if (theApp.m_strSaveAsPath.IsEmpty())
dlg.m_sMiddleFile = m_filePaths.GetMiddle().c_str();
else
- dlg.m_sMiddleFile = GetMainFrame()->m_strSaveAsPath;
+ dlg.m_sMiddleFile = theApp.m_strSaveAsPath;
}
else
dlg.m_sMiddleFile = m_strDesc[1].c_str();
}
if (!m_filePaths.GetRight().empty())
{
- if (GetMainFrame()->m_strSaveAsPath.IsEmpty())
+ if (theApp.m_strSaveAsPath.IsEmpty())
dlg.m_sRightFile = m_filePaths.GetRight().c_str();
else
- dlg.m_sRightFile = GetMainFrame()->m_strSaveAsPath;
+ dlg.m_sRightFile = theApp.m_strSaveAsPath;
}
else
dlg.m_sRightFile = m_strDesc[m_nBuffers - 1].c_str();
if (!filename.empty())
{
- if (GetMainFrame()->m_strDescriptions[index].empty())
+ if (theApp.m_strDescriptions[index].empty())
m_nBufferType[index] = BUFFER_NORMAL;
else
{
m_nBufferType[index] = BUFFER_NORMAL_NAMED;
- m_strDesc[index] = GetMainFrame()->m_strDescriptions[index];
- GetMainFrame()->m_strDescriptions[index].erase();
+ m_strDesc[index] = theApp.m_strDescriptions[index];
+ theApp.m_strDescriptions[index].erase();
}
m_pSaveFileInfo[index]->Update(filename);
m_pRescanFileInfo[index]->Update(filename);
{
m_nBufferType[index] = BUFFER_UNNAMED;
m_ptBuf[index]->InitNew();
- m_strDesc[index] = GetMainFrame()->m_strDescriptions[index];
+ m_strDesc[index] = theApp.m_strDescriptions[index];
m_ptBuf[index]->m_encoding = encoding;
loadSuccess = FileLoadResult::FRESULT_OK;
}
m_pDetailView[nBuffer]->AttachToBuffer();
// Currently there is only one set of syntax colors, which all documents & views share
- m_pView[nBuffer]->SetColorContext(GetMainSyntaxColors());
- m_pDetailView[nBuffer]->SetColorContext(GetMainSyntaxColors());
+ m_pView[nBuffer]->SetColorContext(theApp.GetMainSyntaxColors());
+ m_pDetailView[nBuffer]->SetColorContext(theApp.GetMainSyntaxColors());
// Set read-only statuses
m_ptBuf[nBuffer]->SetReadOnly(bRO[nBuffer]);
// Exit if files are identical should only work for the first
// comparison and must be disabled afterward.
- GetMainFrame()->m_bExitIfNoDiff = MergeCmdLineInfo::Disabled;
+ theApp.m_bExitIfNoDiff = MergeCmdLineInfo::Disabled;
}
else
{
fileloc[pane].encoding.m_unicoding = m_ptBuf[pane]->getUnicoding();
fileloc[pane].encoding.m_codepage = m_ptBuf[pane]->getCodepage();
fileloc[pane].setPath(m_filePaths[pane]);
- GetMainFrame()->m_strDescriptions[pane] = m_strDesc[pane];
+ theApp.m_strDescriptions[pane] = m_strDesc[pane];
}
int nActivePane = GetActiveMergeView()->m_nThisPane;
CPoint pt = m_pView[nActivePane]->GetCursorPos();
String sExt;
paths_SplitFilename(sFileName, NULL, NULL, &sExt);
- if (GetMainFrame()->m_bClearCaseTool)
+ if (theApp.m_bClearCaseTool)
{
// If no extension found in real file name.
if (sExt.empty())
String s;
CString folder;
- if (!SelectFile(GetMainFrame()->GetSafeHwnd(), s, folder, IDS_SAVE_AS_TITLE, IDS_HTML_REPORT_FILES, false, _T("htm")))
+ if (!SelectFile(AfxGetMainWnd()->GetSafeHwnd(), s, folder, IDS_SAVE_AS_TITLE, IDS_HTML_REPORT_FILES, false, _T("htm")))
return;
GenerateReport(s.c_str());
#define AFX_MERGEDOC_H__BBCD4F90_34E4_11D1_BAA6_00A024706EDC__INCLUDED_
#include "DiffTextBuffer.h"
-#include <boost/scoped_ptr.hpp>
#include <vector>
#include <map>
+#include <boost/scoped_ptr.hpp>
#include "DiffWrapper.h"
#include "DiffList.h"
-#include "stringdiffs.h"
#include "TempFile.h"
#include "PathContext.h"
#include "DiffFileInfo.h"
CMergeEditView * GetView(int pane) const { return m_pView[pane]; }
CMergeEditView * GetDetailView(int pane) const { return m_pDetailView[pane]; }
CChildFrame * GetParentFrame();
- const FileTextEncoding & GetEncoding(int file) const
- { return m_ptBuf[file]->getEncoding(); }
void AddSyncPoint();
void ClearSyncPoints();
#include "Merge.h"
#include "DiffList.h"
-#include "MergeLineFlags.h"
+#include "stringdiffs.h"
#ifdef _DEBUG
#define new DEBUG_NEW
// $Id: MergeDocEncoding.cpp 4921 2008-01-16 20:20:54Z kimmov $
#include "stdafx.h"
-
-#include "MainFrm.h"
#include "MergeDoc.h"
+#include "Merge.h"
#include "LoadSaveCodepageDlg.h"
#include "unicoder.h"
fileloc[pane].encoding.m_codepage = m_ptBuf[pane]->getCodepage();
}
fileloc[pane].setPath(m_filePaths[pane]);
- GetMainFrame()->m_strDescriptions[pane] = m_strDesc[pane];
+ theApp.m_strDescriptions[pane] = m_strDesc[pane];
}
OpenDocs(fileloc, bRO);
// $Id: MergeDocLineDiffs.cpp 7067 2009-12-29 14:22:46Z kimmov $
#include "StdAfx.h"
+#include "MergeDoc.h"
#include <vector>
#include <boost/scoped_array.hpp>
#include "Merge.h"
-#include "MainFrm.h"
-
#include "MergeEditView.h"
+#include "DiffTextBuffer.h"
#include "stringdiffs.h"
#include "UnicodeString.h"
// $Id: MergeEditView.cpp 7142 2010-04-28 17:05:50Z kimmov $
#include "StdAfx.h"
+#include "MergeEditView.h"
#include <vector>
#include "BCMenu.h"
#include "Merge.h"
#include "LocationView.h"
-#include "MergeEditView.h"
#include "MergeDoc.h"
#include "MainFrm.h"
#include "OptionsMgr.h"
#include "WaitStatusCursor.h"
#include "FileTransform.h"
#include "Plugins.h"
-#include "lwdisp.h"
#include "WMGotoDlg.h"
#include "OptionsDef.h"
#include "SyntaxColors.h"
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMergeDoc)));
return (CMergeDoc*)m_pDocument;
}
+
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
{
}
+CMergeEditView *CMergeEditView::GetGroupView(int nPane) const
+{
+ return (this == GetDocument()->GetView(this->m_nThisPane)) ? GetDocument()->GetView(nPane) : GetDocument()->GetDetailView(nPane);
+}
+
+bool CMergeEditView::IsDetailViewPane() const
+{
+ return (GetDocument()->GetView(m_nThisPane) != this);
+};
+
+
void CMergeEditView::PrimeListWithFile()
{
// Set the tab size now, just in case the options change...
return;
int nRealLine = ComputeRealLine(GetCursorPos().y) + 1;
- GetMainFrame()->OpenFileToExternalEditor(sFileName.c_str(), nRealLine);
+ theApp.OpenFileToExternalEditor(sFileName.c_str(), nRealLine);
}
/**
/** @brief Open help from mainframe when user presses F1*/
void CMergeEditView::OnHelp()
{
- GetMainFrame()->ShowHelp(MergeViewHelpLocation);
+ theApp.ShowHelp(MergeViewHelpLocation);
}
/**
CString GetSelectedText();
CString GetLineText(int idx);
CMergeDoc* GetDocument();
+ const CMergeDoc *GetDocument() const { return const_cast<CMergeEditView *>(this)->GetDocument(); }
void UpdateResources();
BOOL IsModified() { return (LocateTextBuffer()->IsModified()); }
void PrimeListWithFile();
virtual void PrintFooter(CDC * pdc, int nPageNum);
virtual void SetWordWrapping( bool bWordWrap );
void UpdateStatusbar();
- CMergeEditView *GetGroupView(int nPane) {
- return (this == GetDocument()->GetView(this->m_nThisPane)) ? GetDocument()->GetView(nPane) : GetDocument()->GetDetailView(nPane);
- }
- bool IsDetailViewPane() { return (GetDocument()->GetView(m_nThisPane) != this); };
+ CMergeEditView *GetGroupView(int nPane) const;
+ bool IsDetailViewPane() const;
virtual void OnDisplayDiff(int nDiff=0);
//
#include "stdafx.h"
-#include "Merge.h"
#include "OpenDoc.h"
-#include "Constants.h"
// COpenDoc
// ChildFrm.cpp : implementation of the COpenFrame class
//
#include "stdafx.h"
-#include "Merge.h"
-
#include "OpenFrm.h"
+#include "Merge.h"
#ifdef _DEBUG
#define new DEBUG_NEW
// $Id: OpenDlg.cpp 6861 2009-06-25 12:11:07Z kimmov $
#include "stdafx.h"
+#include "OpenView.h"
#include <vector>
#include <sys/types.h>
#include <sys/stat.h>
#include "UnicodeString.h"
#include "Merge.h"
#include "OpenDoc.h"
-#include "OpenView.h"
#include "ProjectFile.h"
#include "paths.h"
#include "SelectUnpackerDlg.h"
#include "Constants.h"
#include "Picture.h"
#include "DragDrop.h"
+#include "FileFilterHelper.h"
#ifdef _DEBUG
#define new DEBUG_NEW
m_ctlPath[2].SetAutoComplete(nSource);
}
- String filterNameOrMask = theApp.m_globalFileFilter.GetFilterNameOrMask();
- BOOL bMask = theApp.m_globalFileFilter.IsUsingMask();
+ String filterNameOrMask = theApp.m_pGlobalFileFilter->GetFilterNameOrMask();
+ BOOL bMask = theApp.m_pGlobalFileFilter->IsUsingMask();
if (!bMask)
{
{
// Remove prefix + space
filter.erase(0, filterPrefix.length());
- if (!theApp.m_globalFileFilter.SetFilter(filter))
+ if (!theApp.m_pGlobalFileFilter->SetFilter(filter))
{
// If filtername is not found use default *.* mask
- theApp.m_globalFileFilter.SetFilter(_T("*.*"));
+ theApp.m_pGlobalFileFilter->SetFilter(_T("*.*"));
filter = _T("*.*");
}
GetOptionsMgr()->SaveOption(OPT_FILEFILTER_CURRENT, filter);
}
else
{
- BOOL bFilterSet = theApp.m_globalFileFilter.SetFilter(filter);
+ BOOL bFilterSet = theApp.m_pGlobalFileFilter->SetFilter(filter);
if (!bFilterSet)
- m_strExt = theApp.m_globalFileFilter.GetFilterNameOrMask().c_str();
+ m_strExt = theApp.m_pGlobalFileFilter->GetFilterNameOrMask().c_str();
GetOptionsMgr()->SaveOption(OPT_FILEFILTER_CURRENT, filter);
}
String filterPrefix = theApp.LoadString(IDS_FILTER_PREFIX);
CString curFilter;
- const BOOL bUseMask = theApp.m_globalFileFilter.IsUsingMask();
+ const BOOL bUseMask = theApp.m_pGlobalFileFilter->IsUsingMask();
GetDlgItemText(IDC_EXT_COMBO, curFilter);
curFilter.TrimLeft();
curFilter.TrimRight();
GetMainFrame()->SelectFilter();
- String filterNameOrMask = theApp.m_globalFileFilter.GetFilterNameOrMask();
- if (theApp.m_globalFileFilter.IsUsingMask())
+ String filterNameOrMask = theApp.m_pGlobalFileFilter->GetFilterNameOrMask();
+ if (theApp.m_pGlobalFileFilter->IsUsingMask())
{
// If we had filter chosen and now has mask we can overwrite filter
if (!bUseMask || curFilter[0] != '*')
*/
void COpenView::OnHelp()
{
- GetMainFrame()->ShowHelp(OpenDlgHelpLocation);
+ theApp.ShowHelp(OpenDlgHelpLocation);
}
/////////////////////////////////////////////////////////////////////////////
#include "CMoveConstraint.h"
class ProjectFile;
+class COpenDoc;
/**
* @brief The Open-View class.
#include "stdafx.h"
#include <vector>
#include "Merge.h"
-#include "MainFrm.h"
#include "OptionsDef.h"
#include "OptionsMgr.h"
+#include "RegOptionsMgr.h"
#include "OptionsDiffOptions.h"
#include "OptionsDiffColors.h"
#include "OptionsFont.h"
// Copy some values from HKLM to HKCU
CopyHKLMValues();
- m_pOptions->SetRegRootKey(_T("Thingamahoochie\\WinMerge\\"));
+ static_cast<CRegOptionsMgr *>(m_pOptions.get())->SetRegRootKey(_T("Thingamahoochie\\WinMerge\\"));
LANGID LangId = GetUserDefaultLangID();
if (PRIMARYLANGID(LangId) == LANG_JAPANESE)
// $Id: PatchDlg.cpp 6783 2009-05-25 06:47:22Z kimmov $
#include "StdAfx.h"
+#include "PatchDlg.h"
#include "Merge.h"
#include "PatchTool.h"
-#include "PatchDlg.h"
#include "diff.h"
#include "coretools.h"
#include "paths.h"
// $Id: PatchTool.cpp 6858 2009-06-25 07:48:26Z kimmov $
#include "StdAfx.h"
+#include "PatchTool.h"
#include "UnicodeString.h"
#include "DiffWrapper.h"
#include "PathContext.h"
-#include "PatchTool.h"
#include "PatchDlg.h"
#include "paths.h"
#ifndef _PATCHTOOL_H_
#define _PATCHTOOL_H_
+#include "DiffWrapper.h"
+
class CPatchDlg;
/**
// ID line follows -- this is updated by SVN
// $Id: Plugins.cpp 7052 2009-12-22 17:45:22Z kimmov $
+#include "Plugins.h"
#define POCO_NO_UNWINDOWS 1
#include <vector>
#include <list>
#include <Poco/ScopedLock.h>
#include <Poco/RegularExpression.h>
#include <windows.h>
-#include "Plugins.h"
#include "MergeApp.h"
#include "FileTransform.h"
#include "FileFilterMgr.h"
// $Id$
#include "stdafx.h"
+#include "PluginsListDlg.h"
#include "UnicodeString.h"
#include "Merge.h"
#include "Plugins.h"
-#include "PluginsListDlg.h"
#include "OptionsDef.h"
+#include "OptionsMgr.h"
IMPLEMENT_DYNAMIC(PluginsListDlg, CDialog)
// $Id$
#include "stdafx.h"
+#include "ProjectFilePathsDlg.h"
#include "UnicodeString.h"
#include "Merge.h"
#include "MainFrm.h"
#include "paths.h"
#include "OptionsDef.h"
+#include "OptionsMgr.h"
#include "ProjectFile.h"
-#include "ProjectFilePathsDlg.h"
#include "FileOrFolderSelect.h"
+#include "FileFilterHelper.h"
#ifdef _DEBUG
#define new DEBUG_NEW
String filterPrefix = theApp.LoadString(IDS_FILTER_PREFIX);
CString curFilter;
- const BOOL bUseMask = theApp.m_globalFileFilter.IsUsingMask();
+ const BOOL bUseMask = theApp.m_pGlobalFileFilter->IsUsingMask();
GetDlgItemText(IDC_PROJ_FILTER_EDIT, curFilter);
curFilter.TrimLeft();
curFilter.TrimRight();
GetMainFrame()->SelectFilter();
- String filterNameOrMask = theApp.m_globalFileFilter.GetFilterNameOrMask();
- if (theApp.m_globalFileFilter.IsUsingMask())
+ String filterNameOrMask = theApp.m_pGlobalFileFilter->GetFilterNameOrMask();
+ if (theApp.m_pGlobalFileFilter->IsUsingMask())
{
// If we had filter chosen and now has mask we can overwrite filter
if (!bUseMask || curFilter[0] != '*')
// $Id$
#include "stdafx.h"
+#include "PropArchive.h"
#include "Constants.h"
#include "Merge.h"
-#include "PropArchive.h"
#include "OptionsDef.h"
#include "OptionsMgr.h"
#include "OptionsPanel.h"
// $Id$
#include "stdafx.h"
-#include "Merge.h"
#include "PropBackups.h"
+#include "Merge.h"
#include "OptionsDef.h"
#include "OptionsMgr.h"
#include "OptionsPanel.h"
// $Id: PropCodepage.cpp 6908 2009-07-11 08:29:49Z kimmov $
#include "stdafx.h"
+#include "PropCodepage.h"
#include "common/unicoder.h"
#include "common/ExConverter.h"
-#include "merge.h"
-#include "PropCodepage.h"
+#include "Merge.h"
#include "OptionsDef.h"
#include "OptionsMgr.h"
#include "OptionsPanel.h"
// $Id: PropColors.cpp 6908 2009-07-11 08:29:49Z kimmov $
#include "stdafx.h"
-#include "merge.h"
#include "PropColors.h"
+#include "Merge.h"
#include "CustomColors.h"
#include "OptionsDef.h"
#include "OptionsMgr.h"
// $Id$
#include "stdafx.h"
-#include "merge.h"
#include "PropCompare.h"
+#include "Merge.h"
#include "OptionsDef.h"
#include "OptionsMgr.h"
#include "OptionsPanel.h"
// $Id: PropCompareFolder.cpp 6921 2009-07-23 15:20:41Z kimmov $
#include "stdafx.h"
-#include "merge.h"
#include "PropCompareFolder.h"
+#include "Merge.h"
#include "OptionsDef.h"
#include "OptionsMgr.h"
#include "OptionsPanel.h"
// $Id$
#include "stdafx.h"
-#include "merge.h"
#include "PropEditor.h"
+#include "Merge.h"
#include "OptionsDef.h"
#include "OptionsMgr.h"
#include "OptionsPanel.h"
// $Id$
#include "stdafx.h"
-#include "merge.h"
#include "PropGeneral.h"
+#include "Merge.h"
#include "OptionsDef.h"
#include "OptionsMgr.h"
#include "OptionsPanel.h"
// $Id: PropRegistry.cpp 6908 2009-07-11 08:29:49Z kimmov $
#include "stdafx.h"
-#include "resource.h"
#include "PropRegistry.h"
#include "RegKey.h"
#include "coretools.h"
// $Id: PropShell.cpp 6725 2009-05-09 14:31:24Z kimmov $
#include "stdafx.h"
-#include "resource.h"
-#include "merge.h"
#include "PropShell.h"
+#include "Merge.h"
#include "RegKey.h"
#include "OptionsDef.h"
#include "OptionsMgr.h"
// $Id$
#include "stdafx.h"
-#include "resource.h"
+#include "PropSyntaxColors.h"
#include "SyntaxColors.h"
#include "OptionsSyntaxColors.h"
-#include "PropSyntaxColors.h"
#include "CustomColors.h"
#include "Merge.h"
#include "OptionsPanel.h"
// $Id$
#include "stdafx.h"
-#include "resource.h"
-#include "Merge.h"
#include "PropTextColors.h"
+#include "Merge.h"
#include "SyntaxColors.h"
#include "CustomColors.h"
#include "OptionsDef.h"
// $Id$
#include "stdafx.h"
+#include "PropVss.h"
#include "FileOrFolderSelect.h"
-#include "MainFrm.h" // VCS_* constants
#include "Merge.h"
-#include "PropVss.h"
#include "OptionsDef.h"
#include "OptionsMgr.h"
#include "OptionsPanel.h"
// $Id: SaveClosingDlg.cpp 4704 2007-11-03 12:10:48Z jtuc $
#include "stdafx.h"
-#include "Merge.h"
#include "SaveClosingDlg.h"
+#include "Merge.h"
#ifdef _DEBUG
#define new DEBUG_NEW
//
#include "stdafx.h"
-#include "merge.h"
#include "SelectUnpackerDlg.h"
+#include "Merge.h"
#include "Plugins.h"
#include "FileTransform.h"
#define AFX_SELECTUNPACKERDLG_H__C8FD4C3A_5ED5_43D3_ADAE_A2378369705C__INCLUDED_
#include <vector>
+#include <boost/scoped_ptr.hpp>
/////////////////////////////////////////////////////////////////////////////
// CSelectUnpackerDlgDlg dialog
// $Id$
#include "stdafx.h"
-#include "merge.h"
#include "SharedFilterDlg.h"
+#include "Merge.h"
#include "OptionsDef.h"
#include "OptionsMgr.h"
#include <direct.h>
#include "UnicodeString.h"
#include "unicoder.h"
-#include "MainFrm.h"
#include "Merge.h"
#include "OptionsDef.h"
+#include "OptionsMgr.h"
#include "RegKey.h"
#include "paths.h"
#include "VssPrompt.h"
#include "WaitStatusCursor.h"
#include "ssapi.h" // BSP - Includes for Visual Source Safe COM interface
#include "CCPrompt.h"
+#include "VSSHelper.h"
using Poco::format;
using Poco::Process;
using Poco::ProcessHandle;
void
-CMainFrame::InitializeSourceControlMembers()
+CMergeApp::InitializeSourceControlMembers()
{
- m_vssHelper.SetProjectBase((const TCHAR *)theApp.GetProfileString(_T("Settings"), _T("VssProject"), _T("")));
+ m_pVssHelper->SetProjectBase((const TCHAR *)theApp.GetProfileString(_T("Settings"), _T("VssProject"), _T("")));
m_strVssUser = theApp.GetProfileString(_T("Settings"), _T("VssUser"), _T(""));
// m_strVssPassword = theApp.GetProfileString(_T("Settings"), _T("VssPassword"), _T(""));
theApp.WriteProfileString(_T("Settings"), _T("VssPassword"), _T(""));
* @return Tells if caller can continue (no errors happened)
* @sa CheckSavePath()
*/
-BOOL CMainFrame::SaveToVersionControl(const String& strSavePath)
+BOOL CMergeApp::SaveToVersionControl(const String& strSavePath)
{
CFileStatus status;
UINT userChoice = 0;
// Prompt for user choice
CVssPrompt dlg;
dlg.m_strMessage = LangFormatString1(IDS_SAVE_FMT, strSavePath.c_str()).c_str();
- dlg.m_strProject = m_vssHelper.GetProjectBase().c_str();
+ dlg.m_strProject = m_pVssHelper->GetProjectBase().c_str();
dlg.m_strUser = m_strVssUser; // BSP - Add VSS user name to dialog box
dlg.m_strPassword = m_strVssPassword;
if (userChoice == IDOK)
{
WaitStatusCursor waitstatus(IDS_VSS_CHECKOUT_STATUS);
- m_vssHelper.SetProjectBase((const TCHAR *)dlg.m_strProject);
- theApp.WriteProfileString(_T("Settings"), _T("VssProject"), m_vssHelper.GetProjectBase().c_str());
+ m_pVssHelper->SetProjectBase((const TCHAR *)dlg.m_strProject);
+ theApp.WriteProfileString(_T("Settings"), _T("VssProject"), m_pVssHelper->GetProjectBase().c_str());
String path, name;
paths_SplitFilename(strSavePath, &path, &name, NULL);
String spath(path);
std::string sn;
std::vector<std::string> args;
args.push_back("checkout");
- format(sn, "\"%s/%s\"", ucr::toUTF8(m_vssHelper.GetProjectBase()), ucr::toUTF8(sname));
+ format(sn, "\"%s/%s\"", ucr::toUTF8(m_pVssHelper->GetProjectBase()), ucr::toUTF8(sname));
args.push_back(sn);
ProcessHandle hVss(Process::launch(vssPath, args));
int code = Process::wait(hVss);
CString spath, sname;
dlg.m_strMessage = LangFormatString1(IDS_SAVE_FMT, strSavePath.c_str()).c_str();
- dlg.m_strProject = m_vssHelper.GetProjectBase().c_str();
+ dlg.m_strProject = m_pVssHelper->GetProjectBase().c_str();
dlg.m_strUser = m_strVssUser; // BSP - Add VSS user name to dialog box
dlg.m_strPassword = m_strVssPassword;
dlg.m_strSelectedDatabase = m_strVssDatabase;
{
WaitStatusCursor waitstatus(IDS_VSS_CHECKOUT_STATUS);
BOOL bOpened = FALSE;
- m_vssHelper.SetProjectBase((const TCHAR *)dlg.m_strProject);
+ m_pVssHelper->SetProjectBase((const TCHAR *)dlg.m_strProject);
m_strVssUser = dlg.m_strUser;
m_strVssPassword = dlg.m_strPassword;
m_strVssDatabase = dlg.m_strSelectedDatabase;
m_bVCProjSync = dlg.m_bVCProjSync;
theApp.WriteProfileString(_T("Settings"), _T("VssDatabase"), m_strVssDatabase);
- theApp.WriteProfileString(_T("Settings"), _T("VssProject"), m_vssHelper.GetProjectBase().c_str());
+ theApp.WriteProfileString(_T("Settings"), _T("VssProject"), m_pVssHelper->GetProjectBase().c_str());
theApp.WriteProfileString(_T("Settings"), _T("VssUser"), m_strVssUser);
// theApp.WriteProfileString(_T("Settings"), _T("VssPassword"), m_strVssPassword);
static TCHAR buffer2[nBufferSize];
_tcscpy(buffer1, strSavePath.c_str());
- _tcscpy(buffer2, m_vssHelper.GetProjectBase().c_str());
+ _tcscpy(buffer2, m_pVssHelper->GetProjectBase().c_str());
_tcslwr(buffer1);
_tcslwr(buffer2);
buffer1[k] = '\\';
}
- m_vssHelper.SetProjectBase(buffer2);
+ m_pVssHelper->SetProjectBase(buffer2);
TCHAR * pbuf2 = &buffer2[2];//skip the $/
TCHAR * pdest = _tcsstr(buffer1, pbuf2);
if (pdest)
sname = buffer;
}
}
- String strItem = m_vssHelper.GetProjectBase() + _T("\\") + static_cast<const TCHAR *>(sname);
+ String strItem = m_pVssHelper->GetProjectBase() + _T("\\") + static_cast<const TCHAR *>(sname);
TRY
{
/**
* @brief Checkin in file into ClearCase.
*/
-void CMainFrame::CheckinToClearCase(const String &strDestinationPath)
+void CMergeApp::CheckinToClearCase(const String &strDestinationPath)
{
String spath, sname;
paths_SplitFilename(strDestinationPath, &spath, &sname, 0);
// $Id$
#include "stdafx.h"
-#include "resource.h"
+#include "Splash.h"
#include "UnicodeString.h"
#include "Picture.h"
-#include "Splash.h"
#include "version.h"
#ifdef _DEBUG
// $Id$
#include "stdafx.h"
+#include "TestFilterDlg.h"
#include "Merge.h"
#include "resource.h"
#include "UnicodeString.h"
-#include "TestFilterDlg.h"
#include "FileFilterMgr.h"
#ifdef _DEBUG
// $Id$
-#include <windows.h>
#include "VSSHelper.h"
+#include <windows.h>
#include <algorithm>
#include <cassert>
#include "UnicodeString.h"
#ifndef _VSSHELPER_H_
#define _VSSHELPER_H_
+#include <Windows.h>
#include "UnicodeString.h"
/**
// $Id$
#include "stdafx.h"
-#include "Merge.h"
#include "VssPrompt.h"
+#include "Merge.h"
#include "RegKey.h"
#ifdef _DEBUG
// $Id$
#include "stdafx.h"
-#include "merge.h"
#include "WMGotoDlg.h"
+#include "Merge.h"
#ifdef _DEBUG
#define new DEBUG_NEW
// RCS ID line follows -- this is updated by SVN
// $Id$
-#include <windows.h>
#include "codepage.h"
+#include <windows.h>
#include <map>
#include <cassert>
#include <tchar.h>
*/
#include "stdafx.h"
+#include "dllpstub.h"
#include <shlwapi.h>
#include <afxdisp.h>
#include <afxinet.h>
-#include "dllpstub.h"
/**
* @brief Throw DLLPSTUB related exception.
*/
#include "markdown.h"
-#include "unicoder.h"
#include <cstring>
#include <Poco/ByteOrder.h>
#include <Poco/NumberParser.h>
#include <Poco/SharedMemory.h>
+#include "unicoder.h"
#include "TFile.h"
#define MAKEWORD(a, b) ((unsigned short)(((unsigned char)((unsigned)(a) & 0xff)) | ((unsigned short)((unsigned char)((unsigned)(b) & 0xff))) << 8))
// ID line follows -- this is updated by SVN
// $Id: paths.cpp 6514 2009-03-01 16:55:11Z kimmov $
-#include <windows.h>
#include "paths.h"
+#include <windows.h>
#include <cassert>
#include <direct.h>
#include <mbctype.h> // MBCS (multibyte codepage stuff)
// RCS ID line follows -- this is updated by CVS
// $Id: stringdiffs.cpp 7149 2010-05-03 17:08:20Z kimmov $
+#include "stringdiffs.h"
#define NOMINMAX
#include <windows.h>
#include <tchar.h>
#include <cassert>
#include <climits>
#include <mbctype.h>
-#include "stringdiffs.h"
#include "CompareOptions.h"
#include "stringdiffsi.h"
#include "Diff3.h"
msgstr ""
"Project-Id-Version: WinMerge\n"
"Report-Msgid-Bugs-To: http://bugs.winmerge.org/\n"
-"POT-Creation-Date: 2014-01-13 23:04+0000\n"
+"POT-Creation-Date: 2014-01-18 13:40+0000\n"
"PO-Revision-Date: \n"
"Last-Translator: \n"
"Language-Team: English <winmerge-translate@lists.sourceforge.net>\n"