diff options
Diffstat (limited to 'ui')
-rw-r--r-- | ui/IFileDialog_Vista/IFileDialog_Vista.vcxproj | 20 | ||||
-rw-r--r-- | ui/Taskbar_Seven/Taskbar_Seven.vcxproj | 20 | ||||
-rw-r--r-- | ui/batch_config.cpp | 10 | ||||
-rw-r--r-- | ui/batch_status_handler.cpp | 16 | ||||
-rw-r--r-- | ui/column_attr.h | 17 | ||||
-rw-r--r-- | ui/custom_grid.cpp | 29 | ||||
-rw-r--r-- | ui/custom_grid.h | 2 | ||||
-rw-r--r-- | ui/dir_name.cpp | 4 | ||||
-rw-r--r-- | ui/folder_pair.h | 6 | ||||
-rw-r--r-- | ui/grid_view.cpp | 36 | ||||
-rw-r--r-- | ui/gui_generated.cpp | 930 | ||||
-rw-r--r-- | ui/gui_generated.h | 179 | ||||
-rw-r--r-- | ui/gui_status_handler.cpp | 12 | ||||
-rw-r--r-- | ui/main_dlg.cpp | 580 | ||||
-rw-r--r-- | ui/main_dlg.h | 90 | ||||
-rw-r--r-- | ui/msg_popup.cpp | 4 | ||||
-rw-r--r-- | ui/progress_indicator.cpp | 238 | ||||
-rw-r--r-- | ui/search.cpp | 180 | ||||
-rw-r--r-- | ui/search.h | 10 | ||||
-rw-r--r-- | ui/small_dlgs.cpp | 42 | ||||
-rw-r--r-- | ui/sync_cfg.cpp | 43 | ||||
-rw-r--r-- | ui/tree_view.cpp | 61 | ||||
-rw-r--r-- | ui/tree_view.h | 14 | ||||
-rw-r--r-- | ui/triple_splitter.cpp | 35 |
24 files changed, 1292 insertions, 1286 deletions
diff --git a/ui/IFileDialog_Vista/IFileDialog_Vista.vcxproj b/ui/IFileDialog_Vista/IFileDialog_Vista.vcxproj index 31c87839..b1abe5a4 100644 --- a/ui/IFileDialog_Vista/IFileDialog_Vista.vcxproj +++ b/ui/IFileDialog_Vista/IFileDialog_Vista.vcxproj @@ -35,23 +35,23 @@ <ConfigurationType>DynamicLibrary</ConfigurationType> <CharacterSet>Unicode</CharacterSet> <WholeProgramOptimization>true</WholeProgramOptimization> - <PlatformToolset>Windows7.1SDK</PlatformToolset> + <PlatformToolset>v120_xp</PlatformToolset> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <ConfigurationType>DynamicLibrary</ConfigurationType> <CharacterSet>Unicode</CharacterSet> - <PlatformToolset>Windows7.1SDK</PlatformToolset> + <PlatformToolset>v120_xp</PlatformToolset> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <ConfigurationType>DynamicLibrary</ConfigurationType> <CharacterSet>Unicode</CharacterSet> <WholeProgramOptimization>true</WholeProgramOptimization> - <PlatformToolset>Windows7.1SDK</PlatformToolset> + <PlatformToolset>v120_xp</PlatformToolset> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> <ConfigurationType>DynamicLibrary</ConfigurationType> <CharacterSet>Unicode</CharacterSet> - <PlatformToolset>Windows7.1SDK</PlatformToolset> + <PlatformToolset>v120_xp</PlatformToolset> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <ImportGroup Label="ExtensionSettings"> @@ -93,7 +93,7 @@ <ClCompile> <Optimization>Disabled</Optimization> <PreprocessorDefinitions>ZEN_WIN;WXINTL_NO_GETTEXT_MACRO;_DEBUG;_WINDOWS;_USRDLL;IFILE_DIALOG_VISTA_DLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <MinimalRebuild>true</MinimalRebuild> + <MinimalRebuild>false</MinimalRebuild> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> <PrecompiledHeader> @@ -104,6 +104,7 @@ <DisableSpecificWarnings>4100</DisableSpecificWarnings> <AdditionalIncludeDirectories>../..</AdditionalIncludeDirectories> <SmallerTypeCheck>true</SmallerTypeCheck> + <MultiProcessorCompilation>true</MultiProcessorCompilation> </ClCompile> <Link> <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> @@ -129,7 +130,7 @@ <ClCompile> <Optimization>Disabled</Optimization> <PreprocessorDefinitions>ZEN_WIN;WXINTL_NO_GETTEXT_MACRO;_DEBUG;_WINDOWS;_USRDLL;IFILE_DIALOG_VISTA_DLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <MinimalRebuild>true</MinimalRebuild> + <MinimalRebuild>false</MinimalRebuild> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> <PrecompiledHeader> @@ -140,6 +141,7 @@ <DisableSpecificWarnings>4100</DisableSpecificWarnings> <AdditionalIncludeDirectories>../..</AdditionalIncludeDirectories> <SmallerTypeCheck>true</SmallerTypeCheck> + <MultiProcessorCompilation>true</MultiProcessorCompilation> </ClCompile> <Link> <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> @@ -175,11 +177,12 @@ <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> <AdditionalIncludeDirectories>../..</AdditionalIncludeDirectories> <SmallerTypeCheck>false</SmallerTypeCheck> + <MultiProcessorCompilation>true</MultiProcessorCompilation> </ClCompile> <Link> <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> <SuppressStartupBanner>true</SuppressStartupBanner> - <GenerateDebugInformation>false</GenerateDebugInformation> + <GenerateDebugInformation>true</GenerateDebugInformation> <SubSystem>Windows</SubSystem> <OptimizeReferences>true</OptimizeReferences> <EnableCOMDATFolding>true</EnableCOMDATFolding> @@ -214,11 +217,12 @@ <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> <AdditionalIncludeDirectories>../..</AdditionalIncludeDirectories> <SmallerTypeCheck>false</SmallerTypeCheck> + <MultiProcessorCompilation>true</MultiProcessorCompilation> </ClCompile> <Link> <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> <SuppressStartupBanner>true</SuppressStartupBanner> - <GenerateDebugInformation>false</GenerateDebugInformation> + <GenerateDebugInformation>true</GenerateDebugInformation> <SubSystem>Windows</SubSystem> <OptimizeReferences>true</OptimizeReferences> <EnableCOMDATFolding>true</EnableCOMDATFolding> diff --git a/ui/Taskbar_Seven/Taskbar_Seven.vcxproj b/ui/Taskbar_Seven/Taskbar_Seven.vcxproj index 02c4b67b..e7fec802 100644 --- a/ui/Taskbar_Seven/Taskbar_Seven.vcxproj +++ b/ui/Taskbar_Seven/Taskbar_Seven.vcxproj @@ -28,23 +28,23 @@ <ConfigurationType>DynamicLibrary</ConfigurationType> <CharacterSet>Unicode</CharacterSet> <WholeProgramOptimization>true</WholeProgramOptimization> - <PlatformToolset>Windows7.1SDK</PlatformToolset> + <PlatformToolset>v120_xp</PlatformToolset> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <ConfigurationType>DynamicLibrary</ConfigurationType> <CharacterSet>Unicode</CharacterSet> - <PlatformToolset>Windows7.1SDK</PlatformToolset> + <PlatformToolset>v120_xp</PlatformToolset> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <ConfigurationType>DynamicLibrary</ConfigurationType> <CharacterSet>Unicode</CharacterSet> <WholeProgramOptimization>true</WholeProgramOptimization> - <PlatformToolset>Windows7.1SDK</PlatformToolset> + <PlatformToolset>v120_xp</PlatformToolset> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> <ConfigurationType>DynamicLibrary</ConfigurationType> <CharacterSet>Unicode</CharacterSet> - <PlatformToolset>Windows7.1SDK</PlatformToolset> + <PlatformToolset>v120_xp</PlatformToolset> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <ImportGroup Label="ExtensionSettings"> @@ -86,7 +86,7 @@ <ClCompile> <Optimization>Disabled</Optimization> <PreprocessorDefinitions>ZEN_WIN;WXINTL_NO_GETTEXT_MACRO;_DEBUG;_WINDOWS;_USRDLL;TASKBAR_SEVEN_DLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <MinimalRebuild>true</MinimalRebuild> + <MinimalRebuild>false</MinimalRebuild> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> <PrecompiledHeader> @@ -97,6 +97,7 @@ <DisableSpecificWarnings>4100;4996</DisableSpecificWarnings> <AdditionalIncludeDirectories>../..</AdditionalIncludeDirectories> <SmallerTypeCheck>true</SmallerTypeCheck> + <MultiProcessorCompilation>true</MultiProcessorCompilation> </ClCompile> <Link> <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> @@ -121,7 +122,7 @@ <ClCompile> <Optimization>Disabled</Optimization> <PreprocessorDefinitions>ZEN_WIN;WXINTL_NO_GETTEXT_MACRO;_DEBUG;_WINDOWS;_USRDLL;TASKBAR_SEVEN_DLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <MinimalRebuild>true</MinimalRebuild> + <MinimalRebuild>false</MinimalRebuild> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> <PrecompiledHeader> @@ -132,6 +133,7 @@ <DisableSpecificWarnings>4100;4996</DisableSpecificWarnings> <AdditionalIncludeDirectories>../..</AdditionalIncludeDirectories> <SmallerTypeCheck>true</SmallerTypeCheck> + <MultiProcessorCompilation>true</MultiProcessorCompilation> </ClCompile> <Link> <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> @@ -164,11 +166,12 @@ <DisableSpecificWarnings>4100;4996</DisableSpecificWarnings> <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> <AdditionalIncludeDirectories>../..</AdditionalIncludeDirectories> + <MultiProcessorCompilation>true</MultiProcessorCompilation> </ClCompile> <Link> <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> <SuppressStartupBanner>true</SuppressStartupBanner> - <GenerateDebugInformation>false</GenerateDebugInformation> + <GenerateDebugInformation>true</GenerateDebugInformation> <SubSystem>Windows</SubSystem> <OptimizeReferences>true</OptimizeReferences> <EnableCOMDATFolding>true</EnableCOMDATFolding> @@ -201,11 +204,12 @@ <DisableSpecificWarnings>4100;4996</DisableSpecificWarnings> <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> <AdditionalIncludeDirectories>../..</AdditionalIncludeDirectories> + <MultiProcessorCompilation>true</MultiProcessorCompilation> </ClCompile> <Link> <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> <SuppressStartupBanner>true</SuppressStartupBanner> - <GenerateDebugInformation>false</GenerateDebugInformation> + <GenerateDebugInformation>true</GenerateDebugInformation> <SubSystem>Windows</SubSystem> <OptimizeReferences>true</OptimizeReferences> <EnableCOMDATFolding>true</EnableCOMDATFolding> diff --git a/ui/batch_config.cpp b/ui/batch_config.cpp index bf3436f1..1ccb1223 100644 --- a/ui/batch_config.cpp +++ b/ui/batch_config.cpp @@ -43,7 +43,7 @@ private: virtual void OnSaveBatchJob(wxCommandEvent& event); virtual void OnErrorPopup (wxCommandEvent& event) { localBatchCfg.handleError = ON_ERROR_POPUP; updateGui(); } virtual void OnErrorIgnore(wxCommandEvent& event) { localBatchCfg.handleError = ON_ERROR_IGNORE; updateGui(); } - virtual void OnErrorExit (wxCommandEvent& event) { localBatchCfg.handleError = ON_ERROR_EXIT; updateGui(); } + virtual void OnErrorAbort (wxCommandEvent& event) { localBatchCfg.handleError = ON_ERROR_ABORT; updateGui(); } virtual void OnToggleGenerateLogfile(wxCommandEvent& event) { updateGui(); } virtual void OnToggleLogfilesLimit (wxCommandEvent& event) { updateGui(); } @@ -76,6 +76,8 @@ BatchDialog::BatchDialog(wxWindow* parent, wxWindowUpdateLocker dummy(this); //avoid display distortion setRelativeFontSize(*m_staticTextHeader, 1.25); + m_staticTextDescr->SetLabel(replaceCpy(m_staticTextDescr->GetLabel(), L"%x", L"FreeFileSync.exe <" + _("job name") + L">.ffs_batch")); + m_comboBoxExecFinished->initHistory(onCompletionHistory, onCompletionHistoryMax); m_bpButtonHelp ->SetBitmapLabel(getResourceImage(L"help")); @@ -101,7 +103,7 @@ void BatchDialog::updateGui() //re-evaluate gui after config changes m_toggleBtnErrorIgnore->SetValue(false); m_toggleBtnErrorPopup ->SetValue(false); - m_toggleBtnErrorExit ->SetValue(false); + m_toggleBtnErrorAbort ->SetValue(false); switch (cfg.handleError) //*not* owned by GUI controls { case ON_ERROR_IGNORE: @@ -110,8 +112,8 @@ void BatchDialog::updateGui() //re-evaluate gui after config changes case ON_ERROR_POPUP: m_toggleBtnErrorPopup->SetValue(true); break; - case ON_ERROR_EXIT: - m_toggleBtnErrorExit->SetValue(true); + case ON_ERROR_ABORT: + m_toggleBtnErrorAbort->SetValue(true); break; } } diff --git a/ui/batch_status_handler.cpp b/ui/batch_status_handler.cpp index a72aab3e..3c916fdf 100644 --- a/ui/batch_status_handler.cpp +++ b/ui/batch_status_handler.cpp @@ -225,12 +225,12 @@ BatchStatusHandler::~BatchStatusHandler() if (!abortIsRequested()) //if aborted (manually), we don't execute the command { const std::wstring finalCommand = progressDlg->getExecWhenFinishedCommand(); //final value (after possible user modification) - if (isCloseProgressDlgCommand(finalCommand)) - showFinalResults = false; //take precedence over current visibility status - else if (!finalCommand.empty()) + if (!finalCommand.empty()) { - auto cmdexp = expandMacros(utfCvrtTo<Zstring>(finalCommand)); - shellExecute(cmdexp); + if (isCloseProgressDlgCommand(finalCommand)) + showFinalResults = false; //take precedence over current visibility status + else + shellExecute(expandMacros(utfCvrtTo<Zstring>(finalCommand))); } } @@ -329,7 +329,7 @@ void BatchStatusHandler::reportWarning(const std::wstring& warningMessage, bool& } break; //keep it! last switch might not find match - case xmlAccess::ON_ERROR_EXIT: //abort + case xmlAccess::ON_ERROR_ABORT: abortThisProcess(); break; @@ -374,7 +374,7 @@ ProcessCallback::Response BatchStatusHandler::reportError(const std::wstring& er } break; //used if last switch didn't find a match - case xmlAccess::ON_ERROR_EXIT: //abort + case xmlAccess::ON_ERROR_ABORT: abortThisProcess(); break; @@ -416,7 +416,7 @@ void BatchStatusHandler::reportFatalError(const std::wstring& errorMessage) } break; - case xmlAccess::ON_ERROR_EXIT: //abort + case xmlAccess::ON_ERROR_ABORT: abortThisProcess(); break; diff --git a/ui/column_attr.h b/ui/column_attr.h index 399f553b..070e6dd8 100644 --- a/ui/column_attr.h +++ b/ui/column_attr.h @@ -7,7 +7,6 @@ #ifndef COL_ATTR_HEADER_189467891346732143214 #define COL_ATTR_HEADER_189467891346732143214 -#include <stddef.h> //size_t #include <vector> namespace zen @@ -34,18 +33,18 @@ struct ColumnAttributeRim bool visible_; }; - +warn_static("two stretched oclumsn: hide vergrößert range!") inline std::vector<ColumnAttributeRim> getDefaultColumnAttributesLeft() { std::vector<ColumnAttributeRim> attr; - attr.push_back(ColumnAttributeRim(COL_TYPE_FULL_PATH, 250, 0, false)); - attr.push_back(ColumnAttributeRim(COL_TYPE_DIRECTORY, 200, 0, false)); - attr.push_back(ColumnAttributeRim(COL_TYPE_REL_PATH, 200, 0, true)); - attr.push_back(ColumnAttributeRim(COL_TYPE_FILENAME, -280, 1, true)); //stretch to full width and substract sum of fixed size widths! - attr.push_back(ColumnAttributeRim(COL_TYPE_DATE, 112, 0, false)); - attr.push_back(ColumnAttributeRim(COL_TYPE_SIZE, 80, 0, true)); - attr.push_back(ColumnAttributeRim(COL_TYPE_EXTENSION, 60, 0, false)); + attr.push_back(ColumnAttributeRim(COL_TYPE_FULL_PATH, 250, 0, false)); + attr.push_back(ColumnAttributeRim(COL_TYPE_DIRECTORY, 200, 0, false)); + attr.push_back(ColumnAttributeRim(COL_TYPE_REL_PATH, 200, 0, true)); + attr.push_back(ColumnAttributeRim(COL_TYPE_FILENAME, -280, 1, true)); //stretch to full width and substract sum of fixed size widths! + attr.push_back(ColumnAttributeRim(COL_TYPE_DATE, 112, 0, false)); + attr.push_back(ColumnAttributeRim(COL_TYPE_SIZE, 80, 0, true)); + attr.push_back(ColumnAttributeRim(COL_TYPE_EXTENSION, 60, 0, false)); return attr; } diff --git a/ui/custom_grid.cpp b/ui/custom_grid.cpp index 59e80100..d2188f22 100644 --- a/ui/custom_grid.cpp +++ b/ui/custom_grid.cpp @@ -166,6 +166,7 @@ public: GridDataBase(Grid& grid, const std::shared_ptr<const zen::GridView>& gridDataView) : grid_(grid), gridDataView_(gridDataView) {} void holdOwnership(const std::shared_ptr<GridEventManager>& evtMgr) { evtMgr_ = evtMgr; } + GridEventManager* getEventManager() { return evtMgr_.get(); } protected: Grid& refGrid() { return grid_; } @@ -557,7 +558,7 @@ private: } } - virtual size_t getBestSize(wxDC& dc, size_t row, ColumnType colType) + virtual int getBestSize(wxDC& dc, size_t row, ColumnType colType) { // Partitioning: // ________________________________ @@ -1011,9 +1012,9 @@ private: case COL_TYPE_CHECKBOX: break; case COL_TYPE_CMP_CATEGORY: - return _("Category"); + return _("Category") + L" (F9)"; case COL_TYPE_SYNC_ACTION: - return _("Action"); + return _("Action") + L" (F9)"; } return wxEmptyString; } @@ -1335,6 +1336,8 @@ public: ~GridEventManager() { assert(!scrollbarUpdatePending); } + void setScrollMaster(const Grid& grid) { scrollMaster = &grid; } + private: void onCenterSelectBegin(GridClickEvent& event) { @@ -1422,14 +1425,14 @@ private: void onResizeColumnL(GridColumnResizeEvent& event) { resizeOtherSide(gridL_, gridR_, event.colType_, event.offset_); } void onResizeColumnR(GridColumnResizeEvent& event) { resizeOtherSide(gridR_, gridL_, event.colType_, event.offset_); } - void resizeOtherSide(const Grid& src, Grid& trg, ColumnType type, ptrdiff_t offset) + void resizeOtherSide(const Grid& src, Grid& trg, ColumnType type, int offset) { //find stretch factor of resized column: type is unique due to makeConsistent()! std::vector<Grid::ColumnAttribute> cfgSrc = src.getColumnConfig(); auto it = std::find_if(cfgSrc.begin(), cfgSrc.end(), [&](Grid::ColumnAttribute& ca) { return ca.type_ == type; }); if (it == cfgSrc.end()) return; - const ptrdiff_t stretchSrc = it->stretch_; + const int stretchSrc = it->stretch_; //we do not propagate resizings on stretched columns to the other side: awkward user experience if (stretchSrc > 0) @@ -1706,11 +1709,23 @@ void gridview::refresh(Grid& gridLeft, Grid& gridCenter, Grid& gridRight) } +void gridview::setScrollMaster(Grid& grid) +{ + if (auto prov = dynamic_cast<GridDataBase*>(grid.getDataProvider())) + if (auto evtMgr = prov->getEventManager()) + { + evtMgr->setScrollMaster(grid); + return; + } + assert(false); +} + + void gridview::setNavigationMarker(Grid& gridLeft, hash_set<const FileSystemObject*>&& markedFilesAndLinks, hash_set<const HierarchyObject*>&& markedContainer) { - if (auto* provLeft = dynamic_cast<GridDataLeft*>(gridLeft.getDataProvider())) + if (auto provLeft = dynamic_cast<GridDataLeft*>(gridLeft.getDataProvider())) provLeft->setNavigationMarker(std::move(markedFilesAndLinks), std::move(markedContainer)); else assert(false); @@ -1720,7 +1735,7 @@ void gridview::setNavigationMarker(Grid& gridLeft, void gridview::highlightSyncAction(Grid& gridCenter, bool value) { - if (auto* provMiddle = dynamic_cast<GridDataMiddle*>(gridCenter.getDataProvider())) + if (auto provMiddle = dynamic_cast<GridDataMiddle*>(gridCenter.getDataProvider())) provMiddle->highlightSyncAction(value); else assert(false); diff --git a/ui/custom_grid.h b/ui/custom_grid.h index da6387f3..32beee01 100644 --- a/ui/custom_grid.h +++ b/ui/custom_grid.h @@ -29,6 +29,8 @@ void setupIcons(Grid& gridLeft, Grid& gridCenter, Grid& gridRight, bool show, Ic void clearSelection(Grid& gridLeft, Grid& gridCenter, Grid& gridRight); //clear all components void refresh(Grid& gridLeft, Grid& gridCenter, Grid& gridRight); +void setScrollMaster(Grid& grid); + //mark rows selected in navigation/compressed tree and navigate to leading object void setNavigationMarker(Grid& gridLeft, hash_set<const FileSystemObject*>&& markedFilesAndLinks,//mark files/symlinks directly within a container diff --git a/ui/dir_name.cpp b/ui/dir_name.cpp index 356b0888..cbaafe78 100644 --- a/ui/dir_name.cpp +++ b/ui/dir_name.cpp @@ -220,7 +220,7 @@ void DirectoryName<NameControl>::onSelectDir(wxCommandEvent& event) }; //some random GUID => have Windows save IFileDialog state separately from other file/dir pickers! showFolderPicker(static_cast<HWND>(selectButton_.GetHWND()), //in; ==HWND - defaultDirname.empty() ? nullptr : defaultDirname.c_str(), //in, optional! + defaultDirname.empty() ? static_cast<const wchar_t*>(nullptr) : defaultDirname.c_str(), //in, optional! &guid, selectedFolder, //out: call freeString() after use! cancelled, //out @@ -235,7 +235,7 @@ void DirectoryName<NameControl>::onSelectDir(wxCommandEvent& event) newFolder = make_unique<wxString>(selectedFolder); } } -#endif +#endif if (!newFolder.get()) { wxDirDialog dirPicker(&selectButton_, _("Select a folder"), defaultDirname); //put modal wxWidgets dialogs on stack: creating on freestore leads to memleak! diff --git a/ui/folder_pair.h b/ui/folder_pair.h index 11be1e8c..f677df4f 100644 --- a/ui/folder_pair.h +++ b/ui/folder_pair.h @@ -10,7 +10,7 @@ #include <wx/event.h> #include <wx/menu.h> #include <wx+/context_menu.h> -#include <wx+/button.h> +#include <wx+/bitmap_button.h> #include <wx+/image_tools.h> #include "dir_name.h" #include "small_dlgs.h" @@ -86,12 +86,12 @@ private: //test for Null-filter if (!isNullFilter(localFilter)) { - setImage(*basicPanel_.m_bpButtonLocalFilter, getResourceImage(L"filterSmall")); + setImage(*basicPanel_.m_bpButtonLocalFilter, getResourceImage(L"filter_small")); basicPanel_.m_bpButtonLocalFilter->SetToolTip(_("Filter is active")); } else { - setImage(*basicPanel_.m_bpButtonLocalFilter, greyScale(getResourceImage(L"filterSmall"))); + setImage(*basicPanel_.m_bpButtonLocalFilter, greyScale(getResourceImage(L"filter_small"))); basicPanel_.m_bpButtonLocalFilter->SetToolTip(_("No filter selected")); } } diff --git a/ui/grid_view.cpp b/ui/grid_view.cpp index fa1e9915..e1e16e47 100644 --- a/ui/grid_view.cpp +++ b/ui/grid_view.cpp @@ -297,34 +297,26 @@ void GridView::removeInvalidRows() class GridView::SerializeHierarchy { public: + static void execute(HierarchyObject& hierObj, std::vector<GridView::RefIndex>& sortedRef, size_t index) { SerializeHierarchy(sortedRef, index).recurse(hierObj); } + +private: SerializeHierarchy(std::vector<GridView::RefIndex>& sortedRef, size_t index) : index_(index), sortedRef_(sortedRef) {} - void execute(HierarchyObject& hierObj) - { - std::for_each(hierObj.refSubFiles().begin(), hierObj.refSubFiles().end(), *this); - std::for_each(hierObj.refSubLinks().begin(), hierObj.refSubLinks().end(), *this); - std::for_each(hierObj.refSubDirs ().begin(), hierObj.refSubDirs ().end(), *this); - } - - void operator()(FilePair& fileObj) - { - sortedRef_.push_back(RefIndex(index_, fileObj.getId())); - } - - void operator()(SymlinkPair& linkObj) - { - sortedRef_.push_back(RefIndex(index_, linkObj.getId())); - } - - void operator()(DirPair& dirObj) + void recurse(HierarchyObject& hierObj) { - sortedRef_.push_back(RefIndex(index_, dirObj.getId())); - execute(dirObj); //add recursion here to list sub-objects directly below parent! + for (FilePair& fileObj : hierObj.refSubFiles()) + sortedRef_.push_back(RefIndex(index_, fileObj.getId())); + for (SymlinkPair& linkObj : hierObj.refSubLinks()) + sortedRef_.push_back(RefIndex(index_, linkObj.getId())); + for (DirPair& dirObj : hierObj.refSubDirs()) + { + sortedRef_.push_back(RefIndex(index_, dirObj.getId())); + recurse(dirObj); //add recursion here to list sub-objects directly below parent! + } } -private: size_t index_; std::vector<GridView::RefIndex>& sortedRef_; }; @@ -345,7 +337,7 @@ void GridView::setData(FolderComparison& folderCmp) }); for (auto it = begin(folderCmp); it != end(folderCmp); ++it) - SerializeHierarchy(sortedRef, it - begin(folderCmp)).execute(*it); + SerializeHierarchy::execute(*it, sortedRef, it - begin(folderCmp)); } diff --git a/ui/gui_generated.cpp b/ui/gui_generated.cpp index 21f5f82d..19794897 100644 --- a/ui/gui_generated.cpp +++ b/ui/gui_generated.cpp @@ -5,14 +5,13 @@ // PLEASE DO "NOT" EDIT THIS FILE! /////////////////////////////////////////////////////////////////////////// -#include "../wx+/button.h" +#include "../wx+/bitmap_button.h" #include "../wx+/graph.h" #include "../wx+/grid.h" #include "../wx+/toggle_button.h" #include "exec_finished_box.h" #include "folder_history_box.h" #include "triple_splitter.h" -#include "wx_form_build_hide_warnings.h" #include "gui_generated.h" @@ -25,11 +24,6 @@ MainDialogGenerated::MainDialogGenerated( wxWindow* parent, wxWindowID id, const m_menubar1 = new wxMenuBar( 0 ); m_menuFile = new wxMenu(); m_menuItemNew = new wxMenuItem( m_menuFile, wxID_NEW, wxString( _("&New") ) + wxT('\t') + wxT("Ctrl+N"), wxEmptyString, wxITEM_NORMAL ); - #ifdef __WXMSW__ - m_menuItemNew->SetBitmaps( wxNullBitmap ); - #elif defined( __WXGTK__ ) - m_menuItemNew->SetBitmap( wxNullBitmap ); - #endif m_menuFile->Append( m_menuItemNew ); m_menuItemLoad = new wxMenuItem( m_menuFile, wxID_OPEN, wxString( _("&Open...") ) + wxT('\t') + wxT("Ctrl+O"), wxEmptyString, wxITEM_NORMAL ); @@ -47,19 +41,9 @@ MainDialogGenerated::MainDialogGenerated( wxWindow* parent, wxWindowID id, const m_menuFile->AppendSeparator(); m_menuItem10 = new wxMenuItem( m_menuFile, wxID_ANY, wxString( _("1. &Compare") ) + wxT('\t') + wxT("F5"), wxEmptyString, wxITEM_NORMAL ); - #ifdef __WXMSW__ - m_menuItem10->SetBitmaps( wxNullBitmap ); - #elif defined( __WXGTK__ ) - m_menuItem10->SetBitmap( wxNullBitmap ); - #endif m_menuFile->Append( m_menuItem10 ); - m_menuItem11 = new wxMenuItem( m_menuFile, wxID_ANY, wxString( _("2. &Synchronize") ) + wxT('\t') + wxT("F6"), wxEmptyString, wxITEM_NORMAL ); - #ifdef __WXMSW__ - m_menuItem11->SetBitmaps( wxNullBitmap ); - #elif defined( __WXGTK__ ) - m_menuItem11->SetBitmap( wxNullBitmap ); - #endif + m_menuItem11 = new wxMenuItem( m_menuFile, wxID_ANY, wxString( _("2. &Synchronize") ) + wxT('\t') + wxT("F8"), wxEmptyString, wxITEM_NORMAL ); m_menuFile->Append( m_menuItem11 ); m_menuFile->AppendSeparator(); @@ -80,7 +64,7 @@ MainDialogGenerated::MainDialogGenerated( wxWindow* parent, wxWindowID id, const m_menuItem5 = new wxMenuItem( m_menuTools, wxID_ANY, wxString( _("&Export file list...") ) , wxEmptyString, wxITEM_NORMAL ); m_menuTools->Append( m_menuItem5 ); - m_menuItemGlobSett = new wxMenuItem( m_menuTools, wxID_PREFERENCES, wxString( _("&Global settings...") ) , wxEmptyString, wxITEM_NORMAL ); + m_menuItemGlobSett = new wxMenuItem( m_menuTools, wxID_PREFERENCES, wxString( _("&Global settings") ) , wxEmptyString, wxITEM_NORMAL ); m_menuTools->Append( m_menuItemGlobSett ); m_menubar1->Append( m_menuTools, _("&Tools") ); @@ -116,80 +100,50 @@ MainDialogGenerated::MainDialogGenerated( wxWindow* parent, wxWindowID id, const bSizerTopButtons->Add( 15, 0, 0, wxALIGN_CENTER_VERTICAL, 5 ); - wxFlexGridSizer* fgSizer121; - fgSizer121 = new wxFlexGridSizer( 2, 2, 0, 0 ); - fgSizer121->SetFlexibleDirection( wxBOTH ); - fgSizer121->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - - m_staticTextCmpVariant = new wxStaticText( m_panelTopButtons, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextCmpVariant->Wrap( -1 ); - m_staticTextCmpVariant->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) ); - m_staticTextCmpVariant->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_GRAYTEXT ) ); - - fgSizer121->Add( m_staticTextCmpVariant, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL|wxTOP, 1 ); - - - fgSizer121->Add( 0, 0, 1, 0, 5 ); - - wxBoxSizer* bSizer30; - bSizer30 = new wxBoxSizer( wxHORIZONTAL ); + wxBoxSizer* bSizer1721; + bSizer1721 = new wxBoxSizer( wxHORIZONTAL ); - m_buttonCompare = new zen::BitmapButton( m_panelTopButtons, wxID_OK, _("Compare"), wxDefaultPosition, wxSize( 180,-1 ), 0 ); + m_buttonCompare = new zen::BitmapTextButton( m_panelTopButtons, wxID_ANY, _("Compare"), wxDefaultPosition, wxSize( -1,-1 ), 0 ); m_buttonCompare->SetDefault(); m_buttonCompare->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) ); m_buttonCompare->SetToolTip( _("dummy") ); - bSizer30->Add( m_buttonCompare, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + bSizer1721->Add( m_buttonCompare, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); - m_buttonCancel = new zen::BitmapButton( m_panelTopButtons, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxSize( 180,-1 ), 0 ); + m_buttonCancel = new zen::BitmapTextButton( m_panelTopButtons, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxSize( 180,-1 ), 0 ); m_buttonCancel->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) ); m_buttonCancel->Enable( false ); m_buttonCancel->Hide(); - bSizer30->Add( m_buttonCancel, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); - - - fgSizer121->Add( bSizer30, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + bSizer1721->Add( m_buttonCancel, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); m_bpButtonCmpConfig = new wxBitmapButton( m_panelTopButtons, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 46,46 ), wxBU_AUTODRAW ); - m_bpButtonCmpConfig->SetToolTip( _("Comparison settings") ); + m_bpButtonCmpConfig->SetToolTip( _("dummy") ); - fgSizer121->Add( m_bpButtonCmpConfig, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 3 ); + bSizer1721->Add( m_bpButtonCmpConfig, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 3 ); - bSizerTopButtons->Add( fgSizer121, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM, 5 ); + bSizerTopButtons->Add( bSizer1721, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 4 ); bSizerTopButtons->Add( 0, 0, 1, wxALIGN_CENTER_VERTICAL, 5 ); - wxFlexGridSizer* fgSizer12; - fgSizer12 = new wxFlexGridSizer( 2, 2, 0, 0 ); - fgSizer12->SetFlexibleDirection( wxBOTH ); - fgSizer12->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - - - fgSizer12->Add( 0, 0, 1, wxEXPAND, 5 ); - - m_staticTextSyncVariant = new wxStaticText( m_panelTopButtons, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextSyncVariant->Wrap( -1 ); - m_staticTextSyncVariant->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) ); - m_staticTextSyncVariant->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_GRAYTEXT ) ); - - fgSizer12->Add( m_staticTextSyncVariant, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxTOP, 1 ); + wxBoxSizer* bSizer1731; + bSizer1731 = new wxBoxSizer( wxHORIZONTAL ); m_bpButtonSyncConfig = new wxBitmapButton( m_panelTopButtons, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 46,46 ), wxBU_AUTODRAW ); - m_bpButtonSyncConfig->SetToolTip( _("Synchronization settings") ); + m_bpButtonSyncConfig->SetToolTip( _("dummy") ); - fgSizer12->Add( m_bpButtonSyncConfig, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 3 ); + bSizer1731->Add( m_bpButtonSyncConfig, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 3 ); - m_buttonSync = new zen::BitmapButton( m_panelTopButtons, wxID_ANY, _("Synchronize"), wxDefaultPosition, wxSize( 180,-1 ), 0 ); + m_buttonSync = new zen::BitmapTextButton( m_panelTopButtons, wxID_ANY, _("Synchronize"), wxDefaultPosition, wxSize( -1,-1 ), 0 ); m_buttonSync->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) ); m_buttonSync->SetToolTip( _("dummy") ); - fgSizer12->Add( m_buttonSync, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + bSizer1731->Add( m_buttonSync, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); - bSizerTopButtons->Add( fgSizer12, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM, 5 ); + bSizerTopButtons->Add( bSizer1731, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 4 ); bSizerTopButtons->Add( 15, 0, 0, wxALIGN_CENTER_VERTICAL, 5 ); @@ -422,7 +376,7 @@ MainDialogGenerated::MainDialogGenerated( wxWindow* parent, wxWindowID id, const bSizerStatusLeftFiles->Add( m_staticTextStatusLeftFiles, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - bSizerStatusLeftFiles->Add( 10, 0, 0, 0, 5 ); + bSizerStatusLeftFiles->Add( 4, 0, 0, 0, 5 ); m_staticTextStatusLeftBytes = new wxStaticText( m_panelStatusBar, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextStatusLeftBytes->Wrap( -1 ); @@ -497,7 +451,7 @@ MainDialogGenerated::MainDialogGenerated( wxWindow* parent, wxWindowID id, const bSizerStatusRightFiles->Add( m_staticTextStatusRightFiles, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - bSizerStatusRightFiles->Add( 10, 0, 0, 0, 5 ); + bSizerStatusRightFiles->Add( 4, 0, 0, 0, 5 ); m_staticTextStatusRightBytes = new wxStaticText( m_panelStatusBar, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextStatusRightBytes->Wrap( -1 ); @@ -536,6 +490,32 @@ MainDialogGenerated::MainDialogGenerated( wxWindow* parent, wxWindowID id, const bSizer1711->Fit( m_panelCenter ); bSizerPanelHolder->Add( m_panelCenter, 1, wxEXPAND, 5 ); + m_panelSearch = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + wxBoxSizer* bSizer1713; + bSizer1713 = new wxBoxSizer( wxHORIZONTAL ); + + m_bpButtonHideSearch = new wxBitmapButton( m_panelSearch, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 25,25 ), wxBU_AUTODRAW ); + m_bpButtonHideSearch->SetToolTip( _("Close search bar") ); + + bSizer1713->Add( m_bpButtonHideSearch, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); + + m_staticText101 = new wxStaticText( m_panelSearch, wxID_ANY, _("Find what:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText101->Wrap( -1 ); + bSizer1713->Add( m_staticText101, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_textCtrlSearchTxt = new wxTextCtrl( m_panelSearch, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 220,-1 ), 0|wxWANTS_CHARS ); + m_textCtrlSearchTxt->SetMaxLength( 0 ); + bSizer1713->Add( m_textCtrlSearchTxt, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); + + m_checkBoxMatchCase = new wxCheckBox( m_panelSearch, wxID_ANY, _("Match case"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer1713->Add( m_checkBoxMatchCase, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + + m_panelSearch->SetSizer( bSizer1713 ); + m_panelSearch->Layout(); + bSizer1713->Fit( m_panelSearch ); + bSizerPanelHolder->Add( m_panelSearch, 0, 0, 5 ); + m_panelConfig = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); bSizerConfig = new wxBoxSizer( wxHORIZONTAL ); @@ -560,7 +540,7 @@ MainDialogGenerated::MainDialogGenerated( wxWindow* parent, wxWindowID id, const bSizerConfig->Add( bSizer151, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - m_listBoxHistory = new wxListBox( m_panelConfig, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_EXTENDED|wxLB_NEEDED_SB|wxLB_SORT ); + m_listBoxHistory = new wxListBox( m_panelConfig, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_EXTENDED|wxLB_NEEDED_SB ); m_listBoxHistory->SetMinSize( wxSize( -1,40 ) ); bSizerConfig->Add( m_listBoxHistory, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); @@ -876,6 +856,8 @@ MainDialogGenerated::MainDialogGenerated( wxWindow* parent, wxWindowID id, const m_bpButtonAddPair->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnAddFolderPair ), NULL, this ); m_bpButtonRemovePair->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnRemoveTopFolderPair ), NULL, this ); m_bpButtonSwapSides->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSwapSides ), NULL, this ); + m_bpButtonHideSearch->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnHideSearchPanel ), NULL, this ); + m_textCtrlSearchTxt->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( MainDialogGenerated::OnSearchGridEnter ), NULL, this ); m_bpButtonOpen->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnConfigLoad ), NULL, this ); m_bpButtonSave->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnConfigSave ), NULL, this ); m_bpButtonBatchJob->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSaveAsBatchJob ), NULL, this ); @@ -944,6 +926,8 @@ MainDialogGenerated::~MainDialogGenerated() m_bpButtonAddPair->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnAddFolderPair ), NULL, this ); m_bpButtonRemovePair->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnRemoveTopFolderPair ), NULL, this ); m_bpButtonSwapSides->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSwapSides ), NULL, this ); + m_bpButtonHideSearch->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnHideSearchPanel ), NULL, this ); + m_textCtrlSearchTxt->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( MainDialogGenerated::OnSearchGridEnter ), NULL, this ); m_bpButtonOpen->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnConfigLoad ), NULL, this ); m_bpButtonSave->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnConfigSave ), NULL, this ); m_bpButtonBatchJob->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSaveAsBatchJob ), NULL, this ); @@ -1085,7 +1069,6 @@ CompareProgressDlgGenerated::CompareProgressDlgGenerated( wxWindow* parent, wxWi bSizer182 = new wxBoxSizer( wxVERTICAL ); m_textCtrlStatus = new wxTextCtrl( this, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, wxTE_READONLY ); - m_textCtrlStatus->SetMaxLength( 0 ); m_textCtrlStatus->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); bSizer182->Add( m_textCtrlStatus, 0, wxEXPAND, 5 ); @@ -1249,8 +1232,6 @@ SyncProgressPanelGenerated::SyncProgressPanelGenerated( wxWindow* parent, wxWind bSizer42->Add( m_staticTextPhase, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5 ); m_animCtrlSyncing = new wxAnimationCtrl( this, wxID_ANY, wxNullAnimation, wxDefaultPosition, wxSize( 32,32 ), wxAC_DEFAULT_STYLE ); - m_animCtrlSyncing->SetMinSize( wxSize( 32,32 ) ); - bSizer42->Add( m_animCtrlSyncing, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2 ); @@ -1733,7 +1714,7 @@ SyncConfirmationDlgGenerated::SyncConfirmationDlgGenerated( wxWindow* parent, wx wxBoxSizer* bSizer164; bSizer164 = new wxBoxSizer( wxVERTICAL ); - m_checkBoxDontShowAgain = new wxCheckBox( this, wxID_ANY, _("Don't show this dialog again"), wxDefaultPosition, wxDefaultSize, 0 ); + m_checkBoxDontShowAgain = new wxCheckBox( this, wxID_ANY, _("&Don't show this dialog again"), wxDefaultPosition, wxDefaultSize, 0 ); bSizer164->Add( m_checkBoxDontShowAgain, 0, wxALIGN_CENTER_HORIZONTAL|wxTOP|wxRIGHT|wxLEFT, 5 ); bSizerStdButtons = new wxBoxSizer( wxHORIZONTAL ); @@ -1927,48 +1908,111 @@ SyncCfgDlgGenerated::SyncCfgDlgGenerated( wxWindow* parent, wxWindowID id, const wxFlexGridSizer* fgSizer1; fgSizer1 = new wxFlexGridSizer( 4, 2, 6, 8 ); - fgSizer1->SetFlexibleDirection( wxHORIZONTAL ); + fgSizer1->SetFlexibleDirection( wxBOTH ); fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + wxBoxSizer* bSizer171; + bSizer171 = new wxBoxSizer( wxVERTICAL ); + + + bSizer171->Add( 0, 0, 1, wxEXPAND, 5 ); + m_toggleBtnTwoWay = new wxToggleButton( m_panel37, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); m_toggleBtnTwoWay->SetValue( true ); m_toggleBtnTwoWay->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) ); - fgSizer1->Add( m_toggleBtnTwoWay, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + bSizer171->Add( m_toggleBtnTwoWay, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + + + bSizer171->Add( 0, 0, 1, wxEXPAND, 5 ); + + + fgSizer1->Add( bSizer171, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); m_staticTextAutomatic = new wxStaticText( m_panel37, wxID_ANY, _("Identify and propagate changes on both sides. Deletions, moves and conflicts are detected automatically using a database."), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextAutomatic->Wrap( 480 ); fgSizer1->Add( m_staticTextAutomatic, 0, wxALIGN_CENTER_VERTICAL, 5 ); + wxBoxSizer* bSizer172; + bSizer172 = new wxBoxSizer( wxVERTICAL ); + + + bSizer172->Add( 0, 0, 1, wxEXPAND, 5 ); + m_toggleBtnMirror = new wxToggleButton( m_panel37, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); m_toggleBtnMirror->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) ); - fgSizer1->Add( m_toggleBtnMirror, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + bSizer172->Add( m_toggleBtnMirror, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + + + bSizer172->Add( 0, 0, 1, wxEXPAND, 5 ); + + + fgSizer1->Add( bSizer172, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); m_staticTextMirror = new wxStaticText( m_panel37, wxID_ANY, _("Mirror backup of left folder. Right folder is modified to exactly match left folder after synchronization."), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextMirror->Wrap( 480 ); fgSizer1->Add( m_staticTextMirror, 0, wxALIGN_CENTER_VERTICAL, 5 ); + wxBoxSizer* bSizer173; + bSizer173 = new wxBoxSizer( wxVERTICAL ); + + + bSizer173->Add( 0, 0, 1, wxEXPAND, 5 ); + m_toggleBtnUpdate = new wxToggleButton( m_panel37, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); m_toggleBtnUpdate->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) ); - fgSizer1->Add( m_toggleBtnUpdate, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + bSizer173->Add( m_toggleBtnUpdate, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + + + bSizer173->Add( 0, 0, 1, wxEXPAND, 5 ); + + + fgSizer1->Add( bSizer173, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); m_staticTextUpdate = new wxStaticText( m_panel37, wxID_ANY, _("Copy new or updated files to right folder."), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextUpdate->Wrap( 480 ); fgSizer1->Add( m_staticTextUpdate, 0, wxALIGN_CENTER_VERTICAL, 5 ); + wxBoxSizer* bSizer1741; + bSizer1741 = new wxBoxSizer( wxVERTICAL ); + + + bSizer1741->Add( 0, 0, 1, wxEXPAND, 5 ); + m_toggleBtnCustom = new wxToggleButton( m_panel37, wxID_ANY, _("Custom"), wxDefaultPosition, wxDefaultSize, 0 ); m_toggleBtnCustom->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) ); - fgSizer1->Add( m_toggleBtnCustom, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + bSizer1741->Add( m_toggleBtnCustom, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + + + bSizer1741->Add( 0, 0, 1, wxEXPAND, 5 ); + + + fgSizer1->Add( bSizer1741, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); m_staticTextCustom = new wxStaticText( m_panel37, wxID_ANY, _("Configure your own synchronization rules."), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextCustom->Wrap( 480 ); fgSizer1->Add( m_staticTextCustom, 0, wxALIGN_CENTER_VERTICAL, 5 ); - bSizer29->Add( fgSizer1, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + bSizer29->Add( fgSizer1, 0, wxRIGHT|wxLEFT, 5 ); + + wxBoxSizer* bSizer1751; + bSizer1751 = new wxBoxSizer( wxHORIZONTAL ); + + + bSizer1751->Add( 3, 0, 0, 0, 5 ); + + m_checkBoxDetectMove = new wxCheckBox( m_panel37, wxID_ANY, _("Detect moved files"), wxDefaultPosition, wxDefaultSize, 0 ); + m_checkBoxDetectMove->SetValue(true); + m_checkBoxDetectMove->SetToolTip( _("Requires database files. Not supported by all file systems.") ); + + bSizer1751->Add( m_checkBoxDetectMove, 1, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 ); + + + bSizer29->Add( bSizer1751, 0, wxEXPAND, 5 ); bSizerExtraConfig = new wxBoxSizer( wxVERTICAL ); @@ -2071,13 +2115,13 @@ SyncCfgDlgGenerated::SyncCfgDlgGenerated( wxWindow* parent, wxWindowID id, const bSizer180->Add( m_toggleBtnPermanent, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - m_toggleBtnRecycler = new wxToggleButton( m_panel37, wxID_ANY, _("Recycle Bin"), wxDefaultPosition, wxDefaultSize, 0 ); - m_toggleBtnRecycler->SetToolTip( _("Use Recycle Bin for deleted and overwritten files") ); + m_toggleBtnRecycler = new wxToggleButton( m_panel37, wxID_ANY, _("Recycle bin"), wxDefaultPosition, wxDefaultSize, 0 ); + m_toggleBtnRecycler->SetToolTip( _("Back up deleted and overwritten files in the recycle bin") ); bSizer180->Add( m_toggleBtnRecycler, 0, wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 ); m_toggleBtnVersioning = new wxToggleButton( m_panel37, wxID_ANY, _("Versioning"), wxDefaultPosition, wxDefaultSize, 0 ); - m_toggleBtnVersioning->SetToolTip( _("Move files to user-defined folder") ); + m_toggleBtnVersioning->SetToolTip( _("Move files to a user-defined folder") ); bSizer180->Add( m_toggleBtnVersioning, 0, wxALIGN_CENTER_VERTICAL, 5 ); @@ -2317,6 +2361,7 @@ SyncCfgDlgGenerated::SyncCfgDlgGenerated( wxWindow* parent, wxWindowID id, const m_toggleBtnUpdate->Connect( wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncUpdate ), NULL, this ); m_toggleBtnCustom->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( SyncCfgDlgGenerated::OnSyncCustomDouble ), NULL, this ); m_toggleBtnCustom->Connect( wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncCustom ), NULL, this ); + m_checkBoxDetectMove->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnToggleDetectMovedFiles ), NULL, this ); m_toggleBtnErrorIgnore->Connect( wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnErrorIgnore ), NULL, this ); m_toggleBtnErrorPopup->Connect( wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnErrorPopup ), NULL, this ); m_toggleBtnPermanent->Connect( wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnDeletionPermanent ), NULL, this ); @@ -2345,6 +2390,7 @@ SyncCfgDlgGenerated::~SyncCfgDlgGenerated() m_toggleBtnUpdate->Disconnect( wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncUpdate ), NULL, this ); m_toggleBtnCustom->Disconnect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( SyncCfgDlgGenerated::OnSyncCustomDouble ), NULL, this ); m_toggleBtnCustom->Disconnect( wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnSyncCustom ), NULL, this ); + m_checkBoxDetectMove->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnToggleDetectMovedFiles ), NULL, this ); m_toggleBtnErrorIgnore->Disconnect( wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnErrorIgnore ), NULL, this ); m_toggleBtnErrorPopup->Disconnect( wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnErrorPopup ), NULL, this ); m_toggleBtnPermanent->Disconnect( wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler( SyncCfgDlgGenerated::OnDeletionPermanent ), NULL, this ); @@ -2382,9 +2428,9 @@ BatchDlgGenerated::BatchDlgGenerated( wxWindow* parent, wxWindowID id, const wxS bSizer72->Add( m_staticTextHeader, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - m_staticText44 = new wxStaticText( this, wxID_ANY, _("Create a batch file to automate synchronization. Double-click this file or schedule in your system's task planner: FreeFileSync.exe <job name>.ffs_batch"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText44->Wrap( 520 ); - bSizer72->Add( m_staticText44, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); + m_staticTextDescr = new wxStaticText( this, wxID_ANY, _("Create a batch file for unattended synchronization. To start, double-click this file or schedule in a task planner: %x"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextDescr->Wrap( 520 ); + bSizer72->Add( m_staticTextDescr, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); bSizer72->Add( 0, 0, 1, wxEXPAND, 5 ); @@ -2429,10 +2475,10 @@ BatchDlgGenerated::BatchDlgGenerated( wxWindow* parent, wxWindowID id, const wxS bSizer169->Add( m_toggleBtnErrorPopup, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - m_toggleBtnErrorExit = new wxToggleButton( m_panel35, wxID_ANY, _("Exit"), wxDefaultPosition, wxDefaultSize, 0 ); - m_toggleBtnErrorExit->SetToolTip( _("Abort synchronization on first error") ); + m_toggleBtnErrorAbort = new wxToggleButton( m_panel35, wxID_ANY, _("Exit"), wxDefaultPosition, wxDefaultSize, 0 ); + m_toggleBtnErrorAbort->SetToolTip( _("Abort synchronization on first error") ); - bSizer169->Add( m_toggleBtnErrorExit, 0, wxALIGN_CENTER_VERTICAL, 5 ); + bSizer169->Add( m_toggleBtnErrorAbort, 0, wxALIGN_CENTER_VERTICAL, 5 ); bSizer171->Add( bSizer169, 0, wxALIGN_CENTER_VERTICAL, 5 ); @@ -2533,7 +2579,7 @@ BatchDlgGenerated::BatchDlgGenerated( wxWindow* parent, wxWindowID id, const wxS m_bpButtonHelp->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnHelp ), NULL, this ); m_toggleBtnErrorIgnore->Connect( wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnErrorIgnore ), NULL, this ); m_toggleBtnErrorPopup->Connect( wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnErrorPopup ), NULL, this ); - m_toggleBtnErrorExit->Connect( wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnErrorExit ), NULL, this ); + m_toggleBtnErrorAbort->Connect( wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnErrorAbort ), NULL, this ); m_checkBoxGenerateLogfile->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnToggleGenerateLogfile ), NULL, this ); m_checkBoxLogfilesLimit->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnToggleLogfilesLimit ), NULL, this ); m_buttonSaveAs->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnSaveBatchJob ), NULL, this ); @@ -2547,7 +2593,7 @@ BatchDlgGenerated::~BatchDlgGenerated() m_bpButtonHelp->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnHelp ), NULL, this ); m_toggleBtnErrorIgnore->Disconnect( wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnErrorIgnore ), NULL, this ); m_toggleBtnErrorPopup->Disconnect( wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnErrorPopup ), NULL, this ); - m_toggleBtnErrorExit->Disconnect( wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnErrorExit ), NULL, this ); + m_toggleBtnErrorAbort->Disconnect( wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnErrorAbort ), NULL, this ); m_checkBoxGenerateLogfile->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnToggleGenerateLogfile ), NULL, this ); m_checkBoxLogfilesLimit->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnToggleLogfilesLimit ), NULL, this ); m_buttonSaveAs->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnSaveBatchJob ), NULL, this ); @@ -2555,310 +2601,6 @@ BatchDlgGenerated::~BatchDlgGenerated() } -AboutDlgGenerated::AboutDlgGenerated( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) -{ - this->SetSizeHints( wxDefaultSize, wxDefaultSize ); - this->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) ); - - wxBoxSizer* bSizer31; - bSizer31 = new wxBoxSizer( wxVERTICAL ); - - m_panel41 = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - m_panel41->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); - - wxBoxSizer* bSizer162; - bSizer162 = new wxBoxSizer( wxVERTICAL ); - - m_bitmapLogo = new wxStaticBitmap( m_panel41, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), 0 ); - bSizer162->Add( m_bitmapLogo, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_staticline341 = new wxStaticLine( m_panel41, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - bSizer162->Add( m_staticline341, 0, wxEXPAND, 5 ); - - m_build = new wxStaticText( m_panel41, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); - m_build->Wrap( -1 ); - bSizer162->Add( m_build, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - - m_staticline3411 = new wxStaticLine( m_panel41, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - bSizer162->Add( m_staticline3411, 0, wxEXPAND, 5 ); - - m_staticText72 = new wxStaticText( m_panel41, wxID_ANY, _("Source code written in C++ using:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText72->Wrap( -1 ); - m_staticText72->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) ); - - bSizer162->Add( m_staticText72, 0, wxALL, 5 ); - - wxBoxSizer* bSizer171; - bSizer171 = new wxBoxSizer( wxHORIZONTAL ); - - m_hyperlink11 = new wxHyperlinkCtrl( m_panel41, wxID_ANY, _("MS Visual C++"), wxT("http://msdn.microsoft.com/library/60k1461a.aspx"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); - m_hyperlink11->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); - m_hyperlink11->SetToolTip( _("http://msdn.microsoft.com/library/60k1461a.aspx") ); - - bSizer171->Add( m_hyperlink11, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - - m_hyperlink9 = new wxHyperlinkCtrl( m_panel41, wxID_ANY, _("MinGW"), wxT("http://www.mingw.org"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); - m_hyperlink9->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); - m_hyperlink9->SetToolTip( _("http://www.mingw.org") ); - - bSizer171->Add( m_hyperlink9, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - - m_hyperlink10 = new wxHyperlinkCtrl( m_panel41, wxID_ANY, _("Code::Blocks"), wxT("http://www.codeblocks.org"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); - m_hyperlink10->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); - m_hyperlink10->SetToolTip( _("http://www.codeblocks.org") ); - - bSizer171->Add( m_hyperlink10, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - - m_hyperlink7 = new wxHyperlinkCtrl( m_panel41, wxID_ANY, _("wxWidgets"), wxT("http://www.wxwidgets.org"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); - m_hyperlink7->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); - m_hyperlink7->SetToolTip( _("http://www.wxwidgets.org") ); - - bSizer171->Add( m_hyperlink7, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - - m_hyperlink14 = new wxHyperlinkCtrl( m_panel41, wxID_ANY, _("wxFormBuilder"), wxT("http://wxformbuilder.org"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); - m_hyperlink14->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); - m_hyperlink14->SetToolTip( _("http://wxformbuilder.org") ); - - bSizer171->Add( m_hyperlink14, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - - bSizer162->Add( bSizer171, 0, wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - - wxBoxSizer* bSizer172; - bSizer172 = new wxBoxSizer( wxHORIZONTAL ); - - m_hyperlink15 = new wxHyperlinkCtrl( m_panel41, wxID_ANY, _("zen::Xml"), wxT("http://zenxml.sourceforge.net"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); - m_hyperlink15->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); - m_hyperlink15->SetToolTip( _("http://zenxml.sourceforge.net") ); - - bSizer172->Add( m_hyperlink15, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - - m_hyperlink13 = new wxHyperlinkCtrl( m_panel41, wxID_ANY, _("Boost"), wxT("http://www.boost.org"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); - m_hyperlink13->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); - m_hyperlink13->SetToolTip( _("http://www.boost.org") ); - - bSizer172->Add( m_hyperlink13, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - - m_hyperlink16 = new wxHyperlinkCtrl( m_panel41, wxID_ANY, _("Artistic Style"), wxT("http://astyle.sourceforge.net"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); - m_hyperlink16->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); - m_hyperlink16->SetToolTip( _("http://astyle.sourceforge.net") ); - - bSizer172->Add( m_hyperlink16, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - - m_hyperlink12 = new wxHyperlinkCtrl( m_panel41, wxID_ANY, _("Google Test"), wxT("http://code.google.com/p/googletest"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); - m_hyperlink12->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); - m_hyperlink12->SetToolTip( _("http://code.google.com/p/googletest") ); - - bSizer172->Add( m_hyperlink12, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - - m_hyperlink18 = new wxHyperlinkCtrl( m_panel41, wxID_ANY, _("Unicode NSIS"), wxT("http://www.scratchpaper.com"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); - m_hyperlink18->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); - m_hyperlink18->SetToolTip( _("http://www.scratchpaper.com") ); - - bSizer172->Add( m_hyperlink18, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - - bSizer162->Add( bSizer172, 0, wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - - m_panel40 = new wxPanel( m_panel41, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - m_panel40->SetBackgroundColour( wxColour( 153, 170, 187 ) ); - - wxBoxSizer* bSizer183; - bSizer183 = new wxBoxSizer( wxVERTICAL ); - - m_panel39 = new wxPanel( m_panel40, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - m_panel39->SetBackgroundColour( wxColour( 221, 221, 255 ) ); - - wxBoxSizer* bSizer184; - bSizer184 = new wxBoxSizer( wxHORIZONTAL ); - - wxBoxSizer* bSizer178; - bSizer178 = new wxBoxSizer( wxVERTICAL ); - - m_staticText83 = new wxStaticText( m_panel39, wxID_ANY, _("If you like FreeFileSync"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText83->Wrap( -1 ); - m_staticText83->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 93, 92, false, wxEmptyString ) ); - m_staticText83->SetForegroundColour( wxColour( 0, 0, 0 ) ); - - bSizer178->Add( m_staticText83, 0, wxALL, 5 ); - - m_buttonDonate = new wxButton( m_panel39, wxID_ANY, _("Donate with PayPal"), wxDefaultPosition, wxDefaultSize, 0 ); - m_buttonDonate->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 90, false, wxEmptyString ) ); - m_buttonDonate->SetToolTip( _("https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=zenju@gmx.de&no_shipping=1&lc=US¤cy_code=EUR") ); - - bSizer178->Add( m_buttonDonate, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_RIGHT, 5 ); - - - bSizer184->Add( bSizer178, 1, wxALIGN_CENTER_VERTICAL, 5 ); - - m_animCtrlWink = new wxAnimationCtrl( m_panel39, wxID_ANY, wxNullAnimation, wxDefaultPosition, wxSize( -1,-1 ), wxAC_DEFAULT_STYLE ); - bSizer184->Add( m_animCtrlWink, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - - m_panel39->SetSizer( bSizer184 ); - m_panel39->Layout(); - bSizer184->Fit( m_panel39 ); - bSizer183->Add( m_panel39, 0, wxEXPAND|wxALL, 5 ); - - - m_panel40->SetSizer( bSizer183 ); - m_panel40->Layout(); - bSizer183->Fit( m_panel40 ); - bSizer162->Add( m_panel40, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); - - m_scrolledWindowTranslators = new wxScrolledWindow( m_panel41, wxID_ANY, wxDefaultPosition, wxSize( -1,-1 ), wxHSCROLL|wxVSCROLL ); - m_scrolledWindowTranslators->SetScrollRate( 10, 10 ); - m_scrolledWindowTranslators->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); - m_scrolledWindowTranslators->SetMinSize( wxSize( -1,180 ) ); - - bSizerTranslators = new wxBoxSizer( wxVERTICAL ); - - m_staticText54 = new wxStaticText( m_scrolledWindowTranslators, wxID_ANY, _("Many thanks for localization:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText54->Wrap( -1 ); - m_staticText54->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) ); - - bSizerTranslators->Add( m_staticText54, 0, wxALIGN_CENTER_HORIZONTAL|wxTOP|wxBOTTOM, 5 ); - - - bSizerTranslators->Add( 0, 5, 0, 0, 5 ); - - fgSizerTranslators = new wxFlexGridSizer( 50, 3, 2, 20 ); - fgSizerTranslators->SetFlexibleDirection( wxBOTH ); - fgSizerTranslators->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - - - bSizerTranslators->Add( fgSizerTranslators, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); - - - m_scrolledWindowTranslators->SetSizer( bSizerTranslators ); - m_scrolledWindowTranslators->Layout(); - bSizerTranslators->Fit( m_scrolledWindowTranslators ); - bSizer162->Add( m_scrolledWindowTranslators, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); - - m_staticline43 = new wxStaticLine( m_panel41, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - bSizer162->Add( m_staticline43, 0, wxEXPAND, 5 ); - - m_staticText94 = new wxStaticText( m_panel41, wxID_ANY, _("Feedback and suggestions are welcome"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText94->Wrap( -1 ); - bSizer162->Add( m_staticText94, 0, wxALL, 5 ); - - wxBoxSizer* bSizer166; - bSizer166 = new wxBoxSizer( wxHORIZONTAL ); - - wxBoxSizer* bSizer170; - bSizer170 = new wxBoxSizer( wxHORIZONTAL ); - - - bSizer170->Add( 0, 0, 1, wxEXPAND, 5 ); - - m_hyperlink1 = new wxHyperlinkCtrl( m_panel41, wxID_ANY, _("Homepage"), wxT("http://freefilesync.sourceforge.net/"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); - m_hyperlink1->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, true, wxEmptyString ) ); - m_hyperlink1->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); - m_hyperlink1->SetToolTip( _("http://freefilesync.sourceforge.net/") ); - - bSizer170->Add( m_hyperlink1, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_bitmap9 = new wxStaticBitmap( m_panel41, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), 0 ); - bSizer170->Add( m_bitmap9, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); - - - bSizer170->Add( 0, 0, 1, wxEXPAND, 5 ); - - - bSizer166->Add( bSizer170, 1, wxALIGN_CENTER_VERTICAL, 5 ); - - wxBoxSizer* bSizer1711; - bSizer1711 = new wxBoxSizer( wxHORIZONTAL ); - - - bSizer1711->Add( 0, 0, 1, wxEXPAND, 5 ); - - m_hyperlink2 = new wxHyperlinkCtrl( m_panel41, wxID_ANY, _("Email"), wxT("mailto:zenju@gmx.de"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); - m_hyperlink2->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, true, wxEmptyString ) ); - m_hyperlink2->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); - m_hyperlink2->SetToolTip( _("zenju@gmx.de") ); - - bSizer1711->Add( m_hyperlink2, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_bitmap10 = new wxStaticBitmap( m_panel41, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), 0 ); - bSizer1711->Add( m_bitmap10, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); - - - bSizer1711->Add( 0, 0, 1, wxEXPAND, 5 ); - - - bSizer166->Add( bSizer1711, 1, wxALIGN_CENTER_VERTICAL, 5 ); - - - bSizer162->Add( bSizer166, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - - m_staticline34 = new wxStaticLine( m_panel41, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - bSizer162->Add( m_staticline34, 0, wxEXPAND, 5 ); - - m_staticText93 = new wxStaticText( m_panel41, wxID_ANY, _("Published under the GNU General Public License"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText93->Wrap( -1 ); - bSizer162->Add( m_staticText93, 0, wxALL, 5 ); - - wxBoxSizer* bSizer1671; - bSizer1671 = new wxBoxSizer( wxHORIZONTAL ); - - - bSizer1671->Add( 0, 0, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); - - m_bitmap13 = new wxStaticBitmap( m_panel41, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), 0 ); - bSizer1671->Add( m_bitmap13, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - - m_hyperlink5 = new wxHyperlinkCtrl( m_panel41, wxID_ANY, _("http://www.gnu.org/licenses/gpl.html"), wxT("http://www.gnu.org/licenses/gpl.html"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); - m_hyperlink5->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); - - bSizer1671->Add( m_hyperlink5, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - - - bSizer1671->Add( 0, 0, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); - - - bSizer162->Add( bSizer1671, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - - - m_panel41->SetSizer( bSizer162 ); - m_panel41->Layout(); - bSizer162->Fit( m_panel41 ); - bSizer31->Add( m_panel41, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); - - m_staticline36 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - bSizer31->Add( m_staticline36, 0, wxEXPAND, 5 ); - - bSizerStdButtons = new wxBoxSizer( wxHORIZONTAL ); - - m_buttonClose = new wxButton( this, wxID_OK, _("Close"), wxDefaultPosition, wxSize( -1,30 ), 0 ); - m_buttonClose->SetDefault(); - bSizerStdButtons->Add( m_buttonClose, 0, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5 ); - - - bSizer31->Add( bSizerStdButtons, 0, wxALIGN_RIGHT, 5 ); - - - this->SetSizer( bSizer31 ); - this->Layout(); - bSizer31->Fit( this ); - - this->Centre( wxBOTH ); - - // Connect Events - this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( AboutDlgGenerated::OnClose ) ); - m_buttonDonate->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( AboutDlgGenerated::OnDonate ), NULL, this ); - m_buttonClose->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( AboutDlgGenerated::OnOK ), NULL, this ); -} - -AboutDlgGenerated::~AboutDlgGenerated() -{ - // Disconnect Events - this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( AboutDlgGenerated::OnClose ) ); - m_buttonDonate->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( AboutDlgGenerated::OnDonate ), NULL, this ); - m_buttonClose->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( AboutDlgGenerated::OnOK ), NULL, this ); - -} - MessageDlgGenerated::MessageDlgGenerated( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) { this->SetSizeHints( wxSize( 300,160 ), wxDefaultSize ); @@ -2883,7 +2625,6 @@ MessageDlgGenerated::MessageDlgGenerated( wxWindow* parent, wxWindowID id, const bSizer26->Add( m_bitmapMsgType, 0, wxRIGHT|wxLEFT, 10 ); m_textCtrlMessage = new wxTextCtrl( m_panel33, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 420,150 ), wxTE_MULTILINE|wxTE_READONLY|wxNO_BORDER ); - m_textCtrlMessage->SetMaxLength( 0 ); bSizer26->Add( m_textCtrlMessage, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP, 5 ); @@ -2981,7 +2722,6 @@ DeleteDlgGenerated::DeleteDlgGenerated( wxWindow* parent, wxWindowID id, const w bSizer160->Add( 0, 10, 0, 0, 5 ); m_textCtrlFileList = new wxTextCtrl( m_panel31, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 520,200 ), wxTE_DONTWRAP|wxTE_MULTILINE|wxTE_READONLY|wxSTATIC_BORDER ); - m_textCtrlFileList->SetMaxLength( 0 ); bSizer160->Add( m_textCtrlFileList, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); @@ -3004,7 +2744,7 @@ DeleteDlgGenerated::DeleteDlgGenerated( wxWindow* parent, wxWindowID id, const w wxBoxSizer* bSizer99; bSizer99 = new wxBoxSizer( wxVERTICAL ); - m_checkBoxUseRecycler = new wxCheckBox( this, wxID_ANY, _("Recycle Bin"), wxDefaultPosition, wxDefaultSize, 0 ); + m_checkBoxUseRecycler = new wxCheckBox( this, wxID_ANY, _("Recycle bin"), wxDefaultPosition, wxDefaultSize, 0 ); bSizer99->Add( m_checkBoxUseRecycler, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 5 ); m_checkBoxDeleteBothSides = new wxCheckBox( this, wxID_ANY, _("Delete on both sides"), wxDefaultPosition, wxDefaultSize, 0 ); @@ -3074,7 +2814,7 @@ FilterDlgGenerated::FilterDlgGenerated( wxWindow* parent, wxWindowID id, const w bSizer72->Add( m_staticTextHeader, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - m_staticText44 = new wxStaticText( this, wxID_ANY, _("Only files that match all filter settings will be synchronized.\nNote: File names must be relative to base directories."), wxDefaultPosition, wxSize( -1,-1 ), 0 ); + m_staticText44 = new wxStaticText( this, wxID_ANY, _("Files will only be synchronized if they pass all filter rules.\nNote: File paths must be relative to base directories."), wxDefaultPosition, wxSize( -1,-1 ), 0 ); m_staticText44->Wrap( 500 ); bSizer72->Add( m_staticText44, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); @@ -3112,7 +2852,6 @@ FilterDlgGenerated::FilterDlgGenerated( wxWindow* parent, wxWindowID id, const w bSizer1661->Add( m_bitmapInclude, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL|wxTOP|wxBOTTOM|wxRIGHT, 5 ); m_textCtrlInclude = new wxTextCtrl( m_panel38, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,-1 ), wxTE_MULTILINE ); - m_textCtrlInclude->SetMaxLength( 0 ); bSizer1661->Add( m_textCtrlInclude, 1, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); @@ -3132,7 +2871,6 @@ FilterDlgGenerated::FilterDlgGenerated( wxWindow* parent, wxWindowID id, const w bSizer1651->Add( m_bitmapExclude, 0, wxALIGN_CENTER_HORIZONTAL|wxTOP|wxBOTTOM|wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 ); m_textCtrlExclude = new wxTextCtrl( m_panel38, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,-1 ), wxTE_MULTILINE ); - m_textCtrlExclude->SetMaxLength( 0 ); bSizer1651->Add( m_textCtrlExclude, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL, 5 ); @@ -3338,7 +3076,7 @@ GlobalSettingsDlgGenerated::GlobalSettingsDlgGenerated( wxWindow* parent, wxWind m_checkBoxTransCopy = new wxCheckBox( m_panel39, wxID_ANY, _("Fail-safe file copy"), wxDefaultPosition, wxDefaultSize, 0 ); bSizer160->Add( m_checkBoxTransCopy, 0, wxALL|wxEXPAND, 5 ); - m_staticText82 = new wxStaticText( m_panel39, wxID_ANY, _("Write to a temporary file (*.ffs_tmp) first then rename it. This guarantees a consistent state even in case of fatal error."), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText82 = new wxStaticText( m_panel39, wxID_ANY, _("Copy to a temporary file (*.ffs_tmp) first then rename it. This guarantees a consistent state even in case of a fatal error."), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText82->Wrap( 460 ); m_staticText82->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_GRAYTEXT ) ); @@ -3347,7 +3085,7 @@ GlobalSettingsDlgGenerated::GlobalSettingsDlgGenerated( wxWindow* parent, wxWind m_checkBoxCopyLocked = new wxCheckBox( m_panel39, wxID_ANY, _("Copy locked files"), wxDefaultPosition, wxDefaultSize, 0 ); bSizer160->Add( m_checkBoxCopyLocked, 0, wxALL|wxEXPAND, 5 ); - m_staticTextCopyLocked = new wxStaticText( m_panel39, wxID_ANY, _("Copy shared or locked files using Volume Shadow Copy Service (Requires Administrator rights)"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextCopyLocked = new wxStaticText( m_panel39, wxID_ANY, _("Copy shared or locked files using the Volume Shadow Copy Service (requires administrator rights)"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextCopyLocked->Wrap( 460 ); m_staticTextCopyLocked->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_GRAYTEXT ) ); @@ -3356,7 +3094,7 @@ GlobalSettingsDlgGenerated::GlobalSettingsDlgGenerated( wxWindow* parent, wxWind m_checkBoxCopyPermissions = new wxCheckBox( m_panel39, wxID_ANY, _("Copy file access permissions"), wxDefaultPosition, wxDefaultSize, 0 ); bSizer160->Add( m_checkBoxCopyPermissions, 0, wxALL|wxEXPAND, 5 ); - m_staticText8211 = new wxStaticText( m_panel39, wxID_ANY, _("Transfer file and folder permissions (Requires Administrator rights)"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText8211 = new wxStaticText( m_panel39, wxID_ANY, _("Transfer file and folder permissions (requires administrator rights)"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText8211->Wrap( 460 ); m_staticText8211->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_GRAYTEXT ) ); @@ -3368,7 +3106,7 @@ GlobalSettingsDlgGenerated::GlobalSettingsDlgGenerated( wxWindow* parent, wxWind m_staticline191 = new wxStaticLine( m_panel39, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); bSizer166->Add( m_staticline191, 0, wxEXPAND|wxTOP, 5 ); - m_buttonResetDialogs = new zen::BitmapButton( m_panel39, wxID_ANY, _("Restore hidden dialogs"), wxDefaultPosition, wxSize( -1,-1 ), 0 ); + m_buttonResetDialogs = new zen::BitmapTextButton( m_panel39, wxID_ANY, _("Restore hidden dialogs"), wxDefaultPosition, wxSize( -1,-1 ), 0 ); bSizer166->Add( m_buttonResetDialogs, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL|wxALL, 5 ); m_staticline192 = new wxStaticLine( m_panel39, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); @@ -3424,7 +3162,7 @@ GlobalSettingsDlgGenerated::GlobalSettingsDlgGenerated( wxWindow* parent, wxWind bSizer173->Add( m_gridCustomCommand, 1, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); - bSizer166->Add( bSizer173, 1, wxEXPAND|wxALIGN_CENTER_HORIZONTAL, 5 ); + bSizer166->Add( bSizer173, 1, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxBOTTOM, 5 ); m_panel39->SetSizer( bSizer166 ); @@ -3509,78 +3247,6 @@ PopupDialogGenerated::~PopupDialogGenerated() { } -SearchDialogGenerated::SearchDialogGenerated( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) -{ - this->SetSizeHints( wxDefaultSize, wxDefaultSize ); - - wxBoxSizer* bSizer161; - bSizer161 = new wxBoxSizer( wxHORIZONTAL ); - - wxBoxSizer* bSizer166; - bSizer166 = new wxBoxSizer( wxVERTICAL ); - - wxBoxSizer* bSizer162; - bSizer162 = new wxBoxSizer( wxHORIZONTAL ); - - m_staticText101 = new wxStaticText( this, wxID_ANY, _("Find what:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText101->Wrap( -1 ); - bSizer162->Add( m_staticText101, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); - - m_textCtrlSearchTxt = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 220,-1 ), 0 ); - m_textCtrlSearchTxt->SetMaxLength( 0 ); - bSizer162->Add( m_textCtrlSearchTxt, 1, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 ); - - - bSizer166->Add( bSizer162, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); - - - bSizer166->Add( 0, 5, 0, 0, 5 ); - - m_checkBoxMatchCase = new wxCheckBox( this, wxID_ANY, _("Match case"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizer166->Add( m_checkBoxMatchCase, 0, wxEXPAND|wxALL, 5 ); - - - bSizer161->Add( bSizer166, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); - - wxBoxSizer* bSizer97; - bSizer97 = new wxBoxSizer( wxVERTICAL ); - - m_buttonFindNext = new wxButton( this, wxID_OK, _("&Find next"), wxDefaultPosition, wxSize( -1,30 ), 0 ); - m_buttonFindNext->SetDefault(); - m_buttonFindNext->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) ); - - bSizer97->Add( m_buttonFindNext, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); - - m_button29 = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxSize( -1,30 ), 0 ); - bSizer97->Add( m_button29, 0, wxEXPAND|wxALL, 5 ); - - - bSizer161->Add( bSizer97, 0, 0, 5 ); - - - this->SetSizer( bSizer161 ); - this->Layout(); - bSizer161->Fit( this ); - - this->Centre( wxBOTH ); - - // Connect Events - this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( SearchDialogGenerated::OnClose ) ); - m_textCtrlSearchTxt->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( SearchDialogGenerated::OnText ), NULL, this ); - m_buttonFindNext->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SearchDialogGenerated::OnFindNext ), NULL, this ); - m_button29->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SearchDialogGenerated::OnCancel ), NULL, this ); -} - -SearchDialogGenerated::~SearchDialogGenerated() -{ - // Disconnect Events - this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( SearchDialogGenerated::OnClose ) ); - m_textCtrlSearchTxt->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( SearchDialogGenerated::OnText ), NULL, this ); - m_buttonFindNext->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SearchDialogGenerated::OnFindNext ), NULL, this ); - m_button29->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SearchDialogGenerated::OnCancel ), NULL, this ); - -} - SelectTimespanDlgGenerated::SelectTimespanDlgGenerated( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) { this->SetSizeHints( wxDefaultSize, wxDefaultSize ); @@ -3595,10 +3261,10 @@ SelectTimespanDlgGenerated::SelectTimespanDlgGenerated( wxWindow* parent, wxWind wxBoxSizer* bSizer98; bSizer98 = new wxBoxSizer( wxHORIZONTAL ); - m_calendarFrom = new wxCalendarCtrl( m_panel35, wxID_ANY, wxDefaultDateTime, wxDefaultPosition, wxDefaultSize, wxCAL_SHOW_HOLIDAYS ); + m_calendarFrom = new wxCalendarCtrl( m_panel35, wxID_ANY, wxDefaultDateTime, wxDefaultPosition, wxDefaultSize, wxCAL_SHOW_HOLIDAYS|wxNO_BORDER ); bSizer98->Add( m_calendarFrom, 0, wxALL, 5 ); - m_calendarTo = new wxCalendarCtrl( m_panel35, wxID_ANY, wxDefaultDateTime, wxDefaultPosition, wxDefaultSize, wxCAL_SHOW_HOLIDAYS ); + m_calendarTo = new wxCalendarCtrl( m_panel35, wxID_ANY, wxDefaultDateTime, wxDefaultPosition, wxDefaultSize, wxCAL_SHOW_HOLIDAYS|wxNO_BORDER ); bSizer98->Add( m_calendarTo, 0, wxALL, 5 ); @@ -3649,3 +3315,311 @@ SelectTimespanDlgGenerated::~SelectTimespanDlgGenerated() m_buttonCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SelectTimespanDlgGenerated::OnCancel ), NULL, this ); } + +AboutDlgGenerated::AboutDlgGenerated( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) +{ + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + this->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) ); + + wxBoxSizer* bSizer31; + bSizer31 = new wxBoxSizer( wxVERTICAL ); + + m_panel41 = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + m_panel41->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); + + wxBoxSizer* bSizer162; + bSizer162 = new wxBoxSizer( wxVERTICAL ); + + m_bitmapLogo = new wxStaticBitmap( m_panel41, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), 0 ); + bSizer162->Add( m_bitmapLogo, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_staticline341 = new wxStaticLine( m_panel41, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + bSizer162->Add( m_staticline341, 0, wxEXPAND, 5 ); + + wxBoxSizer* bSizer174; + bSizer174 = new wxBoxSizer( wxHORIZONTAL ); + + wxBoxSizer* bSizer181; + bSizer181 = new wxBoxSizer( wxVERTICAL ); + + m_build = new wxStaticText( m_panel41, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); + m_build->Wrap( -1 ); + bSizer181->Add( m_build, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + m_staticline3411 = new wxStaticLine( m_panel41, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + bSizer181->Add( m_staticline3411, 0, wxEXPAND, 5 ); + + m_staticText96 = new wxStaticText( m_panel41, wxID_ANY, _("Source code written in C++ using:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText96->Wrap( -1 ); + bSizer181->Add( m_staticText96, 0, wxALL, 5 ); + + wxBoxSizer* bSizer171; + bSizer171 = new wxBoxSizer( wxHORIZONTAL ); + + m_hyperlink11 = new wxHyperlinkCtrl( m_panel41, wxID_ANY, _("MS Visual C++"), wxT("http://msdn.microsoft.com/library/60k1461a.aspx"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); + m_hyperlink11->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); + m_hyperlink11->SetToolTip( _("http://msdn.microsoft.com/library/60k1461a.aspx") ); + + bSizer171->Add( m_hyperlink11, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); + + m_hyperlink9 = new wxHyperlinkCtrl( m_panel41, wxID_ANY, _("MinGW"), wxT("http://www.mingw.org"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); + m_hyperlink9->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); + m_hyperlink9->SetToolTip( _("http://www.mingw.org") ); + + bSizer171->Add( m_hyperlink9, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); + + m_hyperlink10 = new wxHyperlinkCtrl( m_panel41, wxID_ANY, _("Code::Blocks"), wxT("http://www.codeblocks.org"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); + m_hyperlink10->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); + m_hyperlink10->SetToolTip( _("http://www.codeblocks.org") ); + + bSizer171->Add( m_hyperlink10, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); + + m_hyperlink7 = new wxHyperlinkCtrl( m_panel41, wxID_ANY, _("wxWidgets"), wxT("http://www.wxwidgets.org"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); + m_hyperlink7->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); + m_hyperlink7->SetToolTip( _("http://www.wxwidgets.org") ); + + bSizer171->Add( m_hyperlink7, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); + + m_hyperlink14 = new wxHyperlinkCtrl( m_panel41, wxID_ANY, _("wxFormBuilder"), wxT("http://wxformbuilder.org"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); + m_hyperlink14->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); + m_hyperlink14->SetToolTip( _("http://wxformbuilder.org") ); + + bSizer171->Add( m_hyperlink14, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizer181->Add( bSizer171, 0, wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + wxBoxSizer* bSizer172; + bSizer172 = new wxBoxSizer( wxHORIZONTAL ); + + m_hyperlink15 = new wxHyperlinkCtrl( m_panel41, wxID_ANY, _("zen::Xml"), wxT("http://zenxml.sourceforge.net"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); + m_hyperlink15->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); + m_hyperlink15->SetToolTip( _("http://zenxml.sourceforge.net") ); + + bSizer172->Add( m_hyperlink15, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); + + m_hyperlink13 = new wxHyperlinkCtrl( m_panel41, wxID_ANY, _("Boost"), wxT("http://www.boost.org"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); + m_hyperlink13->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); + m_hyperlink13->SetToolTip( _("http://www.boost.org") ); + + bSizer172->Add( m_hyperlink13, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); + + m_hyperlink16 = new wxHyperlinkCtrl( m_panel41, wxID_ANY, _("Artistic Style"), wxT("http://astyle.sourceforge.net"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); + m_hyperlink16->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); + m_hyperlink16->SetToolTip( _("http://astyle.sourceforge.net") ); + + bSizer172->Add( m_hyperlink16, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); + + m_hyperlink12 = new wxHyperlinkCtrl( m_panel41, wxID_ANY, _("Google Test"), wxT("http://code.google.com/p/googletest"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); + m_hyperlink12->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); + m_hyperlink12->SetToolTip( _("http://code.google.com/p/googletest") ); + + bSizer172->Add( m_hyperlink12, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); + + m_hyperlink18 = new wxHyperlinkCtrl( m_panel41, wxID_ANY, _("Unicode NSIS"), wxT("http://www.scratchpaper.com"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); + m_hyperlink18->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); + m_hyperlink18->SetToolTip( _("http://www.scratchpaper.com") ); + + bSizer172->Add( m_hyperlink18, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizer181->Add( bSizer172, 0, wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + m_panelDonate = new wxPanel( m_panel41, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + m_panelDonate->SetBackgroundColour( wxColour( 153, 170, 187 ) ); + + wxBoxSizer* bSizer183; + bSizer183 = new wxBoxSizer( wxVERTICAL ); + + m_panel39 = new wxPanel( m_panelDonate, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + m_panel39->SetBackgroundColour( wxColour( 221, 221, 255 ) ); + + wxBoxSizer* bSizer184; + bSizer184 = new wxBoxSizer( wxHORIZONTAL ); + + + bSizer184->Add( 0, 0, 1, wxEXPAND, 5 ); + + m_animCtrlWink = new wxAnimationCtrl( m_panel39, wxID_ANY, wxNullAnimation, wxDefaultPosition, wxSize( 48,48 ), wxAC_DEFAULT_STYLE ); + bSizer184->Add( m_animCtrlWink, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + wxBoxSizer* bSizer178; + bSizer178 = new wxBoxSizer( wxVERTICAL ); + + m_staticText83 = new wxStaticText( m_panel39, wxID_ANY, _("If you like FreeFileSync"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText83->Wrap( -1 ); + m_staticText83->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 93, 92, false, wxEmptyString ) ); + m_staticText83->SetForegroundColour( wxColour( 0, 0, 0 ) ); + + bSizer178->Add( m_staticText83, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + m_buttonDonate = new wxButton( m_panel39, wxID_ANY, _("Donate with PayPal"), wxDefaultPosition, wxDefaultSize, 0 ); + m_buttonDonate->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 90, false, wxEmptyString ) ); + m_buttonDonate->SetToolTip( _("https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=zenju@gmx.de&no_shipping=1&lc=US¤cy_code=EUR") ); + + bSizer178->Add( m_buttonDonate, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_HORIZONTAL, 5 ); + + + bSizer184->Add( bSizer178, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizer184->Add( 0, 0, 1, wxEXPAND, 5 ); + + + m_panel39->SetSizer( bSizer184 ); + m_panel39->Layout(); + bSizer184->Fit( m_panel39 ); + bSizer183->Add( m_panel39, 0, wxEXPAND|wxALL, 5 ); + + + m_panelDonate->SetSizer( bSizer183 ); + m_panelDonate->Layout(); + bSizer183->Fit( m_panelDonate ); + bSizer181->Add( m_panelDonate, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxRIGHT|wxLEFT, 5 ); + + m_staticText94 = new wxStaticText( m_panel41, wxID_ANY, _("Feedback and suggestions are welcome"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText94->Wrap( -1 ); + bSizer181->Add( m_staticText94, 0, wxALL, 5 ); + + wxBoxSizer* bSizer166; + bSizer166 = new wxBoxSizer( wxHORIZONTAL ); + + + bSizer166->Add( 0, 0, 1, wxEXPAND, 5 ); + + m_bitmap9 = new wxStaticBitmap( m_panel41, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), 0 ); + m_bitmap9->SetToolTip( _("Homepage") ); + + bSizer166->Add( m_bitmap9, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); + + m_hyperlink1 = new wxHyperlinkCtrl( m_panel41, wxID_ANY, _("freefilesync.sf.net"), wxT("http://freefilesync.sf.net/"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); + m_hyperlink1->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, true, wxEmptyString ) ); + m_hyperlink1->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); + + bSizer166->Add( m_hyperlink1, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizer166->Add( 0, 0, 1, wxEXPAND, 5 ); + + m_bitmap10 = new wxStaticBitmap( m_panel41, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), 0 ); + m_bitmap10->SetToolTip( _("Email") ); + + bSizer166->Add( m_bitmap10, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); + + m_hyperlink2 = new wxHyperlinkCtrl( m_panel41, wxID_ANY, _("zenju@gmx.de"), wxT("mailto:zenju@gmx.de"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); + m_hyperlink2->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, true, wxEmptyString ) ); + m_hyperlink2->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); + + bSizer166->Add( m_hyperlink2, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizer166->Add( 0, 0, 1, wxEXPAND, 5 ); + + + bSizer181->Add( bSizer166, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + m_staticline34 = new wxStaticLine( m_panel41, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + bSizer181->Add( m_staticline34, 0, wxEXPAND, 5 ); + + m_staticText93 = new wxStaticText( m_panel41, wxID_ANY, _("Published under the GNU General Public License"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText93->Wrap( -1 ); + bSizer181->Add( m_staticText93, 0, wxALL, 5 ); + + wxBoxSizer* bSizer1671; + bSizer1671 = new wxBoxSizer( wxHORIZONTAL ); + + + bSizer1671->Add( 0, 0, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); + + m_bitmap13 = new wxStaticBitmap( m_panel41, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), 0 ); + bSizer1671->Add( m_bitmap13, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); + + m_hyperlink5 = new wxHyperlinkCtrl( m_panel41, wxID_ANY, _("http://www.gnu.org/licenses/gpl.html"), wxT("http://www.gnu.org/licenses/gpl.html"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); + m_hyperlink5->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); + + bSizer1671->Add( m_hyperlink5, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizer1671->Add( 0, 0, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizer181->Add( bSizer1671, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + + bSizer174->Add( bSizer181, 0, 0, 5 ); + + m_staticline37 = new wxStaticLine( m_panel41, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL ); + bSizer174->Add( m_staticline37, 0, wxEXPAND, 5 ); + + wxBoxSizer* bSizer177; + bSizer177 = new wxBoxSizer( wxVERTICAL ); + + m_staticText54 = new wxStaticText( m_panel41, wxID_ANY, _("Many thanks for localization:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText54->Wrap( 200 ); + m_staticText54->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) ); + + bSizer177->Add( m_staticText54, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 ); + + + bSizer177->Add( 0, 5, 0, 0, 5 ); + + m_scrolledWindowTranslators = new wxScrolledWindow( m_panel41, wxID_ANY, wxDefaultPosition, wxSize( -1,-1 ), wxVSCROLL ); + m_scrolledWindowTranslators->SetScrollRate( 10, 10 ); + m_scrolledWindowTranslators->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); + m_scrolledWindowTranslators->SetMinSize( wxSize( 220,-1 ) ); + + fgSizerTranslators = new wxFlexGridSizer( 0, 2, 2, 10 ); + fgSizerTranslators->SetFlexibleDirection( wxBOTH ); + fgSizerTranslators->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + + m_scrolledWindowTranslators->SetSizer( fgSizerTranslators ); + m_scrolledWindowTranslators->Layout(); + fgSizerTranslators->Fit( m_scrolledWindowTranslators ); + bSizer177->Add( m_scrolledWindowTranslators, 1, wxALIGN_CENTER_HORIZONTAL|wxLEFT|wxEXPAND, 5 ); + + + bSizer174->Add( bSizer177, 0, wxEXPAND, 5 ); + + + bSizer162->Add( bSizer174, 0, 0, 5 ); + + + m_panel41->SetSizer( bSizer162 ); + m_panel41->Layout(); + bSizer162->Fit( m_panel41 ); + bSizer31->Add( m_panel41, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); + + m_staticline36 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + bSizer31->Add( m_staticline36, 0, wxEXPAND, 5 ); + + bSizerStdButtons = new wxBoxSizer( wxHORIZONTAL ); + + m_buttonClose = new wxButton( this, wxID_OK, _("Close"), wxDefaultPosition, wxSize( -1,30 ), 0 ); + m_buttonClose->SetDefault(); + bSizerStdButtons->Add( m_buttonClose, 0, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizer31->Add( bSizerStdButtons, 0, wxALIGN_RIGHT, 5 ); + + + this->SetSizer( bSizer31 ); + this->Layout(); + bSizer31->Fit( this ); + + this->Centre( wxBOTH ); + + // Connect Events + this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( AboutDlgGenerated::OnClose ) ); + m_buttonDonate->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( AboutDlgGenerated::OnDonate ), NULL, this ); + m_buttonClose->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( AboutDlgGenerated::OnOK ), NULL, this ); +} + +AboutDlgGenerated::~AboutDlgGenerated() +{ + // Disconnect Events + this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( AboutDlgGenerated::OnClose ) ); + m_buttonDonate->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( AboutDlgGenerated::OnDonate ), NULL, this ); + m_buttonClose->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( AboutDlgGenerated::OnOK ), NULL, this ); + +} diff --git a/ui/gui_generated.h b/ui/gui_generated.h index f06ebf93..a590e2c2 100644 --- a/ui/gui_generated.h +++ b/ui/gui_generated.h @@ -14,8 +14,7 @@ class ExecFinishedBox; class FolderHistoryBox; class ToggleButton; -class wxStaticText; -namespace zen{ class BitmapButton; } +namespace zen{ class BitmapTextButton; } namespace zen{ class Graph2D; } namespace zen{ class Grid; } namespace zen{ class TripleSplitter; } @@ -29,19 +28,19 @@ namespace zen{ class TripleSplitter; } #include <wx/font.h> #include <wx/colour.h> #include <wx/settings.h> -#include <wx/stattext.h> #include <wx/button.h> -#include <wx/sizer.h> #include <wx/bmpbuttn.h> +#include <wx/sizer.h> #include <wx/panel.h> +#include <wx/stattext.h> #include <wx/combobox.h> #include <wx/scrolwin.h> #include <wx/statbmp.h> #include <wx/statline.h> -#include <wx/listbox.h> +#include <wx/textctrl.h> #include <wx/checkbox.h> +#include <wx/listbox.h> #include <wx/frame.h> -#include <wx/textctrl.h> #include <wx/gauge.h> #include <wx/animate.h> #include <wx/notebook.h> @@ -49,9 +48,9 @@ namespace zen{ class TripleSplitter; } #include <wx/tglbtn.h> #include <wx/choice.h> #include <wx/spinctrl.h> -#include <wx/hyperlink.h> #include <wx/grid.h> #include <wx/calctrl.h> +#include <wx/hyperlink.h> #include "../zen/i18n.h" @@ -87,13 +86,11 @@ class MainDialogGenerated : public wxFrame wxBoxSizer* bSizerPanelHolder; wxPanel* m_panelTopButtons; wxBoxSizer* bSizerTopButtons; - wxStaticText* m_staticTextCmpVariant; - zen::BitmapButton* m_buttonCompare; - zen::BitmapButton* m_buttonCancel; + zen::BitmapTextButton* m_buttonCompare; + zen::BitmapTextButton* m_buttonCancel; wxBitmapButton* m_bpButtonCmpConfig; - wxStaticText* m_staticTextSyncVariant; wxBitmapButton* m_bpButtonSyncConfig; - zen::BitmapButton* m_buttonSync; + zen::BitmapTextButton* m_buttonSync; wxPanel* m_panelDirectoryPairs; wxStaticText* m_staticTextResolvedPathL; wxBitmapButton* m_bpButtonAddPair; @@ -132,6 +129,11 @@ class MainDialogGenerated : public wxFrame wxStaticText* m_staticTextStatusRightFiles; wxStaticText* m_staticTextStatusRightBytes; wxStaticText* m_staticTextFullStatus; + wxPanel* m_panelSearch; + wxBitmapButton* m_bpButtonHideSearch; + wxStaticText* m_staticText101; + wxTextCtrl* m_textCtrlSearchTxt; + wxCheckBox* m_checkBoxMatchCase; wxPanel* m_panelConfig; wxBoxSizer* bSizerConfig; wxBitmapButton* m_bpButtonOpen; @@ -198,6 +200,8 @@ class MainDialogGenerated : public wxFrame virtual void OnAddFolderPair( wxCommandEvent& event ) { event.Skip(); } virtual void OnRemoveTopFolderPair( wxCommandEvent& event ) { event.Skip(); } virtual void OnSwapSides( wxCommandEvent& event ) { event.Skip(); } + virtual void OnHideSearchPanel( wxCommandEvent& event ) { event.Skip(); } + virtual void OnSearchGridEnter( wxCommandEvent& event ) { event.Skip(); } virtual void OnCfgHistoryKeyEvent( wxKeyEvent& event ) { event.Skip(); } virtual void OnLoadFromHistory( wxCommandEvent& event ) { event.Skip(); } virtual void OnLoadFromHistoryDoubleClick( wxCommandEvent& event ) { event.Skip(); } @@ -470,6 +474,7 @@ class SyncCfgDlgGenerated : public wxDialog wxStaticText* m_staticTextUpdate; wxToggleButton* m_toggleBtnCustom; wxStaticText* m_staticTextCustom; + wxCheckBox* m_checkBoxDetectMove; wxBoxSizer* bSizerExtraConfig; wxStaticLine* m_staticline321; wxBoxSizer* bSizer179; @@ -534,6 +539,7 @@ class SyncCfgDlgGenerated : public wxDialog virtual void OnSyncUpdate( wxCommandEvent& event ) { event.Skip(); } virtual void OnSyncCustomDouble( wxMouseEvent& event ) { event.Skip(); } virtual void OnSyncCustom( wxCommandEvent& event ) { event.Skip(); } + virtual void OnToggleDetectMovedFiles( wxCommandEvent& event ) { event.Skip(); } virtual void OnErrorIgnore( wxCommandEvent& event ) { event.Skip(); } virtual void OnErrorPopup( wxCommandEvent& event ) { event.Skip(); } virtual void OnDeletionPermanent( wxCommandEvent& event ) { event.Skip(); } @@ -568,14 +574,14 @@ class BatchDlgGenerated : public wxDialog protected: wxStaticBitmap* m_bitmapBatchJob; wxStaticText* m_staticTextHeader; - wxStaticText* m_staticText44; + wxStaticText* m_staticTextDescr; wxBitmapButton* m_bpButtonHelp; wxStaticLine* m_staticline18; wxPanel* m_panel35; wxStaticText* m_staticText82; wxToggleButton* m_toggleBtnErrorIgnore; wxToggleButton* m_toggleBtnErrorPopup; - wxToggleButton* m_toggleBtnErrorExit; + wxToggleButton* m_toggleBtnErrorAbort; wxStaticLine* m_staticline26; wxStaticText* m_staticText81; ExecFinishedBox* m_comboBoxExecFinished; @@ -596,7 +602,7 @@ class BatchDlgGenerated : public wxDialog virtual void OnHelp( wxCommandEvent& event ) { event.Skip(); } virtual void OnErrorIgnore( wxCommandEvent& event ) { event.Skip(); } virtual void OnErrorPopup( wxCommandEvent& event ) { event.Skip(); } - virtual void OnErrorExit( wxCommandEvent& event ) { event.Skip(); } + virtual void OnErrorAbort( wxCommandEvent& event ) { event.Skip(); } virtual void OnToggleGenerateLogfile( wxCommandEvent& event ) { event.Skip(); } virtual void OnToggleLogfilesLimit( wxCommandEvent& event ) { event.Skip(); } virtual void OnSaveBatchJob( wxCommandEvent& event ) { event.Skip(); } @@ -612,66 +618,6 @@ class BatchDlgGenerated : public wxDialog }; /////////////////////////////////////////////////////////////////////////////// -/// Class AboutDlgGenerated -/////////////////////////////////////////////////////////////////////////////// -class AboutDlgGenerated : public wxDialog -{ - private: - - protected: - wxPanel* m_panel41; - wxStaticBitmap* m_bitmapLogo; - wxStaticLine* m_staticline341; - wxStaticText* m_build; - wxStaticLine* m_staticline3411; - wxStaticText* m_staticText72; - wxHyperlinkCtrl* m_hyperlink11; - wxHyperlinkCtrl* m_hyperlink9; - wxHyperlinkCtrl* m_hyperlink10; - wxHyperlinkCtrl* m_hyperlink7; - wxHyperlinkCtrl* m_hyperlink14; - wxHyperlinkCtrl* m_hyperlink15; - wxHyperlinkCtrl* m_hyperlink13; - wxHyperlinkCtrl* m_hyperlink16; - wxHyperlinkCtrl* m_hyperlink12; - wxHyperlinkCtrl* m_hyperlink18; - wxPanel* m_panel40; - wxPanel* m_panel39; - wxStaticText* m_staticText83; - wxButton* m_buttonDonate; - wxAnimationCtrl* m_animCtrlWink; - wxScrolledWindow* m_scrolledWindowTranslators; - wxBoxSizer* bSizerTranslators; - wxStaticText* m_staticText54; - wxFlexGridSizer* fgSizerTranslators; - wxStaticLine* m_staticline43; - wxStaticText* m_staticText94; - wxHyperlinkCtrl* m_hyperlink1; - wxStaticBitmap* m_bitmap9; - wxHyperlinkCtrl* m_hyperlink2; - wxStaticBitmap* m_bitmap10; - wxStaticLine* m_staticline34; - wxStaticText* m_staticText93; - wxStaticBitmap* m_bitmap13; - wxHyperlinkCtrl* m_hyperlink5; - wxStaticLine* m_staticline36; - wxBoxSizer* bSizerStdButtons; - wxButton* m_buttonClose; - - // Virtual event handlers, overide them in your derived class - virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } - virtual void OnDonate( wxCommandEvent& event ) { event.Skip(); } - virtual void OnOK( wxCommandEvent& event ) { event.Skip(); } - - - public: - - AboutDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("About"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE ); - ~AboutDlgGenerated(); - -}; - -/////////////////////////////////////////////////////////////////////////////// /// Class MessageDlgGenerated /////////////////////////////////////////////////////////////////////////////// class MessageDlgGenerated : public wxDialog @@ -815,7 +761,7 @@ class GlobalSettingsDlgGenerated : public wxDialog wxCheckBox* m_checkBoxCopyPermissions; wxStaticText* m_staticText8211; wxStaticLine* m_staticline191; - zen::BitmapButton* m_buttonResetDialogs; + zen::BitmapTextButton* m_buttonResetDialogs; wxStaticLine* m_staticline192; wxStaticText* m_staticText85; wxBitmapButton* m_bpButtonAddRow; @@ -863,61 +809,92 @@ class PopupDialogGenerated : public wxDialog }; /////////////////////////////////////////////////////////////////////////////// -/// Class SearchDialogGenerated +/// Class SelectTimespanDlgGenerated /////////////////////////////////////////////////////////////////////////////// -class SearchDialogGenerated : public wxDialog +class SelectTimespanDlgGenerated : public wxDialog { private: protected: - wxStaticText* m_staticText101; - wxTextCtrl* m_textCtrlSearchTxt; - wxCheckBox* m_checkBoxMatchCase; - wxButton* m_buttonFindNext; - wxButton* m_button29; + wxPanel* m_panel35; + wxCalendarCtrl* m_calendarFrom; + wxCalendarCtrl* m_calendarTo; + wxStaticLine* m_staticline21; + wxBoxSizer* bSizerStdButtons; + wxButton* m_buttonOkay; + wxButton* m_buttonCancel; // Virtual event handlers, overide them in your derived class virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } - virtual void OnText( wxCommandEvent& event ) { event.Skip(); } - virtual void OnFindNext( wxCommandEvent& event ) { event.Skip(); } + virtual void OnChangeSelectionFrom( wxCalendarEvent& event ) { event.Skip(); } + virtual void OnChangeSelectionTo( wxCalendarEvent& event ) { event.Skip(); } + virtual void OnOkay( wxCommandEvent& event ) { event.Skip(); } virtual void OnCancel( wxCommandEvent& event ) { event.Skip(); } public: - SearchDialogGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Find"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE ); - ~SearchDialogGenerated(); + SelectTimespanDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Select time span"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE ); + ~SelectTimespanDlgGenerated(); }; /////////////////////////////////////////////////////////////////////////////// -/// Class SelectTimespanDlgGenerated +/// Class AboutDlgGenerated /////////////////////////////////////////////////////////////////////////////// -class SelectTimespanDlgGenerated : public wxDialog +class AboutDlgGenerated : public wxDialog { private: protected: - wxPanel* m_panel35; - wxCalendarCtrl* m_calendarFrom; - wxCalendarCtrl* m_calendarTo; - wxStaticLine* m_staticline21; + wxPanel* m_panel41; + wxStaticBitmap* m_bitmapLogo; + wxStaticLine* m_staticline341; + wxStaticText* m_build; + wxStaticLine* m_staticline3411; + wxStaticText* m_staticText96; + wxHyperlinkCtrl* m_hyperlink11; + wxHyperlinkCtrl* m_hyperlink9; + wxHyperlinkCtrl* m_hyperlink10; + wxHyperlinkCtrl* m_hyperlink7; + wxHyperlinkCtrl* m_hyperlink14; + wxHyperlinkCtrl* m_hyperlink15; + wxHyperlinkCtrl* m_hyperlink13; + wxHyperlinkCtrl* m_hyperlink16; + wxHyperlinkCtrl* m_hyperlink12; + wxHyperlinkCtrl* m_hyperlink18; + wxPanel* m_panelDonate; + wxPanel* m_panel39; + wxAnimationCtrl* m_animCtrlWink; + wxStaticText* m_staticText83; + wxButton* m_buttonDonate; + wxStaticText* m_staticText94; + wxStaticBitmap* m_bitmap9; + wxHyperlinkCtrl* m_hyperlink1; + wxStaticBitmap* m_bitmap10; + wxHyperlinkCtrl* m_hyperlink2; + wxStaticLine* m_staticline34; + wxStaticText* m_staticText93; + wxStaticBitmap* m_bitmap13; + wxHyperlinkCtrl* m_hyperlink5; + wxStaticLine* m_staticline37; + wxStaticText* m_staticText54; + wxScrolledWindow* m_scrolledWindowTranslators; + wxFlexGridSizer* fgSizerTranslators; + wxStaticLine* m_staticline36; wxBoxSizer* bSizerStdButtons; - wxButton* m_buttonOkay; - wxButton* m_buttonCancel; + wxButton* m_buttonClose; // Virtual event handlers, overide them in your derived class virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } - virtual void OnChangeSelectionFrom( wxCalendarEvent& event ) { event.Skip(); } - virtual void OnChangeSelectionTo( wxCalendarEvent& event ) { event.Skip(); } - virtual void OnOkay( wxCommandEvent& event ) { event.Skip(); } - virtual void OnCancel( wxCommandEvent& event ) { event.Skip(); } + virtual void OnDonate( wxCommandEvent& event ) { event.Skip(); } + virtual void OnOK( wxCommandEvent& event ) { event.Skip(); } public: - SelectTimespanDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Select time span"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE ); - ~SelectTimespanDlgGenerated(); + AboutDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("About"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE ); + ~AboutDlgGenerated(); }; diff --git a/ui/gui_status_handler.cpp b/ui/gui_status_handler.cpp index 0131af3f..0816f2f1 100644 --- a/ui/gui_status_handler.cpp +++ b/ui/gui_status_handler.cpp @@ -7,7 +7,7 @@ #include "gui_status_handler.h" #include <wx/wupdlock.h> #include <wx+/shell_execute.h> -#include <wx+/button.h> +#include <wx+/bitmap_button.h> #include <wx/app.h> #include "msg_popup.h" #include "main_dlg.h" @@ -238,12 +238,12 @@ SyncStatusHandler::~SyncStatusHandler() if (!abortIsRequested()) //if aborted (manually), we don't execute the command { const std::wstring finalCommand = progressDlg->getExecWhenFinishedCommand(); //final value (after possible user modification) - if (isCloseProgressDlgCommand(finalCommand)) - showFinalResults = false; //take precedence over current visibility status - else if (!finalCommand.empty()) + if (!finalCommand.empty()) { - auto cmdexp = expandMacros(utfCvrtTo<Zstring>(finalCommand)); - shellExecute(cmdexp); + if (isCloseProgressDlgCommand(finalCommand)) + showFinalResults = false; //take precedence over current visibility status + else + shellExecute(expandMacros(utfCvrtTo<Zstring>(finalCommand))); } } diff --git a/ui/main_dlg.cpp b/ui/main_dlg.cpp index eaae0545..c84606f4 100644 --- a/ui/main_dlg.cpp +++ b/ui/main_dlg.cpp @@ -18,7 +18,7 @@ #include <wx/display.h> #include <wx+/context_menu.h> #include <wx+/string_conv.h> -#include <wx+/button.h> +#include <wx+/bitmap_button.h> #include <wx+/shell_execute.h> #include <wx+/app_main.h> #include <wx+/toggle_button.h> @@ -46,6 +46,10 @@ #include "../lib/lock_holder.h" #include "../lib/localization.h" +#ifdef ZEN_MAC +#include <ApplicationServices/ApplicationServices.h> +#endif + using namespace zen; using namespace std::rel_ops; @@ -56,11 +60,6 @@ struct wxClientHistoryData : public wxClientData //we need a wxClientData derive { wxClientHistoryData(const Zstring& cfgFile, int lastUseIndex) : cfgFile_(cfgFile), lastUseIndex_(lastUseIndex) {} - //~wxClientHistoryData() - //{ - // std::cerr << cfgFile_.c_str() << "\n"; - //} - Zstring cfgFile_; int lastUseIndex_; //support sorting history by last usage, the higher the index the more recent the usage }; @@ -276,7 +275,7 @@ private: namespace { -//workaround for wxWidgets: small hack to update menu items: actually this is a wxWidgets bug (affects Windows- and Linux-build) +//workaround for wxWidgets bug failing to update menu item bitmaps (affects Windows- and Linux-build) void setMenuItemImage(wxMenuItem*& menuItem, const wxBitmap& bmp) { assert(menuItem->GetKind() == wxITEM_NORMAL); @@ -291,14 +290,21 @@ void setMenuItemImage(wxMenuItem*& menuItem, const wxBitmap& bmp) if (pos != wxNOT_FOUND) { /* - menu->Remove(item); ->this simple sequence crashes on Kubuntu x64, wxWidgets 2.9.2 - menu->Insert(index, item); + menu->Remove(menuItem); ->this simple sequence crashes on Kubuntu x64, wxWidgets 2.9.2 + menu->Insert(pos, menuItem); */ const bool enabled = menuItem->IsEnabled(); wxMenuItem* newItem = new wxMenuItem(menu, menuItem->GetId(), menuItem->GetItemLabel()); - newItem->SetBitmap(bmp); - menu->Destroy(menuItem); //actual workaround + newItem->SetBitmap(bmp); +#ifdef __WXMSW__ //not availabe on wxGTK or wxOSX + //for some inconceivable reason wxWidgets is not consistent with itself and renders disabled icons + //just greyscale instead of brightened like bitmap buttons; much better: + newItem->SetDisabledBitmap(bmp.ConvertToDisabled()); +#endif + bool isDestroyed = menu->Destroy(menuItem); //actual workaround + assert(isDestroyed); + (void)isDestroyed; menuItem = menu->Insert(pos, newItem); //don't forget to update input item pointer! if (!enabled) @@ -408,6 +414,13 @@ void MainDialog::create(const xmlAccess::XmlGuiConfig& guiCfg, MainDialog* frame = new MainDialog(guiCfg, referenceFiles, globSett, startComparison); frame->Show(); +#ifdef ZEN_MAC + ProcessSerialNumber psn = { 0, kCurrentProcess }; + ::TransformProcessType(&psn, kProcessTransformToForegroundApplication); //show dock icon, even if we're not an application bundle + //if the executable is not yet in a bundle or if it is called through a launcher, we need to set focus manually: + ::SetFrontProcess(&psn); +#endif + } @@ -417,7 +430,8 @@ MainDialog::MainDialog(const xmlAccess::XmlGuiConfig& guiCfg, bool startComparison) : MainDialogGenerated(nullptr), folderHistoryLeft (std::make_shared<FolderHistory>()), //make sure it is always bound - folderHistoryRight(std::make_shared<FolderHistory>()) // + folderHistoryRight(std::make_shared<FolderHistory>()), // + focusWindowAfterSearch(nullptr) { m_directoryLeft ->init(folderHistoryLeft); m_directoryRight->init(folderHistoryRight); @@ -431,7 +445,6 @@ MainDialog::MainDialog(const xmlAccess::XmlGuiConfig& guiCfg, setRelativeFontSize(*m_buttonCompare, 1.5); setRelativeFontSize(*m_buttonSync, 1.5); setRelativeFontSize(*m_buttonCancel, 1.5); - m_buttonCancel->refreshButtonLabel(); //required after font change! //---------------- support for dockable gui style -------------------------------- bSizerPanelHolder->Detach(m_panelTopButtons); @@ -455,6 +468,9 @@ MainDialog::MainDialog(const xmlAccess::XmlGuiConfig& guiCfg, auiMgr.AddPane(m_panelDirectoryPairs, wxAuiPaneInfo().Name(L"Panel2").Layer(2).Top().Caption(_("Folder pairs")).CaptionVisible(false).PaneBorder(false).Gripper()); + auiMgr.AddPane(m_panelSearch, + wxAuiPaneInfo().Name(L"PanelFind").Layer(2).Bottom().Caption(_("Find")).CaptionVisible(false).PaneBorder(false).Gripper().MinSize(200, m_bpButtonHideSearch->GetSize().GetHeight()).Hide()); + auiMgr.AddPane(m_gridNavi, wxAuiPaneInfo().Name(L"Panel10").Layer(3).Left().Position(1).Caption(_("Overview")).MinSize(300, m_gridNavi->GetSize().GetHeight())); //MinSize(): just default size, see comment below @@ -524,12 +540,17 @@ MainDialog::MainDialog(const xmlAccess::XmlGuiConfig& guiCfg, m_gridMainR->Connect(EVENT_GRID_MOUSE_LEFT_DOUBLE, GridClickEventHandler(MainDialog::onGridDoubleClickR), nullptr, this ); m_gridNavi->Connect(EVENT_GRID_SELECT_RANGE, GridRangeSelectEventHandler(MainDialog::onNaviSelection), nullptr, this); + //---------------------------------------------------------------------------------- + + m_panelSearch->Connect(wxEVT_CHAR_HOOK, wxKeyEventHandler(MainDialog::OnSearchPanelKeyPressed), nullptr, this); //set tool tips with (non-translated!) short cut hint m_bpButtonOpen ->SetToolTip(_("Open...") + L" (Ctrl+O)"); m_bpButtonSave ->SetToolTip(_("Save") + L" (Ctrl+S)"); - m_buttonCompare->SetToolTip(_("Compare both sides") + L" (F5)"); - m_buttonSync ->SetToolTip(_("Start synchronization") + L" (F6)"); + m_buttonCompare ->SetToolTip(_("Compare both sides") + L" (F5)"); + m_bpButtonCmpConfig ->SetToolTip(_("Comparison settings") + L" (F6)"); + m_bpButtonSyncConfig->SetToolTip(_("Synchronization settings") + L" (F7)"); + m_buttonSync ->SetToolTip(_("Start synchronization") + L" (F8)"); gridDataView = std::make_shared<GridView>(); treeDataView = std::make_shared<TreeView>(); @@ -560,12 +581,16 @@ MainDialog::MainDialog(const xmlAccess::XmlGuiConfig& guiCfg, setConfig(guiCfg, referenceFiles); //set icons for this dialog - m_buttonCompare ->setBitmapFront(getResourceImage(L"compare"), 5); m_bpButtonSyncConfig->SetBitmapLabel(getResourceImage(L"cfg_sync")); m_bpButtonCmpConfig ->SetBitmapLabel(getResourceImage(L"cfg_compare")); m_bpButtonOpen ->SetBitmapLabel(getResourceImage(L"load")); m_bpButtonBatchJob ->SetBitmapLabel(getResourceImage(L"batch")); m_bpButtonAddPair ->SetBitmapLabel(getResourceImage(L"item_add")); + m_bpButtonHideSearch->SetBitmapLabel(getResourceImage(L"close_panel")); + + //we can't use a wxButton for cancel: it's rendered smaller on OS X than a wxBitmapButton! + setBitmapTextLabel(*m_buttonCancel, wxImage(), m_buttonCancel->GetLabel()); + { IconBuffer tmp(IconBuffer::SIZE_SMALL); const wxBitmap& bmpFile = tmp.genericFileIcon(); @@ -577,8 +602,6 @@ MainDialog::MainDialog(const xmlAccess::XmlGuiConfig& guiCfg, m_bitmapSmallFileRight ->SetBitmap(bmpFile); } - m_panelTopButtons->Layout(); //wxButtonWithImage size might have changed - const int dummySize = 5; wxImage dummyImg(dummySize, dummySize); if (!dummyImg.HasAlpha()) @@ -826,6 +849,7 @@ void MainDialog::setGlobalCfgOnInit(const xmlAccess::XmlGlobalSettings& globalSe cfgFileNames.push_back(lastRunConfigName()); //make sure <Last session> is always part of history list (if existing) addFileToCfgHistory(cfgFileNames); + removeObsoleteCfgHistoryItems(cfgFileNames); //remove non-existent items (we need this only on startup) //-------------------------------------------------------------------------------- @@ -837,6 +861,8 @@ void MainDialog::setGlobalCfgOnInit(const xmlAccess::XmlGlobalSettings& globalSe gridview::setupIcons(*m_gridMainL, *m_gridMainC, *m_gridMainR, globalSettings.gui.showIcons, convert(globalSettings.gui.iconSize)); //------------------------------------------------------------------------------------------------ + m_checkBoxMatchCase->SetValue(globalCfg.gui.textSearchRespectCase); + //wxAuiManager erroneously loads panel captions, we don't want that typedef std::vector<std::pair<wxString, wxString> > CaptionNameMapping; CaptionNameMapping captionNameMap; @@ -853,6 +879,8 @@ void MainDialog::setGlobalCfgOnInit(const xmlAccess::XmlGlobalSettings& globalSe //if MainDialog::onQueryEndSession() is called while comparison is active, this panel is saved and restored as "visible" auiMgr.GetPane(compareStatus->getAsWindow()).Hide(); + auiMgr.GetPane(m_panelSearch).Hide(); //no need to show it on startup + m_menuItemCheckVersionAuto->Check(globalCfg.gui.lastUpdateCheck != -1); auiMgr.Update(); @@ -886,6 +914,8 @@ xmlAccess::XmlGlobalSettings MainDialog::getGlobalCfgBeforeExit() for (unsigned int i = 0; i < m_listBoxHistory->GetCount(); ++i) if (auto clientString = dynamic_cast<const wxClientHistoryData*>(m_listBoxHistory->GetClientObject(i))) historyDetail.insert(std::make_pair(clientString->lastUseIndex_, clientString->cfgFile_)); + else + assert(false); //sort by last use; put most recent items *first* (looks better in xml than the reverse) std::vector<Zstring> history; @@ -902,6 +932,8 @@ xmlAccess::XmlGlobalSettings MainDialog::getGlobalCfgBeforeExit() globalSettings.gui.folderHistoryLeft = folderHistoryLeft ->getList(); globalSettings.gui.folderHistoryRight = folderHistoryRight->getList(); + globalSettings.gui.textSearchRespectCase = m_checkBoxMatchCase->GetValue(); + globalSettings.gui.guiPerspectiveLast = auiMgr.SavePerspective(); //we need to portably retrieve non-iconized, non-maximized size and position (non-portable: GetWindowPlacement()) @@ -1196,7 +1228,7 @@ void MainDialog::deleteSelectedFiles(const std::vector<FileSystemObject*>& selec deleteOnBothSides, globalCfg.gui.useRecyclerForManualDeletion) == ReturnSmallDlg::BUTTON_OKAY) { - wxBusyCursor dummy; //show hourglass cursor + //wxBusyCursor dummy; -> redundant: progress already shown in status bar! try { //handle errors when deleting files/folders @@ -1348,8 +1380,8 @@ void MainDialog::setStatusBarFileStatistics(size_t filesOnLeftView, size_t foldersOnLeftView, size_t filesOnRightView, size_t foldersOnRightView, - UInt64 filesizeLeftView, - UInt64 filesizeRightView) + zen::UInt64 filesizeLeftView, + zen::UInt64 filesizeRightView) { wxWindowUpdateLocker dummy(m_panelStatusBar); //avoid display distortion @@ -1357,14 +1389,13 @@ void MainDialog::setStatusBarFileStatistics(size_t filesOnLeftView, bSizerFileStatus->Show(true); m_staticTextFullStatus->Hide(); - //fill statistics //update status information bSizerStatusLeftDirectories->Show(foldersOnLeftView > 0); bSizerStatusLeftFiles ->Show(filesOnLeftView > 0); setText(*m_staticTextStatusLeftDirs, replaceCpy(_P("1 directory", "%x directories", foldersOnLeftView), L"%x", toGuiString(foldersOnLeftView), false)); setText(*m_staticTextStatusLeftFiles, replaceCpy(_P("1 file", "%x files", filesOnLeftView), L"%x", toGuiString(filesOnLeftView), false)); - setText(*m_staticTextStatusLeftBytes, filesizeToShortString(to<Int64>(filesizeLeftView))); + setText(*m_staticTextStatusLeftBytes, L"(" + filesizeToShortString(to<Int64>(filesizeLeftView)) + L")"); wxString statusMiddleNew; if (gridDataView->rowsTotal() > 0) @@ -1379,7 +1410,7 @@ void MainDialog::setStatusBarFileStatistics(size_t filesOnLeftView, setText(*m_staticTextStatusRightDirs, replaceCpy(_P("1 directory", "%x directories", foldersOnRightView), L"%x", toGuiString(foldersOnRightView), false)); setText(*m_staticTextStatusRightFiles, replaceCpy(_P("1 file", "%x files", filesOnRightView), L"%x", toGuiString(filesOnRightView), false)); - setText(*m_staticTextStatusRightBytes, filesizeToShortString(to<Int64>(filesizeRightView))); + setText(*m_staticTextStatusRightBytes, L"(" + filesizeToShortString(to<Int64>(filesizeRightView)) + L")"); //fill middle text (considering flashStatusInformation()) if (oldStatusMsgs.empty()) @@ -1463,7 +1494,7 @@ void MainDialog::disableAllElements(bool enableAbort) m_bpButtonSyncConfig ->Disable(); m_buttonSync ->Disable(); m_panelDirectoryPairs->Disable(); - m_panelCenter ->Disable(); + m_splitterMain ->Disable(); //includes m_panelCenter, but not m_panelStatusBar! m_panelViewFilter ->Disable(); m_panelFilter ->Disable(); m_panelConfig ->Disable(); @@ -1499,7 +1530,7 @@ void MainDialog::enableAllElements() m_bpButtonSyncConfig ->Enable(); m_buttonSync ->Enable(); m_panelDirectoryPairs->Enable(); - m_panelCenter ->Enable(); + m_splitterMain ->Enable(); m_panelViewFilter ->Enable(); m_panelFilter ->Enable(); m_panelConfig ->Enable(); @@ -1512,8 +1543,8 @@ void MainDialog::enableAllElements() m_buttonCompare->Enable(); m_buttonCompare->Show(); - m_panelTopButtons->Layout(); m_panelTopButtons->Enable(); + m_panelTopButtons->Layout(); //at least wxWidgets on OS X fails to do this after enabling: Refresh(); @@ -1752,7 +1783,7 @@ void MainDialog::onGridButtonEvent(wxKeyEvent& event, Grid& grid, bool leftSide) } -bool isPartOf(const wxWindow* child, const wxWindow* top) +bool isComponentOf(const wxWindow* child, const wxWindow* top) { for (const wxWindow* wnd = child; wnd != nullptr; wnd = wnd->GetParent()) if (wnd == top) @@ -1788,22 +1819,46 @@ void MainDialog::OnGlobalKeyEvent(wxKeyEvent& event) //process key events withou switch (keyCode) { case 'F': //CTRL + F - zen::startFind(this, *m_gridMainL, *m_gridMainR, globalCfg.gui.textSearchRespectCase); + showFindPanel(); return; //-> swallow event! } switch (keyCode) { - case WXK_F3: //F3 - case WXK_NUMPAD_F3: // - zen::findNext(this, *m_gridMainL, *m_gridMainR, globalCfg.gui.textSearchRespectCase); + case WXK_F3: + case WXK_NUMPAD_F3: + startFindNext(); return; //-> swallow event! - case WXK_F8: //F8 + case WXK_F6: + { + wxCommandEvent dummy2(wxEVT_COMMAND_BUTTON_CLICKED); //simulate button click + if (wxEvtHandler* evtHandler = m_bpButtonCmpConfig->GetEventHandler()) + evtHandler->ProcessEvent(dummy2); //synchronous call + } + return; //-> swallow event! + + case WXK_F7: + { + wxCommandEvent dummy2(wxEVT_COMMAND_BUTTON_CLICKED); //simulate button click + if (wxEvtHandler* evtHandler = m_bpButtonSyncConfig->GetEventHandler()) + evtHandler->ProcessEvent(dummy2); //synchronous call + } + return; //-> swallow event! + + case WXK_F9: setViewTypeSyncAction(!m_bpButtonViewTypeSyncAction->isActive()); return; //-> swallow event! - //redirect certain (unhandled) keys directly to grid! + case WXK_F10: + { + wxCommandEvent dummy2(wxEVT_COMMAND_BUTTON_CLICKED); //simulate button click + if (wxEvtHandler* evtHandler = m_bpButtonFilter->GetEventHandler()) + evtHandler->ProcessEvent(dummy2); //synchronous call + } + return; //-> swallow event! + + //redirect certain (unhandled) keys directly to grid! case WXK_UP: case WXK_DOWN: case WXK_LEFT: @@ -1823,14 +1878,15 @@ void MainDialog::OnGlobalKeyEvent(wxKeyEvent& event) //process key events withou case WXK_NUMPAD_END: { const wxWindow* focus = wxWindow::FindFocus(); - if (!isPartOf(focus, m_gridMainL ) && // - !isPartOf(focus, m_gridMainC ) && //don't propagate keyboard commands if grid is already in focus - !isPartOf(focus, m_gridMainR ) && // - !isPartOf(focus, m_gridNavi ) && - !isPartOf(focus, m_listBoxHistory) && //don't propagate if selecting config - !isPartOf(focus, m_directoryLeft) && //don't propagate if changing directory field - !isPartOf(focus, m_directoryRight) && - !isPartOf(focus, m_scrolledWindowFolderPairs)) + if (!isComponentOf(focus, m_gridMainL ) && // + !isComponentOf(focus, m_gridMainC ) && //don't propagate keyboard commands if grid is already in focus + !isComponentOf(focus, m_gridMainR ) && // + !isComponentOf(focus, m_gridNavi ) && + !isComponentOf(focus, m_listBoxHistory) && //don't propagate if selecting config + !isComponentOf(focus, m_directoryLeft ) && //don't propagate if changing directory field + !isComponentOf(focus, m_directoryRight) && + !isComponentOf(focus, m_panelSearch ) && + !isComponentOf(focus, m_scrolledWindowFolderPairs)) if (wxEvtHandler* evtHandler = m_gridMainL->getMainWin().GetEventHandler()) { m_gridMainL->SetFocus(); @@ -1875,12 +1931,11 @@ void MainDialog::onNaviSelection(GridRangeSelectEvent& event) { leadRow = std::max<ptrdiff_t>(0, leadRow - 1); //scroll one more row - m_gridMainL->scrollTo(leadRow); - m_gridMainC->scrollTo(leadRow); - m_gridMainR->scrollTo(leadRow); + m_gridMainL->scrollTo(leadRow); //scroll all of them (includes the "scroll master") + m_gridMainC->scrollTo(leadRow); // + m_gridMainR->scrollTo(leadRow); // m_gridNavi->getMainWin().Update(); //draw cursor immediately rather than on next idle event (required for slow CPUs, netbook) - } //get selection on navigation tree and set corresponding markers on main grid @@ -1938,6 +1993,27 @@ void MainDialog::onNaviGridContext(GridClickEvent& event) //Gtk requires "no spaces" for shortcut identifiers! menu.addSeparator(); } + + //---------------------------------------------------------------------------------------------------- + //FILE FILTER + auto addFilterMenu = [&](const std::wstring& label, const wxString& iconName, bool include) + { + if (selection.size() == 1) + { + //by relative path + menu.addItem(label + L" " + (FILE_NAME_SEPARATOR + selection[0]->getObjRelativeName()), + [this, &selection, include] { filterItems(selection, include); }, &getResourceImage(iconName)); + } + else if (selection.size() > 1) + { + //by relative path + menu.addItem(label + L" <" + _("multiple selection") + L">", + [this, &selection, include] { filterItems(selection, include); }, &getResourceImage(iconName)); + } + }; + addFilterMenu(_("Include via filter:"), L"filter_include_small", true); + addFilterMenu(_("Exclude via filter:"), L"filter_exclude_small", false); + //---------------------------------------------------------------------------------------------------- if (!selection.empty()) { @@ -1950,23 +2026,9 @@ void MainDialog::onNaviGridContext(GridClickEvent& event) menu.addItem(_("Exclude temporarily") + L"\tSpace", [] {}, nullptr, false); //---------------------------------------------------------------------------------------------------- - //EXCLUDE FILTER - if (selection.size() == 1) - { - //by relative path - menu.addItem(_("Exclude via filter:") + L" " + (FILE_NAME_SEPARATOR + selection[0]->getObjRelativeName()), - [this, &selection] { excludeItems(selection); }, &getResourceImage(L"filterSmall")); - } - else if (selection.size() > 1) - { - //by relative path - menu.addItem(_("Exclude via filter:") + L" <" + _("multiple selection") + L">", - [this, &selection] { excludeItems(selection); }, &getResourceImage(L"filterSmall")); - } - - //---------------------------------------------------------------------------------------------------- //CONTEXT_DELETE_FILES menu.addSeparator(); + menu.addItem(_("Delete") + L"\tDelete", [&] { deleteSelectedFiles(selection, selection); }, nullptr, !selection.empty()); menu.popup(*this); @@ -2030,52 +2092,57 @@ void MainDialog::onMainGridContextRim(bool leftSide) //Gtk requires "no spaces" for shortcut identifiers! menu.addSeparator(); } - //---------------------------------------------------------------------------------------------------- - if (!selection.empty()) - { - if (selection[0]->isActive()) - menu.addItem(_("Exclude temporarily") + L"\tSpace", [this, &selection] { setFilterManually(selection, false); }, &getResourceImage(L"checkboxFalse")); - else - menu.addItem(_("Include temporarily") + L"\tSpace", [this, &selection] { setFilterManually(selection, true); }, &getResourceImage(L"checkboxTrue")); - } - else - menu.addItem(_("Exclude temporarily") + L"\tSpace", [] {}, nullptr, false); //---------------------------------------------------------------------------------------------------- - //EXCLUDE FILTER - if (selection.size() == 1) + //FILE FILTER + auto addFilterMenu = [&](const wxString& label, const wxString& iconName, bool include) { - ContextMenu submenu; - - //by extension - if (dynamic_cast<const DirPair*>(selection[0]) == nullptr) //non empty && no directory + if (selection.size() == 1) { - const Zstring filename = afterLast(selection[0]->getObjRelativeName(), FILE_NAME_SEPARATOR); - if (contains(filename, Zchar('.'))) //be careful: AfterLast would return the whole string if '.' were not found! - { - const Zstring extension = afterLast(filename, Zchar('.')); + ContextMenu submenu; - submenu.addItem(L"*." + utfCvrtTo<wxString>(extension), - [this, extension] { excludeExtension(extension); }); + //by extension + if (dynamic_cast<const DirPair*>(selection[0]) == nullptr) //non empty && no directory + { + const Zstring filename = afterLast(selection[0]->getObjRelativeName(), FILE_NAME_SEPARATOR); + if (contains(filename, Zchar('.'))) //be careful: AfterLast would return the whole string if '.' were not found! + { + const Zstring extension = afterLast(filename, Zchar('.')); + submenu.addItem(L"*." + utfCvrtTo<wxString>(extension), + [this, extension, include] { filterExtension(extension, include); }); + } } - } - //by short name - submenu.addItem(utfCvrtTo<wxString>(Zstring(Zstr("*")) + FILE_NAME_SEPARATOR + selection[0]->getObjShortName()), - [this, &selection] { excludeShortname(*selection[0]); }); + //by short name + submenu.addItem(utfCvrtTo<wxString>(Zstring(Zstr("*")) + FILE_NAME_SEPARATOR + selection[0]->getObjShortName()), + [this, &selection, include] { filterShortname(*selection[0], include); }); - //by relative path - submenu.addItem(utfCvrtTo<wxString>(FILE_NAME_SEPARATOR + selection[0]->getObjRelativeName()), - [this, &selection] { excludeItems(selection); }); + //by relative path + submenu.addItem(utfCvrtTo<wxString>(FILE_NAME_SEPARATOR + selection[0]->getObjRelativeName()), + [this, &selection, include] { filterItems(selection, include); }); - menu.addSubmenu(_("Exclude via filter:"), submenu, &getResourceImage(L"filterSmall")); - } - else if (selection.size() > 1) + menu.addSubmenu(label, submenu, &getResourceImage(iconName)); + } + else if (selection.size() > 1) + { + //by relative path + menu.addItem(label + L" <" + _("multiple selection") + L">", + [this, &selection, include] { filterItems(selection, include); }, &getResourceImage(iconName)); + } + }; + addFilterMenu(_("Include via filter:"), L"filter_include_small", true); + addFilterMenu(_("Exclude via filter:"), L"filter_exclude_small", false); + + //---------------------------------------------------------------------------------------------------- + if (!selection.empty()) { - //by relative path - menu.addItem(_("Exclude via filter:") + L" <" + _("multiple selection") + L">", - [this, &selection] { excludeItems(selection); }, &getResourceImage(L"filterSmall")); + if (selection[0]->isActive()) + menu.addItem(_("Exclude temporarily") + L"\tSpace", [this, &selection] { setFilterManually(selection, false); }, &getResourceImage(L"checkboxFalse")); + else + menu.addItem(_("Include temporarily") + L"\tSpace", [this, &selection] { setFilterManually(selection, true); }, &getResourceImage(L"checkboxTrue")); } + else + menu.addItem(_("Exclude temporarily") + L"\tSpace", [] {}, nullptr, false); //---------------------------------------------------------------------------------------------------- //CONTEXT_EXTERNAL_APP @@ -2117,76 +2184,83 @@ void MainDialog::onMainGridContextRim(bool leftSide) } -void MainDialog::excludeExtension(const Zstring& extension) + +void MainDialog::filterPhrase(const Zstring& phrase, bool include, bool addNewLine) { - const Zstring newExclude = Zstr("*.") + extension; + Zstring& filterString = [&]() -> Zstring& + { + if (include) + { + Zstring& includeFilter = currentCfg.mainCfg.globalFilter.includeFilter; + if (NameFilter::isNull(includeFilter, FilterConfig().excludeFilter)) //fancy way of checking for "*" include + includeFilter.clear(); + return includeFilter; + } + else + return currentCfg.mainCfg.globalFilter.excludeFilter; + }(); - //add to filter config - Zstring& excludeFilter = currentCfg.mainCfg.globalFilter.excludeFilter; - if (!excludeFilter.empty() && !endsWith(excludeFilter, Zstr(";")) && !endsWith(excludeFilter, Zstr("\n"))) - excludeFilter += Zstr("\n"); - excludeFilter += newExclude + Zstr(";"); //';' is appended to 'mark' that next exclude extension entry won't write to new line + if (addNewLine) + { + if (!filterString.empty() && !endsWith(filterString, Zstr("\n"))) + filterString += Zstr("\n"); + filterString += phrase; + } + else + { + if (!filterString.empty() && !endsWith(filterString, Zstr("\n")) && !endsWith(filterString, Zstr(";"))) + filterString += Zstr("\n"); + filterString += phrase + Zstr(";"); //';' is appended to 'mark' that next exclude extension entry won't write to new line + } updateGlobalFilterButton(); + if (include) + applyFilterConfig(); //user's temporary exclusions lost! + else //do not fully apply filter, just exclude new items: preserve user's temporary exclusions + { + std::for_each(begin(folderCmp), end(folderCmp), [&](BaseDirPair& baseDirObj) { addHardFiltering(baseDirObj, phrase); }); + updateGui(); + } +} - //do not fully apply filter, just exclude new items - std::for_each(begin(folderCmp), end(folderCmp), [&](BaseDirPair& baseDirObj) { addHardFiltering(baseDirObj, newExclude); }); - updateGui(); + +void MainDialog::filterExtension(const Zstring& extension, bool include) +{ + filterPhrase(Zstr("*.") + extension, include, false); } -void MainDialog::excludeShortname(const FileSystemObject& fsObj) +void MainDialog::filterShortname(const FileSystemObject& fsObj, bool include) { - Zstring newExclude = Zstring(Zstr("*")) + FILE_NAME_SEPARATOR + fsObj.getObjShortName(); + Zstring phrase = Zstring(Zstr("*")) + FILE_NAME_SEPARATOR + fsObj.getObjShortName(); const bool isDir = dynamic_cast<const DirPair*>(&fsObj) != nullptr; if (isDir) - newExclude += FILE_NAME_SEPARATOR; + phrase += FILE_NAME_SEPARATOR; - //add to filter config - Zstring& excludeFilter = currentCfg.mainCfg.globalFilter.excludeFilter; - if (!excludeFilter.empty() && !endsWith(excludeFilter, Zstr("\n"))) - excludeFilter += Zstr("\n"); - excludeFilter += newExclude; - - updateGlobalFilterButton(); - - //do not fully apply filter, just exclude new items - std::for_each(begin(folderCmp), end(folderCmp), [&](BaseDirPair& baseDirObj) { addHardFiltering(baseDirObj, newExclude); }); - updateGui(); + filterPhrase(phrase, include, true); } -void MainDialog::excludeItems(const std::vector<FileSystemObject*>& selection) +void MainDialog::filterItems(const std::vector<FileSystemObject*>& selection, bool include) { - if (!selection.empty()) //check needed to determine if filtering is needed + if (!selection.empty()) { - Zstring newExclude; + Zstring phrase; for (auto it = selection.begin(); it != selection.end(); ++it) { FileSystemObject* fsObj = *it; if (it != selection.begin()) - newExclude += Zstr("\n"); + phrase += Zstr("\n"); //#pragma warning(suppress: 6011) -> fsObj bound in this context! - newExclude += FILE_NAME_SEPARATOR + fsObj->getObjRelativeName(); + phrase += FILE_NAME_SEPARATOR + fsObj->getObjRelativeName(); const bool isDir = dynamic_cast<const DirPair*>(fsObj) != nullptr; if (isDir) - newExclude += FILE_NAME_SEPARATOR; + phrase += FILE_NAME_SEPARATOR; } - - //add to filter config - Zstring& excludeFilter = currentCfg.mainCfg.globalFilter.excludeFilter; - if (!excludeFilter.empty() && !endsWith(excludeFilter, Zstr("\n"))) - excludeFilter += Zstr("\n"); - excludeFilter += newExclude; - - updateGlobalFilterButton(); - - //do not fully apply filter, just exclude new items - std::for_each(begin(folderCmp), end(folderCmp), [&](BaseDirPair& baseDirObj) { addHardFiltering(baseDirObj, newExclude); }); - updateGui(); + filterPhrase(phrase, include, true); } } @@ -2196,10 +2270,10 @@ void MainDialog::onGridLabelContextC(GridClickEvent& event) ContextMenu menu; const bool actionView = m_bpButtonViewTypeSyncAction->isActive(); - menu.addRadio(_("Category") + (actionView ? L"\tF8" : L""), [&] { setViewTypeSyncAction(false); }, !actionView); - menu.addRadio(_("Action") + (!actionView ? L"\tF8" : L""), [&] { setViewTypeSyncAction(true ); }, actionView); + menu.addRadio(_("Category") + (actionView ? L"\tF9" : L""), [&] { setViewTypeSyncAction(false); }, !actionView); + menu.addRadio(_("Action") + (!actionView ? L"\tF9" : L""), [&] { setViewTypeSyncAction(true ); }, actionView); - //menu.addItem(_("Category") + L"\tF8", [&] { setViewTypeSyncAction(false); }, m_bpButtonViewTypeSyncAction->isActive() ? nullptr : &getResourceImage(L"compare_small")); + //menu.addItem(_("Category") + L"\tF9", [&] { setViewTypeSyncAction(false); }, m_bpButtonViewTypeSyncAction->isActive() ? nullptr : &getResourceImage(L"compare_small")); //menu.addItem(_("Action"), [&] { setViewTypeSyncAction(true ); }, m_bpButtonViewTypeSyncAction->isActive() ? &getResourceImage(L"sync_small") : nullptr); menu.popup(*this); } @@ -2219,30 +2293,23 @@ void MainDialog::onGridLabelContext(Grid& grid, ColumnTypeRim type, const std::v { ContextMenu menu; - auto toggleColumn = [&](const Grid::ColumnAttribute& ca) + auto toggleColumn = [&](ColumnType ct) { auto colAttr = grid.getColumnConfig(); - for (auto it = colAttr.begin(); it != colAttr.end(); ++it) - if (it->type_ == ca.type_) + for (Grid::ColumnAttribute& ca : colAttr) + if (ca.type_ == ct) { - it->visible_ = !ca.visible_; + ca.visible_ = !ca.visible_; grid.setColumnConfig(colAttr); return; } }; - if (auto prov = grid.getDataProvider()) - { - const auto& colAttr = grid.getColumnConfig(); - for (auto it = colAttr.begin(); it != colAttr.end(); ++it) - { - const Grid::ColumnAttribute& ca = *it; - - menu.addCheckBox(prov->getColumnLabel(ca.type_), [ca, toggleColumn] { toggleColumn(ca); }, + if (const GridData* prov = grid.getDataProvider()) + for (const Grid::ColumnAttribute& ca : grid.getColumnConfig()) + menu.addCheckBox(prov->getColumnLabel(ca.type_), [ca, toggleColumn] { toggleColumn(ca.type_); }, ca.visible_, ca.type_ != static_cast<ColumnType>(COL_TYPE_FILENAME)); //do not allow user to hide file name column! - } - } //---------------------------------------------------------------------------------------------- menu.addSeparator(); @@ -2309,7 +2376,9 @@ void MainDialog::OnContextSetLayout(wxMouseEvent& event) const wxAuiPaneInfoArray& paneArray = auiMgr.GetAllPanes(); for (size_t i = 0; i < paneArray.size(); ++i) - if (!paneArray[i].IsShown() && !paneArray[i].name.empty() && paneArray[i].window != compareStatus->getAsWindow()) + if (!paneArray[i].IsShown() && !paneArray[i].name.empty() && + paneArray[i].window != compareStatus->getAsWindow() && + paneArray[i].window != m_panelSearch) captionNameMap.push_back(std::make_pair(paneArray[i].caption, paneArray[i].name)); if (!captionNameMap.empty()) @@ -2364,10 +2433,10 @@ void MainDialog::OnSyncSettingsContext(wxMouseEvent& event) const auto currentVar = getConfig().mainCfg.syncCfg.directionCfg.var; - menu.addRadio(L"<- " + _("Two way") + L" ->" , [&] { setVariant(DirectionConfig::AUTOMATIC); }, currentVar == DirectionConfig::AUTOMATIC); - menu.addRadio( _("Mirror") + L" ->>", [&] { setVariant(DirectionConfig::MIRROR); }, currentVar == DirectionConfig::MIRROR); - menu.addRadio( _("Update") + L" ->" , [&] { setVariant(DirectionConfig::UPDATE); }, currentVar == DirectionConfig::UPDATE); - menu.addRadio( _("Custom") , [&] { setVariant(DirectionConfig::CUSTOM); }, currentVar == DirectionConfig::CUSTOM); + menu.addRadio(L"<- " + _("Two way") + L" ->" , [&] { setVariant(DirectionConfig::TWOWAY); }, currentVar == DirectionConfig::TWOWAY); + menu.addRadio( _("Mirror") + L" ->>", [&] { setVariant(DirectionConfig::MIRROR); }, currentVar == DirectionConfig::MIRROR); + menu.addRadio( _("Update") + L" ->" , [&] { setVariant(DirectionConfig::UPDATE); }, currentVar == DirectionConfig::UPDATE); + menu.addRadio( _("Custom") , [&] { setVariant(DirectionConfig::CUSTOM); }, currentVar == DirectionConfig::CUSTOM); menu.popup(*this); } @@ -2426,8 +2495,12 @@ void MainDialog::addFileToCfgHistory(const std::vector<Zstring>& filenames) const int itemCount = static_cast<int>(m_listBoxHistory->GetCount()); for (int i = 0; i < itemCount; ++i) if (auto histData = dynamic_cast<const wxClientHistoryData*>(m_listBoxHistory->GetClientObject(i))) + { if (EqualFilename()(filename, histData->cfgFile_)) return i; + } + else + assert(false); return -1; }(); @@ -2452,12 +2525,7 @@ void MainDialog::addFileToCfgHistory(const std::vector<Zstring>& filenames) //this prevents problems with m_listBoxHistory losing keyboard selection focus if identical selection is redundantly reapplied for (int pos = 0; pos < static_cast<int>(selections.size()); ++pos) if (m_listBoxHistory->IsSelected(pos) != selections[pos]) - { - if (selections[pos]) - m_listBoxHistory->SetSelection(pos); - else - m_listBoxHistory->Deselect(pos); - } + m_listBoxHistory->SetSelection(pos, selections[pos]); } @@ -2542,9 +2610,6 @@ void MainDialog::updateUnsavedCfgStatus() title += toWx(activeCfgFilename); else if (activeConfigFiles.size() > 1) { -#ifdef _MSC_VER -#pragma warning(disable:4428) // VC wrongly issues warning C4428: universal-character-name encountered in source -#endif const wchar_t* EM_DASH = L" \u2014 "; title += xmlAccess::extractJobName(activeConfigFiles[0]); std::for_each(activeConfigFiles.begin() + 1, activeConfigFiles.end(), [&](const Zstring& filename) { title += EM_DASH + xmlAccess::extractJobName(filename); }); @@ -2722,7 +2787,7 @@ bool MainDialog::saveOldConfig() //return false on user abort QuestConfig().setCaption(toWx(activeCfgFilename)). setLabelYes(_("&Save")). setLabelNo(_("Do&n't save")). - showCheckBox(dontAskAgain, _("Never save changes"), ReturnQuestionDlg::BUTTON_YES))) + showCheckBox(dontAskAgain, _("Never save &changes"), ReturnQuestionDlg::BUTTON_YES))) { case ReturnQuestionDlg::BUTTON_YES: @@ -2808,6 +2873,8 @@ void MainDialog::OnLoadFromHistory(wxCommandEvent& event) { if (auto histData = dynamic_cast<const wxClientHistoryData*>(m_listBoxHistory->GetClientObject(pos))) filenames.push_back(histData->cfgFile_); + else + assert(false); }); if (!filenames.empty()) @@ -2831,6 +2898,8 @@ void MainDialog::OnLoadFromHistoryDoubleClick(wxCommandEvent& event) { if (auto histData = dynamic_cast<const wxClientHistoryData*>(m_listBoxHistory->GetClientObject(pos))) filenames.push_back(histData->cfgFile_); + else + assert(false); }); if (!filenames.empty()) @@ -3026,15 +3095,7 @@ void MainDialog::setConfig(const xmlAccess::XmlGuiConfig& newGuiCfg, const std:: setViewTypeSyncAction(currentCfg.highlightSyncAction); - //########################################################### - //update compare variant name - m_staticTextCmpVariant->SetLabel(currentCfg.mainCfg.getCompVariantName()); - - //update sync variant name - m_staticTextSyncVariant->SetLabel(currentCfg.mainCfg.getSyncVariantName()); - m_panelTopButtons->Layout(); //adapt layout for variant text - - clearGrid(); //+ update GUI + clearGrid(); //+ update GUI! setLastUsedConfig(referenceFiles, newGuiCfg); } @@ -3185,7 +3246,7 @@ inline wxBitmap buttonReleased(const std::string& name) { wxImage output = getResourceImage(utfCvrtTo<wxString>(name)).ConvertToImage().ConvertToGreyscale(1.0/3, 1.0/3, 1.0/3); //treat all channels equally! - zen::move(output, 0, -1); //move image right one pixel + //zen::moveImage(output, 1, 0); //move image right one pixel brighten(output, 80); return mirrorIfRtl(output); @@ -3282,12 +3343,12 @@ void MainDialog::updateGlobalFilterButton() if (!isNullFilter(currentCfg.mainCfg.globalFilter)) { setImage(*m_bpButtonFilter, getResourceImage(L"filter")); - m_bpButtonFilter->SetToolTip(_("Filter is active")); + m_bpButtonFilter->SetToolTip(_("Filter is active") + L" (F10)"); } else { setImage(*m_bpButtonFilter, greyScale(getResourceImage(L"filter"))); - m_bpButtonFilter->SetToolTip(_("No filter selected")); + m_bpButtonFilter->SetToolTip(_("No filter selected")+ L" (F10)"); } } @@ -3296,7 +3357,7 @@ void MainDialog::OnCompare(wxCommandEvent& event) { //PERF_START; - wxBusyCursor dummy; //show hourglass cursor + //wxBusyCursor dummy; -> redundant: progress already shown in progress dialog! wxWindow* oldFocus = wxWindow::FindFocus(); ZEN_ON_SCOPE_EXIT(if (oldFocus) oldFocus->SetFocus();); //e.g. keep focus on main grid after pressing F5 @@ -3368,31 +3429,46 @@ void MainDialog::OnCompare(wxCommandEvent& event) } +void MainDialog::updateTopButtonImages() +{ + auto updateButton = [&](wxBitmapButton& btn, const wxBitmap& bmp, const wxString& variantName, bool makeGrey) + { + wxImage labelImage = createImageFromText(btn.GetLabel(), btn.GetFont(), makeGrey ? wxColor(128, 128, 128) : wxSystemSettings::GetColour(wxSYS_COLOUR_BTNTEXT)); + wxImage variantImage = createImageFromText(variantName, wxFont(wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxBOLD), wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT)); + + wxImage descrImage = stackImages(labelImage, variantImage, ImageStackLayout::VERTICAL, ImageStackAlignment::CENTER); + const wxImage& iconImage = makeGrey ? greyScale(bmp.ConvertToImage()) : bmp.ConvertToImage(); + + wxImage dynImage = btn.GetLayoutDirection() != wxLayout_RightToLeft ? + stackImages(iconImage, descrImage, ImageStackLayout::HORIZONTAL, ImageStackAlignment::CENTER, 5) : + stackImages(descrImage, iconImage, ImageStackLayout::HORIZONTAL, ImageStackAlignment::CENTER, 5); + + //SetMinSize() instead of SetSize() is needed here for wxWindows layout determination to work corretly + wxSize minSize = dynImage.GetSize() + wxSize(10, 10); //add border space + minSize.x = std::max(minSize.x, 180); + btn.SetMinSize(minSize); + + btn.SetBitmapLabel(wxBitmap(dynImage)); + //SetLabel() calls confuse wxBitmapButton in the disabled state and it won't show the image! workaround: + btn.SetBitmapDisabled(wxBitmap(dynImage.ConvertToDisabled())); + }; + + updateButton(*m_buttonCompare, getResourceImage(L"compare"), getConfig().mainCfg.getCompVariantName(), false); + updateButton(*m_buttonSync, getResourceImage(L"sync"), getConfig().mainCfg.getSyncVariantName(), folderCmp.empty()); + + m_panelTopButtons->Layout(); +} + + void MainDialog::updateGui() { updateGridViewData(); //update gridDataView and write status information - //update sync preview statistics updateStatistics(); updateUnsavedCfgStatus(); - //update sync and comparison variant names - m_staticTextSyncVariant->SetLabel(getConfig().mainCfg.getSyncVariantName()); - m_staticTextCmpVariant ->SetLabel(getConfig().mainCfg.getCompVariantName()); - m_panelTopButtons->Layout(); - - //update sync button enabled/disabled status - if (!folderCmp.empty()) - { - m_buttonSync->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNTEXT)); - m_buttonSync->setBitmapFront(getResourceImage(L"sync"), 5); - } - else - { - m_buttonSync->SetForegroundColour(wxColor(128, 128, 128)); //Some colors seem to have problems with 16-bit desktop color, well this one hasn't! - m_buttonSync->setBitmapFront(greyScale(getResourceImage(L"sync")), 5); - } + updateTopButtonImages(); auiMgr.Update(); //fix small display distortion, if view filter panel is empty } @@ -3541,7 +3617,7 @@ void MainDialog::OnStartSync(wxCommandEvent& event) guiCfg.mainCfg.onCompletion, globalCfg.gui.onCompletionHistory); - wxBusyCursor dummy; //show hourglass cursor -> lifetime must end *before* showing results dialog in ~SyncStatusHandler()! + //wxBusyCursor dummy; -> redundant: progress already shown in progress dialog! //GUI mode: place directory locks on directories isolated(!) during both comparison and synchronization std::unique_ptr<LockHolder> dirLocks; @@ -3848,7 +3924,6 @@ void MainDialog::updateGridViewData() void MainDialog::applyFilterConfig() { applyFiltering(folderCmp, getConfig().mainCfg); - updateGui(); //updateGuiDelayedIf(currentCfg.hideExcludedItems); //show update GUI before removing rows } @@ -3873,6 +3948,103 @@ void MainDialog::applySyncConfig() } +void MainDialog::showFindPanel() //CTRL + F or F3 with empty search phrase +{ + auiMgr.GetPane(m_panelSearch).Show(); + auiMgr.Update(); + + m_textCtrlSearchTxt->SelectAll(); + + wxWindow* focus = wxWindow::FindFocus(); //restore when closing panel! + if (!isComponentOf(focus, m_panelSearch)) + focusWindowAfterSearch = focus == &m_gridMainR->getMainWin() ? focus : &m_gridMainL->getMainWin(); + //don't save pointer to arbitrary window: it might not exist anymore when hideFindPanel() uses it!!! (e.g. some folder pair panel) + m_textCtrlSearchTxt->SetFocus(); +} + + +void MainDialog::hideFindPanel() +{ + auiMgr.GetPane(m_panelSearch).Hide(); + auiMgr.Update(); + + if (focusWindowAfterSearch) + { + focusWindowAfterSearch->SetFocus(); + focusWindowAfterSearch = nullptr; + } +} + + +void MainDialog::startFindNext() //F3 or ENTER in m_textCtrlSearchTxt +{ + const wxString& searchString = m_textCtrlSearchTxt->GetValue(); + + if (searchString.empty()) + showFindPanel(); + else + { + Grid* grid1 = m_gridMainL; + Grid* grid2 = m_gridMainR; + + wxWindow* focus = wxWindow::FindFocus(); + if ((isComponentOf(focus, m_panelSearch) ? focusWindowAfterSearch : focus) == &m_gridMainR->getMainWin()) + std::swap(grid1, grid2); //select side to start search at grid cursor position + + wxBeginBusyCursor(wxHOURGLASS_CURSOR); + const std::pair<const Grid*, ptrdiff_t> result = findGridMatch(*grid1, *grid2, searchString, + m_checkBoxMatchCase->GetValue()); //parameter owned by GUI, *not* globalCfg structure! => we should better implement a getGlocalCfg()! + wxEndBusyCursor(); + + if (Grid* grid = const_cast<Grid*>(result.first)) //grid wasn't const when passing to findAndSelectNext(), so this is safe + { + assert(result.second >= 0); + + gridview::setScrollMaster(*grid); + grid->setGridCursor(result.second); + + focusWindowAfterSearch = &grid->getMainWin(); + + if (!isComponentOf(wxWindow::FindFocus(), m_panelSearch)) + grid->getMainWin().SetFocus(); + } + else + { + showFindPanel(); + wxMessageBox(replaceCpy(_("Cannot find %x"), L"%x", L"\"" + searchString + L"\"", false), _("Find"), wxOK, this); + } + } +} + + +void MainDialog::OnSearchGridEnter(wxCommandEvent& event) +{ + startFindNext(); +} + + +void MainDialog::OnHideSearchPanel(wxCommandEvent& event) +{ + hideFindPanel(); +} + + +void MainDialog::OnSearchPanelKeyPressed(wxKeyEvent& event) +{ + switch (event.GetKeyCode()) + { + case WXK_RETURN: + case WXK_NUMPAD_ENTER: //catches ENTER keys while focus is on *any* part of m_panelSearch! Seems to obsolete OnHideSearchPanel()! + startFindNext(); + return; + case WXK_ESCAPE: + hideFindPanel(); + return; + } + event.Skip(); +} + + void MainDialog::OnAddFolderPair(wxCommandEvent& event) { wxWindowUpdateLocker dummy(this); //avoid display distortion @@ -4107,6 +4279,8 @@ void MainDialog::OnMenuExportFileList(wxCommandEvent& event) if (filePicker.ShowModal() != wxID_OK) return; + wxBusyCursor dummy; + const Zstring filename = utfCvrtTo<Zstring>(filePicker.GetPath()); //http://en.wikipedia.org/wiki/Comma-separated_values @@ -4315,7 +4489,7 @@ void MainDialog::setViewTypeSyncAction(bool value) //if (m_bpButtonViewTypeSyncAction->isActive() == value) return; support polling -> what about initialization? m_bpButtonViewTypeSyncAction->setActive(value); - m_bpButtonViewTypeSyncAction->SetToolTip((value ? _("Action") : _("Category")) + L" (F8)"); + m_bpButtonViewTypeSyncAction->SetToolTip((value ? _("Action") : _("Category")) + L" (F9)"); //toggle display of sync preview in middle grid gridview::highlightSyncAction(*m_gridMainC, value); diff --git a/ui/main_dlg.h b/ui/main_dlg.h index b655d95e..72762515 100644 --- a/ui/main_dlg.h +++ b/ui/main_dlg.h @@ -106,6 +106,7 @@ private: void updateGridViewData(); // void updateStatistics(); // more fine-grained updaters void updateUnsavedCfgStatus(); // + void updateTopButtonImages(); // //context menu functions std::vector<zen::FileSystemObject*> getGridSelection(bool fromLeft = true, bool fromRight = true) const; @@ -144,10 +145,10 @@ private: void OnContextSetLayout(wxMouseEvent& event); void OnGlobalKeyEvent (wxKeyEvent& event); - virtual void OnCompSettingsContext(wxMouseEvent& event); - virtual void OnSyncSettingsContext(wxMouseEvent& event); - virtual void OnGlobalFilterContext(wxMouseEvent& event); - virtual void OnViewButtonRightClick(wxMouseEvent& event); + virtual void OnCompSettingsContext(wxMouseEvent& event) override; + virtual void OnSyncSettingsContext(wxMouseEvent& event) override; + virtual void OnGlobalFilterContext(wxMouseEvent& event) override; + virtual void OnViewButtonRightClick(wxMouseEvent& event) override; void applyCompareConfig(bool switchMiddleGrid = false); @@ -183,56 +184,65 @@ private: void onGridLabelContextR(zen::GridClickEvent& event); void onGridLabelContext(zen::Grid& grid, zen::ColumnTypeRim type, const std::vector<zen::ColumnAttributeRim>& defaultColumnAttributes); - void OnToggleViewType (wxCommandEvent& event); - void OnToggleViewButton(wxCommandEvent& event); + virtual void OnToggleViewType (wxCommandEvent& event) override; + virtual void OnToggleViewButton(wxCommandEvent& event) override; - void OnConfigNew (wxCommandEvent& event); - void OnConfigSave (wxCommandEvent& event); - void OnConfigSaveAs (wxCommandEvent& event); - void OnSaveAsBatchJob (wxCommandEvent& event); - void OnConfigLoad (wxCommandEvent& event); - void OnLoadFromHistory(wxCommandEvent& event); - void OnLoadFromHistoryDoubleClick(wxCommandEvent& event); + virtual void OnConfigNew (wxCommandEvent& event) override; + virtual void OnConfigSave (wxCommandEvent& event) override; + virtual void OnConfigSaveAs (wxCommandEvent& event) override; + virtual void OnSaveAsBatchJob (wxCommandEvent& event) override; + virtual void OnConfigLoad (wxCommandEvent& event) override; + virtual void OnLoadFromHistory(wxCommandEvent& event) override; + virtual void OnLoadFromHistoryDoubleClick(wxCommandEvent& event); void deleteSelectedCfgHistoryItems(); - void OnCfgHistoryKeyEvent(wxKeyEvent& event); - void OnCfgHistoryRightClick(wxMouseEvent& event); - void OnRegularUpdateCheck(wxIdleEvent& event); - void OnLayoutWindowAsync (wxIdleEvent& event); + virtual void OnCfgHistoryRightClick(wxMouseEvent& event) override; + void OnCfgHistoryKeyEvent (wxKeyEvent& event) override; + void OnRegularUpdateCheck (wxIdleEvent& event); + void OnLayoutWindowAsync (wxIdleEvent& event); void OnResizeLeftFolderWidth(wxEvent& event); void OnResizeConfigPanel (wxEvent& event); void OnResizeViewPanel (wxEvent& event); void OnResizeStatisticsPanel(wxEvent& event); - void OnShowExcluded (wxCommandEvent& event); - void OnConfigureFilter (wxCommandEvent& event); - void OnSwapSides (wxCommandEvent& event); - void OnCompare (wxCommandEvent& event); - void OnSyncSettings (wxCommandEvent& event); - void OnCmpSettings (wxCommandEvent& event); - void OnStartSync (wxCommandEvent& event); - void OnClose (wxCloseEvent& event); - - void excludeExtension(const Zstring& extension); - void excludeShortname(const zen::FileSystemObject& fsObj); - void excludeItems(const std::vector<zen::FileSystemObject*>& selection); - - void OnAddFolderPair (wxCommandEvent& event); + virtual void OnShowExcluded (wxCommandEvent& event) override; + virtual void OnConfigureFilter (wxCommandEvent& event) override; + virtual void OnSwapSides (wxCommandEvent& event) override; + virtual void OnCompare (wxCommandEvent& event) override; + virtual void OnSyncSettings (wxCommandEvent& event) override; + virtual void OnCmpSettings (wxCommandEvent& event) override; + virtual void OnStartSync (wxCommandEvent& event) override; + virtual void OnClose (wxCloseEvent& event) override; + + void filterExtension(const Zstring& extension, bool include); + void filterShortname(const zen::FileSystemObject& fsObj, bool include); + void filterItems(const std::vector<zen::FileSystemObject*>& selection, bool include); + void filterPhrase(const Zstring& phrase, bool include, bool addNewLine); + + virtual void OnAddFolderPair (wxCommandEvent& event) override; void OnRemoveFolderPair (wxCommandEvent& event); - void OnRemoveTopFolderPair(wxCommandEvent& event); + virtual void OnRemoveTopFolderPair(wxCommandEvent& event) override; void applyFilterConfig(); void applySyncConfig(); + void showFindPanel(); //CTRL + F + void hideFindPanel(); + void startFindNext(); //F3 + + virtual void OnSearchGridEnter(wxCommandEvent& event) override; + virtual void OnHideSearchPanel(wxCommandEvent& event) override; + void OnSearchPanelKeyPressed(wxKeyEvent& event); + //menu events - virtual void OnMenuGlobalSettings(wxCommandEvent& event); - virtual void OnMenuExportFileList(wxCommandEvent& event); - virtual void OnMenuCheckVersion (wxCommandEvent& event); - virtual void OnMenuCheckVersionAutomatically(wxCommandEvent& event); - virtual void OnMenuAbout (wxCommandEvent& event); - virtual void OnShowHelp (wxCommandEvent& event); - virtual void OnMenuQuit (wxCommandEvent& event) { Close(); } + virtual void OnMenuGlobalSettings(wxCommandEvent& event) override; + virtual void OnMenuExportFileList(wxCommandEvent& event) override; + virtual void OnMenuCheckVersion (wxCommandEvent& event) override; + virtual void OnMenuCheckVersionAutomatically(wxCommandEvent& event) override; + virtual void OnMenuAbout (wxCommandEvent& event) override; + virtual void OnShowHelp (wxCommandEvent& event) override; + virtual void OnMenuQuit (wxCommandEvent& event) override { Close(); } void OnMenuLanguageSwitch(wxCommandEvent& event); @@ -296,6 +306,8 @@ private: wxTimer timerForAsyncTasks; //don't use wxWidgets idle handling => repeated idle requests/consumption hogs 100% cpu! std::unique_ptr<zen::FilterConfig> filterCfgOnClipboard; //copy/paste of filter config + + wxWindow* focusWindowAfterSearch; //used to restore focus after search panel is closed }; #endif // MAINDIALOG_H diff --git a/ui/msg_popup.cpp b/ui/msg_popup.cpp index 0d08768c..7fa1550f 100644 --- a/ui/msg_popup.cpp +++ b/ui/msg_popup.cpp @@ -60,7 +60,7 @@ ErrorDlg::ErrorDlg(wxWindow* parent, int activeButtons, const wxString& messageT SetTitle(!caption.empty() ? caption : _("Error")); m_bitmapMsgType->SetBitmap(getResourceImage(L"msg_error")); m_textCtrlMessage->SetValue(messageText); - checkBoxIgnoreErrors.SetLabel(_("Ignore further errors")); + checkBoxIgnoreErrors.SetLabel(_("&Ignore subsequent errors")); buttonIgnore.SetLabel(_("&Ignore")); buttonRetry .SetLabel(_("&Retry")); //buttonIgnore.SetId(wxID_IGNORE); -> setting id after button creation breaks "mouse snap to" functionality @@ -174,7 +174,7 @@ WarningDlg::WarningDlg(wxWindow* parent, int activeButtons, const wxString& mes SetTitle(_("Warning")); m_bitmapMsgType->SetBitmap(getResourceImage(L"msg_warning")); m_textCtrlMessage->SetValue(messageText); - checkBoxDontShowAgain.SetLabel(_("Don't show this warning again")); + checkBoxDontShowAgain.SetLabel(_("&Don't show this warning again")); buttonIgnore.SetLabel(_("&Ignore")); buttonSwitch.SetLabel(_("&Switch")); //buttonIgnore.SetId(wxID_IGNORE); -> see comment in ErrorDlg diff --git a/ui/progress_indicator.cpp b/ui/progress_indicator.cpp index fd1c305d..45fea4d5 100644 --- a/ui/progress_indicator.cpp +++ b/ui/progress_indicator.cpp @@ -12,6 +12,7 @@ #include <wx/sound.h> #include <wx/clipbrd.h> #include <wx/msgdlg.h> +#include <wx/dcclient.h> #include <wx/dataobj.h> //wxTextDataObject #include <zen/basic_math.h> #include <zen/format_unit.h> @@ -34,14 +35,13 @@ #include "tray_icon.h" #include "taskbar.h" #include "exec_finished_box.h" - -#include <wx/msgdlg.h> +//#include <wx/msgdlg.h> +#ifdef ZEN_MAC +#include <ApplicationServices/ApplicationServices.h> +#endif using namespace zen; -warn_static("remove after test") -#include <zen/perf.h> - namespace { @@ -301,7 +301,7 @@ wxBitmap buttonReleased(const std::string& name) //getResourceImage(utfCvrtTo<wxString>(name)).ConvertToImage().ConvertToGreyscale(1.0/3, 1.0/3, 1.0/3); //treat all channels equally! //brighten(output, 30); - zen::move(output, 0, -1); //move image right one pixel + //zen::moveImage(output, 1, 0); //move image right one pixel return output; } @@ -347,11 +347,7 @@ public: size_t rowNumber = 0; bool lastCharNewline = true; - std::for_each(it->message.begin(), it->message.end(), - [&](wchar_t c) - { - typedef Line Line; //workaround MSVC compiler bug! - + for (const wchar_t c : it->message) if (c == L'\n') { if (!lastCharNewline) //do not reference empty lines! @@ -361,7 +357,7 @@ public: } else lastCharNewline = false; - }); + if (!lastCharNewline) viewRef.push_back(Line(&*it, rowNumber)); } @@ -481,7 +477,7 @@ public: switch (static_cast<ColumnTypeMsg>(colType)) { case COL_TYPE_MSG_TIME: - drawCellText(dc, rectTmp, getValue(row, colType), grid.IsEnabled(), wxALIGN_CENTER); + drawCellText(dc, rectTmp, getValue(row, colType), true, wxALIGN_CENTER); break; case COL_TYPE_MSG_CATEGORY: @@ -505,13 +501,13 @@ public: { rectTmp.x += COLUMN_BORDER_LEFT; rectTmp.width -= COLUMN_BORDER_LEFT; - drawCellText(dc, rectTmp, getValue(row, colType), grid.IsEnabled()); + drawCellText(dc, rectTmp, getValue(row, colType), true); } break; } } - virtual size_t getBestSize(wxDC& dc, size_t row, ColumnType colType) + virtual int getBestSize(wxDC& dc, size_t row, ColumnType colType) { // -> synchronize renderCell() <-> getBestSize() @@ -654,7 +650,6 @@ private: m_gridMessages->Refresh(); //update MVC "view" } - void onGridButtonEvent(wxKeyEvent& event) { int keyCode = event.GetKeyCode(); @@ -736,18 +731,24 @@ namespace class CurveDataStatistics : public SparseCurveData { public: - CurveDataStatistics() : SparseCurveData(true), timeNow(0) {} + CurveDataStatistics() : SparseCurveData(true), /*true: add steps*/ timeNow(0) {} void clear() { samples.clear(); timeNow = 0; } void addRecord(long timeNowMs, double value) { - warn_static("review") - timeNow = timeNowMs; + //samples.clear(); + //samples.insert(std::make_pair(-1000, 0)); + //samples.insert(std::make_pair(0, 0)); + //samples.insert(std::make_pair(1, 1)); + //samples.insert(std::make_pair(1000, 0)); + //return; + + timeNow = timeNowMs; if (!samples.empty() && samples.rbegin()->second == value) return; //don't insert duplicate values - samples.insert(samples.end(), std::make_pair(timeNowMs, value)); //use fact that time is monotonously ascending + samples.insert(samples.end(), std::make_pair(timeNowMs, value)); //time is "expected" to be monotonously ascending //documentation differs about whether "hint" should be before or after the to be inserted element! //however "std::map<>::end()" is interpreted correctly by GCC and VS2010 @@ -756,29 +757,29 @@ public: } private: - virtual std::pair<double, double> getRangeX() const final + virtual std::pair<double, double> getRangeX() const final { - if (samples.empty()) return std::make_pair(0.0, 0.0); + if (samples.empty()) return std::make_pair(0.0, 0.0); - double upperEndMs = std::max(timeNow, samples.rbegin()->first); + double upperEndMs = std::max(timeNow, samples.rbegin()->first); - //request some additional width by 5% elapsed time to make graph recalibrate before hitting the right border - //caveat: graph for batch mode binary comparison does NOT start at elapsed time 0!! PHASE_COMPARING_CONTENT and PHASE_SYNCHRONIZING! - //=> consider width of current sample set! - upperEndMs += 0.05 *(upperEndMs - samples.begin()->first); + //report some additional width by 5% elapsed time to make graph recalibrate before hitting the right border + //caveat: graph for batch mode binary comparison does NOT start at elapsed time 0!! PHASE_COMPARING_CONTENT and PHASE_SYNCHRONIZING! + //=> consider width of current sample set! + upperEndMs += 0.05 *(upperEndMs - samples.begin()->first); return std::make_pair(samples.begin()->first / 1000.0, //need not start with 0, e.g. "binary comparison, graph reset, followed by sync" - upperEndMs / 1000.0); + upperEndMs / 1000.0); } virtual Opt<CurvePoint> getLessEq(double x) const final //x: seconds since begin { - const long timex = std::floor(x * 1000); - //------ add artifical last sample value ------- - if (!samples.empty() && samples.rbegin()->first < timeNow) - if (timeNow <= timex) - return CurvePoint(timeNow / 1000.0, samples.rbegin()->second); - //-------------------------------------------------- + const long timex = std::floor(x * 1000); + //------ add artifical last sample value ------- + if (!samples.empty() && samples.rbegin()->first < timeNow) + if (timeNow <= timex) + return CurvePoint(timeNow / 1000.0, samples.rbegin()->second); + //-------------------------------------------------- //find first key > x, then go one step back: => samples must be a std::map, NOT std::multimap!!! auto it = samples.upper_bound(timex); @@ -791,14 +792,14 @@ private: virtual Opt<CurvePoint> getGreaterEq(double x) const final { - const long timex = std::ceil(x * 1000); - //------ add artifical last sample value ------- - if (!samples.empty() && samples.rbegin()->first < timeNow) - if (samples.rbegin()->first < timex && timex <= timeNow) - return CurvePoint(timeNow / 1000.0, samples.rbegin()->second); - //-------------------------------------------------- - - auto it = samples.lower_bound(timex); + const long timex = std::ceil(x * 1000); + //------ add artifical last sample value ------- + if (!samples.empty() && samples.rbegin()->first < timeNow) + if (samples.rbegin()->first < timex && timex <= timeNow) + return CurvePoint(timeNow / 1000.0, samples.rbegin()->second); + //-------------------------------------------------- + + auto it = samples.lower_bound(timex); if (it == samples.end()) return NoValue(); return CurvePoint(it->first / 1000.0, it->second); @@ -807,7 +808,7 @@ private: static const size_t MAX_BUFFER_SIZE = 2500000; //sizeof(single node) worst case ~ 3 * 8 byte ptr + 16 byte key/value = 40 byte std::map<long, double> samples; //time, unit: [ms] !don't use std::multimap, see getLessEq() - long timeNow; //help create an artificial record at the end of samples to visualize current time! + long timeNow; //help create an artificial record at the end of samples to visualize current time! }; @@ -823,41 +824,19 @@ private: virtual void getPoints(double minX, double maxX, int pixelWidth, std::vector<CurvePoint>& points) const final { - - warn_static("remove after test") -#if 0 - if (yTotal_ > 100) - { -points.push_back(CurvePoint(0.38552801074951426,0.3861846045528107)); -points.push_back(CurvePoint(-0.5565680734345084,1.793989720937398)); -points.push_back(CurvePoint(2.85210684934041,3.339141677944872)); -points.push_back(CurvePoint(0.45404408959926135,0.7810567713436095)); -points.push_back(CurvePoint(2.303978218542433,-0.6610850551966995)); -points.push_back(CurvePoint(-2.5606633797896112,-0.4035597290287872)); -points.push_back(CurvePoint(-0.5394390537220716,0.40335295963067147)); - - - //points.push_back(CurvePoint(0.2885508231771302,-1.9264175407823294)); - //points.push_back(CurvePoint(-1.9332518577512143,0.6244007597162101)); - //points.push_back(CurvePoint(3.116299689813205,1.6973640131005165)); - //points.push_back(CurvePoint(0.0,0.0)); - //points.push_back(CurvePoint(-5.993091301993007,0.5231778112837284)); - return; - } -#endif - - - - - + //points.push_back(CurvePoint(-1, 0)); + //points.push_back(CurvePoint(0, 0)); + //points.push_back(CurvePoint(0.0001, 1)); + //points.push_back(CurvePoint(1, 0)); + //return; if (x <= maxX) { points.push_back(CurvePoint(x, 0)); points.push_back(CurvePoint(x, yCurrent_)); - points.push_back(CurvePoint(maxX, yCurrent_)); + points.push_back(CurvePoint(maxX, yCurrent_)); points.push_back(CurvePoint(x, yCurrent_)); - points.push_back(CurvePoint(x, yTotal_)); + points.push_back(CurvePoint(x, yTotal_)); } } @@ -891,15 +870,18 @@ private: }; +const double stretchDefaultBlockSize = 1.4; //enlarge block default size + + struct LabelFormatterBytes : public LabelFormatter { virtual double getOptimalBlockSize(double bytesProposed) const { + bytesProposed *= stretchDefaultBlockSize; //enlarge block default size + if (bytesProposed <= 1) //never smaller than 1 byte return 1; - bytesProposed *= 1.4; //enlarge block default size - //round to next number which is a convenient to read block size const double k = std::floor(std::log(bytesProposed) / std::log(2.0)); const double e = std::pow(2.0, k); @@ -919,6 +901,8 @@ struct LabelFormatterItemCount : public LabelFormatter { virtual double getOptimalBlockSize(double itemsProposed) const { + itemsProposed *= stretchDefaultBlockSize; //enlarge block default size + const double steps[] = { 1, 2, 5, 10 }; if (itemsProposed <= 10) return numeric::nearMatch(itemsProposed, std::begin(steps), std::end(steps)); //similar to nextNiceNumber(), but without the 2.5 step! @@ -998,35 +982,7 @@ public: virtual void initNewPhase(); virtual void notifyProgressChange(); - virtual void updateGui() { - - - warn_static("remove after test") -#if 0 - static bool init = false; - static wxStopWatch sw; - if (!init) - { - init = true; - sw.Start(); - } - if (sw.Time() > 1000 * 10) - { - PERF_START - for (int i = 0; i < 10000; ++i) - //for (int i = 0; i < 1000000; ++i) - updateGuiInt(true); - sw.Start(); - sw.Pause(); - } -#endif - - - - - - - updateGuiInt(true); } + virtual void updateGui() { updateGuiInt(true); } virtual std::wstring getExecWhenFinishedCommand() const { return pnl.m_comboBoxExecFinished->getValue(); } @@ -1197,6 +1153,8 @@ SyncProgressDialogImpl<TopLevelDialog>::SyncProgressDialogImpl(long style, //wxF setLabelY(Graph2D::Y_LABEL_RIGHT, yLabelWidth, std::make_shared<LabelFormatterItemCount>()). setSelectionMode(Graph2D::SELECT_NONE)); + //pnl.m_panelGraphBytes->setAttributes(Graph2D::MainAttributes().setMinX(-1).setMaxX(1).setMinY(-1).setMaxY(1)); + pnl.m_panelGraphBytes->setCurve(curveDataBytes, Graph2D::CurveAttributes().setLineWidth(2). fillCurveArea(wxColor(205, 255, 202)). //faint green setColor (wxColor( 20, 200, 0))); //medium green @@ -1217,30 +1175,18 @@ SyncProgressDialogImpl<TopLevelDialog>::SyncProgressDialogImpl(long style, //wxF updateDialogStatus(); //null-status will be shown while waiting for dir locks - - warn_static("remove after test") -#if 0 - pnl.m_panelGraphBytes->setAttributes(Graph2D::MainAttributes().setMinX(-1).setMaxX(1).setMinY(-1).setMaxY(1)); - pnl.m_panelGraphBytes->setCurve(curveDataBytesCurrent, Graph2D::CurveAttributes().setLineWidth(6).setColor(wxColor(12, 128, 0)) - .fillCurveArea(wxColor(198, 206, 255)) //faint blue - ); // -#endif - - - - - - - - - - this->Fit(); pnl.Layout(); if (showProgress) { this->Show(); +#ifdef ZEN_MAC + ProcessSerialNumber psn = { 0, kCurrentProcess }; + ::TransformProcessType(&psn, kProcessTransformToForegroundApplication); //show dock icon (consider non-silent batch mode) + ::SetFrontProcess(&psn); //why isn't this covered by wxWindows::Raise()?? +#endif + pnl.m_buttonCancel->SetFocus(); //don't steal focus when starting in sys-tray! //clear gui flicker, remove dummy texts: window must be visible to make this work! @@ -1260,6 +1206,11 @@ SyncProgressDialogImpl<TopLevelDialog>::~SyncProgressDialogImpl() //make sure main dialog is shown again if still "minimized to systray"! see SyncProgressDialog::closeWindowDirectly() parentFrame_->Show(); +#ifdef ZEN_MAC + ProcessSerialNumber psn = { 0, kCurrentProcess }; + ::TransformProcessType(&psn, kProcessTransformToForegroundApplication); //show dock icon (consider GUI mode with "close progress dialog") + ::SetFrontProcess(&psn); //why isn't this covered by wxWindows::Raise()?? +#endif //if (parentFrame_->IsIconized()) //caveat: if window is maximized calling Iconize(false) will erroneously un-maximize! // parentFrame_->Iconize(false); } @@ -1301,10 +1252,10 @@ void SyncProgressDialogImpl<TopLevelDialog>::initNewPhase() updateDialogStatus(); //evaluates "syncStat_->currentPhase()" //reset graphs (e.g. after binary comparison) - curveDataBytesTotal ->setValue(0, 0); - curveDataBytesCurrent->setValue(0, 0, 0); - curveDataItemsTotal ->setValue(0, 0); - curveDataItemsCurrent->setValue(0, 0, 0); + curveDataBytesTotal ->setValue(0, 0); + curveDataBytesCurrent->setValue(0, 0, 0); + curveDataItemsTotal ->setValue(0, 0); + curveDataItemsCurrent->setValue(0, 0, 0); curveDataBytes->clear(); curveDataItems->clear(); @@ -1494,10 +1445,10 @@ void SyncProgressDialogImpl<TopLevelDialog>::updateGuiInt(bool allowYield) curveDataItemsTotal ->setValue(timeNow, itemsTotal); curveDataItemsCurrent->setValue(timeNow, itemsCurrent, itemsTotal); //even though notifyProgressChange() already set the latest data, let's add another sample to have all curves consider "timeNow" - //no problem with adding too many records: CurveDataStatistics will remove duplicate entries! - curveDataBytes->addRecord(timeNow, to<double>(dataCurrent)); - curveDataItems->addRecord(timeNow, itemsCurrent); - + //no problem with adding too many records: CurveDataStatistics will remove duplicate entries! + curveDataBytes->addRecord(timeNow, to<double>(dataCurrent)); + curveDataItems->addRecord(timeNow, itemsCurrent); + //remaining objects and data setText(*pnl.m_staticTextRemainingObj, toGuiString(itemsTotal - itemsCurrent), &layoutChanged); setText(*pnl.m_staticTextDataRemaining, L"(" + filesizeToShortString(dataTotal - dataCurrent) + L")", &layoutChanged); @@ -1745,7 +1696,11 @@ void SyncProgressDialogImpl<TopLevelDialog>::processHasFinished(SyncResult resul //at the LATEST(!) to prevent access to currentStatusHandler //enable okay and close events; may be set in this method ONLY - wxWindowUpdateLocker dummy(this); //badly needed +#if (defined __WXGTK__ || defined __WXOSX__) + //In wxWidgets 2.9.3 upwards, the wxWindow::Reparent() below fails on GTK and OS X if window is frozen! http://forums.codeblocks.org/index.php?topic=13388.45 +#else + wxWindowUpdateLocker dummy(this); //badly needed on Windows +#endif paused_ = false; //you never know? @@ -1824,7 +1779,7 @@ void SyncProgressDialogImpl<TopLevelDialog>::processHasFinished(SyncResult resul //hide current operation status pnl.bSizerStatusText->Show(false); - //show and prepare final statistics + //show and prepare final statistics pnl.m_notebookResult->Show(); #if defined ZEN_WIN || defined ZEN_LINUX @@ -1835,15 +1790,15 @@ void SyncProgressDialogImpl<TopLevelDialog>::processHasFinished(SyncResult resul pnl.m_panelTimeRemaining->Hide(); //1. re-arrange graph into results listbook - pnl.bSizerRoot->Detach(pnl.m_panelProgress); + const bool wasDetached = pnl.bSizerRoot->Detach(pnl.m_panelProgress); + assert(wasDetached); + (void)wasDetached; pnl.m_panelProgress->Reparent(pnl.m_notebookResult); -#ifdef ZEN_LINUX //does not seem to be required on Win or OS X - wxTheApp->Yield(); //wxGTK 2.9.3 fails miserably at "reparent" whithout this -#endif - pnl.m_notebookResult->AddPage(pnl.m_panelProgress, _("Statistics"), true); //AddPage() takes ownership! + pnl.m_notebookResult->AddPage(pnl.m_panelProgress, _("Statistics"), true); //2. log file const size_t posLog = 1; + assert(pnl.m_notebookResult->GetPageCount() == 1); LogPanel* logPanel = new LogPanel(pnl.m_notebookResult, log); //owned by m_notebookResult pnl.m_notebookResult->AddPage(logPanel, _("Log"), false); //bSizerHoldStretch->Insert(0, logPanel, 1, wxEXPAND); @@ -1981,6 +1936,11 @@ void SyncProgressDialogImpl<TopLevelDialog>::minimizeToTray() this->Hide(); if (parentFrame_) parentFrame_->Hide(); +#ifdef ZEN_MAC + //hide dock icon: else user is able to forcefully show the hidden main dialog by clicking on the icon!! + ProcessSerialNumber psn = { 0, kCurrentProcess }; + ::TransformProcessType(&psn, kProcessTransformToUIElementApplication); +#endif } } @@ -2008,6 +1968,12 @@ void SyncProgressDialogImpl<TopLevelDialog>::resumeFromSystray() updateDialogStatus(); //restore Windows 7 task bar status (e.g. required in pause mode) updateGuiInt(false); //restore Windows 7 task bar progress (e.g. required in pause mode) + +#ifdef ZEN_MAC + ProcessSerialNumber psn = { 0, kCurrentProcess }; + ::TransformProcessType(&psn, kProcessTransformToForegroundApplication); //show dock icon again + ::SetFrontProcess(&psn); //why isn't this covered by wxWindows::Raise()?? +#endif } } diff --git a/ui/search.cpp b/ui/search.cpp index 4c9c5366..c834b934 100644 --- a/ui/search.cpp +++ b/ui/search.cpp @@ -5,82 +5,19 @@ // ************************************************************************** #include "search.h" -#include "gui_generated.h" -#include <wx/msgdlg.h> -#include <wx/utils.h> -#include <utility> #include <zen/string_tools.h> -#include <wx+/mouse_move_dlg.h> -using namespace zen; - - -class SearchDlg : public SearchDialogGenerated -{ -public: - SearchDlg(wxWindow* parent, wxString& searchText, bool& respectCase); - - enum ReturnCodes - { - BUTTON_CANCEL, - BUTTON_OKAY - }; - -private: - void OnClose (wxCloseEvent& event) { EndModal(BUTTON_CANCEL); } - void OnCancel(wxCommandEvent& event) { EndModal(BUTTON_CANCEL); } - void OnFindNext(wxCommandEvent& event); - void OnText(wxCommandEvent& event); - - wxString& searchText_; - bool& respectCase_; -}; - - -SearchDlg::SearchDlg(wxWindow* parent, wxString& searchText, bool& respectCase) : - SearchDialogGenerated(parent), - searchText_(searchText), - respectCase_(respectCase) -{ -#ifdef ZEN_WIN - new zen::MouseMoveWindow(*this); //allow moving main dialog by clicking (nearly) anywhere...; ownership passed to "this" -#endif - - m_checkBoxMatchCase->SetValue(respectCase_); - m_textCtrlSearchTxt->SetValue(searchText_); - - m_textCtrlSearchTxt->SetFocus(); -} - - -void SearchDlg::OnFindNext(wxCommandEvent& event) -{ - respectCase_ = m_checkBoxMatchCase->GetValue(); - searchText_ = m_textCtrlSearchTxt->GetValue(); - EndModal(BUTTON_OKAY); -} +using namespace zen; -void SearchDlg::OnText(wxCommandEvent& event) +namespace { - if (m_textCtrlSearchTxt->GetValue().Trim().IsEmpty()) - m_buttonFindNext->Disable(); - else - m_buttonFindNext->Enable(); - - event.Skip(); -} -//########################################################################################### - -template <bool respectCase> -class FindInText; - template <bool respectCase> -class FindInText +class ContainsMatch { public: - FindInText(const wxString& textToFind) : textToFind_(textToFind) {} - bool found(const wxString& phrase) const { return contains(phrase, textToFind_); } + ContainsMatch(const wxString& textToFind) : textToFind_(textToFind) {} + bool operator()(const wxString& phrase) const { return contains(phrase, textToFind_); } private: wxString textToFind_; @@ -88,11 +25,11 @@ private: template <> -class FindInText<false> +class ContainsMatch<false> { public: - FindInText(const wxString& textToFind) : textToFind_(textToFind) { textToFind_.MakeUpper(); } - bool found(wxString&& phrase) const + ContainsMatch(const wxString& textToFind) : textToFind_(textToFind) { textToFind_.MakeUpper(); } + bool operator()(wxString&& phrase) const { //wxWidgets::MakeUpper() is inefficient! But performance is not THAT important for this high-level search functionality phrase.MakeUpper(); @@ -111,102 +48,53 @@ ptrdiff_t findRow(const Grid& grid, //return -1 if no matching row found size_t rowFirst, //specify area to search: size_t rowLast) // [rowFirst, rowLast) { - auto prov = grid.getDataProvider(); - std::vector<Grid::ColumnAttribute> colAttr = grid.getColumnConfig(); - vector_remove_if(colAttr, [](const Grid::ColumnAttribute& ca) { return !ca.visible_; }); - if (!colAttr.empty() && prov) + if (auto prov = grid.getDataProvider()) { - const FindInText<respectCase> searchTxt(searchString); + std::vector<Grid::ColumnAttribute> colAttr = grid.getColumnConfig(); + vector_remove_if(colAttr, [](const Grid::ColumnAttribute& ca) { return !ca.visible_; }); + if (!colAttr.empty()) + { + const ContainsMatch<respectCase> containsMatch(searchString); - for (size_t row = rowFirst; row < rowLast; ++row) - for (auto iterCol = colAttr.begin(); iterCol != colAttr.end(); ++iterCol) - if (searchTxt.found(prov->getValue(row, iterCol->type_))) - return row; + for (size_t row = rowFirst; row < rowLast; ++row) + for (auto iterCol = colAttr.begin(); iterCol != colAttr.end(); ++iterCol) + if (containsMatch(prov->getValue(row, iterCol->type_))) + return row; + } } return -1; } - - -//syntactic sugar... -ptrdiff_t findRow(Grid& grid, - bool respectCase, - const wxString& searchString, - size_t rowFirst, //specify area to search: - size_t rowLast) // [rowFirst, rowLast) -{ - return respectCase ? - findRow<true>( grid, searchString, rowFirst, rowLast) : - findRow<false>(grid, searchString, rowFirst, rowLast); } -wxString lastSearchString; //this variable really is conceptionally global... - - -void executeSearch(bool forceShowDialog, - bool& respectCase, - wxWindow* parent, - Grid* gridL, Grid* gridR) +std::pair<const Grid*, ptrdiff_t> zen::findGridMatch(const Grid& grid1, const Grid& grid2, const wxString& searchString, bool respectCase) { - bool searchDialogWasShown = false; - - if (forceShowDialog || lastSearchString.IsEmpty()) - { - SearchDlg searchDlg(parent, lastSearchString, respectCase); //wxWidgets deletion handling -> deleted by parentWindow - if (static_cast<SearchDlg::ReturnCodes>(searchDlg.ShowModal()) != SearchDlg::BUTTON_OKAY) - return; - - searchDialogWasShown = true; - } - - if (wxWindow::FindFocus() == &gridR->getMainWin()) - std::swap(gridL, gridR); //select side to start with + const size_t rowCountL = grid1.getRowCount(); + const size_t rowCountR = grid2.getRowCount(); + auto cursorPos = grid1.getGridCursor(); //(row, component pos) - const size_t rowCountL = gridL->getRowCount(); - const size_t rowCountR = gridR->getRowCount(); - auto cursorPos = gridL->getGridCursor(); //(row, component pos) + std::pair<const Grid*, ptrdiff_t> result(nullptr, -1); size_t cursorRowL = cursorPos.first; if (cursorRowL >= rowCountL) cursorRowL = 0; { - wxBusyCursor showHourGlass; - - auto finishSearch = [&](Grid& grid, size_t rowFirst, size_t rowLast) -> bool + auto finishSearch = [&](const Grid& grid, size_t rowFirst, size_t rowLast) -> bool { - const ptrdiff_t targetRow = findRow(grid, respectCase, lastSearchString, rowFirst, rowLast); + const ptrdiff_t targetRow = respectCase ? + findRow<true>( grid, searchString, rowFirst, rowLast) : + findRow<false>(grid, searchString, rowFirst, rowLast); if (targetRow >= 0) { - //gridOther.clearSelection(); -> not needed other grids are automatically cleared after selection - grid.setGridCursor(targetRow); - grid.SetFocus(); + result = std::make_pair(&grid, targetRow); return true; } return false; }; - if (finishSearch(*gridL, cursorRowL + 1, rowCountL) || - finishSearch(*gridR, 0, rowCountR) || - finishSearch(*gridL, 0, cursorRowL + 1)) - return; + if (!finishSearch(grid1, cursorRowL + 1, rowCountL)) + if (!finishSearch(grid2, 0, rowCountR)) + finishSearch(grid1, 0, cursorRowL + 1); } - - wxMessageBox(replaceCpy(_("Cannot find %x"), L"%x", L"\"" + lastSearchString + L"\"", false), _("Find"), wxOK, parent); - - //show search dialog again - if (searchDialogWasShown) - executeSearch(true, respectCase, parent, gridL, gridR); -} -//########################################################################################### - - -void zen::startFind(wxWindow* parent, Grid& gridL, Grid& gridR, bool& respectCase) //Strg + F -{ - executeSearch(true, respectCase, parent, &gridL, &gridR); -} - - -void zen::findNext(wxWindow* parent, Grid& gridL, Grid& gridR, bool& respectCase) //F3 -{ - executeSearch(false, respectCase, parent, &gridL, &gridR); -} + return result; +}
\ No newline at end of file diff --git a/ui/search.h b/ui/search.h index dd92d5b6..1adf3d01 100644 --- a/ui/search.h +++ b/ui/search.h @@ -4,15 +4,15 @@ // * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved * // ************************************************************************** -#ifndef SEARCH_H_INCLUDED -#define SEARCH_H_INCLUDED +#ifndef SEARCH_H_423905762345342526587 +#define SEARCH_H_423905762345342526587 #include <wx+/grid.h> namespace zen { -void startFind(wxWindow* parent, Grid& gridL, Grid& gridR, bool& respectCase); //Strg + F -void findNext( wxWindow* parent, Grid& gridL, Grid& gridR, bool& respectCase); //F3 +std::pair<const Grid*, ptrdiff_t> findGridMatch(const Grid& grid1, const Grid& grid2, const wxString& searchString, bool respectCase); +//returns (grid/row) where the value was found, (nullptr, -1) if not found } -#endif // SEARCH_H_INCLUDED +#endif //SEARCH_H_423905762345342526587 diff --git a/ui/small_dlgs.cpp b/ui/small_dlgs.cpp index b7b7828b..19ad5417 100644 --- a/ui/small_dlgs.cpp +++ b/ui/small_dlgs.cpp @@ -11,7 +11,7 @@ #include <zen/tick_count.h> #include <zen/stl_tools.h> #include <wx+/choice_enum.h> -#include <wx+/button.h> +#include <wx+/bitmap_button.h> #include <wx+/rtl.h> #include <wx+/no_flicker.h> #include <wx+/mouse_move_dlg.h> @@ -66,18 +66,15 @@ AboutDlg::AboutDlg(wxWindow* parent) : AboutDlgGenerated(parent) wxStaticBitmap* staticBitmapFlag = new wxStaticBitmap(m_scrolledWindowTranslators, wxID_ANY, getResourceImage(it->languageFlag), wxDefaultPosition, wxSize(-1, 11), 0 ); fgSizerTranslators->Add(staticBitmapFlag, 0, wxALIGN_CENTER); - //language name - wxStaticText* staticTextLanguage = new wxStaticText(m_scrolledWindowTranslators, wxID_ANY, it->languageName, wxDefaultPosition, wxDefaultSize, 0 ); - staticTextLanguage->Wrap(-1); - fgSizerTranslators->Add(staticTextLanguage, 0, wxALIGN_CENTER_VERTICAL); - //translator name wxStaticText* staticTextTranslator = new wxStaticText(m_scrolledWindowTranslators, wxID_ANY, it->translatorName, wxDefaultPosition, wxDefaultSize, 0 ); staticTextTranslator->Wrap(-1); fgSizerTranslators->Add(staticTextTranslator, 0, wxALIGN_CENTER_VERTICAL); - } - bSizerTranslators->Fit(m_scrolledWindowTranslators); + staticBitmapFlag ->SetToolTip(it->languageName); + staticTextTranslator->SetToolTip(it->languageName); + } + fgSizerTranslators->Fit(m_scrolledWindowTranslators); #ifdef ZEN_WIN new zen::MouseMoveWindow(*this); //-> put *after* creating credits @@ -112,7 +109,6 @@ AboutDlg::AboutDlg(wxWindow* parent) : AboutDlgGenerated(parent) tmp.Resize(wxSize(GetClientSize().GetWidth(), tmp.GetHeight()), wxPoint(0, 0), 255, 255, 255); //enlarge to fit full width bmpLogo = wxBitmap(tmp); } - { wxMemoryDC dc(bmpLogo); dc.SetTextForeground(wxColor(2, 2, 2)); //for some unknown reason SetBitmap below seems to replace wxBLACK with white on accessibility high contrast schemes!! @@ -177,14 +173,16 @@ FilterDlg::FilterDlg(wxWindow* parent, setRelativeFontSize(*m_staticTextHeader, 1.25); +#ifndef __WXGTK__ //wxWidgets holds portability promise by not supporting for multi-line controls...not m_textCtrlInclude->SetMaxLength(0); //allow large filter entries! m_textCtrlExclude->SetMaxLength(0); // +#endif m_textCtrlInclude->Connect(wxEVT_KEY_DOWN, wxKeyEventHandler(FilterDlg::onKeyEvent), nullptr, this); m_textCtrlExclude->Connect(wxEVT_KEY_DOWN, wxKeyEventHandler(FilterDlg::onKeyEvent), nullptr, this); enumTimeDescr. - add(UTIME_NONE, _("Inactive")). + add(UTIME_NONE, L"(" + _("Inactive") + L")"). //meta options should be enclosed in parentheses add(UTIME_TODAY, _("Today")). // add(UTIME_THIS_WEEK, _("This week")). add(UTIME_THIS_MONTH, _("This month")). @@ -192,7 +190,7 @@ FilterDlg::FilterDlg(wxWindow* parent, add(UTIME_LAST_X_DAYS, _("Last x days")); enumSizeDescr. - add(USIZE_NONE, _("Inactive")). + add(USIZE_NONE, L"(" + _("Inactive") + L")"). //meta options should be enclosed in parentheses add(USIZE_BYTE, _("Byte")). add(USIZE_KB, _("KB")). add(USIZE_MB, _("MB")); @@ -369,7 +367,9 @@ DeleteDialog::DeleteDialog(wxWindow* parent, m_checkBoxDeleteBothSides->SetValue(true); } +#ifndef __WXGTK__ //wxWidgets holds portability promise by not supporting for multi-line controls...not m_textCtrlFileList->SetMaxLength(0); //allow large entries! +#endif updateGui(); @@ -390,8 +390,8 @@ void DeleteDialog::updateGui() wxString header; if (m_checkBoxUseRecycler->GetValue()) { - header = _P("Do you really want to move the following item to the Recycle Bin?", - "Do you really want to move the following %x items to the Recycle Bin?", delInfo.second); + header = _P("Do you really want to move the following item to the recycle bin?", + "Do you really want to move the following %x items to the recycle bin?", delInfo.second); m_bitmapDeleteType->SetBitmap(getResourceImage(L"recycler")); } else @@ -587,7 +587,7 @@ CompareCfgDialog::CompareCfgDialog(wxWindow* parent, m_bpButtonHelp->SetBitmapLabel(getResourceImage(L"help")); enumDescrHandleSyml. - add(SYMLINK_IGNORE, _("Exclude")). + add(SYMLINK_EXCLUDE, _("Exclude")). add(SYMLINK_USE_DIRECTLY, _("Direct")). add(SYMLINK_FOLLOW_LINK, _("Follow")); @@ -679,7 +679,7 @@ private: virtual void OnRemoveRow(wxCommandEvent& event); void onResize(wxSizeEvent& event); - void set(const xmlAccess::ExternalApps& extApp); + void setExtApp(const xmlAccess::ExternalApps& extApp); xmlAccess::ExternalApps getExtApp(); xmlAccess::XmlGlobalSettings& settings; @@ -698,9 +698,9 @@ GlobalSettingsDlg::GlobalSettingsDlg(wxWindow* parent, xmlAccess::XmlGlobalSetti setRelativeFontSize(*m_staticTextHeader, 1.25); m_bitmapSettings ->SetBitmap (getResourceImage(L"settings")); - m_buttonResetDialogs->setBitmapFront(getResourceImage(L"reset_dialogs"), 5); m_bpButtonAddRow ->SetBitmapLabel(getResourceImage(L"item_add")); m_bpButtonRemoveRow ->SetBitmapLabel(getResourceImage(L"item_remove")); + setBitmapTextLabel(*m_buttonResetDialogs, getResourceImage(L"reset_dialogs").ConvertToImage(), m_buttonResetDialogs->GetLabel()); m_checkBoxCopyLocked ->SetValue(globalSettings.copyLockedFiles); m_checkBoxTransCopy ->SetValue(globalSettings.transactionalFileCopy); @@ -713,7 +713,7 @@ GlobalSettingsDlg::GlobalSettingsDlg(wxWindow* parent, xmlAccess::XmlGlobalSetti m_staticTextCopyLocked->Hide(); #endif - set(globalSettings.gui.externelApplications); + setExtApp(globalSettings.gui.externelApplications); const wxString toolTip = wxString(_("Integrate external applications into context menu. The following macros are available:")) + L"\n\n" + L"%item_path% \t" + _("- full file or folder name") + L"\n" + @@ -782,11 +782,11 @@ void GlobalSettingsDlg::OnDefault(wxCommandEvent& event) m_checkBoxCopyLocked ->SetValue(defaultCfg.copyLockedFiles); m_checkBoxTransCopy ->SetValue(defaultCfg.transactionalFileCopy); m_checkBoxCopyPermissions->SetValue(defaultCfg.copyFilePermissions); - set(defaultCfg.gui.externelApplications); + setExtApp(defaultCfg.gui.externelApplications); } -void GlobalSettingsDlg::set(const xmlAccess::ExternalApps& extApp) +void GlobalSettingsDlg::setExtApp(const xmlAccess::ExternalApps& extApp) { auto extAppTmp = extApp; vector_remove_if(extAppTmp, [](decltype(extAppTmp[0])& entry) { return entry.first.empty() && entry.second.empty(); }); @@ -935,11 +935,15 @@ SelectTimespanDlg::SelectTimespanDlg(wxWindow* parent, Int64& timeFrom, Int64& t m_calendarFrom->SetDate(utcToLocalDateTime(to<time_t>(timeFrom_))); m_calendarTo ->SetDate(utcToLocalDateTime(to<time_t>(timeTo_))); +#if wxCHECK_VERSION(2, 9, 5) + //doesn't seem to be a problem here: +#else //wxDatePickerCtrl::BestSize() does not respect year field and trims it, both wxMSW/wxGTK - why isn't there anybody testing this wxWidgets stuff??? wxSize minSz = m_calendarFrom->GetBestSize(); minSz.x += 30; m_calendarFrom->SetMinSize(minSz); m_calendarTo ->SetMinSize(minSz); +#endif Fit(); m_buttonOkay->SetFocus(); diff --git a/ui/sync_cfg.cpp b/ui/sync_cfg.cpp index 97518be1..d0d32c18 100644 --- a/ui/sync_cfg.cpp +++ b/ui/sync_cfg.cpp @@ -35,10 +35,12 @@ public: ExecWhenFinishedCfg* execWhenFinished); //optional input parameter private: - virtual void OnSyncTwoWay(wxCommandEvent& event) { directionCfg.var = DirectionConfig::AUTOMATIC; updateGui(); } - virtual void OnSyncMirror(wxCommandEvent& event) { directionCfg.var = DirectionConfig::MIRROR; updateGui(); } - virtual void OnSyncUpdate(wxCommandEvent& event) { directionCfg.var = DirectionConfig::UPDATE; updateGui(); } - virtual void OnSyncCustom(wxCommandEvent& event) { directionCfg.var = DirectionConfig::CUSTOM; updateGui(); } + virtual void OnSyncTwoWay(wxCommandEvent& event) { directionCfg.var = DirectionConfig::TWOWAY; updateGui(); } + virtual void OnSyncMirror(wxCommandEvent& event) { directionCfg.var = DirectionConfig::MIRROR; updateGui(); } + virtual void OnSyncUpdate(wxCommandEvent& event) { directionCfg.var = DirectionConfig::UPDATE; updateGui(); } + virtual void OnSyncCustom(wxCommandEvent& event) { directionCfg.var = DirectionConfig::CUSTOM; updateGui(); } + + virtual void OnToggleDetectMovedFiles(wxCommandEvent& event) { directionCfg.detectMovedFiles = !directionCfg.detectMovedFiles; updateGui(); } virtual void OnSyncTwoWayDouble(wxMouseEvent& event); virtual void OnSyncMirrorDouble(wxMouseEvent& event); @@ -101,7 +103,7 @@ void updateConfigIcons(const DirectionConfig& directionCfg, wxBitmapButton* buttonDifferent, wxBitmapButton* buttonConflict) { - if (directionCfg.var != DirectionConfig::AUTOMATIC) //automatic mode needs no sync-directions + if (directionCfg.var != DirectionConfig::TWOWAY) //automatic mode needs no sync-directions { const DirectionSet dirCfg = extractDirections(directionCfg); @@ -211,7 +213,7 @@ SyncCfgDialog::SyncCfgDialog(wxWindow* parent, ExecWhenFinishedCfg* execWhenFinished) : SyncCfgDlgGenerated(parent), handleDeletion(DELETE_TO_RECYCLER), // - onGuiError(ON_GUIERROR_POPUP), //dummy init + onGuiError(ON_GUIERROR_POPUP), //dummy init outSyncCfg(syncCfg), outOptOnGuiError(handleError), outOptExecWhenFinished(execWhenFinished), @@ -298,7 +300,7 @@ SyncCfgDialog::Config SyncCfgDialog::getConfig() const output.syncCfg.versioningDirectory = utfCvrtTo<Zstring>(versioningFolder.getName()); output.syncCfg.versioningStyle = getEnumVal(enumVersioningStyle, *m_choiceVersioningStyle), - ////get single parameter "version limit" from both checkbox and spin ctrl: + //get single parameter "version limit" from both checkbox and spin ctrl: // output.syncCfg.versionCountLimit = m_checkBoxVersionsLimit->GetValue() ? m_spinCtrlVersionsLimit->GetValue() : -1; output.onGuiError = onGuiError; @@ -329,9 +331,13 @@ void SyncCfgDialog::updateGui() m_bpButtonDifferent, m_bpButtonConflict); + //selecting "detect move files" does not always make sense: + m_checkBoxDetectMove->Enable(detectMovedFilesSelectable(directionCfg)); + m_checkBoxDetectMove->SetValue(detectMovedFilesEnabled(directionCfg)); //parameter NOT owned by checkbox! + //display only relevant sync options - m_bitmapDatabase ->Show(cfg.syncCfg.directionCfg.var == DirectionConfig::AUTOMATIC); - sbSizerSyncDirections->Show(cfg.syncCfg.directionCfg.var != DirectionConfig::AUTOMATIC); + m_bitmapDatabase ->Show(cfg.syncCfg.directionCfg.var == DirectionConfig::TWOWAY); + sbSizerSyncDirections->Show(cfg.syncCfg.directionCfg.var != DirectionConfig::TWOWAY); switch (compareVar_) //sbSizerSyncDirections->Show resets child sizers! { @@ -359,7 +365,7 @@ void SyncCfgDialog::updateGui() switch (cfg.syncCfg.directionCfg.var) { - case DirectionConfig::AUTOMATIC: + case DirectionConfig::TWOWAY: m_toggleBtnTwoWay->SetValue(true); m_staticTextAutomatic->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT)); break; @@ -512,7 +518,7 @@ void pressCustomDir(DirectionConfig& directionCfg, SyncDirection& syncdir) { switch (directionCfg.var) { - case DirectionConfig::AUTOMATIC: + case DirectionConfig::TWOWAY: assert(false); break; case DirectionConfig::MIRROR: @@ -525,20 +531,21 @@ void pressCustomDir(DirectionConfig& directionCfg, SyncDirection& syncdir) toggleSyncDirection(syncdir); //some config optimization: if custom settings happen to match "mirror" or "update", just switch variant - DirectionSet currentSet = extractDirections(directionCfg); - DirectionSet setMirror; - DirectionSet setUpdate; + const DirectionSet setMirror = [] { DirectionConfig mirrorCfg; mirrorCfg.var = DirectionConfig::MIRROR; - setMirror = extractDirections(mirrorCfg); - } + return extractDirections(mirrorCfg); + }(); + + const DirectionSet setUpdate = [] { DirectionConfig updateCfg; updateCfg.var = DirectionConfig::UPDATE; - setUpdate = extractDirections(updateCfg); - } + return extractDirections(updateCfg); + }(); + const DirectionSet currentSet = extractDirections(directionCfg); if (currentSet == setMirror) directionCfg.var = DirectionConfig::MIRROR; else if (currentSet == setUpdate) diff --git a/ui/tree_view.cpp b/ui/tree_view.cpp index 791fa6cc..cf4eb2e8 100644 --- a/ui/tree_view.cpp +++ b/ui/tree_view.cpp @@ -57,9 +57,7 @@ void TreeView::extractVisibleSubtree(HierarchyObject& hierObj, //in }; cont.firstFileId = nullptr; - std::for_each(hierObj.refSubFiles().begin(), hierObj.refSubFiles().end(), - [&](FilePair& fileObj) - { + for (FilePair& fileObj : hierObj.refSubFiles()) if (pred(fileObj)) { cont.bytesNet += getBytes(fileObj); @@ -68,11 +66,8 @@ void TreeView::extractVisibleSubtree(HierarchyObject& hierObj, //in if (!cont.firstFileId) cont.firstFileId = fileObj.getId(); } - }); - std::for_each(hierObj.refSubLinks().begin(), hierObj.refSubLinks().end(), - [&](SymlinkPair& linkObj) - { + for (SymlinkPair& linkObj : hierObj.refSubLinks()) if (pred(linkObj)) { ++cont.itemCountNet; @@ -80,14 +75,13 @@ void TreeView::extractVisibleSubtree(HierarchyObject& hierObj, //in if (!cont.firstFileId) cont.firstFileId = linkObj.getId(); } - }); + cont.bytesGross += cont.bytesNet; cont.itemCountGross += cont.itemCountNet; cont.subDirs.reserve(hierObj.refSubDirs().size()); //avoid expensive reallocations! - std::for_each(hierObj.refSubDirs().begin(), hierObj.refSubDirs().end(), - [&cont, pred](DirPair& subDirObj) + for (DirPair& subDirObj : hierObj.refSubDirs()) { const bool included = pred(subDirObj); @@ -107,7 +101,7 @@ void TreeView::extractVisibleSubtree(HierarchyObject& hierObj, //in subDirView.objId = subDirObj.getId(); compressNode(subDirView); } - }); + } } @@ -121,30 +115,30 @@ void calcPercentage(std::vector<std::pair<UInt64, int*>>& workList) if (total == 0U) //this case doesn't work with the error minimizing algorithm below { - std::for_each(workList.begin(), workList.end(), [](std::pair<UInt64, int*>& pair) { *pair.second = 0; }); + for (std::pair<UInt64, int*>& pair : workList) + *pair.second = 0; return; } int remainingPercent = 100; - std::for_each(workList.begin(), workList.end(), - [&](std::pair<UInt64, int*>& pair) + for (std::pair<UInt64, int*>& pair : workList) { - *pair.second = to<double>(pair.first) * 100 / to<double>(total); //round down + *pair.second = to<int>(pair.first * 100U / total); //round down remainingPercent -= *pair.second; - }); + } + assert(remainingPercent >= 0); + assert(remainingPercent < static_cast<int>(workList.size())); - //find #remainingPercent items with largest absolute error + //distribute remaining percent so that overall error is minimized as much as possible: remainingPercent = std::min(remainingPercent, static_cast<int>(workList.size())); if (remainingPercent > 0) { std::nth_element(workList.begin(), workList.begin() + remainingPercent - 1, workList.end(), [total](const std::pair<UInt64, int*>& lhs, const std::pair<UInt64, int*>& rhs) { - //return std::abs(*lhs.second - to<double>(lhs.first) * 100 / total) > std::abs(*rhs.second - to<double>(rhs.first) * 100 / total); - return (to<double>(lhs.first) - to<double>(rhs.first)) * 100 / to<double>(total) > *lhs.second - *rhs.second; + return lhs.first * 100U % total > rhs.first * 100U % total; }); - //distribute remaining percent so that overall error is minimized as much as possible std::for_each(workList.begin(), workList.begin() + remainingPercent, [&](std::pair<UInt64, int*>& pair) { ++*pair.second; }); } } @@ -244,7 +238,7 @@ void TreeView::sortSingleLevel(std::vector<TreeLine>& items, ColumnTypeNavi colu } -void TreeView::getChildren(const Container& cont, size_t level, std::vector<TreeLine>& output) +void TreeView::getChildren(const Container& cont, unsigned int level, std::vector<TreeLine>& output) { output.clear(); output.reserve(cont.subDirs.size() + 1); //keep pointers in "workList" valid @@ -453,7 +447,7 @@ void TreeView::reduceNode(size_t row) { if (row < flatTree.size()) { - const size_t parentLevel = flatTree[row].level_; + const unsigned int parentLevel = flatTree[row].level_; bool done = false; flatTree.erase(std::remove_if(flatTree.begin() + row + 1, flatTree.end(), @@ -477,7 +471,7 @@ ptrdiff_t TreeView::getParent(size_t row) const { if (row < flatTree.size()) { - const size_t level = flatTree[row].level_; + const auto level = flatTree[row].level_; while (row-- > 0) if (flatTree[row].level_ < level) @@ -638,18 +632,13 @@ std::unique_ptr<TreeView::Node> TreeView::getLine(size_t row) const HierarchyObject& parent = firstFile->parent(); //lazy evaluation: recheck "lastViewFilterPred" again rather than buffer and bloat "lastViewFilterPred" - std::for_each(parent.refSubFiles().begin(), parent.refSubFiles().end(), - [&](FileSystemObject& fsObj) - { + for (FileSystemObject& fsObj : parent.refSubFiles()) if (lastViewFilterPred(fsObj)) filesAndLinks.push_back(&fsObj); - }); - std::for_each(parent.refSubLinks().begin(), parent.refSubLinks().end(), - [&](FileSystemObject& fsObj) - { + + for (FileSystemObject& fsObj : parent.refSubLinks()) if (lastViewFilterPred(fsObj)) filesAndLinks.push_back(&fsObj); - }); return make_unique<TreeView::FilesNode>(percent, parentDir->bytesNet, parentDir->itemCountNet, level, filesAndLinks); } @@ -664,10 +653,6 @@ std::unique_ptr<TreeView::Node> TreeView::getLine(size_t row) const namespace { -#ifdef _MSC_VER -#pragma warning(disable:4428) // VC wrongly issues warning C4428: universal-character-name encountered in source -#endif - wxString getShortDisplayNameForFolderPair(const Zstring& dirLeftPf, const Zstring& dirRightPf) //post-fixed with separator { assert(endsWith(dirLeftPf, FILE_NAME_SEPARATOR) || dirLeftPf .empty()); @@ -1015,7 +1000,7 @@ private: rectTmp.width -= widthNodeIcon + GAP_SIZE; if (rectTmp.width > 0) - drawCellText(dc, rectTmp, getValue(row, colType), grid.IsEnabled(), wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL); + drawCellText(dc, rectTmp, getValue(row, colType), isActive, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL); } } } @@ -1038,11 +1023,11 @@ private: rectTmp.width -= 2 * GAP_SIZE; } - drawCellText(dc, rectTmp, getValue(row, colType), grid.IsEnabled(), alignment); + drawCellText(dc, rectTmp, getValue(row, colType), true, alignment); } } - virtual size_t getBestSize(wxDC& dc, size_t row, ColumnType colType) + virtual int getBestSize(wxDC& dc, size_t row, ColumnType colType) { // -> synchronize renderCell() <-> getBestSize() <-> onMouseLeft() diff --git a/ui/tree_view.h b/ui/tree_view.h index d7289d17..719212dd 100644 --- a/ui/tree_view.h +++ b/ui/tree_view.h @@ -57,12 +57,12 @@ public: //--------------------------------------------------------------------- struct Node { - Node(int percent, UInt64 bytes, int itemCount, size_t level, NodeStatus status) : + Node(int percent, UInt64 bytes, int itemCount, unsigned int level, NodeStatus status) : percent_(percent), level_(level), status_(status), bytes_(bytes), itemCount_(itemCount) {} virtual ~Node() {} const int percent_; //[0, 100] - const size_t level_; + const unsigned int level_; const NodeStatus status_; const UInt64 bytes_; const int itemCount_; @@ -70,13 +70,13 @@ public: struct FilesNode : public Node { - FilesNode(int percent, UInt64 bytes, int itemCount, size_t level, const std::vector<FileSystemObject*>& filesAndLinks) : Node(percent, bytes, itemCount, level, STATUS_EMPTY), filesAndLinks_(filesAndLinks) {} + FilesNode(int percent, UInt64 bytes, int itemCount, unsigned int level, const std::vector<FileSystemObject*>& filesAndLinks) : Node(percent, bytes, itemCount, level, STATUS_EMPTY), filesAndLinks_(filesAndLinks) {} std::vector<FileSystemObject*> filesAndLinks_; //files or symlinks; pointers are bound! }; struct DirNode : public Node { - DirNode(int percent, UInt64 bytes, int itemCount, size_t level, NodeStatus status, DirPair& dirObj) : Node(percent, bytes, itemCount, level, status), dirObj_(dirObj) {} + DirNode(int percent, UInt64 bytes, int itemCount, unsigned int level, NodeStatus status, DirPair& dirObj) : Node(percent, bytes, itemCount, level, status), dirObj_(dirObj) {} DirPair& dirObj_; }; @@ -137,9 +137,9 @@ private: struct TreeLine { - TreeLine(size_t level, int percent, const Container* node, enum NodeType type) : level_(level), percent_(percent), node_(node), type_(type) {} + TreeLine(unsigned int level, int percent, const Container* node, enum NodeType type) : level_(level), percent_(percent), node_(node), type_(type) {} - size_t level_; + unsigned int level_; int percent_; //[0, 100] const Container* node_; // NodeType type_; //we choose to increase size of "flatTree" rather than "folderCmpView" by not using dynamic polymorphism! @@ -148,7 +148,7 @@ private: static void compressNode(Container& cont); template <class Function> static void extractVisibleSubtree(HierarchyObject& hierObj, Container& cont, Function includeObject); - void getChildren(const Container& cont, size_t level, std::vector<TreeLine>& output); + void getChildren(const Container& cont, unsigned int level, std::vector<TreeLine>& output); template <class Predicate> void updateView(Predicate pred); void applySubView(std::vector<RootNodeImpl>&& newView); diff --git a/ui/triple_splitter.cpp b/ui/triple_splitter.cpp index 65c39337..fbdd22d7 100644 --- a/ui/triple_splitter.cpp +++ b/ui/triple_splitter.cpp @@ -13,7 +13,7 @@ using namespace zen; namespace { //------------ Grid Constants ------------------------------- -const int SASH_HIT_TOLERANCE = 5; //currently onla a placebo! +const int SASH_HIT_TOLERANCE = 5; //currently only a placebo! const int SASH_SIZE = 10; const double SASH_GRAVITY = 0.5; //value within [0, 1]; 1 := resize left only, 0 := resize right only const int CHILD_WINDOW_MIN_SIZE = 50; //min. size of managed windows @@ -36,11 +36,9 @@ TripleSplitter::TripleSplitter(wxWindow* parent, Connect(wxEVT_SIZE, wxSizeEventHandler (TripleSplitter::onSizeEvent ), nullptr, this); //http://wiki.wxwidgets.org/Flicker-Free_Drawing Connect(wxEVT_ERASE_BACKGROUND, wxEraseEventHandler(TripleSplitter::onEraseBackGround), nullptr, this); -#if wxCHECK_VERSION(2, 9, 1) + SetBackgroundStyle(wxBG_STYLE_PAINT); -#else - SetBackgroundStyle(wxBG_STYLE_CUSTOM); -#endif + Connect(wxEVT_LEFT_DOWN, wxMouseEventHandler(TripleSplitter::onMouseLeftDown ), nullptr, this); Connect(wxEVT_LEFT_UP, wxMouseEventHandler(TripleSplitter::onMouseLeftUp ), nullptr, this); Connect(wxEVT_MOTION, wxMouseEventHandler(TripleSplitter::onMouseMovement ), nullptr, this); @@ -49,6 +47,7 @@ TripleSplitter::TripleSplitter(wxWindow* parent, Connect(wxEVT_LEFT_DCLICK, wxMouseEventHandler(TripleSplitter::onMouseLeftDouble), nullptr, this); } + TripleSplitter::~TripleSplitter() {} //make sure correct destructor gets created for std::unique_ptr<SashMove> @@ -78,7 +77,7 @@ void TripleSplitter::updateWindowSizes() class TripleSplitter::SashMove { public: - SashMove(wxWindow& wnd, int mousePosX, int centerPosX) : wnd_(wnd), mousePosX_(mousePosX), centerPosX_(centerPosX) + SashMove(wxWindow& wnd, int mousePosX, int centerOffset) : wnd_(wnd), mousePosX_(mousePosX), centerOffset_(centerOffset) { wnd_.SetCursor(wxCURSOR_SIZEWE); wnd_.CaptureMouse(); @@ -89,13 +88,13 @@ public: if (wnd_.HasCapture()) wnd_.ReleaseMouse(); } - int getMousePosXStart () { return mousePosX_; } - int getCenterPosXStart() { return centerPosX_; } + int getMousePosXStart () const { return mousePosX_; } + int getCenterOffsetStart() const { return centerOffset_; } private: wxWindow& wnd_; const int mousePosX_; - const int centerPosX_; + const int centerOffset_; }; @@ -113,6 +112,7 @@ int TripleSplitter::getCenterPosXOptimal() const return (clientRect.width - centerWidth) * SASH_GRAVITY; //allowed to be negative for extreme client widths! } + int TripleSplitter::getCenterPosX() const { const wxRect clientRect = GetClientRect(); @@ -120,12 +120,12 @@ int TripleSplitter::getCenterPosX() const const int centerPosXOptimal = getCenterPosXOptimal(); //normalize "centerPosXOptimal + centerOffset" - if (clientRect.width < 2 * CHILD_WINDOW_MIN_SIZE + centerWidth) //continuous transition between conditional branches! + if (clientRect.width < 2 * CHILD_WINDOW_MIN_SIZE + centerWidth) //use fixed "centeroffset" when "clientRect.width == 2 * CHILD_WINDOW_MIN_SIZE + centerWidth" return centerPosXOptimal + CHILD_WINDOW_MIN_SIZE - static_cast<int>(2 * CHILD_WINDOW_MIN_SIZE * SASH_GRAVITY); //avoid rounding error - else - return std::max(CHILD_WINDOW_MIN_SIZE, //make sure centerPosXOptimal + offset is within bounds - std::min(centerPosXOptimal + centerOffset, clientRect.width - CHILD_WINDOW_MIN_SIZE - centerWidth)); + //make sure transition between conditional branches is continuous! + return std::max(CHILD_WINDOW_MIN_SIZE, //make sure centerPosXOptimal + offset is within bounds + std::min(centerPosXOptimal + centerOffset, clientRect.width - CHILD_WINDOW_MIN_SIZE - centerWidth)); } @@ -173,7 +173,7 @@ void TripleSplitter::onMouseLeftDown(wxMouseEvent& event) const int posX = event.GetPosition().x; if (hitOnSashLine(posX)) - activeMove.reset(new SashMove(*this, posX, getCenterPosX())); + activeMove.reset(new SashMove(*this, posX, centerOffset)); event.Skip(); } @@ -189,10 +189,11 @@ void TripleSplitter::onMouseMovement(wxMouseEvent& event) { if (activeMove) { - centerOffset = activeMove->getCenterPosXStart() - getCenterPosXOptimal() + event.GetPosition().x - activeMove->getMousePosXStart(); + centerOffset = activeMove->getCenterOffsetStart() + event.GetPosition().x - activeMove->getMousePosXStart(); - //CAVEAT: centerOffset is evaluated *before* normalization in getCenterPosX()! - //This can lead to the strange effect of window not immediately resizing when centerOffset is extremely off limits => normalize right here + //CAVEAT: function getCenterPosX() normalizes centerPosX *not* centerOffset! + //This can lead to the strange effect of window not immediately resizing when centerOffset is extremely off limits + //=> normalize centerOffset right here centerOffset = getCenterPosX() - getCenterPosXOptimal(); updateWindowSizes(); |