Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Docs/Manual/English/Command_line.xml
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@
<para>Specifies the type of window in which to display files.
This can be one of the keywords <userinput>Text</userinput>,
<userinput>Table</userinput>, <userinput>Binary</userinput>,
<userinput>Image</userinput> or <userinput>Webpage</userinput>.</para>
<userinput>Image</userinput>, <userinput>Webpage</userinput> or <userinput>Folder</userinput>.</para>
</listitem>
</varlistentry>

Expand Down
4 changes: 2 additions & 2 deletions Docs/Manual/French/Command_line.xml
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@ masque de filtre ou d'un nom contenant des espaces.</para>
<para>Spécifie le type de fenêtre dans laquelle afficher les fichiers. Cela peut
être l'un des mots-clés <userinput>Text</userinput> (Texte),
<userinput>Table</userinput> (Tableau), <userinput>Binary</userinput>
(Binaire), <userinput>Image</userinput> ou <userinput>Webpage</userinput>
(Page Web).</para>
(Binaire), <userinput>Image</userinput>, <userinput>Webpage</userinput>
(Page Web) ou <userinput>Folder</userinput>.</para>
</listitem>
</varlistentry>

Expand Down
4 changes: 2 additions & 2 deletions Docs/Manual/Hebrew/Command_line.xml
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ keywords <userinput>Full</userinput>, <userinput>Quick</userinput>,
<listitem>
<para>מציין את סוג החלון בו יוצגו קבצים. זה יכול להיות אחד ממילות המפתח
<userinput>Text</userinput>, <userinput>Table</userinput>,
<userinput>Binary</userinput>, <userinput>Image</userinput> או
<userinput>Webpage</userinput>.</para>
<userinput>Binary</userinput>, <userinput>Image</userinput>,
<userinput>Webpage</userinput> או <userinput>Folder</userinput>.</para>
</listitem>
</varlistentry>

Expand Down
9 changes: 5 additions & 4 deletions Docs/Manual/Italian/Command_line.xml
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,11 @@ delle parole chiave <userinput>Full</userinput>,

<term><option>/t <replaceable>tipo di finestra</replaceable></option></term>
<listitem>
<para>Specifica il tipo di finestra in cui visualizzare i file.Può essere una
delle parole chiave <userinput>Testo</userinput>,
<userinput>Tabella</userinput>, <userinput>Binario</userinput>,
<userinput>Immagine</userinput> o <userinput>Pagina Web</userinput>.</para>
<para>Specifica il tipo di finestra in cui visualizzare i file. Può essere una
delle parole chiave <userinput>Text</userinput>,
<userinput>Table</userinput>, <userinput>Binary</userinput>,
<userinput>Image</userinput>, <userinput>Webpage</userinput> o
<userinput>Folder</userinput>.</para>
</listitem>
</varlistentry>

Expand Down
3 changes: 2 additions & 1 deletion Docs/Manual/Japanese/Command_line.xml
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,8 @@ Devel</userinput>のようなファイルフィルターの名前です。スペ
<listitem>
<para>ファイルを表示するウィンドウの種類を指定します。次のキーワードが指定できます。 <userinput>Text</userinput>,
<userinput>Table</userinput>, <userinput>Binary</userinput>,
<userinput>Image</userinput>, <userinput>Webpage</userinput></para>
<userinput>Image</userinput>, <userinput>Webpage</userinput>,
<userinput>Folder</userinput></para>
</listitem>
</varlistentry>

Expand Down
12 changes: 12 additions & 0 deletions Src/7zCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -732,4 +732,16 @@ DecompressResult DecompressArchive(HWND hWnd, const PathContext& files)
return res;
}

void Merge7zInitFlags()
{
if (m_Merge7z.Merge7z[0])
return;
LANGID wLangID = (LANGID)GetThreadLocale();
DWORD flags = Merge7z::Initialize::Default | Merge7z::Initialize::Local7z | (wLangID << 16);
if (GetOptionsMgr()->GetBool(OPT_ARCHIVE_PROBETYPE))
{
flags |= Merge7z::Initialize::GuessFormatBySignature | Merge7z::Initialize::GuessFormatByExtension;
}
((interface Merge7z*)m_Merge7z.Merge7z[1])->Initialize(flags);
}

2 changes: 2 additions & 0 deletions Src/7zCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,5 @@ struct DecompressResult
HRESULT hr;
};
DecompressResult DecompressArchive(HWND hWnd, const PathContext& infiles);
void Merge7zInitFlags();

111 changes: 111 additions & 0 deletions Src/Common/ScopeExit.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
/**
* @file ScopeExit.h
*
* @brief std::scope_exit-like implementation (C++20 Library Fundamentals TS v3)
*
* This file provides a scope exit mechanism similar to std::scope_exit from
* the C++20 Library Fundamentals TS. It executes a function when leaving scope.
*
* Usage example:
* void foo() {
* FILE* file = fopen("test.txt", "r");
* auto guard = make_scope_exit([file] { if (file) fclose(file); });
*
* // ... use file ...
* // file will be automatically closed when leaving scope
* }
*
* With release():
* void bar() {
* auto guard = make_scope_exit([]{ cleanup(); });
* if (success) {
* guard.release(); // Don't execute cleanup
* }
* }
*/
#pragma once

#include <type_traits>
#include <utility>

/**
* @brief RAII wrapper that executes a function when going out of scope
*
* This class template is similar to std::experimental::scope_exit.
* The exit function is stored directly (not through std::function) for efficiency.
*
* @tparam EF The type of the exit function
*/
template<typename EF>
class scope_exit
{
public:
/**
* @brief Constructs a scope_exit from an exit function
* @param f Exit function to be executed on scope exit
*/
template<typename EFP,
typename = typename std::enable_if<
std::is_constructible<EF, EFP>::value &&
!std::is_same<typename std::remove_cv<typename std::remove_reference<EFP>::type>::type, scope_exit>::value
>::type>
explicit scope_exit(EFP&& f) noexcept(std::is_nothrow_constructible<EF, EFP>::value || std::is_nothrow_constructible<EF, EFP&>::value)
: m_exit_function(std::forward<EFP>(f))
, m_execute_on_destruction(true)
{
}

/**
* @brief Move constructor
*/
scope_exit(scope_exit&& other) noexcept(std::is_nothrow_move_constructible<EF>::value || std::is_nothrow_copy_constructible<EF>::value)
: m_exit_function(std::forward<EF>(other.m_exit_function))
, m_execute_on_destruction(other.m_execute_on_destruction)
{
other.release();
}

/**
* @brief Destructor - executes the exit function if active
*/
~scope_exit() noexcept
{
if (m_execute_on_destruction)
{
m_exit_function();
}
}

/**
* @brief Disables the execution of the exit function
*/
void release() noexcept
{
m_execute_on_destruction = false;
}

// Non-copyable and non-move-assignable
scope_exit(const scope_exit&) = delete;
scope_exit& operator=(const scope_exit&) = delete;
scope_exit& operator=(scope_exit&&) = delete;

private:
EF m_exit_function;
bool m_execute_on_destruction;
};

/**
* @brief Creates a scope_exit object, deducing the template argument type
*
* This is the recommended way to create scope_exit objects.
*
* @tparam EF The type of the exit function (deduced)
* @param f Exit function to be executed on scope exit
* @return scope_exit<EF> object
*/
template<typename EF>
scope_exit<typename std::remove_reference<EF>::type> make_scope_exit(EF&& f) noexcept(noexcept(scope_exit<typename std::remove_reference<EF>::type>(std::forward<EF>(f))))
{
return scope_exit<typename std::remove_reference<EF>::type>(std::forward<EF>(f));
}

3 changes: 2 additions & 1 deletion Src/DirDoc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -887,7 +887,8 @@ void CDirDoc::SetTitle(LPCTSTR lpszTitle)
{
String strPath = m_pCtxt->GetPath(index);
ApplyDisplayRoot(index, strPath);
sDirName[index] = paths::FindFileName(strPath);
const String& desc = m_strDesc[index];
sDirName[index] = desc.empty() ? paths::FindFileName(strPath) : desc;
}
if (std::count(&sDirName[0], &sDirName[0] + m_nDirs, sDirName[0]) == m_nDirs)
sTitle = sDirName[0] + strutils::format(_T(" x %d"), m_nDirs);
Expand Down
15 changes: 8 additions & 7 deletions Src/DirView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,9 @@ BEGIN_MESSAGE_MAP(CDirView, CListView)
ON_UPDATE_COMMAND_UI(ID_MERGE_COMPARE_LEFT2_RIGHT1, OnUpdateMergeCompare2<SELECTIONTYPE_LEFT2RIGHT1>)
ON_COMMAND(ID_MERGE_COMPARE_NONHORIZONTALLY, OnMergeCompareNonHorizontally)
// Context menu -> Compare As
ON_COMMAND_RANGE(ID_MERGE_COMPARE_TEXT, ID_MERGE_COMPARE_WEBPAGE, OnMergeCompareAs)
ON_COMMAND_RANGE(ID_MERGE_COMPARE_TEXT, ID_MERGE_COMPARE_FOLDER, OnMergeCompareAs)
ON_COMMAND_RANGE(ID_UNPACKERS_FIRST, ID_UNPACKERS_LAST, OnMergeCompareAs)
ON_UPDATE_COMMAND_UI_RANGE(ID_MERGE_COMPARE_TEXT, ID_MERGE_COMPARE_WEBPAGE, OnUpdateMergeCompare)
ON_UPDATE_COMMAND_UI_RANGE(ID_MERGE_COMPARE_TEXT, ID_MERGE_COMPARE_FOLDER, OnUpdateMergeCompare)
ON_UPDATE_COMMAND_UI(ID_NO_UNPACKER, OnUpdateNoUnpacker)
// Context menu -> Copy
ON_COMMAND(ID_DIR_COPY_LEFT_TO_RIGHT, (OnCtxtDirCopy<SIDE_LEFT, SIDE_RIGHT>))
Expand Down Expand Up @@ -726,8 +726,6 @@ void CDirView::OnContextMenu(CWnd*, CPoint point)
{
if (CMouseHook::IsRightWheelScrolling())
return;
if (GetListCtrl().GetItemCount() == 0)
return;
// Make sure window is active
GetParentFrame()->ActivateFrame();

Expand Down Expand Up @@ -769,6 +767,9 @@ void CDirView::OnContextMenu(CWnd*, CPoint point)
return;
}

if (GetListCtrl().GetItemCount() == 0)
return;

ListContextMenu(point, i);
}

Expand Down Expand Up @@ -4344,7 +4345,7 @@ void CDirView::OnUpdateOptionsShowMissingRightOnly(CCmdUI* pCmdUI)
*/
void CDirView::OnMergeCompare(UINT nID)
{
bool openableForDir = !((nID >= ID_MERGE_COMPARE_TEXT && nID <= ID_MERGE_COMPARE_WEBPAGE) ||
bool openableForDir = !((nID >= ID_MERGE_COMPARE_TEXT && nID <= ID_MERGE_COMPARE_FOLDER) ||
(nID >= ID_UNPACKERS_FIRST && nID <= ID_UNPACKERS_LAST));

if (AreItemsComparable(SELECTIONTYPE_NORMAL, openableForDir))
Expand Down Expand Up @@ -4489,7 +4490,7 @@ void CDirView::OnMergeCompareNonHorizontally()
*/
void CDirView::OnMergeCompareAs(UINT nID)
{
if (nID >= ID_MERGE_COMPARE_TEXT && nID <= ID_MERGE_COMPARE_WEBPAGE)
if (nID >= ID_MERGE_COMPARE_TEXT && nID <= ID_MERGE_COMPARE_FOLDER)
{
if (AreItemsComparable(SELECTIONTYPE_NORMAL, false))
{
Expand Down Expand Up @@ -4527,7 +4528,7 @@ void CDirView::OnMergeCompareAs(UINT nID)
*/
void CDirView::OnUpdateMergeCompare(CCmdUI *pCmdUI)
{
bool openableForDir = !((pCmdUI->m_nID >= ID_MERGE_COMPARE_TEXT && pCmdUI->m_nID <= ID_MERGE_COMPARE_WEBPAGE) ||
bool openableForDir = !((pCmdUI->m_nID >= ID_MERGE_COMPARE_TEXT && pCmdUI->m_nID <= ID_MERGE_COMPARE_FOLDER) ||
(pCmdUI->m_nID >= ID_UNPACKERS_FIRST && pCmdUI->m_nID <= ID_UNPACKERS_LAST));

bool bOn = AreItemsComparable(SELECTIONTYPE_NORMAL, openableForDir);
Expand Down
4 changes: 2 additions & 2 deletions Src/HexMergeDoc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ BEGIN_MESSAGE_MAP(CHexMergeDoc, CDocument)
ON_UPDATE_COMMAND_UI(ID_FILE_SAVE_MIDDLE, OnUpdateFileSaveMiddle)
ON_UPDATE_COMMAND_UI(ID_FILE_SAVE_RIGHT, OnUpdateFileSaveRight)
ON_COMMAND(ID_RESCAN, OnFileReload)
ON_COMMAND_RANGE(ID_MERGE_COMPARE_TEXT, ID_MERGE_COMPARE_WEBPAGE, OnFileRecompareAs)
ON_UPDATE_COMMAND_UI_RANGE(ID_MERGE_COMPARE_TEXT, ID_MERGE_COMPARE_WEBPAGE, OnUpdateFileRecompareAs)
ON_COMMAND_RANGE(ID_MERGE_COMPARE_TEXT, ID_MERGE_COMPARE_FOLDER, OnFileRecompareAs)
ON_UPDATE_COMMAND_UI_RANGE(ID_MERGE_COMPARE_TEXT, ID_MERGE_COMPARE_FOLDER, OnUpdateFileRecompareAs)
// [View] menu
ON_COMMAND(ID_VIEW_ZOOMIN, OnViewZoomIn)
ON_COMMAND(ID_VIEW_ZOOMOUT, OnViewZoomOut)
Expand Down
4 changes: 2 additions & 2 deletions Src/ImgMergeFrm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ BEGIN_MESSAGE_MAP(CImgMergeFrame, CMergeFrameCommon)
ON_COMMAND(ID_FILE_RIGHT_READONLY, OnFileReadOnlyRight)
ON_UPDATE_COMMAND_UI(ID_FILE_RIGHT_READONLY, OnUpdateFileReadOnlyRight)
ON_COMMAND(ID_RESCAN, OnFileReload)
ON_COMMAND_RANGE(ID_MERGE_COMPARE_TEXT, ID_MERGE_COMPARE_WEBPAGE, OnFileRecompareAs)
ON_UPDATE_COMMAND_UI_RANGE(ID_MERGE_COMPARE_TEXT, ID_MERGE_COMPARE_WEBPAGE, OnUpdateFileRecompareAs)
ON_COMMAND_RANGE(ID_MERGE_COMPARE_TEXT, ID_MERGE_COMPARE_FOLDER, OnFileRecompareAs)
ON_UPDATE_COMMAND_UI_RANGE(ID_MERGE_COMPARE_TEXT, ID_MERGE_COMPARE_FOLDER, OnUpdateFileRecompareAs)
// [Edit] menu
ON_COMMAND(ID_EDIT_UNDO, OnEditUndo)
ON_UPDATE_COMMAND_UI(ID_EDIT_UNDO, OnUpdateEditUndo)
Expand Down
Loading
Loading