From b916407a2a06f8452e82b74dc44c54acbcc572b0 Mon Sep 17 00:00:00 2001 From: Daniel Wilhelm Date: Fri, 18 Apr 2014 17:27:42 +0200 Subject: 5.21 --- RealtimeSync/RealtimeSync.vcxproj | 27 ++++++++++++--------------- RealtimeSync/application.cpp | 10 +--------- RealtimeSync/gui_generated.cpp | 5 ++--- RealtimeSync/gui_generated.h | 4 ++-- RealtimeSync/main_dlg.cpp | 37 +++++++++++++++++++++++++++++++++---- RealtimeSync/main_dlg.h | 5 ++++- RealtimeSync/makefile | 8 ++++---- RealtimeSync/tray_menu.cpp | 1 + 8 files changed, 59 insertions(+), 38 deletions(-) (limited to 'RealtimeSync') 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 @@ Windows true $(OutDir)$(TargetName)$(TargetExt) - 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) + 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) C:\Program Files\C++\Boost\stage\lib;C:\Program Files\C++\wxWidgets\lib\vc12_x86_debug_dll C:\Program Files\C++\wxWidgets\include - %(PreprocessorDefinitions); + %(PreprocessorDefinitions);ZEN_ARCHITECTURE_X86 @@ -143,14 +143,14 @@ Windows true $(OutDir)$(TargetName)$(TargetExt) - 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) + 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) C:\Program Files\C++\Boost\stage_x64\lib;C:\Program Files\C++\wxWidgets\lib\vc12_x64_debug_dll C:\Program Files\C++\wxWidgets\include - %(PreprocessorDefinitions);WX_CPU_AMD64 + %(PreprocessorDefinitions);ZEN_ARCHITECTURE_X64 @@ -162,7 +162,7 @@ _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\vc12_x86_release_lib\mswu;.. Speed - 4100;4512 + 4100;4512;4996 MultiThreaded true zen/warn_static.h @@ -172,13 +172,13 @@ false true true - 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) + 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) $(OutDir)$(TargetName)$(TargetExt) C:\Program Files\C++\Boost\stage\lib;C:\Program Files\C++\wxWidgets\lib\vc12_x86_release_lib C:\Program Files\C++\wxWidgets\include - %(PreprocessorDefinitions); + %(PreprocessorDefinitions);ZEN_ARCHITECTURE_X86 "C:\Program Files\C++\CodeSigning\SignCode.cmd" "$(TargetPath)" @@ -193,7 +193,7 @@ _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\vc12_x64_release_lib\mswu;.. Speed - 4100;4512 + 4100;4512;4996 MultiThreaded true zen/warn_static.h @@ -203,13 +203,13 @@ false true true - 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) + 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) $(OutDir)$(TargetName)$(TargetExt) C:\Program Files\C++\Boost\stage_x64\lib;C:\Program Files\C++\wxWidgets\lib\vc12_x64_release_lib C:\Program Files\C++\wxWidgets\include - %(PreprocessorDefinitions);WX_CPU_AMD64 + %(PreprocessorDefinitions);ZEN_ARCHITECTURE_X64 "C:\Program Files\C++\CodeSigning\SignCode.cmd" "$(TargetPath)" @@ -224,11 +224,11 @@ - Create Create + @@ -240,10 +240,7 @@ - - Use - Use - + 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 - -#elif defined ZEN_MAC -#include #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 #include #include -namespace zen { class BitmapButton; } +namespace zen { class BitmapTextButton; } #include #include @@ -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 #include #include -//#include -#include +#include #include #include #include @@ -23,6 +22,9 @@ #include "../lib/help_provider.h" #include "../lib/process_xml.h" #include "../lib/ffs_paths.h" +#ifdef ZEN_MAC +#include +#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(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 #include #include +#include #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 #include //Linux needs this #include +#include #include "resources.h" #include "gui_generated.h" #include "monitor.h" -- cgit