summaryrefslogtreecommitdiff
path: root/RealtimeSync
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2014-04-18 17:28:01 +0200
committerDaniel Wilhelm <daniel@wili.li>2014-04-18 17:28:01 +0200
commitfe9eb89ebc1b3c33cbac00a3fa095a14faef9113 (patch)
tree8a3bb620a9acb83fe0057061a86e8f2cb91a9fe1 /RealtimeSync
parent5.21 (diff)
downloadFreeFileSync-fe9eb89ebc1b3c33cbac00a3fa095a14faef9113.tar.gz
FreeFileSync-fe9eb89ebc1b3c33cbac00a3fa095a14faef9113.tar.bz2
FreeFileSync-fe9eb89ebc1b3c33cbac00a3fa095a14faef9113.zip
5.22
Diffstat (limited to 'RealtimeSync')
-rw-r--r--RealtimeSync/RealtimeSync.vcxproj37
-rw-r--r--RealtimeSync/app_icon.h40
-rw-r--r--RealtimeSync/application.cpp19
-rw-r--r--RealtimeSync/gui_generated.cpp144
-rw-r--r--RealtimeSync/gui_generated.h35
-rw-r--r--RealtimeSync/main_dlg.cpp123
-rw-r--r--RealtimeSync/makefile7
-rw-r--r--RealtimeSync/resources.cpp79
-rw-r--r--RealtimeSync/resources.h36
-rw-r--r--RealtimeSync/tray_menu.cpp165
10 files changed, 224 insertions, 461 deletions
diff --git a/RealtimeSync/RealtimeSync.vcxproj b/RealtimeSync/RealtimeSync.vcxproj
index dbaa2aa5..99f64740 100644
--- a/RealtimeSync/RealtimeSync.vcxproj
+++ b/RealtimeSync/RealtimeSync.vcxproj
@@ -99,7 +99,7 @@
<WarningLevel>Level4</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_SCL_SECURE_NO_WARNINGS;wxUSE_UNICODE;__WXMSW__;ZEN_WIN;WXINTL_NO_GETTEXT_MACRO;__WXDEBUG__;WXUSINGDLL;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>C:\Program Files\C++\Boost;C:\Program Files\C++\wxWidgets\include;C:\Program Files\C++\wxWidgets\lib\vc12_x86_debug_dll\mswud;..</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>C:\Data\C++\Boost;C:\Data\C++\wxWidgets\include;C:\Data\C++\wxWidgets\lib\vc12_x86_debug_dll\mswud;..</AdditionalIncludeDirectories>
<PrecompiledHeaderFile>wx+/pch.h</PrecompiledHeaderFile>
<DisableSpecificWarnings>4100;4512</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
@@ -114,10 +114,10 @@
<GenerateDebugInformation>true</GenerateDebugInformation>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
<AdditionalDependencies>wxmsw29ud_adv.lib;wxmsw29ud_core.lib;wxbase29ud.lib;wxpngd.lib;wxzlibd.lib;wxbase29ud_net.lib;comctl32.lib;ws2_32.lib;Rpcrt4.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <AdditionalLibraryDirectories>C:\Program Files\C++\Boost\stage\lib;C:\Program Files\C++\wxWidgets\lib\vc12_x86_debug_dll</AdditionalLibraryDirectories>
+ <AdditionalLibraryDirectories>C:\Data\C++\Boost\stage\lib;C:\Data\C++\wxWidgets\lib\vc12_x86_debug_dll</AdditionalLibraryDirectories>
</Link>
<ResourceCompile>
- <AdditionalIncludeDirectories>C:\Program Files\C++\wxWidgets\include</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>C:\Data\C++\wxWidgets\include</AdditionalIncludeDirectories>
<PreprocessorDefinitions>%(PreprocessorDefinitions);ZEN_ARCHITECTURE_X86</PreprocessorDefinitions>
</ResourceCompile>
</ItemDefinitionGroup>
@@ -127,7 +127,7 @@
<WarningLevel>Level4</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_SCL_SECURE_NO_WARNINGS;wxUSE_UNICODE;__WXMSW__;ZEN_WIN;WXINTL_NO_GETTEXT_MACRO;__WXDEBUG__;WXUSINGDLL;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>C:\Program Files\C++\Boost;C:\Program Files\C++\wxWidgets\include;C:\Program Files\C++\wxWidgets\lib\vc12_x64_debug_dll\mswud;..</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>C:\Data\C++\Boost;C:\Data\C++\wxWidgets\include;C:\Data\C++\wxWidgets\lib\vc12_x64_debug_dll\mswud;..</AdditionalIncludeDirectories>
<PrecompiledHeaderFile>wx+/pch.h</PrecompiledHeaderFile>
<DisableSpecificWarnings>4100;4512</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
@@ -144,12 +144,12 @@
<GenerateDebugInformation>true</GenerateDebugInformation>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
<AdditionalDependencies>wxmsw29ud_adv.lib;wxmsw29ud_core.lib;wxbase29ud.lib;wxpngd.lib;wxzlibd.lib;wxbase29ud_net.lib;comctl32.lib;ws2_32.lib;Rpcrt4.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <AdditionalLibraryDirectories>C:\Program Files\C++\Boost\stage_x64\lib;C:\Program Files\C++\wxWidgets\lib\vc12_x64_debug_dll</AdditionalLibraryDirectories>
+ <AdditionalLibraryDirectories>C:\Data\C++\Boost\stage_x64\lib;C:\Data\C++\wxWidgets\lib\vc12_x64_debug_dll</AdditionalLibraryDirectories>
<LinkStatus>
</LinkStatus>
</Link>
<ResourceCompile>
- <AdditionalIncludeDirectories>C:\Program Files\C++\wxWidgets\include</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>C:\Data\C++\wxWidgets\include</AdditionalIncludeDirectories>
<PreprocessorDefinitions>%(PreprocessorDefinitions);ZEN_ARCHITECTURE_X64</PreprocessorDefinitions>
</ResourceCompile>
</ItemDefinitionGroup>
@@ -160,7 +160,7 @@
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PreprocessorDefinitions>_SCL_SECURE_NO_WARNINGS;wxUSE_UNICODE;__WXMSW__;ZEN_WIN;WXINTL_NO_GETTEXT_MACRO;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>C:\Program Files\C++\Boost;C:\Program Files\C++\wxWidgets\include;C:\Program Files\C++\wxWidgets\lib\vc12_x86_release_lib\mswu;..</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>C:\Data\C++\Boost;C:\Data\C++\wxWidgets\include;C:\Data\C++\wxWidgets\lib\vc12_x86_release_lib\mswu;..</AdditionalIncludeDirectories>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<DisableSpecificWarnings>4100;4512;4996</DisableSpecificWarnings>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
@@ -174,14 +174,14 @@
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>wxbase29u.lib;wxmsw29u_adv.lib;wxmsw29u_core.lib;wxpng.lib;wxzlib.lib;wxbase29u_net.lib;comctl32.lib;ws2_32.lib;winmm.lib;Rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
- <AdditionalLibraryDirectories>C:\Program Files\C++\Boost\stage\lib;C:\Program Files\C++\wxWidgets\lib\vc12_x86_release_lib</AdditionalLibraryDirectories>
+ <AdditionalLibraryDirectories>C:\Data\C++\Boost\stage\lib;C:\Data\C++\wxWidgets\lib\vc12_x86_release_lib</AdditionalLibraryDirectories>
</Link>
<ResourceCompile>
- <AdditionalIncludeDirectories>C:\Program Files\C++\wxWidgets\include</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>C:\Data\C++\wxWidgets\include</AdditionalIncludeDirectories>
<PreprocessorDefinitions>%(PreprocessorDefinitions);ZEN_ARCHITECTURE_X86</PreprocessorDefinitions>
</ResourceCompile>
<PostBuildEvent>
- <Command>"C:\Program Files\C++\CodeSigning\SignCode.cmd" "$(TargetPath)"</Command>
+ <Command>"C:\Data\C++\CodeSigning\SignCode.cmd" "$(TargetPath)"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
@@ -191,7 +191,7 @@
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PreprocessorDefinitions>_SCL_SECURE_NO_WARNINGS;wxUSE_UNICODE;__WXMSW__;ZEN_WIN;WXINTL_NO_GETTEXT_MACRO;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>C:\Program Files\C++\Boost;C:\Program Files\C++\wxWidgets\include;C:\Program Files\C++\wxWidgets\lib\vc12_x64_release_lib\mswu;..</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>C:\Data\C++\Boost;C:\Data\C++\wxWidgets\include;C:\Data\C++\wxWidgets\lib\vc12_x64_release_lib\mswu;..</AdditionalIncludeDirectories>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<DisableSpecificWarnings>4100;4512;4996</DisableSpecificWarnings>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
@@ -205,14 +205,14 @@
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>wxmsw29u_adv.lib;wxmsw29u_core.lib;wxbase29u.lib;wxpng.lib;wxzlib.lib;wxbase29u_net.lib;comctl32.lib;ws2_32.lib;winmm.lib;Rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
- <AdditionalLibraryDirectories>C:\Program Files\C++\Boost\stage_x64\lib;C:\Program Files\C++\wxWidgets\lib\vc12_x64_release_lib</AdditionalLibraryDirectories>
+ <AdditionalLibraryDirectories>C:\Data\C++\Boost\stage_x64\lib;C:\Data\C++\wxWidgets\lib\vc12_x64_release_lib</AdditionalLibraryDirectories>
</Link>
<ResourceCompile>
- <AdditionalIncludeDirectories>C:\Program Files\C++\wxWidgets\include</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>C:\Data\C++\wxWidgets\include</AdditionalIncludeDirectories>
<PreprocessorDefinitions>%(PreprocessorDefinitions);ZEN_ARCHITECTURE_X64</PreprocessorDefinitions>
</ResourceCompile>
<PostBuildEvent>
- <Command>"C:\Program Files\C++\CodeSigning\SignCode.cmd" "$(TargetPath)"</Command>
+ <Command>"C:\Data\C++\CodeSigning\SignCode.cmd" "$(TargetPath)"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
@@ -228,14 +228,18 @@
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
</ClCompile>
+ <ClCompile Include="..\wx+\image_resources.cpp" />
<ClCompile Include="..\wx+\image_tools.cpp" />
<ClCompile Include="..\wx+\mouse_move_dlg.cpp" />
+ <ClCompile Include="..\wx+\popup_dlg.cpp" />
+ <ClCompile Include="..\wx+\popup_dlg_generated.cpp" />
<ClCompile Include="..\zen\debug_memory_leaks.cpp" />
<ClCompile Include="..\zen\dir_watcher.cpp" />
<ClCompile Include="..\zen\dst_hack.cpp" />
<ClCompile Include="..\zen\file_handling.cpp" />
<ClCompile Include="..\zen\file_io.cpp" />
<ClCompile Include="..\zen\file_traverser.cpp" />
+ <ClCompile Include="..\zen\format_unit.cpp" />
<ClCompile Include="..\zen\notify_removal.cpp" />
<ClCompile Include="..\zen\privilege.cpp" />
<ClCompile Include="..\zen\scroll_window_under_cursor.cpp" />
@@ -244,7 +248,6 @@
<ClCompile Include="gui_generated.cpp" />
<ClCompile Include="main_dlg.cpp" />
<ClCompile Include="monitor.cpp" />
- <ClCompile Include="resources.cpp" />
<ClCompile Include="tray_menu.cpp" />
<ClCompile Include="xml_ffs.cpp" />
<ClCompile Include="xml_proc.cpp" />
@@ -253,9 +256,7 @@
<ResourceCompile Include="resource.rc" />
</ItemGroup>
<ItemGroup>
- <None Include="WxWizFrame.fbp">
- <SubType>Designer</SubType>
- </None>
+ <None Include="RealtimeSync.fbp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
diff --git a/RealtimeSync/app_icon.h b/RealtimeSync/app_icon.h
new file mode 100644
index 00000000..fcd2b548
--- /dev/null
+++ b/RealtimeSync/app_icon.h
@@ -0,0 +1,40 @@
+// **************************************************************************
+// * This file is part of the FreeFileSync project. It is distributed under *
+// * GNU General Public License: http://www.gnu.org/licenses/gpl.html *
+// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
+// **************************************************************************
+
+#ifndef RTS_APP_ICON_8914578394545
+#define RTS_APP_ICON_8914578394545
+
+#include <wx/icon.h>
+#include <wx+/image_resources.h>
+
+namespace zen
+{
+inline
+wxIcon getRtsIcon()
+{
+ //wxWidgets' bitmap to icon conversion on OS X can only deal with very specific sizes => check on all platforms!
+ assert(getResourceImage(L"RealtimeSync").GetWidth () == getResourceImage(L"RealtimeSync").GetHeight() &&
+ getResourceImage(L"RealtimeSync").GetWidth() % 128 == 0);
+#ifdef ZEN_WIN
+ //for compatibility it seems we need to stick with a "real" icon
+ return wxIcon(L"A_RTS_ICON");
+
+#elif defined ZEN_LINUX
+ //attention: make sure to not implicitly call "instance()" again => deadlock on Linux
+ wxIcon icon;
+ icon.CopyFromBitmap(getResourceImage(L"RealtimeSync")); //use big logo bitmap for better quality
+ return icon;
+
+#elif defined ZEN_MAC
+ wxIcon icon;
+ icon.CopyFromBitmap(getResourceImage(L"RealtimeSync").ConvertToImage().Scale(128, 128, wxIMAGE_QUALITY_HIGH)); //"von hinten durch die Brust ins Auge"
+ return icon;
+#endif
+}
+}
+
+
+#endif //RTS_APP_ICON_8914578394545
diff --git a/RealtimeSync/application.cpp b/RealtimeSync/application.cpp
index c2ed4078..a0d693d6 100644
--- a/RealtimeSync/application.cpp
+++ b/RealtimeSync/application.cpp
@@ -10,9 +10,10 @@
#include <zen/thread.h>
#include <wx/event.h>
#include <wx/log.h>
-#include <wx/msgdlg.h>
+#include <wx/tooltip.h>
#include <wx+/string_conv.h>
-//#include "resources.h"
+#include <wx+/popup_dlg.h>
+#include <wx+/image_resources.h>
#include "xml_ffs.h"
#include "../lib/localization.h"
#include "../lib/ffs_paths.h"
@@ -71,7 +72,15 @@ bool Application::OnInit()
::gtk_rc_parse((zen::getResourceDir() + "styles.gtk_rc").c_str()); //remove inner border from bitmap buttons
#endif
- SetAppName(L"FreeFileSync"); //reuse FFS's name, to have "GetUserDataDir()/GetResourcesDir()" return the same directory in ffs_paths.cpp
+#ifdef ZEN_WIN
+ wxToolTip::SetMaxWidth(-1); //disable tooltip wrapping -> Windows only
+#endif
+ //Windows User Experience Interaction Guidelines: tool tips should have 5s timeout, info tips no timeout => compromise:
+ wxToolTip::SetAutoPop(7000); //http://msdn.microsoft.com/en-us/library/windows/desktop/aa511495.aspx
+
+ SetAppName(L"RealtimeSync");
+
+ initResourceImages(getResourceDir() + Zstr("Resources.zip"));
//do not call wxApp::OnInit() to avoid using default commandline parser
@@ -101,7 +110,7 @@ void Application::onEnterEventLoop(wxEvent& event)
}
catch (const FileError& e)
{
- wxMessageBox(e.toString(), L"RealtimeSync" + _("Error"), wxOK | wxICON_ERROR);
+ showNotificationDialog(nullptr, DialogInfoType::ERROR2, PopupDialogCfg().setDetailInstructions(e.toString()));
//continue!
}
@@ -119,7 +128,7 @@ void Application::onEnterEventLoop(wxEvent& event)
filename += Zstr(".ffs_batch");
else
{
- wxMessageBox(replaceCpy(_("Cannot open file %x."), L"%x", fmtFileName(filename)), L"RealtimeSync" + _("Error"), wxOK | wxICON_ERROR);
+ showNotificationDialog(nullptr, DialogInfoType::ERROR2, PopupDialogCfg().setMainInstructions(replaceCpy(_("Cannot open file %x."), L"%x", fmtFileName(filename))));
return;
}
}
diff --git a/RealtimeSync/gui_generated.cpp b/RealtimeSync/gui_generated.cpp
index 16b52345..3b3ad3fe 100644
--- a/RealtimeSync/gui_generated.cpp
+++ b/RealtimeSync/gui_generated.cpp
@@ -13,7 +13,7 @@
MainDlgGenerated::MainDlgGenerated( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxFrame( parent, id, title, pos, size, style )
{
- this->SetSizeHints( wxSize( 420,350 ), wxDefaultSize );
+ this->SetSizeHints( wxSize( -1,-1 ), wxDefaultSize );
this->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) );
m_menubar1 = new wxMenuBar( 0 );
@@ -36,7 +36,7 @@ MainDlgGenerated::MainDlgGenerated( wxWindow* parent, wxWindowID id, const wxStr
m_menuHelp = new wxMenu();
wxMenuItem* m_menuItemContent;
- m_menuItemContent = new wxMenuItem( m_menuHelp, wxID_HELP, wxString( _("&Content") ) + wxT('\t') + wxT("F1"), wxEmptyString, wxITEM_NORMAL );
+ m_menuItemContent = new wxMenuItem( m_menuHelp, wxID_HELP, wxString( _("&View help") ) + wxT('\t') + wxT("F1"), wxEmptyString, wxITEM_NORMAL );
m_menuHelp->Append( m_menuItemContent );
m_menuHelp->AppendSeparator();
@@ -50,6 +50,9 @@ MainDlgGenerated::MainDlgGenerated( wxWindow* parent, wxWindowID id, const wxStr
bSizerMain = new wxBoxSizer( wxVERTICAL );
+ wxBoxSizer* bSizer161;
+ bSizer161 = new wxBoxSizer( wxVERTICAL );
+
wxBoxSizer* bSizer16;
bSizer16 = new wxBoxSizer( wxHORIZONTAL );
@@ -64,27 +67,30 @@ MainDlgGenerated::MainDlgGenerated( wxWindow* parent, wxWindowID id, const wxStr
m_staticText3 = new wxStaticText( this, wxID_ANY, _("1. Select folders to watch."), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText3->Wrap( -1 );
- bSizer15->Add( m_staticText3, 0, wxLEFT, 10 );
+ bSizer15->Add( m_staticText3, 0, 0, 5 );
m_staticText4 = new wxStaticText( this, wxID_ANY, _("2. Enter a command line."), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText4->Wrap( -1 );
- bSizer15->Add( m_staticText4, 0, wxLEFT, 10 );
+ bSizer15->Add( m_staticText4, 0, 0, 5 );
m_staticText5 = new wxStaticText( this, wxID_ANY, _("3. Press 'Start'."), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText5->Wrap( -1 );
- bSizer15->Add( m_staticText5, 0, wxLEFT, 10 );
+ bSizer15->Add( m_staticText5, 0, 0, 5 );
- bSizer16->Add( bSizer15, 0, wxTOP|wxLEFT, 5 );
+ bSizer16->Add( bSizer15, 0, wxALL, 5 );
- bSizerMain->Add( bSizer16, 0, 0, 5 );
+ bSizer161->Add( bSizer16, 0, 0, 5 );
m_staticText811 = new wxStaticText( this, wxID_ANY, _("To get started just import a .ffs_batch file."), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText811->Wrap( -1 );
m_staticText811->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_GRAYTEXT ) );
- bSizerMain->Add( m_staticText811, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
+ bSizer161->Add( m_staticText811, 0, wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
+
+
+ bSizerMain->Add( bSizer161, 0, wxALL|wxEXPAND, 5 );
m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bSizerMain->Add( m_staticline2, 0, wxEXPAND, 5 );
@@ -95,9 +101,12 @@ MainDlgGenerated::MainDlgGenerated( wxWindow* parent, wxWindowID id, const wxStr
wxBoxSizer* bSizer1;
bSizer1 = new wxBoxSizer( wxVERTICAL );
- m_staticText7 = new wxStaticText( m_panelMain, wxID_ANY, _("Folders to watch"), wxDefaultPosition, wxDefaultSize, 0 );
+ wxBoxSizer* bSizer151;
+ bSizer151 = new wxBoxSizer( wxVERTICAL );
+
+ m_staticText7 = new wxStaticText( m_panelMain, wxID_ANY, _("Folders to watch:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText7->Wrap( -1 );
- bSizer1->Add( m_staticText7, 0, wxALL, 5 );
+ bSizer151->Add( m_staticText7, 0, wxALL, 5 );
m_panelMainFolder = new wxPanel( m_panelMain, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
m_panelMainFolder->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) );
@@ -150,7 +159,7 @@ MainDlgGenerated::MainDlgGenerated( wxWindow* parent, wxWindowID id, const wxStr
m_panelMainFolder->SetSizer( fgSizer1 );
m_panelMainFolder->Layout();
fgSizer1->Fit( m_panelMainFolder );
- bSizer1->Add( m_panelMainFolder, 0, wxRIGHT|wxLEFT|wxEXPAND, 5 );
+ bSizer151->Add( m_panelMainFolder, 0, wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_scrolledWinFolders = new wxScrolledWindow( m_panelMain, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL );
m_scrolledWinFolders->SetScrollRate( 10, 10 );
@@ -162,7 +171,10 @@ MainDlgGenerated::MainDlgGenerated( wxWindow* parent, wxWindowID id, const wxStr
m_scrolledWinFolders->SetSizer( bSizerFolders );
m_scrolledWinFolders->Layout();
bSizerFolders->Fit( m_scrolledWinFolders );
- bSizer1->Add( m_scrolledWinFolders, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
+ bSizer151->Add( m_scrolledWinFolders, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
+
+
+ bSizer1->Add( bSizer151, 1, wxALL|wxEXPAND, 5 );
m_staticline212 = new wxStaticLine( m_panelMain, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bSizer1->Add( m_staticline212, 0, wxEXPAND, 5 );
@@ -170,12 +182,9 @@ MainDlgGenerated::MainDlgGenerated( wxWindow* parent, wxWindowID id, const wxStr
wxBoxSizer* bSizer14;
bSizer14 = new wxBoxSizer( wxHORIZONTAL );
- m_staticText8 = new wxStaticText( m_panelMain, wxID_ANY, _("Idle time [seconds]"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_staticText8 = new wxStaticText( m_panelMain, wxID_ANY, _("Idle time (in seconds):"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText8->Wrap( -1 );
- bSizer14->Add( m_staticText8, 0, wxALL, 5 );
-
-
- bSizer14->Add( 0, 0, 1, wxEXPAND, 5 );
+ bSizer14->Add( m_staticText8, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 );
m_spinCtrlDelay = new wxSpinCtrl( m_panelMain, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 2000000000, 0 );
m_spinCtrlDelay->SetToolTip( _("Idle time between last detected change and execution of command") );
@@ -183,20 +192,26 @@ MainDlgGenerated::MainDlgGenerated( wxWindow* parent, wxWindowID id, const wxStr
bSizer14->Add( m_spinCtrlDelay, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
- bSizer1->Add( bSizer14, 0, wxALIGN_RIGHT|wxEXPAND, 5 );
+ bSizer1->Add( bSizer14, 0, wxALIGN_RIGHT|wxEXPAND|wxALL, 5 );
m_staticline211 = new wxStaticLine( m_panelMain, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bSizer1->Add( m_staticline211, 0, wxEXPAND, 5 );
- m_staticText6 = new wxStaticText( m_panelMain, wxID_ANY, _("Command line"), wxDefaultPosition, wxDefaultSize, 0 );
+ wxBoxSizer* bSizer141;
+ bSizer141 = new wxBoxSizer( wxVERTICAL );
+
+ m_staticText6 = new wxStaticText( m_panelMain, wxID_ANY, _("Command line:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText6->Wrap( -1 );
- bSizer1->Add( m_staticText6, 0, wxALL, 5 );
+ bSizer141->Add( m_staticText6, 0, wxALL, 5 );
m_textCtrlCommand = new wxTextCtrl( m_panelMain, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_textCtrlCommand->SetMaxLength( 0 );
m_textCtrlCommand->SetToolTip( _("The command is triggered if:\n- files or subfolders change\n- new folders arrive (e.g. USB stick insert)") );
- bSizer1->Add( m_textCtrlCommand, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
+ bSizer141->Add( m_textCtrlCommand, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
+
+
+ bSizer1->Add( bSizer141, 0, wxALL|wxEXPAND, 5 );
m_panelMain->SetSizer( bSizer1 );
@@ -207,7 +222,7 @@ MainDlgGenerated::MainDlgGenerated( wxWindow* parent, wxWindowID id, const wxStr
m_staticline5 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bSizerMain->Add( m_staticline5, 0, wxEXPAND, 5 );
- m_buttonStart = new zen::BitmapTextButton( this, wxID_OK, _("Start"), wxDefaultPosition, wxSize( -1,-1 ), 0 );
+ m_buttonStart = new zen::BitmapTextButton( this, wxID_OK, _("&Start"), wxDefaultPosition, wxSize( -1,-1 ), 0 );
m_buttonStart->SetDefault();
m_buttonStart->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) );
@@ -218,6 +233,8 @@ MainDlgGenerated::MainDlgGenerated( wxWindow* parent, wxWindowID id, const wxStr
this->Layout();
bSizerMain->Fit( this );
+ this->Centre( wxBOTH );
+
// Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( MainDlgGenerated::OnClose ) );
this->Connect( m_menuItem13->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDlgGenerated::OnConfigLoad ) );
@@ -232,17 +249,6 @@ MainDlgGenerated::MainDlgGenerated( wxWindow* parent, wxWindowID id, const wxStr
MainDlgGenerated::~MainDlgGenerated()
{
- // Disconnect Events
- this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( MainDlgGenerated::OnClose ) );
- this->Disconnect( wxID_OPEN, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDlgGenerated::OnConfigLoad ) );
- this->Disconnect( wxID_SAVEAS, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDlgGenerated::OnConfigSave ) );
- this->Disconnect( wxID_EXIT, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDlgGenerated::OnMenuQuit ) );
- this->Disconnect( wxID_HELP, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDlgGenerated::OnShowHelp ) );
- this->Disconnect( wxID_ABOUT, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDlgGenerated::OnMenuAbout ) );
- m_bpButtonAddFolder->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDlgGenerated::OnAddFolder ), NULL, this );
- m_bpButtonRemoveTopFolder->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDlgGenerated::OnRemoveTopFolder ), NULL, this );
- m_buttonStart->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDlgGenerated::OnStart ), NULL, this );
-
}
FolderGenerated::FolderGenerated( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style )
@@ -275,75 +281,3 @@ FolderGenerated::FolderGenerated( wxWindow* parent, wxWindowID id, const wxPoint
FolderGenerated::~FolderGenerated()
{
}
-
-ErrorDlgGenerated::ErrorDlgGenerated( 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 );
- this->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) );
-
- wxBoxSizer* bSizer24;
- bSizer24 = new wxBoxSizer( wxVERTICAL );
-
- m_panel3 = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
- m_panel3->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) );
-
- wxBoxSizer* bSizer16;
- bSizer16 = new wxBoxSizer( wxVERTICAL );
-
-
- bSizer16->Add( 0, 10, 0, wxEXPAND, 5 );
-
- wxBoxSizer* bSizer26;
- bSizer26 = new wxBoxSizer( wxHORIZONTAL );
-
- m_bitmap10 = new wxStaticBitmap( m_panel3, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), 0 );
- bSizer26->Add( m_bitmap10, 0, wxRIGHT|wxLEFT, 10 );
-
- m_textCtrl8 = new wxTextCtrl( m_panel3, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 400,150 ), wxTE_MULTILINE|wxTE_READONLY|wxNO_BORDER );
- bSizer26->Add( m_textCtrl8, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxTOP, 5 );
-
-
- bSizer16->Add( bSizer26, 1, wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
-
-
- m_panel3->SetSizer( bSizer16 );
- m_panel3->Layout();
- bSizer16->Fit( m_panel3 );
- bSizer24->Add( m_panel3, 1, wxEXPAND|wxALIGN_CENTER_HORIZONTAL, 5 );
-
- m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
- bSizer24->Add( m_staticline2, 0, wxEXPAND, 5 );
-
- bSizerStdButtons = new wxBoxSizer( wxHORIZONTAL );
-
- m_buttonRetry = new wxButton( this, wxID_RETRY, _("&Retry"), wxDefaultPosition, wxSize( -1,30 ), 0 );
- m_buttonRetry->SetDefault();
- bSizerStdButtons->Add( m_buttonRetry, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
-
- m_buttonCancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxSize( -1,30 ), 0 );
- bSizerStdButtons->Add( m_buttonCancel, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
-
-
- bSizer24->Add( bSizerStdButtons, 0, wxALIGN_RIGHT, 5 );
-
-
- this->SetSizer( bSizer24 );
- this->Layout();
- bSizer24->Fit( this );
-
- this->Centre( wxBOTH );
-
- // Connect Events
- this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( ErrorDlgGenerated::OnClose ) );
- m_buttonRetry->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ErrorDlgGenerated::OnRetry ), NULL, this );
- m_buttonCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ErrorDlgGenerated::OnAbort ), NULL, this );
-}
-
-ErrorDlgGenerated::~ErrorDlgGenerated()
-{
- // Disconnect Events
- this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( ErrorDlgGenerated::OnClose ) );
- m_buttonRetry->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ErrorDlgGenerated::OnRetry ), NULL, this );
- m_buttonCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ErrorDlgGenerated::OnAbort ), NULL, this );
-
-}
diff --git a/RealtimeSync/gui_generated.h b/RealtimeSync/gui_generated.h
index 182f75ca..a816e10a 100644
--- a/RealtimeSync/gui_generated.h
+++ b/RealtimeSync/gui_generated.h
@@ -32,10 +32,8 @@ namespace zen { class BitmapTextButton; }
#include <wx/scrolwin.h>
#include <wx/spinctrl.h>
#include <wx/frame.h>
-#include <wx/statbmp.h>
-#include <wx/dialog.h>
-#include "../zen/i18n.h"
+#include "zen/i18n.h"
///////////////////////////////////////////////////////////////////////////
@@ -91,7 +89,7 @@ protected:
public:
- MainDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("RealtimeSync - Automated Synchronization"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL );
+ MainDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("dummy"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL );
~MainDlgGenerated();
@@ -116,33 +114,4 @@ public:
};
-///////////////////////////////////////////////////////////////////////////////
-/// Class ErrorDlgGenerated
-///////////////////////////////////////////////////////////////////////////////
-class ErrorDlgGenerated : public wxDialog
-{
-private:
-
-protected:
- wxPanel* m_panel3;
- wxStaticBitmap* m_bitmap10;
- wxTextCtrl* m_textCtrl8;
- wxStaticLine* m_staticline2;
- wxBoxSizer* bSizerStdButtons;
- wxButton* m_buttonRetry;
- wxButton* m_buttonCancel;
-
- // Virtual event handlers, overide them in your derived class
- virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
- virtual void OnRetry( wxCommandEvent& event ) { event.Skip(); }
- virtual void OnAbort( wxCommandEvent& event ) { event.Skip(); }
-
-
-public:
-
- ErrorDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Error"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
- ~ErrorDlgGenerated();
-
-};
-
#endif //__GUI_GENERATED_H__
diff --git a/RealtimeSync/main_dlg.cpp b/RealtimeSync/main_dlg.cpp
index 7b3e0f92..f29f396b 100644
--- a/RealtimeSync/main_dlg.cpp
+++ b/RealtimeSync/main_dlg.cpp
@@ -5,24 +5,27 @@
// **************************************************************************
#include "main_dlg.h"
-#include "resources.h"
-#include <wx/msgdlg.h>
#include <wx/wupdlock.h>
#include <wx/filedlg.h>
#include <wx+/bitmap_button.h>
#include <wx+/string_conv.h>
#include <wx+/mouse_move_dlg.h>
#include <wx+/font_size.h>
+#include <wx+/popup_dlg.h>
+#include <wx+/image_resources.h>
#include <zen/assert_static.h>
#include <zen/file_handling.h>
#include <zen/build_info.h>
#include "xml_proc.h"
#include "tray_menu.h"
#include "xml_ffs.h"
+#include "app_icon.h"
#include "../lib/help_provider.h"
#include "../lib/process_xml.h"
#include "../lib/ffs_paths.h"
-#ifdef ZEN_MAC
+#ifdef ZEN_LINUX
+#include <gtk/gtk.h>
+#elif defined ZEN_MAC
#include <ApplicationServices/ApplicationServices.h>
#endif
@@ -34,7 +37,14 @@ class DirectoryPanel : public FolderGenerated
public:
DirectoryPanel(wxWindow* parent) :
FolderGenerated(parent),
- dirName(*this, *m_buttonSelectDir, *m_txtCtrlDirectory) {}
+ dirName(*this, *m_buttonSelectDir, *m_txtCtrlDirectory)
+ {
+#ifdef ZEN_LINUX
+ //file drag and drop directly into the text control unhelpfully inserts in format "file://..<cr><nl>"; see folder_history_box.cpp
+ if (GtkWidget* widget = m_txtCtrlDirectory->GetConnectWidget())
+ ::gtk_drag_dest_unset(widget);
+#endif
+ }
void setName(const wxString& dirname) { dirName.setName(dirname); }
wxString getName() const { return dirName.getName(); }
@@ -55,10 +65,16 @@ MainDialog::MainDialog(wxDialog* dlg, const Zstring& cfgFileName)
{
#ifdef ZEN_WIN
new MouseMoveWindow(*this); //ownership passed to "this"
+ wxWindowUpdateLocker dummy(this); //leads to GUI corruption problems on Linux/OS X!
#endif
- wxWindowUpdateLocker dummy(this); //avoid display distortion
- SetIcon(GlobalResources::instance().programIconRTS); //set application icon
+#ifdef ZEN_LINUX
+ //file drag and drop directly into the text control unhelpfully inserts in format "file://..<cr><nl>"; see folder_history_box.cpp
+ if (GtkWidget* widget = m_txtCtrlDirectoryMain->GetConnectWidget())
+ ::gtk_drag_dest_unset(widget);
+#endif
+
+ SetIcon(getRtsIcon()); //set application icon
setRelativeFontSize(*m_buttonStart, 1.5);
@@ -67,8 +83,6 @@ MainDialog::MainDialog(wxDialog* dlg, const Zstring& cfgFileName)
m_bpButtonAddFolder ->SetBitmapLabel(getResourceImage(L"item_add"));
m_bpButtonRemoveTopFolder->SetBitmapLabel(getResourceImage(L"item_remove"));
- ///m_buttonStart ->setBitmapFront(getResourceImage(L"startRts"), 5);
-
setBitmapTextLabel(*m_buttonStart, getResourceImage(L"startRts").ConvertToImage(), m_buttonStart->GetLabel(), 5, 8);
@@ -89,12 +103,12 @@ MainDialog::MainDialog(wxDialog* dlg, const Zstring& cfgFileName)
rts::readRealOrBatchConfig(currentConfigFile, newConfig); //throw FfsXmlError
loadCfgSuccess = true;
}
- catch (const xmlAccess::FfsXmlError& error)
+ catch (const xmlAccess::FfsXmlError& e)
{
- if (error.getSeverity() == xmlAccess::FfsXmlError::WARNING)
- wxMessageBox(error.toString(),L"RealtimeSync" + _("Warning"), wxOK | wxICON_WARNING, this);
+ if (e.getSeverity() == xmlAccess::FfsXmlError::WARNING)
+ showNotificationDialog(this, DialogInfoType::WARNING, PopupDialogCfg().setDetailInstructions(e.toString()));
else
- wxMessageBox(error.toString(), L"RealtimeSync" + _("Error"), wxOK | wxICON_ERROR, this);
+ showNotificationDialog(this, DialogInfoType::ERROR2, PopupDialogCfg().setDetailInstructions(e.toString()));
}
const bool startWatchingImmediately = loadCfgSuccess && !cfgFileName.empty();
@@ -102,15 +116,6 @@ MainDialog::MainDialog(wxDialog* dlg, const Zstring& cfgFileName)
setConfiguration(newConfig);
setLastUsedConfig(currentConfigFile);
//-----------------------------------------------------------------------------------------
- //Layout();
- //Fit();
-
- m_scrolledWinFolders->Fit(); //adjust scrolled window size
- m_scrolledWinFolders->Layout(); //fix small layout problem
- m_panelMain->Layout(); //adjust stuff inside scrolled window
- Fit(); //adapt dialog size
-
- Center();
if (startWatchingImmediately) //start watch mode directly
{
@@ -124,9 +129,9 @@ MainDialog::MainDialog(wxDialog* dlg, const Zstring& cfgFileName)
Show();
#ifdef ZEN_MAC
ProcessSerialNumber psn = { 0, kCurrentProcess };
+ ::SetFrontProcess(&psn); //call before TransformProcessType() so that OSX menu is updated correctly
::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
}
@@ -147,9 +152,9 @@ MainDialog::~MainDialog()
{
writeRealConfig(currentCfg, lastConfigFileName()); //throw FfsXmlError
}
- catch (const xmlAccess::FfsXmlError& error)
+ catch (const xmlAccess::FfsXmlError& e)
{
- wxMessageBox(error.toString().c_str(), L"RealtimeSync" + _("Error"), wxOK | wxICON_ERROR, this);
+ showNotificationDialog(this, DialogInfoType::ERROR2, PopupDialogCfg().setDetailInstructions(e.toString()));
}
}
@@ -193,17 +198,20 @@ void MainDialog::OnMenuAbout(wxCommandEvent& event)
build += L" x86";
assert_static(zen::is32BitBuild || zen::is64BitBuild);
- wxMessageBox(L"RealtimeSync" L"\n\n" + replaceCpy(_("Build: %x"), L"%x", build), _("About"), wxOK, this);
+ showNotificationDialog(this, DialogInfoType::INFO, PopupDialogCfg().
+ setTitle(_("About")).
+ setMainInstructions(L"RealtimeSync" L"\n\n" + replaceCpy(_("Build: %x"), L"%x", build)));
}
void MainDialog::OnKeyPressed(wxKeyEvent& event)
{
const int keyCode = event.GetKeyCode();
-
if (keyCode == WXK_ESCAPE)
+ {
Close();
-
+ return;
+ }
event.Skip();
}
@@ -230,8 +238,9 @@ void MainDialog::OnStart(wxCommandEvent& event)
}
Show(); //don't show for EXIT_APP
#ifdef ZEN_MAC
+ ::SetFrontProcess(&psn); //call before TransformProcessType() so that OSX menu is updated correctly
+ //why isn't this covered by wxWindows::Raise()??
::TransformProcessType(&psn, kProcessTransformToForegroundApplication); //show dock icon again
- ::SetFrontProcess(&psn); //why isn't this covered by wxWindows::Raise()??
#endif
Raise();
}
@@ -266,7 +275,7 @@ void MainDialog::OnConfigSave(wxCommandEvent& event)
}
catch (const xmlAccess::FfsXmlError& e)
{
- wxMessageBox(e.toString().c_str(), L"RealtimeSync" + _("Error"), wxOK | wxICON_ERROR, this);
+ showNotificationDialog(this, DialogInfoType::ERROR2, PopupDialogCfg().setDetailInstructions(e.toString()));
}
}
@@ -279,13 +288,13 @@ void MainDialog::loadConfig(const Zstring& filename)
{
rts::readRealOrBatchConfig(filename, newConfig);
}
- catch (const xmlAccess::FfsXmlError& error)
+ catch (const xmlAccess::FfsXmlError& e)
{
- if (error.getSeverity() == xmlAccess::FfsXmlError::WARNING)
- wxMessageBox(error.toString(), L"RealtimeSync" + _("Warning"), wxOK | wxICON_WARNING, this);
+ if (e.getSeverity() == xmlAccess::FfsXmlError::WARNING)
+ showNotificationDialog(this, DialogInfoType::WARNING, PopupDialogCfg().setDetailInstructions(e.toString()));
else
{
- wxMessageBox(error.toString(), L"RealtimeSync" + _("Error"), wxOK | wxICON_ERROR, this);
+ showNotificationDialog(this, DialogInfoType::ERROR2, PopupDialogCfg().setDetailInstructions(e.toString()));
return;
}
}
@@ -300,7 +309,7 @@ void MainDialog::setLastUsedConfig(const Zstring& filename)
//set title
if (filename == lastConfigFileName())
{
- SetTitle(_("RealtimeSync - Automated Synchronization"));
+ SetTitle(L"RealtimeSync - " + _("Automated Synchronization"));
currentConfigFileName.clear();
}
else
@@ -317,7 +326,7 @@ void MainDialog::OnConfigLoad(wxCommandEvent& event)
wxEmptyString,
utfCvrtTo<wxString>(beforeLast(currentConfigFileName, FILE_NAME_SEPARATOR)), //default dir; empty string if / not found
wxEmptyString,
- wxString(L"RealtimeSync (*.ffs_real;*.ffs_batch)|*.ffs_real;*.ffs_batch") + L"|" +_("All files") + L" (*.*)|*",
+ wxString(L"RealtimeSync (*.ffs_real; *.ffs_batch)|*.ffs_real;*.ffs_batch") + L"|" +_("All files") + L" (*.*)|*",
wxFD_OPEN);
if (filePicker.ShowModal() == wxID_OK)
loadConfig(utfCvrtTo<Zstring>(filePicker.GetPath()));
@@ -336,7 +345,6 @@ void MainDialog::setConfiguration(const xmlAccess::XmlRealConfig& cfg)
{
//clear existing folders
dirNameFirst->setName(wxString());
-
clearAddFolders();
if (!cfg.directories.empty())
@@ -389,10 +397,10 @@ void MainDialog::OnRemoveFolder(wxCommandEvent& event)
{
//find folder pair originating the event
const wxObject* const eventObj = event.GetEventObject();
- for (std::vector<DirectoryPanel*>::const_iterator i = dirNamesExtra.begin(); i != dirNamesExtra.end(); ++i)
- if (eventObj == static_cast<wxObject*>((*i)->m_bpButtonRemoveFolder))
+ for (auto it = dirNamesExtra.begin(); it != dirNamesExtra.end(); ++it)
+ if (eventObj == static_cast<wxObject*>((*it)->m_bpButtonRemoveFolder))
{
- removeAddFolder(i - dirNamesExtra.begin());
+ removeAddFolder(it - dirNamesExtra.begin());
return;
}
}
@@ -423,7 +431,9 @@ void MainDialog::addFolder(const std::vector<Zstring>& newFolders, bool addFront
if (newFolders.size() == 0)
return;
- wxWindowUpdateLocker dummy(this); //avoid display distortion
+#ifdef ZEN_WIN
+ wxWindowUpdateLocker dummy(this); //leads to GUI corruption problems on Linux/OS X!
+#endif
int folderHeight = 0;
for (auto it = newFolders.begin(); it != newFolders.end(); ++it)
@@ -459,19 +469,18 @@ void MainDialog::addFolder(const std::vector<Zstring>& newFolders, bool addFront
//adapt delete top folder pair button
m_bpButtonRemoveTopFolder->Show();
- m_panelMainFolder->Layout();
- //update controls
- m_scrolledWinFolders->Fit(); //adjust scrolled window size
- m_scrolledWinFolders->Layout(); //fix small layout problem
- m_panelMain->Layout(); //adjust stuff inside scrolled window
- Fit(); //adapt dialog size
+ GetSizer()->SetSizeHints(this); //~=Fit() + SetMinSize()
+ Layout();
+ Refresh(); //remove a little flicker near the start button
}
void MainDialog::removeAddFolder(size_t pos)
{
- wxWindowUpdateLocker dummy(this); //avoid display distortion
+#ifdef ZEN_WIN
+ wxWindowUpdateLocker dummy(this); //leads to GUI corruption problems on Linux/OS X!
+#endif
if (pos < dirNamesExtra.size())
{
@@ -498,24 +507,28 @@ void MainDialog::removeAddFolder(size_t pos)
m_panelMainFolder->Layout();
}
- //update controls
- m_scrolledWinFolders->Fit(); //adjust scrolled window size
- m_panelMain->Layout(); //adjust stuff inside scrolled window
- Fit(); //adapt dialog size
+ GetSizer()->SetSizeHints(this); //~=Fit() + SetMinSize()
+ Layout();
+ Refresh(); //remove a little flicker near the start button
}
}
void MainDialog::clearAddFolders()
{
- wxWindowUpdateLocker dummy(this); //avoid display distortion
+#ifdef ZEN_WIN
+ wxWindowUpdateLocker dummy(this); //leads to GUI corruption problems on Linux/OS X!
+#endif
- dirNamesExtra.clear();
bSizerFolders->Clear(true);
+ dirNamesExtra.clear();
+
+ m_scrolledWinFolders->SetMinSize(wxSize(-1, 0));
m_bpButtonRemoveTopFolder->Hide();
m_panelMainFolder->Layout();
- m_scrolledWinFolders->SetMinSize(wxSize(-1, 0));
- Fit(); //adapt dialog size
+ GetSizer()->SetSizeHints(this); //~=Fit()
+ Layout();
+ Refresh(); //remove a little flicker near the start button
}
diff --git a/RealtimeSync/makefile b/RealtimeSync/makefile
index 50a08049..8098d586 100644
--- a/RealtimeSync/makefile
+++ b/RealtimeSync/makefile
@@ -42,7 +42,7 @@ CXXFLAGS += -DZEN_MAC
WX_CONFIG_BIN =$(HOME)/Desktop/wxWidgets-2.9.5/lib/release/bin/wx-config
CXXFLAGS += -I$(HOME)/Desktop/boost_1_54_0
BOOST_LIB_DIR =$(HOME)/Desktop/boost_1_54_0/stage/lib
-MACOS_SDK =-mmacosx-version-min=10.7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk
+MACOS_SDK =-mmacosx-version-min=10.7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk
#-Wl,-Bstatic not supported on OSX!
# link wxWidgets and boost statically -> check dependencies with: otool -L RealtimeSync
@@ -56,7 +56,6 @@ CPP_LIST= #internal list of all *.cpp files needed for compilation
CPP_LIST+=application.cpp
CPP_LIST+=gui_generated.cpp
CPP_LIST+=main_dlg.cpp
-CPP_LIST+=resources.cpp
CPP_LIST+=tray_menu.cpp
CPP_LIST+=monitor.cpp
CPP_LIST+=xml_ffs.cpp
@@ -74,7 +73,11 @@ CPP_LIST+=../zen/file_handling.cpp
CPP_LIST+=../zen/file_io.cpp
CPP_LIST+=../zen/file_traverser.cpp
CPP_LIST+=../zen/zstring.cpp
+CPP_LIST+=../zen/format_unit.cpp
CPP_LIST+=../wx+/image_tools.cpp
+CPP_LIST+=../wx+/image_resources.cpp
+CPP_LIST+=../wx+/popup_dlg.cpp
+CPP_LIST+=../wx+/popup_dlg_generated.cpp
#list of all *.o files (we need the "RTS" subdirectory to handle "../*.cpp" files
OBJECT_LIST=$(CPP_LIST:%.cpp=../OBJ/RTS_GCC_Make_Release/RTS/%.o)
diff --git a/RealtimeSync/resources.cpp b/RealtimeSync/resources.cpp
deleted file mode 100644
index 34c9e8dc..00000000
--- a/RealtimeSync/resources.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-// **************************************************************************
-// * This file is part of the FreeFileSync project. It is distributed under *
-// * GNU General Public License: http://www.gnu.org/licenses/gpl.html *
-// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
-// **************************************************************************
-
-#include "resources.h"
-#include <memory>
-#include <zen/utf.h>
-#include <wx/wfstream.h>
-#include <wx/zipstrm.h>
-#include <wx/image.h>
-#include "../lib/ffs_paths.h"
-
-using namespace zen;
-
-
-const GlobalResources& GlobalResources::instance()
-{
- static GlobalResources inst;
- return inst;
-}
-
-
-GlobalResources::GlobalResources()
-{
- wxFFileInputStream input(utfCvrtTo<wxString>(zen::getResourceDir()) + L"Resources.zip");
- if (input.IsOk()) //if not... we don't want to react too harsh here
- {
- //activate support for .png files
- wxImage::AddHandler(new wxPNGHandler); //ownership passed
-
- wxZipInputStream resourceFile(input, wxConvUTF8);
- //do NOT rely on wxConvLocal! May result in "Cannot convert from the charset 'Unknown encoding (-1)'!"
-
- while (true)
- {
- std::unique_ptr<wxZipEntry> entry(resourceFile.GetNextEntry());
- if (entry.get() == nullptr)
- break;
-
- const wxString name = entry->GetName();
-
- //generic image loading
- if (endsWith(name, L".png"))
- bitmaps.insert(std::make_pair(name, wxImage(resourceFile, wxBITMAP_TYPE_PNG)));
- }
- }
-
-#ifdef ZEN_WIN
- //for compatibility it seems we need to stick with a "real" icon
- programIconRTS = wxIcon(L"A_RTS_ICON");
-
-#elif defined ZEN_LINUX
- programIconRTS.CopyFromBitmap(getImage(L"RealtimeSync"));
-
-#elif defined ZEN_MAC
- assert(getImage(L"RealtimeSync").GetWidth () == getImage(L"RealtimeSync").GetHeight() &&
- getImage(L"RealtimeSync").GetWidth() % 128 == 0);
- //wxWidgets' bitmap to icon conversion on OS X can only deal with very specific sizes
- programIconRTS.CopyFromBitmap(getImage(L"RealtimeSync").ConvertToImage().Scale(128, 128, wxIMAGE_QUALITY_HIGH));
-#endif
-
-}
-
-
-const wxBitmap& GlobalResources::getImage(const wxString& name) const
-{
- auto it = bitmaps.find(!contains(name, L'.') ? //assume .png ending if nothing else specified
- name + L".png" :
- name);
- if (it != bitmaps.end())
- return it->second;
- else
- {
- assert(false);
- return wxNullBitmap;
- }
-}
diff --git a/RealtimeSync/resources.h b/RealtimeSync/resources.h
deleted file mode 100644
index 7cec3a73..00000000
--- a/RealtimeSync/resources.h
+++ /dev/null
@@ -1,36 +0,0 @@
-// **************************************************************************
-// * This file is part of the FreeFileSync project. It is distributed under *
-// * GNU General Public License: http://www.gnu.org/licenses/gpl.html *
-// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
-// **************************************************************************
-
-#ifndef RESOURCES_H_INCLUDED_870857342085670826521345
-#define RESOURCES_H_INCLUDED_870857342085670826521345
-
-#include <map>
-#include <wx/bitmap.h>
-#include <wx/icon.h>
-
-
-class GlobalResources
-{
-public:
- static const GlobalResources& instance();
-
- const wxBitmap& getImage(const wxString& name) const;
-
- //image resource objects
- wxIcon programIconRTS;
-
-private:
- GlobalResources();
- GlobalResources(const GlobalResources&); //=delete
- GlobalResources& operator=(const GlobalResources&); //=delete
-
- std::map<wxString, wxBitmap> bitmaps;
-};
-
-inline
-const wxBitmap& getResourceImage(const wxString& name) { return GlobalResources::instance().getImage(name); }
-
-#endif //RESOURCES_H_INCLUDED_870857342085670826521345
diff --git a/RealtimeSync/tray_menu.cpp b/RealtimeSync/tray_menu.cpp
index e1cf8cad..6e67b5ec 100644
--- a/RealtimeSync/tray_menu.cpp
+++ b/RealtimeSync/tray_menu.cpp
@@ -5,20 +5,17 @@
// **************************************************************************
#include "tray_menu.h"
-#include <zen/build_info.h>
-#include <zen/tick_count.h>
#include <zen/thread.h>
-#include <wx+/mouse_move_dlg.h>
-#include <wx+/image_tools.h>
-//#include <wx+/string_conv.h>
-#include <wx+/shell_execute.h>
-#include <wx+/std_button_order.h>
+#include <zen/tick_count.h>
#include <wx/taskbar.h>
#include <wx/icon.h> //Linux needs this
#include <wx/app.h>
+#include <wx/menu.h>
#include <wx/timer.h>
-#include "resources.h"
-#include "gui_generated.h"
+#include <wx+/image_tools.h>
+#include <zen/shell_execute.h>
+#include <wx+/popup_dlg.h>
+#include <wx+/image_resources.h>
#include "monitor.h"
#include "../lib/resolve_path.h"
@@ -67,7 +64,7 @@ public:
trayBmp(getResourceImage(L"RTS_tray_24x24")) //use a 24x24 bitmap for perfect fit
#endif
{
- Connect(wxEVT_TASKBAR_LEFT_DCLICK, wxCommandEventHandler(TrayIconObject::OnDoubleClick), nullptr, this);
+ Connect(wxEVT_TASKBAR_LEFT_DCLICK, wxEventHandler(TrayIconObject::OnDoubleClick), nullptr, this);
setMode(mode);
}
@@ -122,24 +119,29 @@ private:
{
CONTEXT_RESTORE = 1, //wxWidgets: "A MenuItem ID of zero does not work under Mac"
CONTEXT_SHOW_ERROR,
- CONTEXT_ABORT = wxID_EXIT,
- CONTEXT_ABOUT = wxID_ABOUT
+ CONTEXT_ABORT = wxID_EXIT
};
virtual wxMenu* CreatePopupMenu()
{
wxMenu* contextMenu = new wxMenu;
+
+ wxMenuItem* defaultItem = nullptr;
switch (mode)
{
case TRAY_MODE_ACTIVE:
case TRAY_MODE_WAITING:
- contextMenu->Append(CONTEXT_RESTORE, _("&Restore"));
+ defaultItem = new wxMenuItem(contextMenu, CONTEXT_RESTORE, _("&Restore"));
break;
case TRAY_MODE_ERROR:
- contextMenu->Append(CONTEXT_SHOW_ERROR, _("&Show error"));
+ defaultItem = new wxMenuItem(contextMenu, CONTEXT_SHOW_ERROR, _("&Show error"));
break;
}
- contextMenu->Append(CONTEXT_ABOUT, _("&About"));
+#ifdef ZEN_WIN //no wxMenuItem::SetFont() on Linux and OS X: wasn't wxWidgets supposed to be *portable* at some point in time?????
+ defaultItem->SetFont(wxNORMAL_FONT->Bold());
+#endif
+ contextMenu->Append(defaultItem);
+
contextMenu->AppendSeparator();
contextMenu->Append(CONTEXT_ABORT, _("&Exit"));
//event handling
@@ -163,34 +165,10 @@ private:
case CONTEXT_SHOW_ERROR:
showErrorMsgRequested = true;
break;
-
- case CONTEXT_ABOUT:
- {
- //ATTENTION: the modal dialog below does NOT disable all GUI input, e.g. user may still double-click on tray icon
- //no crash in this context, but the double-click is remembered and executed after the modal dialog quits
- SetEvtHandlerEnabled(false);
- ZEN_ON_SCOPE_EXIT(SetEvtHandlerEnabled(true));
-
- wxString build = __TDATE__;
-#if wxUSE_UNICODE
- build += L" - Unicode";
-#else
- build += L" - ANSI";
-#endif //wxUSE_UNICODE
-
- if (zen::is64BitBuild)
- build += L" x64";
- else
- build += L" x86";
- assert_static(zen::is32BitBuild || zen::is64BitBuild);
-
- wxMessageBox(L"RealtimeSync" L"\n\n" + replaceCpy(_("Build: %x"), L"%x", build), _("About"), wxOK);
- }
- break;
}
}
- void OnDoubleClick(wxCommandEvent& event)
+ void OnDoubleClick(wxEvent& event)
{
switch (mode)
{
@@ -262,85 +240,6 @@ private:
};
//##############################################################################################################
-
-//#define ERROR_DLG_ENABLE_TIMEOUT
-class ErrorDlgWithTimeout : public ErrorDlgGenerated
-{
-public:
- ErrorDlgWithTimeout(wxWindow* parent, const wxString& messageText) :
- ErrorDlgGenerated(parent)
-#ifdef ERROR_DLG_ENABLE_TIMEOUT
- , secondsLeft(15) //give user some time to read msg!?
-#endif
- {
-#ifdef ZEN_WIN
- new zen::MouseMoveWindow(*this); //allow moving main dialog by clicking (nearly) anywhere...; ownership passed to "this"
-#endif
- setStandardButtonOrder(*bSizerStdButtons, StdButtons().setAffirmative(m_buttonRetry).setCancel(m_buttonCancel));
-
- m_bitmap10->SetBitmap(getResourceImage(L"msg_error"));
- m_textCtrl8->SetValue(messageText);
-
-#ifdef ERROR_DLG_ENABLE_TIMEOUT
- //count down X seconds then automatically press "retry"
- timer.Connect(wxEVT_TIMER, wxEventHandler(ErrorDlgWithTimeout::OnTimerEvent), nullptr, this);
- timer.Start(1000); //timer interval in ms
- updateButtonLabel();
-#endif
- Fit(); //child-element widths have changed: image was set
- m_buttonRetry->SetFocus();
- }
-
- enum ButtonPressed
- {
- BUTTON_RETRY,
- BUTTON_ABORT
- };
-
-private:
-#ifdef ERROR_DLG_ENABLE_TIMEOUT
- void OnTimerEvent(wxEvent& event)
- {
- if (secondsLeft <= 0)
- {
- EndModal(BUTTON_RETRY);
- return;
- }
- --secondsLeft;
- updateButtonLabel();
- }
-
- void updateButtonLabel()
- {
- m_buttonRetry->SetLabel(_("&Retry") + L" (" + replaceCpy(_P("1 sec", "%x sec", secondsLeft), L"%x", numberTo<std::wstring>(secondsLeft)) + L")");
- Layout();
- }
-#endif
-
- void OnClose(wxCloseEvent& event) { EndModal(BUTTON_ABORT); }
- void OnRetry(wxCommandEvent& event) { EndModal(BUTTON_RETRY); }
- void OnAbort(wxCommandEvent& event) { EndModal(BUTTON_ABORT); }
-
-#ifdef ERROR_DLG_ENABLE_TIMEOUT
- int secondsLeft;
- wxTimer timer;
-#endif
-};
-
-
-bool reportErrorTimeout(const std::wstring& msg) //return true: "retry"; false: "abort"
-{
- ErrorDlgWithTimeout errorDlg(nullptr, msg);
- errorDlg.Raise();
- switch (static_cast<ErrorDlgWithTimeout::ButtonPressed>(errorDlg.ShowModal()))
- {
- case ErrorDlgWithTimeout::BUTTON_RETRY:
- return true;
- case ErrorDlgWithTimeout::BUTTON_ABORT:
- return false;
- }
- return false;
-}
}
@@ -351,7 +250,7 @@ rts::AbortReason rts::startDirectoryMonitor(const xmlAccess::XmlRealConfig& conf
if (dirNamesNonFmt.empty())
{
- wxMessageBox(_("A folder input field is empty."), L"RealtimeSync" + _("Error"), wxOK | wxICON_ERROR);
+ showNotificationDialog(nullptr, DialogInfoType::ERROR2, PopupDialogCfg().setMainInstructions(_("A folder input field is empty.")));
return SHOW_GUI;
}
@@ -360,7 +259,7 @@ rts::AbortReason rts::startDirectoryMonitor(const xmlAccess::XmlRealConfig& conf
if (cmdLine.empty())
{
- wxMessageBox(_("Invalid command line:") + L" \"\"", L"RealtimeSync" + _("Error"), wxOK | wxICON_ERROR);
+ showNotificationDialog(nullptr, DialogInfoType::ERROR2, PopupDialogCfg().setMainInstructions(_("Incorrect command line:") + L" \"\""));
return SHOW_GUI;
}
@@ -385,7 +284,15 @@ rts::AbortReason rts::startDirectoryMonitor(const xmlAccess::XmlRealConfig& conf
virtual void executeExternalCommand()
{
auto cmdLineExp = expandMacros(cmdLine_);
- zen::shellExecute(cmdLineExp, zen::EXEC_TYPE_SYNC);
+ try
+ {
+ shellExecute2(cmdLineExp, EXEC_TYPE_SYNC); //throw FileError
+ }
+ catch (const FileError& e)
+ {
+ warn_static("fix dialog hiding on OSX !!")
+ showNotificationDialog(nullptr, DialogInfoType::ERROR2, PopupDialogCfg().setDetailInstructions(e.toString()));
+ }
}
virtual void requestUiRefresh()
@@ -406,12 +313,14 @@ rts::AbortReason rts::startDirectoryMonitor(const xmlAccess::XmlRealConfig& conf
trayIcon.doUiRefreshNow(); //throw AbortMonitoring
if (trayIcon.getShowErrorRequested())
- {
- if (reportErrorTimeout(msg)) //return true: "retry"; false: "abort"
- return;
- else
- throw AbortMonitoring(SHOW_GUI);
- }
+ switch (showConfirmationDialog(nullptr, DialogInfoType::ERROR2, PopupDialogCfg().
+ setDetailInstructions(msg), _("&Retry")))
+ {
+ case ConfirmationButton::DO_IT: //retry
+ return;
+ case ConfirmationButton::CANCEL:
+ throw AbortMonitoring(SHOW_GUI);
+ }
boost::this_thread::sleep(boost::posix_time::milliseconds(UI_UPDATE_INTERVAL));
}
}
bgstack15