From a1c91f4695e208d5a8f80dc37b1818169b7829ff Mon Sep 17 00:00:00 2001 From: Daniel Wilhelm Date: Fri, 18 Apr 2014 17:24:59 +0200 Subject: 5.17 --- RealtimeSync/RealtimeSync.vcxproj | 10 ++++------ RealtimeSync/application.cpp | 18 +++++++++--------- RealtimeSync/gui_generated.cpp | 19 +++++++++---------- RealtimeSync/gui_generated.h | 3 ++- RealtimeSync/main_dlg.cpp | 10 +++++----- RealtimeSync/makefile | 14 +++++++------- RealtimeSync/resources.cpp | 6 +++--- RealtimeSync/tray_menu.cpp | 25 ++++++++++++++++--------- RealtimeSync/watcher.cpp | 2 +- RealtimeSync/xml_proc.cpp | 3 +-- 10 files changed, 57 insertions(+), 53 deletions(-) (limited to 'RealtimeSync') diff --git a/RealtimeSync/RealtimeSync.vcxproj b/RealtimeSync/RealtimeSync.vcxproj index 097f9965..487f2cce 100644 --- a/RealtimeSync/RealtimeSync.vcxproj +++ b/RealtimeSync/RealtimeSync.vcxproj @@ -68,14 +68,12 @@ - true ..\BUILD\Bin\ ..\OBJ\$(ProjectName)_VCPP_$(PlatformName)_$(Configuration)\ false $(ProjectName)_$(PlatformName) - true ..\BUILD\Bin\ ..\OBJ\$(ProjectName)_VCPP_$(PlatformName)_$(Configuration)\ false @@ -100,7 +98,7 @@ Use Level4 Disabled - _SCL_SECURE_NO_WARNINGS;ZEN_PLATFORM_WINDOWS;wxUSE_UNICODE;__WXMSW__;FFS_WIN;WXINTL_NO_GETTEXT_MACRO;__WXDEBUG__;WXUSINGDLL + _SCL_SECURE_NO_WARNINGS;wxUSE_UNICODE;__WXMSW__;ZEN_WIN;WXINTL_NO_GETTEXT_MACRO;__WXDEBUG__;WXUSINGDLL;_DEBUG;%(PreprocessorDefinitions) C:\Program Files\C++\Boost;C:\Program Files\C++\wxWidgets\include;C:\Program Files\C++\wxWidgets\lib\vc10_x86_debug_dll\mswud;.. wx+/pch.h 4100;4512 @@ -128,7 +126,7 @@ Use Level4 Disabled - _SCL_SECURE_NO_WARNINGS;ZEN_PLATFORM_WINDOWS;wxUSE_UNICODE;__WXMSW__;FFS_WIN;WXINTL_NO_GETTEXT_MACRO;__WXDEBUG__;WXUSINGDLL + _SCL_SECURE_NO_WARNINGS;wxUSE_UNICODE;__WXMSW__;ZEN_WIN;WXINTL_NO_GETTEXT_MACRO;__WXDEBUG__;WXUSINGDLL;_DEBUG;%(PreprocessorDefinitions) C:\Program Files\C++\Boost;C:\Program Files\C++\wxWidgets\include;C:\Program Files\C++\wxWidgets\lib\vc10_x64_debug_dll\mswud;.. wx+/pch.h 4100;4512 @@ -161,7 +159,7 @@ NotUsing MaxSpeed true - _SCL_SECURE_NO_WARNINGS;ZEN_PLATFORM_WINDOWS;wxUSE_UNICODE;__WXMSW__;FFS_WIN;WXINTL_NO_GETTEXT_MACRO;NDEBUG + _SCL_SECURE_NO_WARNINGS;wxUSE_UNICODE;__WXMSW__;ZEN_WIN;WXINTL_NO_GETTEXT_MACRO;NDEBUG;%(PreprocessorDefinitions) C:\Program Files\C++\Boost;C:\Program Files\C++\wxWidgets\include;C:\Program Files\C++\wxWidgets\lib\vc10_x86_release_lib\mswu;.. Speed 4100;4512 @@ -192,7 +190,7 @@ NotUsing MaxSpeed true - _SCL_SECURE_NO_WARNINGS;ZEN_PLATFORM_WINDOWS;wxUSE_UNICODE;__WXMSW__;FFS_WIN;WXINTL_NO_GETTEXT_MACRO;NDEBUG + _SCL_SECURE_NO_WARNINGS;wxUSE_UNICODE;__WXMSW__;ZEN_WIN;WXINTL_NO_GETTEXT_MACRO;NDEBUG;%(PreprocessorDefinitions) C:\Program Files\C++\Boost;C:\Program Files\C++\wxWidgets\include;C:\Program Files\C++\wxWidgets\lib\vc10_x64_release_lib\mswu;.. Speed 4100;4512 diff --git a/RealtimeSync/application.cpp b/RealtimeSync/application.cpp index 61c9ca96..a7aff305 100644 --- a/RealtimeSync/application.cpp +++ b/RealtimeSync/application.cpp @@ -19,13 +19,13 @@ #include "../lib/return_codes.h" #include "lib/error_log.h" -#ifdef FFS_WIN +#ifdef ZEN_WIN #include -#elif defined FFS_LINUX +#elif defined ZEN_LINUX #include -#elif defined FFS_MAC +#elif defined ZEN_MAC #include #endif @@ -43,9 +43,9 @@ void onTerminationRequested() std::wstring msg = boost::this_thread::get_id() == mainThreadId ? L"Termination requested in main thread!\n\n" : L"Termination requested in worker thread!\n\n"; - msg += L"Please take a screenshot and file a bug report at: http://sourceforge.net/projects/freefilesync"; + msg += L"Please file a bug report at: http://sourceforge.net/projects/freefilesync"; - wxSafeShowMessage(_("An exception occurred!"), msg); + wxSafeShowMessage(_("An exception occurred"), msg); std::abort(); } @@ -61,7 +61,7 @@ bool Application::OnInit() { std::set_terminate(onTerminationRequested); //unlike wxWidgets uncaught exception handling, this works for all worker threads -#ifdef FFS_WIN +#ifdef ZEN_WIN #ifdef _MSC_VER _set_invalid_parameter_handler(crtInvalidParameterHandler); //see comment in #endif @@ -69,10 +69,10 @@ bool Application::OnInit() //SEM_FAILCRITICALERRORS at startup. This is to prevent error mode dialogs from hanging the application." ::SetErrorMode(SEM_FAILCRITICALERRORS); -#elif defined FFS_LINUX +#elif defined ZEN_LINUX ::gtk_rc_parse((zen::getResourceDir() + "styles.gtk_rc").c_str()); //remove inner border from bitmap buttons -#elif defined FFS_MAC +#elif defined ZEN_MAC ProcessSerialNumber psn = { 0, kCurrentProcess }; ::TransformProcessType(&psn, kProcessTransformToForegroundApplication); //behave like an application bundle, even when the app is not packaged (yet) #endif @@ -148,7 +148,7 @@ int Application::OnRun() { //it's not always possible to display a message box, e.g. corrupted stack, however low-level file output works! logError(utfCvrtTo(msg)); - wxSafeShowMessage(_("An exception occurred!") + L" - FFS", msg); + wxSafeShowMessage(_("An exception occurred"), msg); }; try diff --git a/RealtimeSync/gui_generated.cpp b/RealtimeSync/gui_generated.cpp index d388e40d..cf072240 100644 --- a/RealtimeSync/gui_generated.cpp +++ b/RealtimeSync/gui_generated.cpp @@ -291,11 +291,11 @@ ErrorDlgGenerated::ErrorDlgGenerated( wxWindow* parent, wxWindowID id, const wxS 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, 5 ); + 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 ); m_textCtrl8->SetMaxLength( 0 ); - bSizer26->Add( m_textCtrl8, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); + bSizer26->Add( m_textCtrl8, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxTOP, 5 ); bSizer16->Add( bSizer26, 1, wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); @@ -309,18 +309,17 @@ ErrorDlgGenerated::ErrorDlgGenerated( wxWindow* parent, wxWindowID id, const wxS m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); bSizer24->Add( m_staticline2, 0, wxEXPAND, 5 ); - wxBoxSizer* bSizer13; - bSizer13 = new wxBoxSizer( wxHORIZONTAL ); + bSizerStdButtons = new wxBoxSizer( wxHORIZONTAL ); m_buttonRetry = new wxButton( this, wxID_RETRY, _("&Retry"), wxDefaultPosition, wxSize( -1,30 ), 0 ); m_buttonRetry->SetDefault(); - bSizer13->Add( m_buttonRetry, 0, wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); + bSizerStdButtons->Add( m_buttonRetry, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - m_buttonAbort = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxSize( -1,30 ), 0 ); - bSizer13->Add( m_buttonAbort, 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( bSizer13, 0, wxALIGN_RIGHT, 5 ); + bSizer24->Add( bSizerStdButtons, 0, wxALIGN_RIGHT, 5 ); this->SetSizer( bSizer24 ); @@ -332,7 +331,7 @@ ErrorDlgGenerated::ErrorDlgGenerated( wxWindow* parent, wxWindowID id, const wxS // Connect Events this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( ErrorDlgGenerated::OnClose ) ); m_buttonRetry->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ErrorDlgGenerated::OnRetry ), NULL, this ); - m_buttonAbort->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ErrorDlgGenerated::OnAbort ), NULL, this ); + m_buttonCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ErrorDlgGenerated::OnAbort ), NULL, this ); } ErrorDlgGenerated::~ErrorDlgGenerated() @@ -340,6 +339,6 @@ 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_buttonAbort->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ErrorDlgGenerated::OnAbort ), 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 9a19bf63..2b42b271 100644 --- a/RealtimeSync/gui_generated.h +++ b/RealtimeSync/gui_generated.h @@ -128,8 +128,9 @@ protected: wxStaticBitmap* m_bitmap10; wxTextCtrl* m_textCtrl8; wxStaticLine* m_staticline2; + wxBoxSizer* bSizerStdButtons; wxButton* m_buttonRetry; - wxButton* m_buttonAbort; + wxButton* m_buttonCancel; // Virtual event handlers, overide them in your derived class virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } diff --git a/RealtimeSync/main_dlg.cpp b/RealtimeSync/main_dlg.cpp index f0d4d4f7..b750b110 100644 --- a/RealtimeSync/main_dlg.cpp +++ b/RealtimeSync/main_dlg.cpp @@ -47,7 +47,7 @@ private: MainDialog::MainDialog(wxDialog* dlg, const wxString& cfgFileName) : MainDlgGenerated(dlg) { -#ifdef FFS_WIN +#ifdef ZEN_WIN new MouseMoveWindow(*this); //ownership passed to "this" #endif wxWindowUpdateLocker dummy(this); //avoid display distortion @@ -61,7 +61,7 @@ MainDialog::MainDialog(wxDialog* dlg, const wxString& cfgFileName) m_panelMainFolder->Layout(); m_bpButtonAddFolder ->SetBitmapLabel(getResourceImage(L"item_add")); - m_bpButtonRemoveTopFolder->SetBitmapLabel(getResourceImage(L"item_delete")); + m_bpButtonRemoveTopFolder->SetBitmapLabel(getResourceImage(L"item_remove")); m_buttonStart ->setBitmapFront(getResourceImage(L"startRts"), 5); //register key event @@ -376,9 +376,9 @@ void MainDialog::OnRemoveTopFolder(wxCommandEvent& event) } -#ifdef FFS_WIN +#ifdef ZEN_WIN static const size_t MAX_ADD_FOLDERS = 8; -#elif defined FFS_LINUX || defined FFS_MAC +#elif defined ZEN_LINUX || defined ZEN_MAC static const size_t MAX_ADD_FOLDERS = 6; #endif @@ -395,7 +395,7 @@ void MainDialog::addFolder(const std::vector& newFolders, bool addFron { //add new folder pair DirectoryPanel* newFolder = new DirectoryPanel(m_scrolledWinFolders); - newFolder->m_bpButtonRemoveFolder->SetBitmapLabel(getResourceImage(L"item_delete")); + newFolder->m_bpButtonRemoveFolder->SetBitmapLabel(getResourceImage(L"item_remove")); //get size of scrolled window folderHeight = newFolder->GetSize().GetHeight(); diff --git a/RealtimeSync/makefile b/RealtimeSync/makefile index 325578a1..865d73a1 100644 --- a/RealtimeSync/makefile +++ b/RealtimeSync/makefile @@ -4,7 +4,7 @@ APPNAME = RealtimeSync prefix = /usr BINDIR = $(DESTDIR)$(prefix)/bin -CXXFLAGS = -std=c++11 -Wall -pipe -O3 -DNDEBUG -DwxUSE_UNICODE -DZEN_PLATFORM_OTHER -DWXINTL_NO_GETTEXT_MACRO -I.. -include "zen/i18n.h" -include "zen/warn_static.h" +CXXFLAGS = -std=c++11 -Wall -pipe -O3 -DNDEBUG -DwxUSE_UNICODE -DWXINTL_NO_GETTEXT_MACRO -I.. -include "zen/i18n.h" -include "zen/warn_static.h" LINKFLAGS = #distinguish Linux/Mac builds @@ -13,7 +13,7 @@ OPERATING_SYSTEM_NAME := $(shell uname) #################### Linux ############################ ifeq ($(OPERATING_SYSTEM_NAME), Linux) COMPILER_BIN=g++ -pthread -CXXFLAGS += -DFFS_LINUX +CXXFLAGS += -DZEN_LINUX #Gtk - support "no button border" CXXFLAGS += `pkg-config --cflags gtk+-2.0` @@ -26,8 +26,8 @@ LINKFLAGS += `wx-config --libs --debug=no` -lboost_thread -lboost_system -lz else #static wxWidgets and boost library linkage for precompiled release WX_CONFIG_BIN =$(HOME)/Desktop/wxGTK-2.8.12/lib/release/bin/wx-config -CXXFLAGS += -I$(HOME)/Desktop/boost_1_53_0 -BOOST_LIB_DIR =$(HOME)/Desktop/boost_1_53_0/stage/lib +CXXFLAGS += -I$(HOME)/Desktop/boost_1_54_0 +BOOST_LIB_DIR =$(HOME)/Desktop/boost_1_54_0/stage/lib CXXFLAGS += `$(WX_CONFIG_BIN) --cxxflags --debug=no --static=yes` LINKFLAGS += `$(WX_CONFIG_BIN) --libs --debug=no --static=yes` $(BOOST_LIB_DIR)/libboost_thread.a $(BOOST_LIB_DIR)/libboost_system.a -lX11 @@ -37,11 +37,11 @@ endif #################### OS X ############################ ifeq ($(OPERATING_SYSTEM_NAME), Darwin) COMPILER_BIN=clang++ -stdlib=libc++ -CXXFLAGS += -DFFS_MAC +CXXFLAGS += -DZEN_MAC WX_CONFIG_BIN =$(HOME)/Desktop/wxWidgets-2.9.4/lib/release/bin/wx-config -CXXFLAGS += -I$(HOME)/Desktop/boost_1_53_0 -BOOST_LIB_DIR =$(HOME)/Desktop/boost_1_53_0/stage/lib +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 #-Wl,-Bstatic not supported on OSX! diff --git a/RealtimeSync/resources.cpp b/RealtimeSync/resources.cpp index f55887ee..34c9e8dc 100644 --- a/RealtimeSync/resources.cpp +++ b/RealtimeSync/resources.cpp @@ -47,14 +47,14 @@ GlobalResources::GlobalResources() } } -#ifdef FFS_WIN +#ifdef ZEN_WIN //for compatibility it seems we need to stick with a "real" icon programIconRTS = wxIcon(L"A_RTS_ICON"); -#elif defined FFS_LINUX +#elif defined ZEN_LINUX programIconRTS.CopyFromBitmap(getImage(L"RealtimeSync")); -#elif defined FFS_MAC +#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 diff --git a/RealtimeSync/tray_menu.cpp b/RealtimeSync/tray_menu.cpp index 8f2dcfde..676904f1 100644 --- a/RealtimeSync/tray_menu.cpp +++ b/RealtimeSync/tray_menu.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -153,25 +154,29 @@ public: void showIconActive() { wxIcon realtimeIcon; -#if defined FFS_WIN || defined FFS_MAC //16x16 seems to be the only size that is shown correctly on OS X +#if defined ZEN_WIN || defined ZEN_MAC //16x16 seems to be the only size that is shown correctly on OS X realtimeIcon.CopyFromBitmap(getResourceImage(L"RTS_tray_16x16")); //use a 16x16 bitmap -#elif defined FFS_LINUX +#elif defined ZEN_LINUX realtimeIcon.CopyFromBitmap(getResourceImage(L"RTS_tray_24x24")); //use a 24x24 bitmap for perfect fit #endif - const wxString postFix = jobName_.empty() ? wxString() : (L"\n\"" + jobName_ + L"\""); - trayMenu->SetIcon(realtimeIcon, _("Monitoring active...") + postFix); + wxString tooltip = L"RealtimeSync"; + if (!jobName_.empty()) + tooltip += L"\n\"" + jobName_ + L"\""; + trayMenu->SetIcon(realtimeIcon, tooltip); } void showIconWaiting() { wxIcon realtimeIcon; -#if defined FFS_WIN || defined FFS_MAC +#if defined ZEN_WIN || defined ZEN_MAC realtimeIcon.CopyFromBitmap(greyScale(getResourceImage(L"RTS_tray_16x16"))); -#elif defined FFS_LINUX +#elif defined ZEN_LINUX realtimeIcon.CopyFromBitmap(greyScale(getResourceImage(L"RTS_tray_24x24"))); #endif - const wxString postFix = jobName_.empty() ? wxString() : (L"\n\"" + jobName_ + L"\""); - trayMenu->SetIcon(realtimeIcon, _("Waiting for missing directories...") + postFix); + wxString tooltip = _("Waiting for missing directories..."); + if (!jobName_.empty()) + tooltip += L"\n\"" + jobName_ + L"\""; + trayMenu->SetIcon(realtimeIcon, tooltip); } private: @@ -244,9 +249,11 @@ public: ErrorDlgGenerated(parent), secondsLeft(15) //give user some time to read msg!? { -#ifdef FFS_WIN +#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); diff --git a/RealtimeSync/watcher.cpp b/RealtimeSync/watcher.cpp index 4e33bd98..6ef5e924 100644 --- a/RealtimeSync/watcher.cpp +++ b/RealtimeSync/watcher.cpp @@ -171,7 +171,7 @@ void rts::waitForMissingDirs(const std::vector& dirNamesNonFmt, WaitCal const Zstring dirnameFmt = *it; auto ftDirExisting = async([=]() -> bool { -#ifdef FFS_WIN +#ifdef ZEN_WIN //1. login to network share, if necessary -> we probably do NOT want multiple concurrent runs: GUI!? loginNetworkShare(dirnameFmt, false); //login networks shares, no PW prompt -> is this really RTS's job? #endif diff --git a/RealtimeSync/xml_proc.cpp b/RealtimeSync/xml_proc.cpp index 1f4d89cc..db235ecb 100644 --- a/RealtimeSync/xml_proc.cpp +++ b/RealtimeSync/xml_proc.cpp @@ -38,8 +38,7 @@ bool isXmlTypeRTS(const XmlDoc& doc) //throw() void xmlAccess::readRealConfig(const Zstring& filename, XmlRealConfig& config) { - XmlDoc doc; - loadXmlDocument(filename, doc); //throw FfsXmlError + XmlDoc doc = loadXmlDocument(filename); //throw FfsXmlError if (!isXmlTypeRTS(doc)) throw FfsXmlError(replaceCpy(_("File %x does not contain a valid configuration."), L"%x", fmtFileName(filename))); -- cgit