#include "DirDoc.h"
#include "ShellContextMenu.h"
#include "editcmd.h"
+#include "Shell.h"
#ifdef _DEBUG
#define new DEBUG_NEW
, m_nThisGroup(0)
, m_bDetailView(false)
, m_piMergeEditStatus(nullptr)
-, m_bAutomaticRescan(false)
, fTimerWaitingForIdle(0)
, m_lineBegin(0)
, m_lineEnd(-1)
ON_COMMAND(ID_FILE_OPEN_REGISTERED, OnOpenFile)
ON_COMMAND(ID_FILE_OPEN_WITHEDITOR, OnOpenFileWithEditor)
ON_COMMAND(ID_FILE_OPEN_WITH, OnOpenFileWith)
+ ON_COMMAND(ID_FILE_OPEN_PARENT_FOLDER, OnOpenParentFolder)
ON_COMMAND(ID_SWAPPANES_SWAP12, OnViewSwapPanes12)
ON_COMMAND(ID_SWAPPANES_SWAP23, OnViewSwapPanes23)
ON_COMMAND(ID_SWAPPANES_SWAP13, OnViewSwapPanes13)
return GetDocument()->m_ptBuf[m_nThisPane].get();
}
+void CMergeEditView::CopyProperties(CCrystalTextView* pSource)
+{
+ __super::CopyProperties(pSource);
+ auto pSourceEditView = dynamic_cast<decltype(this)>(pSource);
+ if (!pSourceEditView)
+ return;
+ m_bChangedSchemeManually = pSourceEditView->m_bChangedSchemeManually;
+}
+
/**
* @brief Update any resources necessary after a GUI language change
*/
*/
CString CMergeEditView::GetSelectedText()
{
- CPoint ptStart, ptEnd;
CString strText;
- GetSelection(ptStart, ptEnd);
+ auto [ptStart, ptEnd] = GetSelection();
if (ptStart != ptEnd)
GetTextWithoutEmptys(ptStart.y, ptStart.x, ptEnd.y, ptEnd.x, strText);
return strText;
return;
int firstLine, lastLine;
- CPoint ptStart, ptEnd;
- GetSelection(ptStart, ptEnd);
+ auto [ptStart, ptEnd] = GetSelection();
if (pptStart != nullptr)
ptStart = *pptStart;
if (pptEnd != nullptr)
return;
int firstLine, lastLine;
- CPoint ptStart, ptEnd;
- GetSelection(ptStart, ptEnd);
+ auto [ptStart, ptEnd] = GetSelection();
firstLine = ptStart.y;
lastLine = ptEnd.y;
CMergeDoc *pDoc = GetDocument();
std::map<int, std::vector<int>> ret;
std::map<int, std::vector<int> *> list;
- CPoint ptStart, ptEnd;
- GetSelection(ptStart, ptEnd);
+ auto [ptStart, ptEnd] = GetSelection();
for (int nLine = ptStart.y; nLine <= ptEnd.y; ++nLine)
{
if (pDoc->m_diffList.LineToDiff(nLine) != -1)
void CMergeEditView::OnEditCopy()
{
CMergeDoc * pDoc = GetDocument();
- CPoint ptSelStart, ptSelEnd;
- GetSelection(ptSelStart, ptSelEnd);
+ auto [ptSelStart, ptSelEnd] = GetSelection();
// Nothing selected
if (ptSelStart == ptSelEnd)
if (!QueryEditable())
return;
- CPoint ptSelStart, ptSelEnd;
CMergeDoc * pDoc = GetDocument();
- GetSelection(ptSelStart, ptSelEnd);
+ auto [ptSelStart, ptSelEnd] = GetSelection();
// Nothing selected
if (ptSelStart == ptSelEnd)
}
}
- CPoint ptStart, ptEnd;
- GetSelection(ptStart, ptEnd);
+ auto [ptStart, ptEnd] = GetSelection();
if (IsSelection() || pDoc->EqualCurrentWordDiff(srcPane, ptStart, ptEnd))
{
if (!m_bRectangularSelection)
// If one or more diffs inside selection OR
// there is an active diff OR
// cursor is inside diff
- CPoint ptStart, ptEnd;
- GetSelection(ptStart, ptEnd);
+ auto [ptStart, ptEnd] = GetSelection();
if (IsSelection() || GetDocument()->EqualCurrentWordDiff(m_nThisPane, ptStart, ptEnd))
{
if (m_bCurrentLineIsDiff || (m_pTextBuffer->GetLineFlags(m_ptSelStart.y) & LF_NONTRIVIAL_DIFF) != 0)
pDoc->UpdateHeaderPath(m_nThisPane);
// If automatic rescan enabled, rescan after edit events
- if (m_bAutomaticRescan)
+ if (pDoc->GetAutomaticRescan())
{
// keep document up to date
// (Re)start timer to rescan only when user edits text
RENDERING_MODE nRenderingMode = static_cast<RENDERING_MODE>(GetOptionsMgr()->GetInt(OPT_RENDERING_MODE));
SetRenderingMode(nRenderingMode);
- m_bAutomaticRescan = GetOptionsMgr()->GetBool(OPT_AUTOMATIC_RESCAN);
-
if (GetOptionsMgr()->GetInt(OPT_TAB_TYPE) == 0)
SetInsertTabs(true);
else
SetTextType(def->type);
else
SetTextType(CrystalLineParser::SRC_PLAIN);
+ SetDisableBSAtSOL(false);
}
SetWordWrapping(GetOptionsMgr()->GetBool(OPT_WORDWRAP));
*/
void CMergeEditView::OnEditCopyLineNumbers()
{
- CPoint ptStart;
- CPoint ptEnd;
CString strText;
CString strLine;
CString strNumLine;
CMergeDoc *pDoc = GetDocument();
- GetSelection(ptStart, ptEnd);
+ auto [ptStart, ptEnd] = GetSelection();
// Get last selected line (having widest linenumber)
int line = pDoc->m_ptBuf[m_nThisPane]->ComputeRealLine(ptEnd.y);
String sFileName = pDoc->m_filePaths[m_nThisPane];
if (sFileName.empty())
return;
- HINSTANCE rtn = ShellExecute(::GetDesktopWindow(), _T("edit"), sFileName.c_str(),
- 0, 0, SW_SHOWNORMAL);
- if (reinterpret_cast<uintptr_t>(rtn) == SE_ERR_NOASSOC)
- rtn = ShellExecute(::GetDesktopWindow(), _T("open"), sFileName.c_str(),
- 0, 0, SW_SHOWNORMAL);
- if (reinterpret_cast<uintptr_t>(rtn) == SE_ERR_NOASSOC)
- OnOpenFileWith();
+ shell::Edit(sFileName.c_str());
}
/**
String sFileName = pDoc->m_filePaths[m_nThisPane];
if (sFileName.empty())
return;
-
- CString sysdir;
- if (!GetSystemDirectory(sysdir.GetBuffer(MAX_PATH), MAX_PATH))
- return;
- sysdir.ReleaseBuffer();
- CString arg = (CString)_T("shell32.dll,OpenAs_RunDLL ") + sFileName.c_str();
- ShellExecute(::GetDesktopWindow(), 0, _T("RUNDLL32.EXE"), arg,
- sysdir, SW_SHOWNORMAL);
+ shell::OpenWith(sFileName.c_str());
}
/**
}
/**
+ * @brief Open parent folder of active file
+ */
+void CMergeEditView::OnOpenParentFolder()
+{
+ CMergeDoc * pDoc = GetDocument();
+ ASSERT(pDoc != nullptr);
+
+ String sFileName = pDoc->m_filePaths[m_nThisPane];
+ if (sFileName.empty())
+ return;
+
+ shell::OpenParentFolder(sFileName.c_str());
+}
+
+/**
* @brief Force repaint of the location pane.
*/
void CMergeEditView::RepaintLocationPane()
SetTopMargin(false);
}
- // Enable/disable automatic rescan (rescanning after edit)
- EnableRescan(GetOptionsMgr()->GetBool(OPT_AUTOMATIC_RESCAN));
-
// SetTextType will revert to language dependent defaults for tab
SetTabSize(GetOptionsMgr()->GetInt(OPT_TAB_SIZE));
SetViewTabs(GetOptionsMgr()->GetBool(OPT_VIEW_WHITESPACE));
if ( amount == 0)
{
- nPointSize = -MulDiv(GetOptionsMgr()->GetInt(OPT_FONT_FILECMP + OPT_FONT_HEIGHT), 72, nLogPixelsY);
+ nPointSize = GetOptionsMgr()->GetInt(OPT_FONT_FILECMP + OPT_FONT_POINTSIZE);
+ if (nPointSize == 0)
+ nPointSize = -MulDiv(GetOptionsMgr()->GetInt(OPT_FONT_FILECMP + OPT_FONT_HEIGHT), 72, nLogPixelsY);
}
nPointSize += amount;
if (EnsureInDiff(pt))
SetCursorPos(pt);
- CPoint ptSelStart, ptSelEnd;
- GetSelection(ptSelStart, ptSelEnd);
+ auto [ptSelStart, ptSelEnd] = GetSelection();
if (EnsureInDiff(ptSelStart) || EnsureInDiff(ptSelEnd))
SetSelection(ptSelStart, ptSelEnd);
}