diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:27:42 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:27:42 +0200 |
commit | b916407a2a06f8452e82b74dc44c54acbcc572b0 (patch) | |
tree | 46358e0bb035fca0f42edb4b5b8aa5f1613814af /RealtimeSync | |
parent | 5.20 (diff) | |
download | FreeFileSync-b916407a2a06f8452e82b74dc44c54acbcc572b0.tar.gz FreeFileSync-b916407a2a06f8452e82b74dc44c54acbcc572b0.tar.bz2 FreeFileSync-b916407a2a06f8452e82b74dc44c54acbcc572b0.zip |
5.21
Diffstat (limited to 'RealtimeSync')
-rw-r--r-- | RealtimeSync/RealtimeSync.vcxproj | 27 | ||||
-rw-r--r-- | RealtimeSync/application.cpp | 10 | ||||
-rw-r--r-- | RealtimeSync/gui_generated.cpp | 5 | ||||
-rw-r--r-- | RealtimeSync/gui_generated.h | 4 | ||||
-rw-r--r-- | RealtimeSync/main_dlg.cpp | 37 | ||||
-rw-r--r-- | RealtimeSync/main_dlg.h | 5 | ||||
-rw-r--r-- | RealtimeSync/makefile | 8 | ||||
-rw-r--r-- | RealtimeSync/tray_menu.cpp | 1 |
8 files changed, 59 insertions, 38 deletions
diff --git a/RealtimeSync/RealtimeSync.vcxproj b/RealtimeSync/RealtimeSync.vcxproj index 08abd76f..dbaa2aa5 100644 --- a/RealtimeSync/RealtimeSync.vcxproj +++ b/RealtimeSync/RealtimeSync.vcxproj @@ -113,12 +113,12 @@ <SubSystem>Windows</SubSystem> <GenerateDebugInformation>true</GenerateDebugInformation> <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> - <AdditionalDependencies>wxmsw28ud_adv.lib;wxmsw28ud_core.lib;wxbase28ud.lib;wxpngd.lib;wxzlibd.lib;wxbase28ud_net.lib;comctl32.lib;ws2_32.lib;Rpcrt4.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies> + <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> </Link> <ResourceCompile> <AdditionalIncludeDirectories>C:\Program Files\C++\wxWidgets\include</AdditionalIncludeDirectories> - <PreprocessorDefinitions>%(PreprocessorDefinitions);</PreprocessorDefinitions> + <PreprocessorDefinitions>%(PreprocessorDefinitions);ZEN_ARCHITECTURE_X86</PreprocessorDefinitions> </ResourceCompile> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> @@ -143,14 +143,14 @@ <SubSystem>Windows</SubSystem> <GenerateDebugInformation>true</GenerateDebugInformation> <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> - <AdditionalDependencies>wxmsw28ud_adv.lib;wxmsw28ud_core.lib;wxbase28ud.lib;wxpngd.lib;wxzlibd.lib;wxbase28ud_net.lib;comctl32.lib;ws2_32.lib;Rpcrt4.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies> + <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> <LinkStatus> </LinkStatus> </Link> <ResourceCompile> <AdditionalIncludeDirectories>C:\Program Files\C++\wxWidgets\include</AdditionalIncludeDirectories> - <PreprocessorDefinitions>%(PreprocessorDefinitions);WX_CPU_AMD64</PreprocessorDefinitions> + <PreprocessorDefinitions>%(PreprocessorDefinitions);ZEN_ARCHITECTURE_X64</PreprocessorDefinitions> </ResourceCompile> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> @@ -162,7 +162,7 @@ <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> <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> - <DisableSpecificWarnings>4100;4512</DisableSpecificWarnings> + <DisableSpecificWarnings>4100;4512;4996</DisableSpecificWarnings> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> <MultiProcessorCompilation>true</MultiProcessorCompilation> <ForcedIncludeFiles>zen/warn_static.h</ForcedIncludeFiles> @@ -172,13 +172,13 @@ <GenerateDebugInformation>false</GenerateDebugInformation> <EnableCOMDATFolding>true</EnableCOMDATFolding> <OptimizeReferences>true</OptimizeReferences> - <AdditionalDependencies>wxbase28u.lib;wxmsw28u_adv.lib;wxmsw28u_core.lib;wxpng.lib;wxzlib.lib;wxbase28u_net.lib;comctl32.lib;ws2_32.lib;winmm.lib;Rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies> + <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> </Link> <ResourceCompile> <AdditionalIncludeDirectories>C:\Program Files\C++\wxWidgets\include</AdditionalIncludeDirectories> - <PreprocessorDefinitions>%(PreprocessorDefinitions);</PreprocessorDefinitions> + <PreprocessorDefinitions>%(PreprocessorDefinitions);ZEN_ARCHITECTURE_X86</PreprocessorDefinitions> </ResourceCompile> <PostBuildEvent> <Command>"C:\Program Files\C++\CodeSigning\SignCode.cmd" "$(TargetPath)"</Command> @@ -193,7 +193,7 @@ <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> <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> - <DisableSpecificWarnings>4100;4512</DisableSpecificWarnings> + <DisableSpecificWarnings>4100;4512;4996</DisableSpecificWarnings> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> <MultiProcessorCompilation>true</MultiProcessorCompilation> <ForcedIncludeFiles>zen/warn_static.h</ForcedIncludeFiles> @@ -203,13 +203,13 @@ <GenerateDebugInformation>false</GenerateDebugInformation> <EnableCOMDATFolding>true</EnableCOMDATFolding> <OptimizeReferences>true</OptimizeReferences> - <AdditionalDependencies>wxmsw28u_adv.lib;wxmsw28u_core.lib;wxbase28u.lib;wxpng.lib;wxzlib.lib;wxbase28u_net.lib;comctl32.lib;ws2_32.lib;winmm.lib;Rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies> + <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> </Link> <ResourceCompile> <AdditionalIncludeDirectories>C:\Program Files\C++\wxWidgets\include</AdditionalIncludeDirectories> - <PreprocessorDefinitions>%(PreprocessorDefinitions);WX_CPU_AMD64</PreprocessorDefinitions> + <PreprocessorDefinitions>%(PreprocessorDefinitions);ZEN_ARCHITECTURE_X64</PreprocessorDefinitions> </ResourceCompile> <PostBuildEvent> <Command>"C:\Program Files\C++\CodeSigning\SignCode.cmd" "$(TargetPath)"</Command> @@ -224,11 +224,11 @@ <ClCompile Include="..\structures.cpp" /> <ClCompile Include="..\ui\dir_name.cpp" /> <ClCompile Include="..\ui\folder_history_box.cpp" /> - <ClCompile Include="..\wx+\button.cpp" /> <ClCompile Include="..\wx+\create_pch.cpp"> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader> </ClCompile> + <ClCompile Include="..\wx+\image_tools.cpp" /> <ClCompile Include="..\wx+\mouse_move_dlg.cpp" /> <ClCompile Include="..\zen\debug_memory_leaks.cpp" /> <ClCompile Include="..\zen\dir_watcher.cpp" /> @@ -240,10 +240,7 @@ <ClCompile Include="..\zen\privilege.cpp" /> <ClCompile Include="..\zen\scroll_window_under_cursor.cpp" /> <ClCompile Include="..\zen\zstring.cpp" /> - <ClCompile Include="application.cpp"> - <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader> - <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Use</PrecompiledHeader> - </ClCompile> + <ClCompile Include="application.cpp" /> <ClCompile Include="gui_generated.cpp" /> <ClCompile Include="main_dlg.cpp" /> <ClCompile Include="monitor.cpp" /> diff --git a/RealtimeSync/application.cpp b/RealtimeSync/application.cpp index af8a40a9..c2ed4078 100644 --- a/RealtimeSync/application.cpp +++ b/RealtimeSync/application.cpp @@ -24,9 +24,6 @@ #elif defined ZEN_LINUX #include <gtk/gtk.h> - -#elif defined ZEN_MAC -#include <ApplicationServices/ApplicationServices.h> #endif using namespace zen; @@ -72,10 +69,6 @@ bool Application::OnInit() #elif defined ZEN_LINUX ::gtk_rc_parse((zen::getResourceDir() + "styles.gtk_rc").c_str()); //remove inner border from bitmap buttons - -#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 SetAppName(L"FreeFileSync"); //reuse FFS's name, to have "GetUserDataDir()/GetResourcesDir()" return the same directory in ffs_paths.cpp @@ -137,8 +130,7 @@ void Application::onEnterEventLoop(wxEvent& event) if (!commandArgs.empty()) cfgFilename = commandArgs[0]; - MainDialog* frame = new MainDialog(nullptr, cfgFilename); - frame->Show(); + MainDialog::create(cfgFilename); } diff --git a/RealtimeSync/gui_generated.cpp b/RealtimeSync/gui_generated.cpp index 659f7ea4..16b52345 100644 --- a/RealtimeSync/gui_generated.cpp +++ b/RealtimeSync/gui_generated.cpp @@ -5,7 +5,7 @@ // PLEASE DO "NOT" EDIT THIS FILE! /////////////////////////////////////////////////////////////////////////// -#include "../wx+/button.h" +#include "../wx+/bitmap_button.h" #include "gui_generated.h" @@ -207,7 +207,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::BitmapButton( 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 ) ); @@ -300,7 +300,6 @@ ErrorDlgGenerated::ErrorDlgGenerated( wxWindow* parent, wxWindowID id, const wxS 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|wxTOP, 5 ); diff --git a/RealtimeSync/gui_generated.h b/RealtimeSync/gui_generated.h index aabb23fc..182f75ca 100644 --- a/RealtimeSync/gui_generated.h +++ b/RealtimeSync/gui_generated.h @@ -11,7 +11,7 @@ #include <wx/artprov.h> #include <wx/xrc/xmlres.h> #include <wx/intl.h> -namespace zen { class BitmapButton; } +namespace zen { class BitmapTextButton; } #include <wx/string.h> #include <wx/bitmap.h> @@ -75,7 +75,7 @@ protected: wxStaticText* m_staticText6; wxTextCtrl* m_textCtrlCommand; wxStaticLine* m_staticline5; - zen::BitmapButton* m_buttonStart; + zen::BitmapTextButton* m_buttonStart; // 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 b7a0aee1..7b3e0f92 100644 --- a/RealtimeSync/main_dlg.cpp +++ b/RealtimeSync/main_dlg.cpp @@ -9,8 +9,7 @@ #include <wx/msgdlg.h> #include <wx/wupdlock.h> #include <wx/filedlg.h> -//#include <wx/utils.h> -#include <wx+/button.h> +#include <wx+/bitmap_button.h> #include <wx+/string_conv.h> #include <wx+/mouse_move_dlg.h> #include <wx+/font_size.h> @@ -23,6 +22,9 @@ #include "../lib/help_provider.h" #include "../lib/process_xml.h" #include "../lib/ffs_paths.h" +#ifdef ZEN_MAC +#include <ApplicationServices/ApplicationServices.h> +#endif using namespace zen; @@ -42,6 +44,12 @@ private: }; +void MainDialog::create(const Zstring& cfgFile) +{ + /*MainDialog* frame = */ new MainDialog(nullptr, cfgFile); +} + + MainDialog::MainDialog(wxDialog* dlg, const Zstring& cfgFileName) : MainDlgGenerated(dlg) { @@ -53,14 +61,16 @@ MainDialog::MainDialog(wxDialog* dlg, const Zstring& cfgFileName) SetIcon(GlobalResources::instance().programIconRTS); //set application icon setRelativeFontSize(*m_buttonStart, 1.5); - m_buttonStart->setInnerBorderSize(8); m_bpButtonRemoveTopFolder->Hide(); m_panelMainFolder->Layout(); m_bpButtonAddFolder ->SetBitmapLabel(getResourceImage(L"item_add")); m_bpButtonRemoveTopFolder->SetBitmapLabel(getResourceImage(L"item_remove")); - m_buttonStart ->setBitmapFront(getResourceImage(L"startRts"), 5); + ///m_buttonStart ->setBitmapFront(getResourceImage(L"startRts"), 5); + + setBitmapTextLabel(*m_buttonStart, getResourceImage(L"startRts").ConvertToImage(), m_buttonStart->GetLabel(), 5, 8); + //register key event Connect(wxEVT_CHAR_HOOK, wxKeyEventHandler(MainDialog::OnKeyPressed), nullptr, this); @@ -106,9 +116,19 @@ MainDialog::MainDialog(wxDialog* dlg, const Zstring& cfgFileName) { wxCommandEvent dummy2(wxEVT_COMMAND_BUTTON_CLICKED); this->OnStart(dummy2); + //don't Show()! } else + { m_buttonStart->SetFocus(); //don't "steal" focus if program is running from sys-tray" + 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 + } //drag and drop .ffs_real and .ffs_batch on main dialog setupFileDrop(*m_panelMain); @@ -193,6 +213,11 @@ void MainDialog::OnStart(wxCommandEvent& event) xmlAccess::XmlRealConfig currentCfg = getConfiguration(); 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 switch (rts::startDirectoryMonitor(currentCfg, xmlAccess::extractJobName(utfCvrtTo<Zstring>(currentConfigFileName)))) { @@ -204,6 +229,10 @@ void MainDialog::OnStart(wxCommandEvent& event) break; } Show(); //don't show for EXIT_APP +#ifdef ZEN_MAC + ::TransformProcessType(&psn, kProcessTransformToForegroundApplication); //show dock icon again + ::SetFrontProcess(&psn); //why isn't this covered by wxWindows::Raise()?? +#endif Raise(); } diff --git a/RealtimeSync/main_dlg.h b/RealtimeSync/main_dlg.h index 2a1fb03e..9e5537f0 100644 --- a/RealtimeSync/main_dlg.h +++ b/RealtimeSync/main_dlg.h @@ -13,6 +13,7 @@ #include <zen/zstring.h> #include <zen/async_task.h> #include <wx+/file_drop.h> +#include <wx/timer.h> #include "../ui/dir_name.h" namespace xmlAccess @@ -25,10 +26,12 @@ class DirectoryPanel; class MainDialog: public MainDlgGenerated { public: + static void create(const Zstring& cfgFile); + +private: MainDialog(wxDialog* dlg, const Zstring& cfgFileName); ~MainDialog(); -private: void loadConfig(const Zstring& filename); virtual void OnClose (wxCloseEvent& event) { Destroy(); } diff --git a/RealtimeSync/makefile b/RealtimeSync/makefile index d84c425f..50a08049 100644 --- a/RealtimeSync/makefile +++ b/RealtimeSync/makefile @@ -25,7 +25,7 @@ CXXFLAGS += `wx-config --cxxflags --debug=no` 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 +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 @@ -39,7 +39,7 @@ ifeq ($(OPERATING_SYSTEM_NAME), Darwin) COMPILER_BIN=clang++ -stdlib=libc++ CXXFLAGS += -DZEN_MAC -WX_CONFIG_BIN =$(HOME)/Desktop/wxWidgets-2.9.4/lib/release/bin/wx-config +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 @@ -50,7 +50,7 @@ CXXFLAGS += $(MACOS_SDK) `$(WX_CONFIG_BIN) --cxxflags --debug=no --static=yes` LINKFLAGS += $(MACOS_SDK) `$(WX_CONFIG_BIN) --libs --debug=no --static=yes` $(BOOST_LIB_DIR)/libboost_thread.a $(BOOST_LIB_DIR)/libboost_system.a endif -##################################################################################################### +###################################################### CPP_LIST= #internal list of all *.cpp files needed for compilation CPP_LIST+=application.cpp @@ -74,7 +74,7 @@ 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+=../wx+/button.cpp +CPP_LIST+=../wx+/image_tools.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/tray_menu.cpp b/RealtimeSync/tray_menu.cpp index 33758ad2..e1cf8cad 100644 --- a/RealtimeSync/tray_menu.cpp +++ b/RealtimeSync/tray_menu.cpp @@ -16,6 +16,7 @@ #include <wx/taskbar.h> #include <wx/icon.h> //Linux needs this #include <wx/app.h> +#include <wx/timer.h> #include "resources.h" #include "gui_generated.h" #include "monitor.h" |