Repository: alamaison/swish
Branch: develop
Commit: 2a2140d9b521
Files: 460
Total size: 2.6 MB
Directory structure:
gitextract_02n81_nz/
├── .clang-format
├── .gitattributes
├── .tx/
│ └── config
├── CMakeLists.txt
├── COPYING.rtf
├── LICENSE.txt
├── NEWS
├── README.md
├── appcast.xml.in
├── build/
│ ├── making_a_release.txt
│ └── news_html.py
├── cmake/
│ ├── GetGitRevisionDescription.cmake
│ ├── GetGitRevisionDescription.cmake.in
│ ├── Hunter/
│ │ └── config.cmake
│ └── HunterGate.cmake
├── cpack_wix_patch.xml
├── ezel/
│ ├── CMakeLists.txt
│ ├── control.hpp
│ ├── control_parent_impl.hpp
│ ├── controls/
│ │ ├── button.hpp
│ │ ├── checkbox.hpp
│ │ ├── edit.hpp
│ │ ├── icon.hpp
│ │ ├── label.hpp
│ │ ├── line.hpp
│ │ └── spinner.hpp
│ ├── detail/
│ │ ├── command_dispatch.hpp
│ │ ├── dialog_template.hpp
│ │ ├── hooks.hpp
│ │ ├── hwnd_linking.hpp
│ │ ├── message_dispatch.hpp
│ │ ├── window_impl.hpp
│ │ ├── window_link.hpp
│ │ ├── window_proc.hpp
│ │ └── window_proxy.hpp
│ ├── form.hpp
│ └── window.hpp
├── guids.txt
├── po/
│ ├── CMakeLists.txt
│ ├── bg/
│ │ ├── swish.mo
│ │ └── swish.po
│ ├── ca/
│ │ ├── swish.mo
│ │ └── swish.po
│ ├── compile_mo.sh
│ ├── cs/
│ │ ├── swish.mo
│ │ └── swish.po
│ ├── cy/
│ │ ├── swish.mo
│ │ └── swish.po
│ ├── da_DK/
│ │ ├── swish.mo
│ │ └── swish.po
│ ├── de/
│ │ ├── swish.mo
│ │ └── swish.po
│ ├── el_GR/
│ │ ├── swish.mo
│ │ └── swish.po
│ ├── es/
│ │ ├── swish.mo
│ │ └── swish.po
│ ├── et/
│ │ ├── swish.mo
│ │ └── swish.po
│ ├── fi/
│ │ ├── swish.mo
│ │ └── swish.po
│ ├── fr/
│ │ ├── swish.mo
│ │ └── swish.po
│ ├── he/
│ │ ├── swish.mo
│ │ └── swish.po
│ ├── hi/
│ │ ├── swish.mo
│ │ └── swish.po
│ ├── hu/
│ │ ├── swish.mo
│ │ └── swish.po
│ ├── it/
│ │ ├── swish.mo
│ │ └── swish.po
│ ├── ja/
│ │ ├── swish.mo
│ │ └── swish.po
│ ├── ko/
│ │ ├── swish.mo
│ │ └── swish.po
│ ├── lv/
│ │ ├── swish.mo
│ │ └── swish.po
│ ├── nl/
│ │ ├── swish.mo
│ │ └── swish.po
│ ├── pl/
│ │ ├── swish.mo
│ │ └── swish.po
│ ├── pt/
│ │ ├── swish.mo
│ │ └── swish.po
│ ├── pt_BR/
│ │ ├── swish.mo
│ │ └── swish.po
│ ├── ro/
│ │ ├── swish.mo
│ │ └── swish.po
│ ├── ru/
│ │ ├── swish.mo
│ │ └── swish.po
│ ├── sk/
│ │ ├── swish.mo
│ │ └── swish.po
│ ├── sv/
│ │ ├── swish.mo
│ │ └── swish.po
│ ├── template/
│ │ └── swish.pot
│ ├── tr/
│ │ ├── swish.mo
│ │ └── swish.po
│ ├── zh_CN/
│ │ ├── swish.mo
│ │ └── swish.po
│ └── zh_TW/
│ ├── swish.mo
│ └── swish.po
├── setup_conf.xml.in
├── ssh/
│ ├── .clang-format
│ ├── CMakeLists.txt
│ ├── agent.hpp
│ ├── detail/
│ │ ├── agent_state.hpp
│ │ ├── file_handle_state.hpp
│ │ ├── libssh2/
│ │ │ ├── agent.hpp
│ │ │ ├── knownhost.hpp
│ │ │ ├── libssh2.hpp
│ │ │ ├── session.hpp
│ │ │ ├── sftp.hpp
│ │ │ └── userauth.hpp
│ │ ├── session_state.hpp
│ │ └── sftp_channel_state.hpp
│ ├── filesystem/
│ │ └── path.hpp
│ ├── filesystem.hpp
│ ├── host_key.hpp
│ ├── knownhost.hpp
│ ├── session.hpp
│ ├── sftp_error.hpp
│ ├── ssh_error.hpp
│ └── stream.hpp
├── swish/
│ ├── CMakeLists.txt
│ ├── CoFactory.hpp
│ ├── atl.hpp
│ ├── connection/
│ │ ├── CMakeLists.txt
│ │ ├── authenticated_session.cpp
│ │ ├── authenticated_session.hpp
│ │ ├── connection.vcproj
│ │ ├── connection_spec.cpp
│ │ ├── connection_spec.hpp
│ │ ├── interruptable_session.hpp
│ │ ├── running_session.cpp
│ │ ├── running_session.hpp
│ │ ├── session_manager.cpp
│ │ ├── session_manager.hpp
│ │ ├── session_pool.cpp
│ │ └── session_pool.hpp
│ ├── debug.hpp
│ ├── drop_target/
│ │ ├── CMakeLists.txt
│ │ ├── CopyFileOperation.cpp
│ │ ├── CopyFileOperation.hpp
│ │ ├── CreateDirectoryOperation.cpp
│ │ ├── CreateDirectoryOperation.hpp
│ │ ├── DropActionCallback.hpp
│ │ ├── DropTarget.cpp
│ │ ├── DropTarget.hpp
│ │ ├── DropUI.cpp
│ │ ├── DropUI.hpp
│ │ ├── Operation.hpp
│ │ ├── PidlCopyPlan.cpp
│ │ ├── PidlCopyPlan.hpp
│ │ ├── Plan.hpp
│ │ ├── Progress.hpp
│ │ ├── RootedSource.hpp
│ │ ├── SequentialPlan.cpp
│ │ ├── SequentialPlan.hpp
│ │ └── SftpDestination.hpp
│ ├── forms/
│ │ ├── CMakeLists.txt
│ │ ├── add_host.cpp
│ │ ├── add_host.hpp
│ │ ├── password.cpp
│ │ └── password.hpp
│ ├── frontend/
│ │ ├── CMakeLists.txt
│ │ ├── UserInteraction.cpp
│ │ ├── UserInteraction.hpp
│ │ ├── announce_error.cpp
│ │ ├── announce_error.hpp
│ │ ├── bind_best_taskdialog.cpp
│ │ ├── bind_best_taskdialog.hpp
│ │ ├── commands/
│ │ │ ├── About.cpp
│ │ │ └── About.hpp
│ │ ├── winsparkle_shower.cpp
│ │ └── winsparkle_shower.hpp
│ ├── host_folder/
│ │ ├── CMakeLists.txt
│ │ ├── ViewCallback.cpp
│ │ ├── ViewCallback.hpp
│ │ ├── columns.cpp
│ │ ├── columns.hpp
│ │ ├── commands/
│ │ │ ├── Add.cpp
│ │ │ ├── Add.hpp
│ │ │ ├── CloseSession.cpp
│ │ │ ├── CloseSession.hpp
│ │ │ ├── LaunchAgent.cpp
│ │ │ ├── LaunchAgent.hpp
│ │ │ ├── Remove.cpp
│ │ │ ├── Remove.hpp
│ │ │ ├── Rename.cpp
│ │ │ ├── Rename.hpp
│ │ │ ├── commands.cpp
│ │ │ └── commands.hpp
│ │ ├── context_menu_callback.cpp
│ │ ├── context_menu_callback.hpp
│ │ ├── extract_icon.hpp
│ │ ├── host_itemid_connection.cpp
│ │ ├── host_itemid_connection.hpp
│ │ ├── host_management.cpp
│ │ ├── host_management.hpp
│ │ ├── host_pidl.hpp
│ │ ├── menu_command_manager.cpp
│ │ ├── menu_command_manager.hpp
│ │ ├── overlay_icon.hpp
│ │ ├── properties.cpp
│ │ └── properties.hpp
│ ├── nse/
│ │ ├── CMakeLists.txt
│ │ ├── Command.cpp
│ │ ├── Command.hpp
│ │ ├── StaticColumn.hpp
│ │ ├── UICommand.cpp
│ │ ├── UICommand.hpp
│ │ ├── command_site.cpp
│ │ ├── command_site.hpp
│ │ ├── data_object_util.cpp
│ │ ├── data_object_util.hpp
│ │ ├── default_context_menu_callback.cpp
│ │ ├── default_context_menu_callback.hpp
│ │ ├── detail/
│ │ │ └── command_state_conversion.hpp
│ │ ├── explorer_command.cpp
│ │ ├── explorer_command.hpp
│ │ ├── task_pane.hpp
│ │ ├── view_callback.cpp
│ │ └── view_callback.hpp
│ ├── port_conversion.hpp
│ ├── provider/
│ │ ├── CMakeLists.txt
│ │ ├── Provider.cpp
│ │ ├── Provider.hpp
│ │ ├── libssh2_sftp_filesystem_item.cpp
│ │ ├── libssh2_sftp_filesystem_item.hpp
│ │ ├── sftp_filesystem_item.hpp
│ │ ├── sftp_provider.hpp
│ │ └── ticketed_stream.hpp
│ ├── remote_folder/
│ │ ├── CMakeLists.txt
│ │ ├── Mode.cpp
│ │ ├── Mode.h
│ │ ├── ViewCallback.cpp
│ │ ├── ViewCallback.hpp
│ │ ├── columns.cpp
│ │ ├── columns.hpp
│ │ ├── commands/
│ │ │ ├── NewFolder.cpp
│ │ │ ├── NewFolder.hpp
│ │ │ ├── commands.cpp
│ │ │ ├── commands.hpp
│ │ │ ├── delete.cpp
│ │ │ └── delete.hpp
│ │ ├── context_menu_callback.cpp
│ │ ├── context_menu_callback.hpp
│ │ ├── filemode.c
│ │ ├── filemode.h
│ │ ├── pidl_connection.cpp
│ │ ├── pidl_connection.hpp
│ │ ├── properties.cpp
│ │ ├── properties.hpp
│ │ ├── remote_pidl.hpp
│ │ └── swish_pidl.hpp
│ ├── remotelimits.h
│ ├── shell/
│ │ ├── CMakeLists.txt
│ │ ├── parent_and_item.hpp
│ │ ├── shell.cpp
│ │ ├── shell.hpp
│ │ ├── shell_item.hpp
│ │ └── shell_item_array.hpp
│ ├── shell_folder/
│ │ ├── CMakeLists.txt
│ │ ├── DataObject.cpp
│ │ ├── DataObject.h
│ │ ├── Folder.h
│ │ ├── HostFolder.cpp
│ │ ├── HostFolder.h
│ │ ├── IconExtractor.cpp
│ │ ├── IconExtractor.h
│ │ ├── KbdInteractiveDialog.cpp
│ │ ├── KbdInteractiveDialog.h
│ │ ├── Pidl.h
│ │ ├── Registry.cpp
│ │ ├── Registry.h
│ │ ├── RemoteFolder.cpp
│ │ ├── RemoteFolder.h
│ │ ├── SftpDataObject.cpp
│ │ ├── SftpDataObject.h
│ │ ├── SftpDirectory.cpp
│ │ ├── SftpDirectory.h
│ │ ├── SnitchingDataObject.hpp
│ │ ├── Swish.idl
│ │ ├── SwishFolder.hpp
│ │ ├── com_dll/
│ │ │ ├── CMakeLists.txt
│ │ │ ├── HostFolder.rgs
│ │ │ ├── RemoteFolder.rgs
│ │ │ ├── Swish.rgs
│ │ │ ├── SwishCoClasses.cpp
│ │ │ ├── SwishModule.cpp
│ │ │ ├── com_dll.def
│ │ │ ├── com_dll.rc
│ │ │ └── resource.h
│ │ ├── data_object/
│ │ │ ├── FileGroupDescriptor.hpp
│ │ │ ├── GlobalLocker.hpp
│ │ │ ├── ShellDataObject.cpp
│ │ │ ├── ShellDataObject.hpp
│ │ │ └── StorageMedium.hpp
│ │ ├── locale_setup.hpp
│ │ ├── resource.h
│ │ ├── shell_folder.rc
│ │ └── wtl.hpp
│ ├── trace.hpp
│ ├── utils.hpp
│ ├── versions/
│ │ ├── CMakeLists.txt
│ │ ├── git_version.h.in
│ │ ├── metadata.h.in
│ │ ├── version.cpp
│ │ └── version.hpp
│ └── windows_api.hpp
├── test/
│ ├── CMakeLists.txt
│ ├── common_boost/
│ │ ├── CMakeLists.txt
│ │ ├── ConsumerStub.hpp
│ │ ├── MockConsumer.hpp
│ │ ├── MockProvider.hpp
│ │ ├── SwishPidlFixture.hpp
│ │ ├── data_object_utils.cpp
│ │ ├── data_object_utils.hpp
│ │ ├── fixtures.hpp
│ │ ├── helpers.hpp
│ │ ├── stream_utils.cpp
│ │ ├── stream_utils.hpp
│ │ ├── tree.hh
│ │ └── tree.hpp
│ ├── connection/
│ │ ├── CMakeLists.txt
│ │ ├── authenticated_session_test.cpp
│ │ ├── connection_spec_create_session_test.cpp
│ │ ├── connection_spec_test.cpp
│ │ ├── running_session_test.cpp
│ │ ├── session_manager_test.cpp
│ │ └── session_pool_test.cpp
│ ├── drop_target/
│ │ ├── CMakeLists.txt
│ │ ├── drop_target_test.cpp
│ │ └── rooted_source_test.cpp
│ ├── ezel/
│ │ ├── CMakeLists.txt
│ │ └── form_test.cpp
│ ├── fix_key_permissions.sh
│ ├── fixtures/
│ │ ├── CMakeLists.txt
│ │ ├── com_stream_fixture.cpp
│ │ ├── com_stream_fixture.hpp
│ │ ├── fixture_dsakey
│ │ ├── fixture_dsakey.pub
│ │ ├── fixture_hostkey
│ │ ├── fixture_hostkey.pub
│ │ ├── fixture_rsakey
│ │ ├── fixture_rsakey.pub
│ │ ├── fixture_wrong_dsakey
│ │ ├── fixture_wrong_dsakey.pub
│ │ ├── local_sandbox_fixture.cpp
│ │ ├── local_sandbox_fixture.hpp
│ │ ├── openssh_fixture.cpp
│ │ ├── openssh_fixture.hpp
│ │ ├── provider_fixture.cpp
│ │ ├── provider_fixture.hpp
│ │ ├── session_fixture.cpp
│ │ ├── session_fixture.hpp
│ │ ├── sftp_fixture.cpp
│ │ ├── sftp_fixture.hpp
│ │ ├── ssh_server/
│ │ │ ├── Dockerfile
│ │ │ ├── authorized_keys
│ │ │ └── ssh_host_rsa_key
│ │ ├── test_known_hosts
│ │ ├── test_known_hosts_hashed
│ │ └── test_known_hosts_out
│ ├── forms/
│ │ ├── CMakeLists.txt
│ │ ├── add_host_test.cpp
│ │ └── password_test.cpp
│ ├── host_folder/
│ │ ├── CMakeLists.txt
│ │ ├── columns_test.cpp
│ │ ├── host_management_test.cpp
│ │ ├── host_pidl_test.cpp
│ │ ├── properties_test.cpp
│ │ └── view_callback_test.cpp
│ ├── module.cpp.in
│ ├── nse/
│ │ ├── CMakeLists.txt
│ │ ├── default_context_menu_callback_tests.cpp
│ │ └── explorer_command_tests.cpp
│ ├── provider-integration/
│ │ ├── CMakeLists.txt
│ │ ├── auth_test.cpp
│ │ ├── provider_test.cpp
│ │ ├── stream_create_test.cpp
│ │ ├── stream_read_test.cpp
│ │ ├── stream_test.cpp
│ │ └── stream_write_test.cpp
│ ├── remote_folder/
│ │ ├── CMakeLists.txt
│ │ ├── columns_test.cpp
│ │ ├── properties_test.cpp
│ │ ├── remote_commands_test.cpp
│ │ ├── remote_pidl_test.cpp
│ │ └── swish_pidl_test.cpp
│ ├── shell/
│ │ ├── CMakeLists.txt
│ │ └── shell_test.cpp
│ ├── shell_folder/
│ │ ├── CMakeLists.txt
│ │ ├── atl.cpp
│ │ ├── data_object_test.cpp
│ │ ├── exercise_data_object.h
│ │ ├── file_group_descriptor_test.cpp
│ │ ├── global_lock_test.cpp
│ │ ├── remote_folder_test.cpp
│ │ ├── sftp_data_object_nasty_old_test.cpp
│ │ ├── sftp_data_object_test.cpp
│ │ ├── sftp_directory_test.cpp
│ │ ├── shell_data_object_test.cpp
│ │ └── utils_test.cpp
│ ├── shell_folder-com_dll/
│ │ ├── CMakeLists.txt
│ │ ├── CppUnitExtensions.h
│ │ ├── HostFolder_test.cpp
│ │ ├── Module.cpp
│ │ ├── RemoteFolder_test.cpp
│ │ ├── main.cpp
│ │ ├── pidl.cpp
│ │ └── pidl.hpp
│ ├── shell_folder-dialogue/
│ │ ├── CMakeLists.txt
│ │ └── KbdInteractiveDialog_test.cpp
│ ├── ssh/
│ │ ├── CMakeLists.txt
│ │ ├── auth_test.cpp
│ │ ├── filesystem_construction_test.cpp
│ │ ├── filesystem_test.cpp
│ │ ├── fixture_dsakey
│ │ ├── fixture_dsakey.pub
│ │ ├── fixture_hostkey
│ │ ├── fixture_hostkey.pub
│ │ ├── fixture_rsakey
│ │ ├── fixture_rsakey.pub
│ │ ├── fixture_wrong_dsakey
│ │ ├── fixture_wrong_dsakey.pub
│ │ ├── host_key_test.cpp
│ │ ├── input_stream_test.cpp
│ │ ├── io_stream_test.cpp
│ │ ├── knownhost_test.cpp
│ │ ├── module.cpp
│ │ ├── openssh_fixture.cpp
│ │ ├── openssh_fixture.hpp
│ │ ├── output_stream_test.cpp
│ │ ├── path_test.cpp
│ │ ├── session_fixture.cpp
│ │ ├── session_fixture.hpp
│ │ ├── session_test.cpp
│ │ ├── sftp_fixture.cpp
│ │ ├── sftp_fixture.hpp
│ │ ├── ssh_server/
│ │ │ ├── Dockerfile
│ │ │ ├── authorized_keys
│ │ │ └── ssh_host_rsa_key
│ │ ├── stream_threading_test.cpp
│ │ ├── test_known_hosts
│ │ ├── test_known_hosts_hashed
│ │ └── test_known_hosts_out
│ └── versions/
│ ├── CMakeLists.txt
│ └── version_test.cpp
└── thirdparty/
└── taskdialog98/
├── TaskDialog.h
├── TaskDialogTest.cpp
├── TaskDialogTest.dsp
├── TaskDialogTest.dsw
├── TaskDialogTest.h
├── TaskDialogTest.rc
├── icons.h
├── maindlg.h
├── res/
│ ├── TaskDialogTest.exe.manifest
│ └── make_icons_include.bat
├── resource.h
├── stdafx.cpp
└── stdafx.h
================================================
FILE CONTENTS
================================================
================================================
FILE: .clang-format
================================================
---
AccessModifierOffset: '-4'
AllowShortFunctionsOnASingleLine: Empty
AlwaysBreakTemplateDeclarations: 'true'
BreakBeforeBraces: Allman
ColumnLimit: '80'
ConstructorInitializerAllOnOneLineOrOnePerLine: 'true'
ForEachMacros: [ foreach, BOOST_FOREACH ]
IndentWidth: '4'
MacroBlockBegin: "^[A-Z_]+_BEGIN$"
MacroBlockEnd: "^[A-Z_]+_END(?)?$"
MaxEmptyLinesToKeep: '1'
NamespaceIndentation: None
PointerAlignment: Left
SpaceAfterControlStatementKeyword: true
SpaceBeforeAssignmentOperators: true
SpacesInAngles: false
SpacesInParentheses: false
UseTab: Never
...
================================================
FILE: .gitattributes
================================================
*.sh crlf=input
================================================
FILE: .tx/config
================================================
[main]
host = https://www.transifex.com
[swish.swish]
file_filter = po\\swish.po
source_file = po\template\swish.pot
source_lang = en_GB
type = PO
================================================
FILE: CMakeLists.txt
================================================
# Copyright (C) 2015 Alexander Lamaison
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
# Street, Fifth Floor, Boston, MA 02110-1301 USA.
cmake_minimum_required(VERSION 3.1)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
# Package management ###########################################################
include(HunterGate)
HunterGate(
URL "https://github.com/alamaison/hunter/archive/ee83a15960b5d74098d8704bc9cf82ad8ec1734f.tar.gz"
SHA1 "d02301fee68f00198e7941129da446f80189017e"
LOCAL
)
################################################################################
project(swish VERSION 0.8.3)
set(SWISH_FRIENDLY_NAME "Swish")
set(SWISH_VENDOR "swish-sftp.org")
set(SWISH_DESCRIPTION "Easy SFTP for Windows Explorer")
set(SWISH_COPYRIGHT "Copyright (C) 2006-2015 Alexander Lamaison and contributors")
#include(max_warnings)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/taskdialog98)
# Prevent Winsock errors and gives quicker builds
add_definitions(-DWIN32_LEAN_AND_MEAN)
# Silence bogus MSVC warnings
add_definitions(-D_SCL_SECURE_NO_WARNINGS)
# Currently required because not all Win32 calls use A or W form explicitly
add_definitions(-DUNICODE -D_UNICODE)
hunter_add_package(Boost
COMPONENTS filesystem system test date_time regex signals locale)
set(Boost_USE_STATIC_LIBS ON)
find_package(Boost 1.49 REQUIRED
COMPONENTS filesystem date_time system regex signals thread locale)
if(MSVC)
add_definitions(-DBOOST_ALL_NO_LIB=1)
endif()
include_directories(${Boost_INCLUDE_DIRS})
add_subdirectory(ezel)
add_subdirectory(ssh)
add_subdirectory(swish)
add_subdirectory(po)
option(BUILD_TESTING "Build test suite" ON)
if(BUILD_TESTING)
enable_testing()
add_subdirectory(test)
endif()
set(INSTALLER_URL
"https://sourceforge.net/projects/swish/files/swish/swish-${swish_VERSION}/swish-${swish_VERSION}.exe")
string(TIMESTAMP PUBLICATION_DATE UTC)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/appcast.xml.in
${CMAKE_CURRENT_BINARY_DIR}/appcast.xml
@ONLY)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/setup_conf.xml.in
${CMAKE_CURRENT_BINARY_DIR}/setup_conf.xml
@ONLY)
file(DOWNLOAD "http://the.earth.li/~sgtatham/putty/0.64/x86/pageant.exe"
"${CMAKE_CURRENT_BINARY_DIR}/pageant.exe"
SHOW_PROGRESS
EXPECTED_HASH SHA1=4f7ec7e53b7dd557603c2447fd177d85f14006ad)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/pageant.exe" NEWS LICENSE.txt README.md
DESTINATION .)
include(InstallRequiredSystemLibraries)
set(CPACK_GENERATOR WIX)
set(CPACK_PACKAGE_NAME "${SWISH_FRIENDLY_NAME}")
set(CPACK_PACKAGE_VENDOR "${SWISH_VENDOR}")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${SWISH_DESCRIPTION}")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt")
set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
set(CPACK_WIX_UPGRADE_GUID "97CF376F-FFDE-472A-946B-E3F5D45229DA")
set(CPACK_WIX_PATCH_FILE "${CMAKE_CURRENT_SOURCE_DIR}/cpack_wix_patch.xml")
set(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "${SWISH_FRIENDLY_NAME}")
set(CMAKE_WIX_PROPERTY_ARPCONTACT swish@lammy.co.uk)
set(CMAKE_WIX_PROPERTY_ARPHELPLINK http://www.swish-sftp.org)
set(CMAKE_WIX_PROPERTY_ARPURLINFOABOUT http://www.swish-sftp.org)
set(CMAKE_WIX_PROPERTY_ARPURLUPDATEINFO http://sourceforge.net/projects/swish/)
#set(CPACK_WIX_UI_REF WixUI_Minimal)
include(CPack)
================================================
FILE: COPYING.rtf
================================================
{\rtf1\ansi\ansicpg1252\deff0{\fonttbl{\f0\fmodern\fprq1\fcharset0 Courier New;}}
{\colortbl ;\red0\green0\blue0;}
{\*\generator Msftedit 5.41.15.1507;}\viewkind4\uc1\pard\cf1\lang2057\f0\fs18\tab\tab GNU GENERAL PUBLIC LICENSE\par
\tab\tab Version 2, June 1991\par
\par
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,\par
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\par
Everyone is permitted to copy and distribute verbatim copies\par
of this license document, but changing it is not allowed.\par
\par
\tab\tab\tab Preamble\par
\par
The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too.\par
\par
When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.\par
\par
To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.\par
\par
For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.\par
\par
We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.\par
\par
Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations.\par
\par
Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.\par
\par
The precise terms and conditions for copying, distribution and modification follow. \par
\par
\tab\tab GNU GENERAL PUBLIC LICENSE\par
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION\par
\par
0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you".\par
\par
Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.\par
\par
1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.\par
\par
You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.\par
\par
2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:\par
\par
a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. \par
b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. \par
c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) \par
\par
These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.\par
\par
Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.\par
\par
In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.\par
\par
3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:\par
\par
a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, \par
b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, \par
c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) \par
\par
The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.\par
\par
If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.\par
\par
4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.\par
\par
5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.\par
\par
6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.\par
\par
7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.\par
\par
If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.\par
\par
It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.\par
\par
This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.\par
\par
8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.\par
\par
9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.\par
\par
Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.\par
\par
10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. \par
\par
\tab\tab\tab NO WARRANTY\par
\par
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.\par
\par
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. \par
\par
\tab\tab END OF TERMS AND CONDITIONS\par
\par
\tab How to Apply These Terms to Your New Programs\par
\par
If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.\par
\par
To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. \par
\par
\par
Copyright (C) \par
\par
This program is free software; you can redistribute it and/or modify\par
it under the terms of the GNU General Public License as published by\par
the Free Software Foundation; either version 2 of the License, or\par
(at your option) any later version.\par
\par
This program is distributed in the hope that it will be useful,\par
but WITHOUT ANY WARRANTY; without even the implied warranty of\par
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\par
GNU General Public License for more details.\par
\par
You should have received a copy of the GNU General Public License along\par
with this program; if not, write to the Free Software Foundation, Inc.,\par
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\par
\par
Also add information on how to contact you by electronic and paper mail.\par
\par
If the program is interactive, make it output a short notice like this when it starts in an interactive mode: \par
\par
Gnomovision version 69, Copyright (C) year name of author\par
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\par
This is free software, and you are welcome to redistribute it\par
under certain conditions; type `show c' for details.\par
\par
The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program.\par
\par
You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: \par
\par
Yoyodyne, Inc., hereby disclaims all copyright interest in the program\par
`Gnomovision' (which makes passes at compilers) written by James Hacker.\par
\par
, 1 April 1989\par
Ty Coon, President of Vice\par
\par
This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License.\par
\par
}
================================================
FILE: LICENSE.txt
================================================
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
Copyright (C)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.
================================================
FILE: NEWS
================================================
swish-0.8.2
-Fixed error when known_hosts contained unrecognised key types.
swish-0.8.1
-Fix crash in 32-bit version when showing dialogues.
-Updated OpenSSL to 1.0.0l.
-Updated Hebrew translation.
swish-0.8.0
-Added option to log out of server manually.
-Fix file extension behaviour to match Windows folder options.
-Fixed bug where timestamps were adjusted to local time twice.
-New Latvian and Catalan translations.
-Updated Hungarian, Japanese and Portuguese translations.
swish-0.7.4
-Restored copy progress bar which had disappeared in 0.7.2.
-Updated Welsh translation.
swish-0.7.3
-Fixed drag-and-drop crash on Windows 8.
-Fixed timestamps so they are in user's timezone.
-New Romanian translation.
-Updated Korean translation.
swish-0.7.2
-Added direct downloading and installation of updates.
-More detailed error messages.
-Fixed bug with non-ASCII characters in usernames and passwords.
-New Welsh, Danish, Greek, Estonian, Finnish and Korean translations.
-Updated Bulgarian, Czech, German, Spanish, French, Hebrew, Italian, Japanese,
Dutch, Polish, Russian, Swedish and Chinese (Simplified) translations.
swish-0.7.0
-Added support for public key authentication through Pageant key agent.
-Updated Czech, Spanish, Japanese, Dutch and Portuguese (Brazil) translations.
swish-0.6.3
-Fixed errors with Windows 8.
-Disabled compression to support a greater range of SSH servers.
-Updated German, Italian, Japanese, Portuguese (Brazil), Chinese (Simplified),
Chinese (Traditional) and French translations.
swish-0.6.2
-Fixed performance problems with small files.
-Fixed bug causing ZIP files to be unpacked as the were copied.
-New Brazilian Portuguese translation.
-Updated Dutch, German, Chinese (Simplified), Italian and Portuguese
translations.
swish-0.6.1
-Significant speed improvement.
-Installer supports Windows 8.
-Better error reporting when copying to a remote server.
-Fixed bug where renaming a folder did not change the name displayed.
-Fixed bug where files did not appear after copying to remote server.
-Hindi, Bulgarian, Portuguese, Swedish and Chinese (Simplified) translations.
swish-0.6.0
-Added double-click file opening.
-Downgraded to libssh2 1.2.7 to fix incomplete file transfers.
swish-0.5.4
-Added support for symlinks.
-Display error message if drag-and-drop fails.
-Japanese, Polish, Slovak, Hungarian and Chinese translations.
swish-0.4.6
-Fixed major installer problem which broke all new installations as it failed
to register an interface.
-Fixed problem that left assertion checks in release builds.
swish-0.4.5
-Added ability to create new folders.
-Added auto-updater.
-More useful error messages.
-Better error dialogues.
-Fixed pasting files to the server. This may have been broken for a long time!
-Fixed problem with port numbers above 999 in some locales.
-Fixed bug where pressing Cancel showed an error message.
-Fixed bug causing Explorer Window to flash when navigating between folders.
-Italian translation.
swish-0.4.4
-64-bit support.
-Windows XP 'webtask' pane.
-Hebrew, Czech, Spanish, French and Turkish translations.
swish-0.4.2
-Explicitly prevent 64-bit installation.
-Fix bug where sessions couldn't be restored until Explorer restarted.
-Fix bug with non-ASCII Windows usernames.
swish-0.4.1
-Write speeds 4x faster.
-Huge reduction in GUI memory usage.
-Confirmation before overwriting existing files.
-Improved write progress indicator.
-Better error reporting.
-Fix bug where 'Remove' option missing from host menu.
-German translation.
swish-0.4.0
-Full support for files and directories with non-Latin Unicode names.
swish-0.3.5
-Display Unicode filenames.
swish-0.3.4
-Fixed hostname resolution for Windows versions earlier than Vista
swish-0.3.3
-IPv6 support.
-Window 7 fixes.
-Fix overwriting larger file with smaller one.
-Error messages when negotiating a connection fails.
-Support for most characters (e.g. @) in user names.
swish-0.3.2.0
-Internationalisation (English, Dutch, Russian)
swish-0.3.1.0
-Added host-key verification.
-New WIX-based installer
swish-0.3.0.1
-Added command buttons to add and remove hosts (Windows Vista and above).
-Allow the user to cancel a file transfer mid-file rather than only between
files.
-Fix bug where password dialogues appear behind the Explorer window.
-Fix missing menu options bug in Windows 98.
swish-0.3.0.0
-Full drag-and-drop support in Windows XP and above. Drag-and-drop files and
folders to and from the remote server.
swish-0.2.1.13
-Enable removal of hosts from Swish folder.
swish-0.2.1.12
-Added 'Type' property to Explorer view.
-Fixed incorrect column witdths (ticket #2).
-Display user name and group name rather than the UID and GID.
-Added 'Owner ID' and 'Group ID' columns to Explorer view to display the
numerical UID and GID.
-Added 'Date Accessed' column to Explorer view.
swish-0.2.1.11
-Read-only file transfer support added. Files and folders can be copied from a
remote server to the local computer using cut&paste or drag&drop.
swish-0.2.1.10
-Now supports Windows Vista.
swish-0.2.1.9
-Added support for the keyboard-interactive authentication scheme:
(http://www.ietf.org/rfc/rfc4256.txt).
-Improved robustness of the low-level backend session handling in the face
of errors.
swish-0.2.1.8
-Fixed bug when overwriting existing directories.
swish-0.2.1.7
-Files and folders can be renamed. If an item with the chosen name already
exists, we offer to overwrite it. Due to the limitations of SFTP versions 4
and below, we do this non-atomically which is not ideal. Time will tell
whether this is more trouble than it's worth.
swish-0.2.1.6
-Files and folders can be deleted from the Explorer window. If a directory
contains other items, we deleted these recursively using separate calls to the
server. This is a bit clunky but we are limited by what SFTP supports.
swish-0.2.1.5
-SFTP sessions (connections) are now pooled in the COM ROT so that subsequent
requests can reuse them without prompting the user for a password or having to
renegotiate with the server.
swish-0.2.1.4
-Replace the PuTTY-based dataprovider component with one based in libssh2. This
is vastly more stable. The new backend has all the abilities of the of the
old one with a few exceptions, namely, host-verification (aka known_hosts),
key-interactive authentication and public-key authentication. Replacing these
is a priority.
-The frontend has been integrate much more closely with Explorer.
-Connections are added with a dialog invoked from the Tools menu and are stored
in the registry.
-Explorer displays the default icon for files based on their extension (this
doesn't work in Windows 98 yet).
-Subfolder can be navigated.
-The default explorer context menu is displayed when right-clicking a file.
swish-0.2.1
-Created a data provider component to wrap PuTTY's SFTP client (psftp.exe)
permitting listing of files in a directory
-Linked data provider to front end using simple dialog box for requesting
host information from the user
swish-0.2
-All previous prototype code discarded
-Created Explorer namespace extension with window explorer window showing
three dummy host connection items
-Used SHCreateShellFolderView to create default shell view window giving
best possible Explorer integration
-Created PIDL Manager to handle host (connection) folder item
-Added conection item details to Details and Tiles view
-Created Remote Folder displaying dummy file listing which is displayed by
double-clicking (or otherwise opening) host connection in initial folder
swish-0.1.1
-Experimentation with Visual Studio and linking with gcc-compiled libssh
swish-0.1-gcc
-Experimentation using gcc, wxWidgets and libssh-0.11
================================================
FILE: README.md
================================================
Swish
=====
What is Swish?
--------------
Swish is a plugin for Microsoft Windows Explorer that adds support for SFTP.
If you've used Explorer's built-in FTP support, Swish is that but for SFTP
over SSH.
Supported Operating Systems
---------------------------
* Windows 8 (most tested)
* Windows 7 (occasionally tested)
* Windows Vista (rarely tested)
Swish may also work on Windows XP, but we haven't tested that in a while.
Binaries
--------
Binary installers are [on our website](http://www.swish-sftp.org).
Getting involved
----------------
We welcome patches to help improve Swish.
Swish fetches almost all its dependencies when you configure it with [CMake].
That magic happens thanks to the [Hunter package manager]. However, you will
need Perl installed. [Strawberry Perl] is good, and available on [Chocolatey].
You'll also need a compiler (obviously), a recent version of the Windows SDK
and CMake.
[CMake]: https://cmake.org/
[Hunter package manager]: https://github.com/ruslo/hunter/
[Strawberry Perl]: http://strawberryperl.com/
[Chocolatey]: https://chocolatey.org/packages/StrawberryPerl
Licensing
---------
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or (at
your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
If you modify this Program, or any covered work, by linking or
combining it with the OpenSSL project's OpenSSL library (or a modified
version of that library), containing parts covered by the terms of the
OpenSSL or SSLeay licenses, the licensors of this Program grant you
additional permission to convey the resulting work.
### Why have an exception for OpenSSL?
The [OpenSSL] library is incompatible with the GPL license because it
contains an advertising clause. However lots of useful, open source
software (including our own projects) need to use it and currently the
alternatives aren't quite up to scratch. As we want these projects to
be able to reuse Washer, we have added this exception to the GPL - a
common technique used by other projects such as [wget].
If [GnuTLS] improves to the point where OpenSSL is no longer
necessary, we may remove this exception.
[OpenSSL]: http://www.openssl.org/
[wget]: http://www.gnu.org/software/wget/
[GnuTLS]: http://www.gnu.org/software/gnutls/
================================================
FILE: appcast.xml.in
================================================
Swish updates
http://www.swish-sftp.org/autoupdate/appcast.xml
Appcast for Swish updates.enVersion @swish_VERSION@
http://www.swish-sftp.org/autoupdate/NEWS-@swish_VERSION@.html
@PUBLICATION_DATE@
================================================
FILE: build/making_a_release.txt
================================================
Update version number in:
- top-level CMakeLists.txt
- wix/swish.wxs
- wix/wix.wixproj
Add notable changes to NEWS.
Make sure .po files are compiled to .mo files (po/compile_mo.sh).
To build the final multi-architecture EXE, run this command in the top level:
"C:\Program Files (x86)\dotNetInstaller\bin\InstallerLinker.exe" /Output:swish.exe /Template:"C:\Program Files (x86)\dotNetInstaller\bin\dotNetInstaller.exe" /Configuration:setup_conf.xml
Add version to Trac.
================================================
FILE: build/news_html.py
================================================
"""Convert Swish NEWS file to HTML.
"""
_NEWS = '../NEWS'
_VERSIONED_NEWS = '../NEWS-%s.html'
def main():
with open(_NEWS, 'r') as news_in:
html = ('''
%s
''') % read_news(news_in, 1)
with open(_NEWS, 'r') as news_in:
version = extract_version(news_in)
with open(_VERSIONED_NEWS % version, 'w') as html_open:
html_open.write(html)
def extract_version(news):
return news.readline().strip('\n\r').replace('swish-', '')
def read_news(news, indent):
entry_html = '''
%s
%s
'''
html = []
while True:
entry = read_entry(news)
if not entry:
break
lines = []
for item in entry['items']:
lines.append(create_list_item(item, indent + 1))
html.append(entry_html % (entry['heading'], '\n'.join(lines)))
return '\n'.join(html)
def create_list_item(item, indent):
return '%s
%s
' % (('\t' * indent), item)
def read_entry(news):
entry = { 'heading' : news.readline().strip(), 'items' : [] }
while True:
line = news.readline().strip('\n\r')
print line
if not line:
break
if line[0] == ' ':
entry['items'][-1] += line
continue
if line[0] != '-':
raise Exception('Incorrect format: %s' % line)
entry['items'].append(line[1:])
if not entry['heading']:
return None
return entry
if __name__ == '__main__':
main()
================================================
FILE: cmake/GetGitRevisionDescription.cmake
================================================
# - Returns a version string from Git
#
# These functions force a re-configure on each git commit so that you can
# trust the values of the variables in your build system.
#
# get_git_head_revision( [ ...])
#
# Returns the refspec and sha hash of the current head revision
#
# git_describe( [ ...])
#
# Returns the results of git describe on the source tree, and adjusting
# the output so that it tests false if an error occurs.
#
# git_get_exact_tag( [ ...])
#
# Returns the results of git describe --exact-match on the source tree,
# and adjusting the output so that it tests false if there was no exact
# matching tag.
#
# Requires CMake 2.6 or newer (uses the 'function' command)
#
# Original Author:
# 2009-2010 Ryan Pavlik
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2010.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
if(__get_git_revision_description)
return()
endif()
set(__get_git_revision_description YES)
# We must run the following at "include" time, not at function call time,
# to find the path to this module rather than the path to a calling list file
get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH)
function(get_git_head_revision _refspecvar _hashvar)
set(GIT_PARENT_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
set(GIT_DIR "${GIT_PARENT_DIR}/.git")
while(NOT EXISTS "${GIT_DIR}") # .git dir not found, search parent directories
set(GIT_PREVIOUS_PARENT "${GIT_PARENT_DIR}")
get_filename_component(GIT_PARENT_DIR ${GIT_PARENT_DIR} PATH)
if(GIT_PARENT_DIR STREQUAL GIT_PREVIOUS_PARENT)
# We have reached the root directory, we are not in git
set(${_refspecvar} "GITDIR-NOTFOUND" PARENT_SCOPE)
set(${_hashvar} "GITDIR-NOTFOUND" PARENT_SCOPE)
return()
endif()
set(GIT_DIR "${GIT_PARENT_DIR}/.git")
endwhile()
# check if this is a submodule
if(NOT IS_DIRECTORY ${GIT_DIR})
file(READ ${GIT_DIR} submodule)
string(REGEX REPLACE "gitdir: (.*)\n$" "\\1" GIT_DIR_RELATIVE ${submodule})
get_filename_component(SUBMODULE_DIR ${GIT_DIR} PATH)
get_filename_component(GIT_DIR ${SUBMODULE_DIR}/${GIT_DIR_RELATIVE} ABSOLUTE)
endif()
set(GIT_DATA "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/git-data")
if(NOT EXISTS "${GIT_DATA}")
file(MAKE_DIRECTORY "${GIT_DATA}")
endif()
if(NOT EXISTS "${GIT_DIR}/HEAD")
return()
endif()
set(HEAD_FILE "${GIT_DATA}/HEAD")
configure_file("${GIT_DIR}/HEAD" "${HEAD_FILE}" COPYONLY)
configure_file("${_gitdescmoddir}/GetGitRevisionDescription.cmake.in"
"${GIT_DATA}/grabRef.cmake"
@ONLY)
include("${GIT_DATA}/grabRef.cmake")
set(${_refspecvar} "${HEAD_REF}" PARENT_SCOPE)
set(${_hashvar} "${HEAD_HASH}" PARENT_SCOPE)
endfunction()
function(git_describe _var)
if(NOT GIT_FOUND)
find_package(Git QUIET)
endif()
get_git_head_revision(refspec hash)
if(NOT GIT_FOUND)
set(${_var} "GIT-NOTFOUND" PARENT_SCOPE)
return()
endif()
if(NOT hash)
set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE)
return()
endif()
# TODO sanitize
#if((${ARGN}" MATCHES "&&") OR
# (ARGN MATCHES "||") OR
# (ARGN MATCHES "\\;"))
# message("Please report the following error to the project!")
# message(FATAL_ERROR "Looks like someone's doing something nefarious with git_describe! Passed arguments ${ARGN}")
#endif()
#message(STATUS "Arguments to execute_process: ${ARGN}")
execute_process(COMMAND
"${GIT_EXECUTABLE}"
describe
${hash}
${ARGN}
WORKING_DIRECTORY
"${CMAKE_CURRENT_SOURCE_DIR}"
RESULT_VARIABLE
res
OUTPUT_VARIABLE
out
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT res EQUAL 0)
set(out "${out}-${res}-NOTFOUND")
endif()
set(${_var} "${out}" PARENT_SCOPE)
endfunction()
function(git_get_exact_tag _var)
git_describe(out --exact-match ${ARGN})
set(${_var} "${out}" PARENT_SCOPE)
endfunction()
================================================
FILE: cmake/GetGitRevisionDescription.cmake.in
================================================
#
# Internal file for GetGitRevisionDescription.cmake
#
# Requires CMake 2.6 or newer (uses the 'function' command)
#
# Original Author:
# 2009-2010 Ryan Pavlik
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2010.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
set(HEAD_HASH)
file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024)
string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS)
if(HEAD_CONTENTS MATCHES "ref")
# named branch
string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}")
if(EXISTS "@GIT_DIR@/${HEAD_REF}")
configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY)
else()
configure_file("@GIT_DIR@/packed-refs" "@GIT_DATA@/packed-refs" COPYONLY)
file(READ "@GIT_DATA@/packed-refs" PACKED_REFS)
if(${PACKED_REFS} MATCHES "([0-9a-z]*) ${HEAD_REF}")
set(HEAD_HASH "${CMAKE_MATCH_1}")
endif()
endif()
else()
# detached HEAD
configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY)
endif()
if(NOT HEAD_HASH)
file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024)
string(STRIP "${HEAD_HASH}" HEAD_HASH)
endif()
================================================
FILE: cmake/Hunter/config.cmake
================================================
hunter_config(Boost VERSION 1.49.0)
================================================
FILE: cmake/HunterGate.cmake
================================================
# Copyright (c) 2013-2015, Ruslan Baratov
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# This is a gate file to Hunter package manager.
# Include this file using `include` command and add package you need, example:
#
# cmake_minimum_required(VERSION 3.0)
#
# include("cmake/HunterGate.cmake")
# HunterGate(
# URL "https://github.com/path/to/hunter/archive.tar.gz"
# SHA1 "798501e983f14b28b10cda16afa4de69eee1da1d"
# )
#
# project(MyProject)
#
# hunter_add_package(Foo)
# hunter_add_package(Boo COMPONENTS Bar Baz)
#
# Projects:
# * https://github.com/hunter-packages/gate/
# * https://github.com/ruslo/hunter
cmake_minimum_required(VERSION 3.0) # Minimum for Hunter
include(CMakeParseArguments) # cmake_parse_arguments
option(HUNTER_ENABLED "Enable Hunter package manager support" ON)
option(HUNTER_STATUS_PRINT "Print working status" ON)
option(HUNTER_STATUS_DEBUG "Print a lot info" OFF)
set(HUNTER_WIKI "https://github.com/ruslo/hunter/wiki")
function(hunter_gate_status_print)
foreach(print_message ${ARGV})
if(HUNTER_STATUS_PRINT OR HUNTER_STATUS_DEBUG)
message(STATUS "[hunter] ${print_message}")
endif()
endforeach()
endfunction()
function(hunter_gate_status_debug)
foreach(print_message ${ARGV})
if(HUNTER_STATUS_DEBUG)
string(TIMESTAMP timestamp)
message(STATUS "[hunter *** DEBUG *** ${timestamp}] ${print_message}")
endif()
endforeach()
endfunction()
function(hunter_gate_wiki wiki_page)
message("------------------------------ WIKI -------------------------------")
message(" ${HUNTER_WIKI}/${wiki_page}")
message("-------------------------------------------------------------------")
message("")
message(FATAL_ERROR "")
endfunction()
function(hunter_gate_internal_error)
message("")
foreach(print_message ${ARGV})
message("[hunter ** INTERNAL **] ${print_message}")
endforeach()
message("[hunter ** INTERNAL **] [Directory:${CMAKE_CURRENT_LIST_DIR}]")
message("")
hunter_gate_wiki("error.internal")
endfunction()
function(hunter_gate_fatal_error)
cmake_parse_arguments(hunter "" "WIKI" "" "${ARGV}")
string(COMPARE EQUAL "${hunter_WIKI}" "" have_no_wiki)
if(have_no_wiki)
hunter_gate_internal_error("Expected wiki")
endif()
message("")
foreach(x ${hunter_UNPARSED_ARGUMENTS})
message("[hunter ** FATAL ERROR **] ${x}")
endforeach()
message("[hunter ** FATAL ERROR **] [Directory:${CMAKE_CURRENT_LIST_DIR}]")
message("")
hunter_gate_wiki("${hunter_WIKI}")
endfunction()
function(hunter_gate_user_error)
hunter_gate_fatal_error(${ARGV} WIKI "error.incorrect.input.data")
endfunction()
function(hunter_gate_self root version sha1 result)
string(COMPARE EQUAL "${root}" "" is_bad)
if(is_bad)
hunter_gate_internal_error("root is empty")
endif()
string(COMPARE EQUAL "${version}" "" is_bad)
if(is_bad)
hunter_gate_internal_error("version is empty")
endif()
string(COMPARE EQUAL "${sha1}" "" is_bad)
if(is_bad)
hunter_gate_internal_error("sha1 is empty")
endif()
string(SUBSTRING "${sha1}" 0 7 archive_id)
if(EXISTS "${root}/cmake/Hunter")
set(hunter_self "${root}")
else()
set(
hunter_self
"${root}/_Base/Download/Hunter/${version}/${archive_id}/Unpacked"
)
endif()
set("${result}" "${hunter_self}" PARENT_SCOPE)
endfunction()
# Set HUNTER_GATE_ROOT cmake variable to suitable value.
function(hunter_gate_detect_root)
# Check CMake variable
string(COMPARE NOTEQUAL "${HUNTER_ROOT}" "" not_empty)
if(not_empty)
set(HUNTER_GATE_ROOT "${HUNTER_ROOT}" PARENT_SCOPE)
hunter_gate_status_debug("HUNTER_ROOT detected by cmake variable")
return()
endif()
# Check environment variable
string(COMPARE NOTEQUAL "$ENV{HUNTER_ROOT}" "" not_empty)
if(not_empty)
set(HUNTER_GATE_ROOT "$ENV{HUNTER_ROOT}" PARENT_SCOPE)
hunter_gate_status_debug("HUNTER_ROOT detected by environment variable")
return()
endif()
# Check HOME environment variable
string(COMPARE NOTEQUAL "$ENV{HOME}" "" result)
if(result)
set(HUNTER_GATE_ROOT "$ENV{HOME}/.hunter" PARENT_SCOPE)
hunter_gate_status_debug("HUNTER_ROOT set using HOME environment variable")
return()
endif()
# Check SYSTEMDRIVE and USERPROFILE environment variable (windows only)
if(WIN32)
string(COMPARE NOTEQUAL "$ENV{SYSTEMDRIVE}" "" result)
if(result)
set(HUNTER_GATE_ROOT "$ENV{SYSTEMDRIVE}/.hunter" PARENT_SCOPE)
hunter_gate_status_debug(
"HUNTER_ROOT set using SYSTEMDRIVE environment variable"
)
return()
endif()
string(COMPARE NOTEQUAL "$ENV{USERPROFILE}" "" result)
if(result)
set(HUNTER_GATE_ROOT "$ENV{USERPROFILE}/.hunter" PARENT_SCOPE)
hunter_gate_status_debug(
"HUNTER_ROOT set using USERPROFILE environment variable"
)
return()
endif()
endif()
hunter_gate_fatal_error(
"Can't detect HUNTER_ROOT"
WIKI "error.detect.hunter.root"
)
endfunction()
macro(hunter_gate_lock dir)
if(NOT HUNTER_SKIP_LOCK)
if("${CMAKE_VERSION}" VERSION_LESS "3.2")
hunter_gate_fatal_error(
"Can't lock, upgrade to CMake 3.2 or use HUNTER_SKIP_LOCK"
WIKI "error.can.not.lock"
)
endif()
hunter_gate_status_debug("Locking directory: ${dir}")
file(LOCK "${dir}" DIRECTORY GUARD FUNCTION)
hunter_gate_status_debug("Lock done")
endif()
endmacro()
function(hunter_gate_download dir)
string(
COMPARE
NOTEQUAL
"$ENV{HUNTER_DISABLE_AUTOINSTALL}"
""
disable_autoinstall
)
if(disable_autoinstall AND NOT HUNTER_RUN_INSTALL)
hunter_gate_fatal_error(
"Hunter not found in '${dir}'"
"Set HUNTER_RUN_INSTALL=ON to auto-install it from '${HUNTER_GATE_URL}'"
"Settings:"
" HUNTER_ROOT: ${HUNTER_GATE_ROOT}"
" HUNTER_SHA1: ${HUNTER_GATE_SHA1}"
WIKI "error.run.install"
)
endif()
string(COMPARE EQUAL "${dir}" "" is_bad)
if(is_bad)
hunter_gate_internal_error("Empty 'dir' argument")
endif()
string(COMPARE EQUAL "${HUNTER_GATE_SHA1}" "" is_bad)
if(is_bad)
hunter_gate_internal_error("HUNTER_GATE_SHA1 empty")
endif()
string(COMPARE EQUAL "${HUNTER_GATE_URL}" "" is_bad)
if(is_bad)
hunter_gate_internal_error("HUNTER_GATE_URL empty")
endif()
set(done_location "${dir}/DONE")
set(sha1_location "${dir}/SHA1")
set(build_dir "${dir}/Build")
set(cmakelists "${dir}/CMakeLists.txt")
hunter_gate_lock("${dir}")
if(EXISTS "${done_location}")
# while waiting for lock other instance can do all the job
hunter_gate_status_debug("File '${done_location}' found, skip install")
return()
endif()
file(REMOVE_RECURSE "${build_dir}")
file(REMOVE_RECURSE "${cmakelists}")
file(MAKE_DIRECTORY "${build_dir}") # check directory permissions
# Disabling languages speeds up a little bit, reduces noise in the output
# and avoids path too long windows error
file(
WRITE
"${cmakelists}"
"cmake_minimum_required(VERSION 3.0)\n"
"project(HunterDownload LANGUAGES NONE)\n"
"include(ExternalProject)\n"
"ExternalProject_Add(\n"
" Hunter\n"
" URL\n"
" \"${HUNTER_GATE_URL}\"\n"
" URL_HASH\n"
" SHA1=${HUNTER_GATE_SHA1}\n"
" DOWNLOAD_DIR\n"
" \"${dir}\"\n"
" SOURCE_DIR\n"
" \"${dir}/Unpacked\"\n"
" CONFIGURE_COMMAND\n"
" \"\"\n"
" BUILD_COMMAND\n"
" \"\"\n"
" INSTALL_COMMAND\n"
" \"\"\n"
")\n"
)
if(HUNTER_STATUS_DEBUG)
set(logging_params "")
else()
set(logging_params OUTPUT_QUIET)
endif()
hunter_gate_status_debug("Run generate")
execute_process(
COMMAND "${CMAKE_COMMAND}" "-H${dir}" "-B${build_dir}"
WORKING_DIRECTORY "${dir}"
RESULT_VARIABLE download_result
${logging_params}
)
if(NOT download_result EQUAL 0)
hunter_gate_internal_error("Configure project failed")
endif()
hunter_gate_status_print(
"Initializing Hunter workspace (${HUNTER_GATE_SHA1})"
" ${HUNTER_GATE_URL}"
" -> ${dir}"
)
execute_process(
COMMAND "${CMAKE_COMMAND}" --build "${build_dir}"
WORKING_DIRECTORY "${dir}"
RESULT_VARIABLE download_result
${logging_params}
)
if(NOT download_result EQUAL 0)
hunter_gate_internal_error("Build project failed")
endif()
file(REMOVE_RECURSE "${build_dir}")
file(REMOVE_RECURSE "${cmakelists}")
file(WRITE "${sha1_location}" "${HUNTER_GATE_SHA1}")
file(WRITE "${done_location}" "DONE")
hunter_gate_status_debug("Finished")
endfunction()
# Must be a macro so master file 'cmake/Hunter' can
# apply all variables easily just by 'include' command
# (otherwise PARENT_SCOPE magic needed)
macro(HunterGate)
if(HUNTER_GATE_DONE)
# variable HUNTER_GATE_DONE set explicitly for external project
# (see `hunter_download`)
set_property(GLOBAL PROPERTY HUNTER_GATE_DONE YES)
endif()
# First HunterGate command will init Hunter, others will be ignored
get_property(_hunter_gate_done GLOBAL PROPERTY HUNTER_GATE_DONE SET)
if(NOT HUNTER_ENABLED)
# Empty function to avoid error "unknown function"
function(hunter_add_package)
endfunction()
elseif(_hunter_gate_done)
hunter_gate_status_debug("Secondary HunterGate (use old settings)")
hunter_gate_self(
"${HUNTER_CACHED_ROOT}"
"${HUNTER_VERSION}"
"${HUNTER_SHA1}"
_hunter_self
)
include("${_hunter_self}/cmake/Hunter")
else()
set(HUNTER_GATE_LOCATION "${CMAKE_CURRENT_LIST_DIR}")
string(COMPARE NOTEQUAL "${PROJECT_NAME}" "" _have_project_name)
if(_have_project_name)
hunter_gate_fatal_error(
"Please set HunterGate *before* 'project' command. "
"Detected project: ${PROJECT_NAME}"
WIKI "error.huntergate.before.project"
)
endif()
cmake_parse_arguments(
HUNTER_GATE "LOCAL" "URL;SHA1;GLOBAL;FILEPATH" "" ${ARGV}
)
string(COMPARE EQUAL "${HUNTER_GATE_SHA1}" "" _empty_sha1)
string(COMPARE EQUAL "${HUNTER_GATE_URL}" "" _empty_url)
string(
COMPARE
NOTEQUAL
"${HUNTER_GATE_UNPARSED_ARGUMENTS}"
""
_have_unparsed
)
string(COMPARE NOTEQUAL "${HUNTER_GATE_GLOBAL}" "" _have_global)
string(COMPARE NOTEQUAL "${HUNTER_GATE_FILEPATH}" "" _have_filepath)
if(_empty_sha1)
hunter_gate_user_error("SHA1 suboption of HunterGate is mandatory")
endif()
if(_empty_url)
hunter_gate_user_error("URL suboption of HunterGate is mandatory")
endif()
if(_have_unparsed)
hunter_gate_user_error(
"HunterGate unparsed arguments: ${HUNTER_GATE_UNPARSED_ARGUMENTS}"
)
endif()
if(_have_global)
if(HUNTER_GATE_LOCAL)
hunter_gate_user_error("Unexpected LOCAL (already has GLOBAL)")
endif()
if(_have_filepath)
hunter_gate_user_error("Unexpected FILEPATH (already has GLOBAL)")
endif()
endif()
if(HUNTER_GATE_LOCAL)
if(_have_global)
hunter_gate_user_error("Unexpected GLOBAL (already has LOCAL)")
endif()
if(_have_filepath)
hunter_gate_user_error("Unexpected FILEPATH (already has LOCAL)")
endif()
endif()
if(_have_filepath)
if(_have_global)
hunter_gate_user_error("Unexpected GLOBAL (already has FILEPATH)")
endif()
if(HUNTER_GATE_LOCAL)
hunter_gate_user_error("Unexpected LOCAL (already has FILEPATH)")
endif()
endif()
hunter_gate_detect_root() # set HUNTER_GATE_ROOT
# Beautify path, fix probable problems with windows path slashes
get_filename_component(
HUNTER_GATE_ROOT "${HUNTER_GATE_ROOT}" ABSOLUTE
)
hunter_gate_status_debug("HUNTER_ROOT: ${HUNTER_GATE_ROOT}")
if(NOT HUNTER_ALLOW_SPACES_IN_PATH)
string(FIND "${HUNTER_GATE_ROOT}" " " _contain_spaces)
if(NOT _contain_spaces EQUAL -1)
hunter_gate_fatal_error(
"HUNTER_ROOT (${HUNTER_GATE_ROOT}) contains spaces."
"Set HUNTER_ALLOW_SPACES_IN_PATH=ON to skip this error"
"(Use at your own risk!)"
WIKI "error.spaces.in.hunter.root"
)
endif()
endif()
string(
REGEX
MATCH
"[0-9]+\\.[0-9]+\\.[0-9]+[-_a-z0-9]*"
HUNTER_GATE_VERSION
"${HUNTER_GATE_URL}"
)
string(COMPARE EQUAL "${HUNTER_GATE_VERSION}" "" _is_empty)
if(_is_empty)
set(HUNTER_GATE_VERSION "unknown")
endif()
hunter_gate_self(
"${HUNTER_GATE_ROOT}"
"${HUNTER_GATE_VERSION}"
"${HUNTER_GATE_SHA1}"
hunter_self_
)
set(_master_location "${hunter_self_}/cmake/Hunter")
if(EXISTS "${HUNTER_GATE_ROOT}/cmake/Hunter")
# Hunter downloaded manually (e.g. by 'git clone')
set(_unused "xxxxxxxxxx")
set(HUNTER_GATE_SHA1 "${_unused}")
set(HUNTER_GATE_VERSION "${_unused}")
else()
get_filename_component(_archive_id_location "${hunter_self_}/.." ABSOLUTE)
set(_done_location "${_archive_id_location}/DONE")
set(_sha1_location "${_archive_id_location}/SHA1")
# Check Hunter already downloaded by HunterGate
if(NOT EXISTS "${_done_location}")
hunter_gate_download("${_archive_id_location}")
endif()
if(NOT EXISTS "${_done_location}")
hunter_gate_internal_error("hunter_gate_download failed")
endif()
if(NOT EXISTS "${_sha1_location}")
hunter_gate_internal_error("${_sha1_location} not found")
endif()
file(READ "${_sha1_location}" _sha1_value)
string(COMPARE EQUAL "${_sha1_value}" "${HUNTER_GATE_SHA1}" _is_equal)
if(NOT _is_equal)
hunter_gate_internal_error(
"Short SHA1 collision:"
" ${_sha1_value} (from ${_sha1_location})"
" ${HUNTER_GATE_SHA1} (HunterGate)"
)
endif()
if(NOT EXISTS "${_master_location}")
hunter_gate_user_error(
"Master file not found:"
" ${_master_location}"
"try to update Hunter/HunterGate"
)
endif()
endif()
include("${_master_location}")
set_property(GLOBAL PROPERTY HUNTER_GATE_DONE YES)
endif()
endmacro()
================================================
FILE: cpack_wix_patch.xml
================================================
================================================
FILE: ezel/CMakeLists.txt
================================================
# Copyright (C) 2015 Alexander Lamaison
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see .
set(SOURCES
detail/command_dispatch.hpp
detail/dialog_template.hpp
detail/hooks.hpp
detail/hwnd_linking.hpp
detail/message_dispatch.hpp
detail/window_impl.hpp
detail/window_link.hpp
detail/window_proc.hpp
detail/window_proxy.hpp
controls/button.hpp
controls/checkbox.hpp
controls/edit.hpp
controls/icon.hpp
controls/label.hpp
controls/line.hpp
controls/spinner.hpp
control.hpp
control_parent_impl.hpp
form.hpp
window.hpp)
add_custom_target(ezel-src SOURCES ${SOURCES})
add_library(ezel INTERFACE)
target_include_directories(ezel INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(ezel INTERFACE ${Boost_LIBRARIES})
================================================
FILE: ezel/control.hpp
================================================
/**
@file
GUI control base.
@if license
Copyright (C) 2010 Alexander Lamaison
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
@endif
*/
#ifndef EZEL_CONTROL_HPP
#define EZEL_CONTROL_HPP
#pragma once
#include // window
#include // shared_ptr
#include
namespace ezel {
class form;
/**
* Base-class for form control facades.
*
* All controls that can be added to forms are added as an instance of a
* subclass of this this template.
* This allows form to access the impl pointer but nothing else.
*
* @param T Type of implementation class (pimpl)
*/
template
class control : public window
{
public:
control(boost::shared_ptr impl) : window(impl) {}
virtual ~control() {}
protected:
friend class form; // form need a p-impl from controls
};
} // namespace ezel
#endif
================================================
FILE: ezel/control_parent_impl.hpp
================================================
/**
@file
Compound window parent.
@if license
Copyright (C) 2010 Alexander Lamaison
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
@endif
*/
#ifndef EZEL_CONTROL_PARENT_IMPL_HPP
#define EZEL_CONTROL_PARENT_IMPL_HPP
#pragma once
#include // window_impl
#include // message
#include // assert
namespace ezel {
namespace detail {
/**
* Parent of any window that receive WM_COMMAND message from one or more
* children.
*/
class control_parent_impl : public window_impl
{
public:
typedef window_impl super;
typedef message_map messages;
virtual LRESULT handle_message(
UINT message, WPARAM wparam, LPARAM lparam)
{
return dispatch_message(this, message, wparam, lparam);
}
/**
* What to do if this window is sent a command message by a child window.
*
* We reflect the command back to the control that sent it in case
* wants to react to it.
*/
LRESULT on(message m)
{
window_impl* w = window_from_hwnd(m.control_hwnd());
assert(w != this);
w->handle_command(m.command_code(), m.wparam(), m.lparam());
return default_message_handler(m);
}
protected:
control_parent_impl(
const std::wstring& title, short left, short top, short width,
short height)
:
window_impl(title, left, top, width, height) {}
};
}} // namespace ezel::detail
#endif
================================================
FILE: ezel/controls/button.hpp
================================================
/**
@file
GUI button control.
@if license
Copyright (C) 2010 Alexander Lamaison
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
@endif
*/
#ifndef EZEL_CONTROLS_BUTTON_HPP
#define EZEL_CONTROLS_BUTTON_HPP
#pragma once
#include // control base class
#include // command_map
#include // window_impl
#include // command
#include // shared_ptr
#include // signal
#include
namespace ezel {
namespace controls {
class button_impl : public ezel::detail::window_impl
{
public:
typedef ezel::detail::window_impl super;
typedef ezel::detail::command_map commands;
virtual void handle_command(
WORD command_id, WPARAM wparam, LPARAM lparam)
{
dispatch_command(this, command_id, wparam, lparam);
}
button_impl(
const std::wstring& title, short left, short top, short width,
short height, bool default)
:
ezel::detail::window_impl(title, left, top, width, height),
m_default(default) {}
std::wstring window_class() const { return L"button"; }
DWORD style() const
{
DWORD style = WS_CHILD | WS_VISIBLE | WS_TABSTOP;
style |= (m_default) ? BS_DEFPUSHBUTTON : BS_PUSHBUTTON;
return style;
}
boost::signal& on_click() { return m_on_click; }
void on(command) { m_on_click(); }
private:
boost::signal m_on_click;
bool m_default;
};
class button : public ezel::control
{
public:
button(
const std::wstring& title, short left, short top, short width,
short height, bool default=false)
:
control(
boost::shared_ptr(
new button_impl(title, left, top, width, height, default))) {}
boost::signal& on_click() { return impl()->on_click(); }
short left() const { return impl()->left(); }
short top() const { return impl()->top(); }
short width() const { return impl()->width(); }
short height() const { return impl()->height(); }
};
}} // namespace ezel::controls
#endif
================================================
FILE: ezel/controls/checkbox.hpp
================================================
/**
@file
GUI check-box control.
@if license
Copyright (C) 2010 Alexander Lamaison
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
@endif
*/
#ifndef EZEL_CONTROLS_CHECKBOX_HPP
#define EZEL_CONTROLS_CHECKBOX_HPP
#pragma once
#include // control base class
#include // window_impl
#include // function
#include // shared_ptr
#include
namespace ezel {
namespace controls {
typedef boost::function on_click_callback;
class checkbox_impl : public ezel::detail::window_impl
{
public:
typedef ezel::detail::window_impl super;
typedef ezel::detail::command_map commands;
virtual void handle_command(
WORD command_id, WPARAM wparam, LPARAM lparam)
{
dispatch_command(this, command_id, wparam, lparam);
}
checkbox_impl(
const std::wstring& text, short left, short top, short width,
short height)
:
ezel::detail::window_impl(text, left, top, width, height)
{}
std::wstring window_class() const { return L"button"; }
DWORD style() const
{
return WS_CHILD | WS_VISIBLE | BS_CHECKBOX | WS_TABSTOP;
}
boost::signal& on_click() { return m_on_click; }
void on(command) { m_on_click(); }
private:
boost::signal m_on_click;
bool m_default;
};
class checkbox : public ezel::control
{
public:
checkbox(
const std::wstring& text, short left, short top, short width,
short height)
:
control(
boost::shared_ptr(
new checkbox_impl(text, left, top, width, height))) {}
std::wstring text() const { return impl()->text(); }
short left() const { return impl()->left(); }
short top() const { return impl()->top(); }
short width() const { return impl()->width(); }
short height() const { return impl()->height(); }
};
}} // namespace ezel::controls
#endif
================================================
FILE: ezel/controls/edit.hpp
================================================
/**
@file
GUI edit (text) control.
@if license
Copyright (C) 2010 Alexander Lamaison
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
@endif
*/
#ifndef EZEL_CONTROLS_EDIT_HPP
#define EZEL_CONTROLS_EDIT_HPP
#pragma once
#include // control base class
#include // window_impl
#include // shared_ptr
#include // signal
#include
namespace ezel {
namespace controls {
class edit_impl : public ezel::detail::window_impl
{
public:
typedef ezel::detail::window_impl super;
typedef ezel::detail::command_map commands;
virtual void handle_command(
WORD command_id, WPARAM wparam, LPARAM lparam)
{
dispatch_command(this, command_id, wparam, lparam);
}
edit_impl(
const std::wstring& text, short left, short top, short width,
short height, DWORD custom_style)
:
ezel::detail::window_impl(text, left, top, width, height),
m_custom_style(custom_style) {}
std::wstring window_class() const { return L"Edit"; }
DWORD style() const
{
DWORD style = ezel::detail::window_impl::style() |
WS_CHILD | ES_LEFT | WS_BORDER | ES_AUTOHSCROLL;
style |= m_custom_style;
return style;
}
boost::signal& on_change() { return m_on_change; }
boost::signal& on_update() { return m_on_update; }
void on(command) { m_on_change(); }
void on(command) { m_on_update(); }
private:
boost::signal m_on_change;
boost::signal m_on_update;
DWORD m_custom_style;
};
class edit : public ezel::control
{
public:
struct style
{
enum value
{
default = 0,
password = ES_PASSWORD,
force_lowercase = ES_LOWERCASE,
only_allow_numbers = ES_NUMBER
};
};
edit(
const std::wstring& text, short left, short top, short width,
short height, style::value custom_style=style::default)
:
control(
boost::shared_ptr(
new edit_impl(
text, left, top, width, height, custom_style))) {}
boost::signal& on_change() { return impl()->on_change(); }
boost::signal& on_update() { return impl()->on_update(); }
boost::signal& on_text_change()
{ return impl()->on_text_change(); }
boost::signal& on_text_changed()
{ return impl()->on_text_changed(); }
short left() const { return impl()->left(); }
short top() const { return impl()->top(); }
short width() const { return impl()->width(); }
short height() const { return impl()->height(); }
};
}} // namespace ezel::controls
#endif
================================================
FILE: ezel/controls/icon.hpp
================================================
/**
@file
GUI icon control.
@if license
Copyright (C) 2010, 2013 Alexander Lamaison
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
@endif
*/
#ifndef EZEL_CONTROLS_ICON_HPP
#define EZEL_CONTROLS_ICON_HPP
#pragma once
#include // control base class
#include // window_impl
#include // icon_window
#include // shared_ptr
#include
namespace ezel {
namespace controls {
class icon_impl : public ezel::detail::window_impl
{
protected:
typedef ezel::detail::window_impl super;
public:
icon_impl(short left, short top, short width, short height)
:
ezel::detail::window_impl(L"", left, top, width, height),
m_icon(NULL) {}
std::wstring window_class() const { return L"static"; }
DWORD style() const
{
DWORD style = ezel::detail::window_impl::style() |
WS_CHILD | SS_ICON | WS_GROUP | SS_NOTIFY | SS_CENTERIMAGE;
return style;
}
HICON change_icon(HICON new_icon)
{
if (!is_active())
{
HICON previous = m_icon;
m_icon = new_icon;
return previous;
}
else
{
washer::window::icon_window icon(
washer::window::window_handle::foster_handle(hwnd()));
return icon.change_icon(new_icon);
}
}
protected:
/**
* Set the source of the icon to whatever the user set via change_icon.
*/
virtual void push()
{
super::push();
washer::send_message(
hwnd(), STM_SETIMAGE, IMAGE_ICON, m_icon);
}
private:
HICON m_icon;
};
class icon : public ezel::control
{
public:
struct style
{
enum value
{
default = 0,
ampersand_not_special = SS_NOPREFIX
};
};
icon(short left, short top, short width, short height)
:
control(
boost::shared_ptr(
new icon_impl(left, top, width, height))) {}
HICON change_icon(HICON new_icon) { return impl()->change_icon(new_icon); }
short left() const { return impl()->left(); }
short top() const { return impl()->top(); }
short width() const { return impl()->width(); }
short height() const { return impl()->height(); }
};
}} // namespace ezel::controls
#endif
================================================
FILE: ezel/controls/label.hpp
================================================
/**
@file
GUI label (static text) control.
@if license
Copyright (C) 2010 Alexander Lamaison
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
@endif
*/
#ifndef EZEL_CONTROLS_LABEL_HPP
#define EZEL_CONTROLS_LABEL_HPP
#pragma once
#include // control base class
#include // window_impl
#include // shared_ptr
#include
namespace ezel {
namespace controls {
class label_impl : public ezel::detail::window_impl
{
public:
label_impl(
const std::wstring& text, short left, short top, short width,
short height, DWORD custom_style)
:
ezel::detail::window_impl(text, left, top, width, height),
m_custom_style(custom_style) {}
std::wstring window_class() const { return L"static"; }
DWORD style() const
{
DWORD style = ezel::detail::window_impl::style() |
WS_CHILD | SS_LEFT | WS_GROUP | SS_NOTIFY;
style &= ~WS_TABSTOP;
style |= m_custom_style;
return style;
}
private:
DWORD m_custom_style;
};
class label : public ezel::control
{
public:
struct style
{
enum value
{
default = 0,
ampersand_not_special = SS_NOPREFIX
};
};
label(
const std::wstring& text, short left, short top, short width,
short height, style::value custom_style=style::default)
:
control(
boost::shared_ptr(
new label_impl(
text, left, top, width, height, custom_style))) {}
short left() const { return impl()->left(); }
short top() const { return impl()->top(); }
short width() const { return impl()->width(); }
short height() const { return impl()->height(); }
};
}} // namespace ezel::controls
#endif
================================================
FILE: ezel/controls/line.hpp
================================================
/**
@file
GUI horizontal line control.
@if license
Copyright (C) 2010 Alexander Lamaison
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
@endif
*/
#ifndef EZEL_CONTROLS_LINE_HPP
#define EZEL_CONTROLS_LINE_HPP
#pragma once
#include // control base class
#include // window_impl
#include // shared_ptr
#include
namespace ezel {
namespace controls {
class line_impl : public ezel::detail::window_impl
{
public:
line_impl(short left, short top, short width)
:
ezel::detail::window_impl(L"", left, top, width, 1) {}
std::wstring window_class() const { return L"static"; }
DWORD style() const
{
return WS_CHILD | WS_VISIBLE | SS_ETCHEDHORZ | WS_GROUP | SS_NOTIFY;
}
};
class line : public ezel::control
{
public:
line(
short left, short top, short width)
:
control(
boost::shared_ptr(new line_impl(left, top, width)))
{}
short left() const { return impl()->left(); }
short top() const { return impl()->top(); }
short width() const { return impl()->width(); }
short height() const { return impl()->height(); }
};
}} // namespace ezel::controls
#endif
================================================
FILE: ezel/controls/spinner.hpp
================================================
/**
@file
GUI spinner control.
@if license
Copyright (C) 2010 Alexander Lamaison
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
@endif
*/
#ifndef EZEL_CONTROLS_SPINNER_HPP
#define EZEL_CONTROLS_SPINNER_HPP
#pragma once
#include // control base class
#include // window_impl
#include // send_message
#include // shared_ptr
#include // int32_t
#include
#include // UDS_*, UDM_*
namespace ezel {
namespace controls {
class spinner_impl : public ezel::detail::window_impl
{
protected:
typedef ezel::detail::window_impl super;
public:
spinner_impl(
short left, short top, short width, short height,
boost::int32_t minimum, boost::int32_t maximum,
boost::int32_t initial_value, DWORD custom_style)
:
ezel::detail::window_impl(L"", left, top, width, height),
m_min(minimum), m_max(maximum), m_value(initial_value),
m_custom_style(custom_style) {}
std::wstring window_class() const { return L"msctls_updown32"; }
DWORD style() const
{
DWORD style = ezel::detail::window_impl::style() |
WS_CHILD | UDS_ARROWKEYS | UDS_SETBUDDYINT | UDS_AUTOBUDDY;
style |= m_custom_style;
return style;
}
void range(boost::int32_t minimum, boost::int32_t maximum)
{
if (!is_active())
{
m_min = minimum;
m_max = maximum;
}
else
{
washer::send_message(
hwnd(), UDM_SETRANGE32, minimum, maximum);
}
}
boost::int32_t value(boost::int32_t v)
{
if (!is_active())
m_value = v;
else
return washer::send_message_return(
hwnd(), UDM_SETPOS32, 0, v);
}
protected:
/**
* Set the initial range of the spinner.
*/
virtual void push()
{
super::push();
washer::send_message(hwnd(), UDM_SETRANGE32, m_min, m_max);
washer::send_message(hwnd(), UDM_SETPOS32, 0, m_value);
}
private:
boost::int32_t m_min;
boost::int32_t m_max;
boost::int32_t m_value;
DWORD m_custom_style;
};
class spinner : public ezel::control
{
public:
struct style
{
enum value
{
default = 0,
no_thousand_separator = UDS_NOTHOUSANDS,
wrap_sequence = UDS_WRAP
};
};
spinner(
short left, short top, short width, short height,
boost::int32_t minimum, boost::int32_t maximum,
boost::int32_t initial_value,
style::value custom_style=style::default)
:
control(
boost::shared_ptr(
new spinner_impl(
left, top, width, height, minimum, maximum, initial_value,
custom_style)))
{}
void range(boost::int32_t minimum, boost::int32_t maximum)
{ impl()->range(minimum, maximum); }
boost::int32_t value(boost::int32_t new_value)
{ return impl()->value(new_value); }
short left() const { return impl()->left(); }
short top() const { return impl()->top(); }
short width() const { return impl()->width(); }
short height() const { return impl()->height(); }
};
}} // namespace ezel::controls
#endif
================================================
FILE: ezel/detail/command_dispatch.hpp
================================================
/**
@file
Command message dispatch.
@if license
Copyright (C) 2010 Alexander Lamaison
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
@endif
*/
#ifndef EZEL_COMMAND_DISPATCH_HPP
#define EZEL_COMMAND_DISPATCH_HPP
#pragma once
#include // command
#ifndef BOOST_MPL_LIMIT_VECTOR_SIZE
#define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
#endif
#ifndef BOOST_MPL_LIMIT_VECTOR_SIZE
#define BOOST_MPL_LIMIT_VECTOR_SIZE 50
#endif
#include // begin, end
#include // copy_if
#include // not_equal_to
#include // vector_c
#include // is_same
#define EZEL_COMMAND_MAP_TEMPLATE \
int EZC0=-1, int EZC1=-1, int EZC2=-1, int EZC3=-1, int EZC4=-1, \
int EZC5=-1, int EZC6=-1, int EZC7=-1, int EZC8=-1, int EZC9=-1, \
int EZC10=-1, int EZC11=-1, int EZC12=-1, int EZC13=-1, int EZC14=-1, \
int EZC15=-1, int EZC16=-1, int EZC17=-1, int EZC18=-1, int EZC19=-1, \
int EZC20=-1, int EZC21=-1, int EZC22=-1, int EZC23=-1, int EZC24=-1, \
int EZC25=-1, int EZC26=-1, int EZC27=-1, int EZC28=-1, int EZC29=-1, \
int EZC30=-1, int EZC31=-1, int EZC32=-1, int EZC33=-1, int EZC34=-1, \
int EZC35=-1, int EZC36=-1, int EZC37=-1, int EZC38=-1, int EZC39=-1, \
int EZC40=-1, int EZC41=-1, int EZC42=-1, int EZC43=-1, int EZC44=-1, \
int EZC45=-1, int EZC46=-1, int EZC47=-1, int EZC48=-1, int EZC49=-1
#define EZEL_COMMAND_ARG \
EZC0, EZC1, EZC2, EZC3, EZC4, \
EZC5, EZC6, EZC7, EZC8, EZC9, \
EZC10, EZC11, EZC12, EZC13, EZC14, \
EZC15, EZC16, EZC17, EZC18, EZC19, \
EZC20, EZC21, EZC22, EZC23, EZC24, \
EZC25, EZC26, EZC27, EZC28, EZC29, \
EZC30, EZC31, EZC32, EZC33, EZC34, \
EZC35, EZC36, EZC37, EZC38, EZC39, \
EZC40, EZC41, EZC42, EZC43, EZC44, \
EZC45, EZC46, EZC47, EZC48, EZC49
namespace ezel {
namespace detail {
template
inline void dispatch_command(T* obj, WORD id, WPARAM wparam, LPARAM lparam);
template
inline void dispatch_command_next(
T* obj, WORD /*id*/, WPARAM wparam, LPARAM lparam, boost::mpl::true_)
{
obj->on(washer::gui::command_base(wparam, lparam));
}
template
inline void dispatch_command_next(
T* obj, WORD id, WPARAM wparam, LPARAM lparam, boost::mpl::false_)
{
dispatch_command(obj, id, wparam, lparam);
}
/**
* Dispatch conditionally based on whether we're at end of superclass chain.
*
* If we are, this command goes to the default command handler. Otherwise,
* we create a dispatch for the superclasses command map and delegate
* dispatch there.
*/
template
inline void dispatch_command(
T* obj, WORD command_id, WPARAM wparam, LPARAM lparam, boost::mpl::true_)
{
return dispatch_command_next(
obj, command_id, wparam, lparam, boost::is_same::type());
}
template
inline void dispatch_command(
T* obj, WORD command_id, WPARAM wparam, LPARAM lparam, boost::mpl::false_)
{
typedef boost::mpl::deref::type Front;
typedef boost::mpl::next::type Next;
if(command_id == Front::value)
{
return obj->on(command(wparam, lparam));
}
else
{
return dispatch_command(
obj, command_id, wparam, lparam,
typename boost::is_same::type());
}
}
/**
* Command dispatcher.
*
* Messages are dispatched to the superclasses of T one at a time until one is
* found whose command map contains the current command. Then its handler
* for that meassage is invoked.
* If we reach the end of the chain without finding a matching map entry,
* the command is delivered to the default command handler.
*/
template
inline void dispatch_command(
T* obj, WORD command_id, WPARAM wparam, LPARAM lparam)
{
typedef boost::mpl::begin::type Begin;
typedef boost::mpl::end::type End;
dispatch_command(
obj, command_id, wparam, lparam,
typename boost::is_same::type());
}
template
class command_map
{
public:
// -1 is used to indicate an unused template parameter. To
// prevent us having to treat -1 as a special case, we filter it out of
// the command map immediately here
typedef typename boost::mpl::copy_if<
boost::mpl::vector_c,
boost::mpl::not_equal_to< boost::mpl::_1, boost::mpl::int_<-1> >,
boost::mpl::back_inserter< boost::mpl::vector_c >
>::type commands;
};
}} // namespace washer::gui
#endif
================================================
FILE: ezel/detail/dialog_template.hpp
================================================
/**
@file
Windows dialog in-memory template helpers
@if license
Copyright (C) 2010 Alexander Lamaison
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
@endif
*/
#ifndef EZEL_DETAIL_DIALOG_TEMPLATE_HPP
#define EZEL_DETAIL_DIALOG_TEMPLATE_HPP
#pragma once
#include // window_impl
#include // BOOST_FOREACH
#include // numeric_cast
#include // shared_ptr
#include // BOOST_STATIC_ASSERT
#include // copy
#include
#include
namespace ezel {
namespace detail {
#pragma warning(push)
#pragma warning(disable: 4996) // std::copy: Function call that may be unsafe
// the calculations rely on pointer-arithmetic on wchar_t pointers
// skipping 16-bit (WORD-sized) fields
BOOST_STATIC_ASSERT(sizeof(wchar_t) == 2); // 16-bits
BOOST_STATIC_ASSERT(sizeof(wchar_t) == sizeof(WORD));
/**
* If the pointer is already DWORD-aligned return it unchanged otherwise
* advance to the next DWORD boundary.
*/
template
inline T* next_double_word(T* p)
{
return reinterpret_cast((reinterpret_cast(p) + 3) & ~3);
}
/**
* If the pointer is already WORD-aligned return it unchanged otherwise
* advance to the next WORD boundary.
*/
template
inline T* next_word(T* p)
{
return reinterpret_cast((reinterpret_cast(p) + 1) & ~1);
}
/**
* Calculate the necessary buffer size for a dialog template.
*
* Apparently all the fields are naturally WORD-aligned so we don't need to
* force it explicitly
* (@see http://msdn.microsoft.com/en-us/library/ms644996%28VS.85%29.aspx in
* the user contrib comments) but we do so anyway just to be on the safe side.
*/
inline size_t calculate_template_size(
const std::wstring& title, const std::wstring& font)
{
DLGTEMPLATE* dlg = 0;
// template
wchar_t* pos = reinterpret_cast(dlg + 1);
pos = next_word(pos) + 1; // menu (1)
pos = next_word(pos) + 1; // window class (1)
// title (?) + terminator (1)
wchar_t* title_array = next_word(pos);
title_array = title_array + title.size() + 1;
// fontsize (1)
pos = next_word(title_array);
pos = pos + 1;
// font (?) + terminator (1)
wchar_t* font_array = next_word(pos);
font_array = next_word(font_array) + font.size() + 1;
// padding
return reinterpret_cast(next_double_word(font_array));
}
/**
* Write the DLGTEMPLATE part of a Dialog template.
*
* Assumes the buffer is big enough to fit the data. Use
* calculate_template_size to calculate the nescessary size.
*/
inline DLGITEMTEMPLATE* write_template_to_buffer(
const std::wstring& title, short font_size, const std::wstring& font,
short left, short top, short width, short height, size_t control_count,
DLGTEMPLATE* dlg)
{
// dlg buffer must already be DWORD aligned
assert((((int)dlg) % sizeof(DWORD)) == 0);
dlg->style = DS_SETFONT | WS_VISIBLE | WS_POPUPWINDOW | DS_MODALFRAME;
if (!title.empty())
dlg->style |= WS_CAPTION;
dlg->cx = width;
dlg->cy = height;
dlg->x = left;
dlg->y = top;
dlg->cdit = boost::numeric_cast(control_count);
wchar_t* pos = reinterpret_cast(dlg + 1);
pos = next_word(pos);
*pos++ = 0; // no menu
pos = next_word(pos);
*pos++ = 0; // default dialog window class
// caption
wchar_t* title_array = next_word(pos);
title_array = std::copy(title.begin(), title.end(), title_array);
*title_array++ = 0; // null-terminate
// font size
pos = next_word(title_array);
*pos++ = font_size;
// font name
wchar_t* font_array = next_word(pos);
font_array = std::copy(font.begin(), font.end(), font_array);
*font_array++ = 0; // null-terminate
return reinterpret_cast(next_double_word(font_array));
}
/**
* Calculate the necessary buffer size for an item template.
*
* Apparently all the fields are naturally WORD-aligned so we don't need to
* force it explicitly
* (@see http://msdn.microsoft.com/en-us/library/ms644996%28VS.85%29.aspx in
* the user contrib comments) but we do so anyway just to be on the safe side.
*
* After the custom data field we have to add en extra WORD of buffer *not*
* including any extra needed for DWORD-alignment. This does not match the
* MSDN documentation but is required.
*/
template
inline size_t calculate_control_template_size(
const std::wstring& window_class, const std::wstring& title,
size_t current_buffer_size)
{
// item template
DLGITEMTEMPLATE* item =
reinterpret_cast(current_buffer_size);
item = next_double_word(item) + 1;
// class (?) + terminator (1)
wchar_t* class_array = reinterpret_cast(item);
class_array = next_word(class_array) + window_class.size() + 1;
// title (?) + terminator (1)
wchar_t* title_array = class_array + 1;
title_array = next_word(title_array) + title.size() + 1;
// custom data size (1) + custom data (?) + extra WORD (1)
wchar_t* custom_data_size = title_array + 1;
custom_data_size = next_word(custom_data_size);
Customdata* data = reinterpret_cast(custom_data_size + 1);
data++;
wchar_t* mystery_extra = reinterpret_cast(data);
mystery_extra++;
return reinterpret_cast(next_double_word(mystery_extra));
}
/**
* Write a DLGITEMTEMPLATE entry for a dialog control.
*
* Assumes the buffer is big enough to fit the data. Use
* calculate_item_template_size to calculate the nescessary size.
*/
template
inline DLGITEMTEMPLATE* write_control_to_buffer(
const std::wstring& window_class, const std::wstring& title,
unsigned short id, DWORD style,
short width, short height, short left, short top,
const CustomData& custom_data, DLGITEMTEMPLATE* buffer)
{
DLGITEMTEMPLATE* item = next_double_word(buffer);
item->style = style;
item->id = id;
item->cx = width;
item->cy = height;
item->x = left;
item->y = top;
item = item + 1; // skip over template
// control window class name
wchar_t* class_array = reinterpret_cast(next_word(item));
class_array = std::copy(
window_class.begin(), window_class.end(), class_array);
*class_array++ = 0; // null-terminate
// title
wchar_t* title_array = next_word(class_array);
title_array = std::copy(title.begin(), title.end(), title_array);
*title_array++ = 0; // null-terminate
// custom data size must include its own memory in the size value
wchar_t* custom_data_size = next_word(title_array);
*custom_data_size++ = sizeof(wchar_t) + sizeof(CustomData);
CustomData* data = reinterpret_cast(custom_data_size);
*data++ = custom_data;
wchar_t* mystery_extra = reinterpret_cast(data);
mystery_extra++;
return reinterpret_cast(next_double_word(mystery_extra));
}
/**
* The required buffer size to store the window as a control in a
* dialog template.
*/
inline size_t increment_required_buffer_size(
const window_impl* w, size_t current_buffer_size)
{
return calculate_control_template_size(
w->window_class(), w->text(), current_buffer_size);
}
/**
* Write the window to a byte buffer as a control in a dialog template.
*/
inline DLGITEMTEMPLATE* to_buffer(
window_impl* w, unsigned short id, DLGITEMTEMPLATE* buffer)
{
return write_control_to_buffer(
w->window_class(), w->text(), id, w->style(),
w->width(), w->height(), w->left(), w->top(),
w, buffer);
}
const unsigned short BUTTON_ID_OFFSET = 100;
/**
* Build a dialog resource template in memory.
*/
inline std::vector build_dialog_template_in_memory(
const std::wstring& font, short font_size, const std::wstring& title,
short width, short height, short left, short top,
const std::vector >& controls)
{
size_t buffer_len = calculate_template_size(title, font);
BOOST_FOREACH(boost::shared_ptr w, controls)
{
buffer_len = increment_required_buffer_size(w.get(), buffer_len);
}
std::vector buffer(buffer_len, 0);
DLGITEMTEMPLATE* pos = write_template_to_buffer(
title, font_size, font, width, height, left, top,
controls.size(), reinterpret_cast(&buffer[0]));
for (size_t i = 0; i < controls.size(); ++i)
{
window_impl* w = controls[i].get();
// offset ID to avoid collision with dialog manager's
// 'special' button IDs
unsigned short id = boost::numeric_cast(
i + BUTTON_ID_OFFSET);
pos = to_buffer(
w, id, reinterpret_cast(pos));
}
return buffer;
}
#pragma warning(pop)
}} // namespace ezel::detail
#endif
================================================
FILE: ezel/detail/hooks.hpp
================================================
/**
@file
Window creation hooks
@if license
Copyright (C) 2010, 2011 Alexander Lamaison
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
@endif
*/
#ifndef EZEL_HOOKS_HPP
#define EZEL_HOOKS_HPP
#pragma once
#include // window_impl
#include // windows_hook
#include // cerr
#include // CallNextHookEx
namespace ezel {
namespace detail {
namespace native {
/// @name CREATESTRUCT
// @{
template struct create_struct;
template<> struct create_struct
{ typedef CREATESTRUCTA type; };
template<> struct create_struct
{ typedef CREATESTRUCTW type; };
// @}
/// @name CBT_CREATEWND
// @{
template struct cbt_createwnd;
template<> struct cbt_createwnd
{ typedef CBT_CREATEWNDA type; };
template<> struct cbt_createwnd
{ typedef CBT_CREATEWNDW type; };
// @}
}
template
inline void handle_create(
HWND hwnd, HWND /*insert_after*/,
typename native::create_struct::type& create_info)
{
UNALIGNED wchar_t* data =
static_cast(create_info.lpCreateParams);
if (data)
{
assert(*data == sizeof(wchar_t) + sizeof(window_impl*));
data++; // skip size
window_impl* w = *reinterpret_cast(data);
w->attach(hwnd);
}
}
template
inline void handle_destroy(HWND hwnd)
{
window_impl* this_window =
fetch_user_window_data(hwnd);
this_window->detach();
}
/**
* Hooking procedure called by Windows any time a GUI event happens.
*
* This function captures window creation and establishes a two-way link
* between the Win32 window object and the C++ wrapper object.
*
* @todo Pass *this* hook as first param for Windows 9x.
*/
template
inline LRESULT CALLBACK cbt_hook_function(
int code, WPARAM wparam, LPARAM lparam)
{
try
{
if (code == HCBT_CREATEWND)
{
HWND hwnd = reinterpret_cast(wparam);
typedef typename native::cbt_createwnd::type* cbt_param;
cbt_param cbt_info = reinterpret_cast(lparam);
handle_create(
hwnd, cbt_info->hwndInsertAfter, *(cbt_info->lpcs));
}
else if (code == HCBT_DESTROYWND)
{
//handle_destroy(reinterpret_cast(wparam));
}
}
catch (std::exception& e)
{
std::cerr << e.what();
}
// TODO: pass *this* hook as first param for Windows 9x
LRESULT rc = ::CallNextHookEx(NULL, code, wparam, lparam);
return rc;
}
/**
* Sets up and tears down window event hooks.
*
* Declare one static instance of this class in order to register window
* creation.
*/
template
class creation_hooks
{
public:
creation_hooks()
:
m_cbt_hook(washer::windows_hook(WH_CBT, &cbt_hook_function)) {}
private:
washer::hhook m_cbt_hook;
};
}} // namespace ezel::detail
#endif
================================================
FILE: ezel/detail/hwnd_linking.hpp
================================================
/**
@file
Low-level HWND manipulation.
@if license
Copyright (C) 2010, 2011 Alexander Lamaison
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
@endif
*/
#ifndef EZEL_DETAIL_WINDOW_HPP
#define EZEL_DETAIL_WINDOW_HPP
#pragma once
#include // last_error
#include // set_window_field, window_field
namespace ezel {
namespace detail {
/**
* Store a value in the GWLP_USERDATA segment of the window descriptor.
*
* The value type must be no bigger than a LONG_PTR.
*/
template
inline void store_user_window_data(HWND hwnd, const U& data)
{
washer::gui::set_window_field(hwnd, GWLP_USERDATA, data);
}
/**
* Store a value in the DWLP_USER segment of the window descriptor.
*
* The value type must be no bigger than a LONG_PTR.
*/
template
inline void store_dialog_window_data(HWND hwnd, const U& data)
{
washer::gui::set_window_field(hwnd, DWLP_USER, data);
}
/**
* Get a value previously stored in the GWLP_USERDATA segment of the
* window descriptor.
*
* The value type must be no bigger than a LONG_PTR.
*
* @throws system_error if there is an error or if no value has yet been
* stored.
* @note Storing 0 will count as not having a previous value so will
* throw an exception.
*/
template
inline U fetch_user_window_data(HWND hwnd)
{
return washer::gui::window_field(hwnd, GWLP_USERDATA);
}
/**
* Get a value previously stored in the DWLP_USER segment of the
* window descriptor.
*
* The value type must be no bigger than a LONG_PTR.
*
* @throws system_error if there is an error or if no value has yet been
* stored.
* @note Storing 0 will count as not having a previous value so will
* throw an exception.
*/
template
inline U fetch_dialog_window_data(HWND hwnd)
{
return washer::gui::window_field(hwnd, DWLP_USER);
}
}} // namespace ezel::detail
#endif
================================================
FILE: ezel/detail/message_dispatch.hpp
================================================
/**
@file
Message dispatch.
@if license
Copyright (C) 2010 Alexander Lamaison
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
@endif
*/
#ifndef EZEL_MESSAGE_DISPATCH_HPP
#define EZEL_MESSAGE_DISPATCH_HPP
#pragma once
#include // message
#ifndef BOOST_MPL_LIMIT_VECTOR_SIZE
#define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
#endif
#ifndef BOOST_MPL_LIMIT_VECTOR_SIZE
#define BOOST_MPL_LIMIT_VECTOR_SIZE 50
#endif
#include // begin, end
#include // copy_if
#include // not_equal_to
#include // vector_c
#include // is_same
#define EZEL_MESSAGE_MAP_TEMPLATE \
UINT EZM0=0, UINT EZM1=0, UINT EZM2=0, UINT EZM3=0, UINT EZM4=0, \
UINT EZM5=0, UINT EZM6=0, UINT EZM7=0, UINT EZM8=0, UINT EZM9=0, \
UINT EZM10=0, UINT EZM11=0, UINT EZM12=0, UINT EZM13=0, UINT EZM14=0, \
UINT EZM15=0, UINT EZM16=0, UINT EZM17=0, UINT EZM18=0, UINT EZM19=0, \
UINT EZM20=0, UINT EZM21=0, UINT EZM22=0, UINT EZM23=0, UINT EZM24=0, \
UINT EZM25=0, UINT EZM26=0, UINT EZM27=0, UINT EZM28=0, UINT EZM29=0, \
UINT EZM30=0, UINT EZM31=0, UINT EZM32=0, UINT EZM33=0, UINT EZM34=0, \
UINT EZM35=0, UINT EZM36=0, UINT EZM37=0, UINT EZM38=0, UINT EZM39=0, \
UINT EZM40=0, UINT EZM41=0, UINT EZM42=0, UINT EZM43=0, UINT EZM44=0, \
UINT EZM45=0, UINT EZM46=0, UINT EZM47=0, UINT EZM48=0, UINT EZM49=0
#define EZEL_MESSAGE_ARG \
EZM0, EZM1, EZM2, EZM3, EZM4, \
EZM5, EZM6, EZM7, EZM8, EZM9, \
EZM10, EZM11, EZM12, EZM13, EZM14, \
EZM15, EZM16, EZM17, EZM18, EZM19, \
EZM20, EZM21, EZM22, EZM23, EZM24, \
EZM25, EZM26, EZM27, EZM28, EZM29, \
EZM30, EZM31, EZM32, EZM33, EZM34, \
EZM35, EZM36, EZM37, EZM38, EZM39, \
EZM40, EZM41, EZM42, EZM43, EZM44, \
EZM45, EZM46, EZM47, EZM48, EZM49
namespace ezel {
namespace detail {
template
inline LRESULT dispatch_message_next(
T* obj, UINT message_id, WPARAM wparam, LPARAM lparam);
template
inline LRESULT dispatch_message_next(
T* obj, UINT message_id, WPARAM wparam, LPARAM lparam, boost::mpl::true_)
{
return obj->default_message_handler(message_id, wparam, lparam);
}
template
inline LRESULT dispatch_message_next(
T* obj, UINT message_id, WPARAM wparam, LPARAM lparam, boost::mpl::false_)
{
return dispatch_message(obj, message_id, wparam, lparam);
}
/**
* Dispatch conditionally based on whether we're at end of superclass chain.
*
* If we are, this message goes to the default message handler. Otherwise,
* we create a dispatch for the superclasses message map and delegate
* dispatch there.
*/
template
inline LRESULT dispatch_message(
T* obj, UINT message_id, WPARAM wparam, LPARAM lparam, boost::mpl::true_)
{
return dispatch_message_next(
obj, message_id, wparam, lparam, boost::is_same::type());
}
template
inline LRESULT dispatch_message(
T* obj, UINT message_id, WPARAM wparam, LPARAM lparam, boost::mpl::false_)
{
typedef boost::mpl::deref::type Front;
typedef boost::mpl::next::type Next;
if(message_id == Front::value)
{
return obj->on(message(wparam, lparam));
}
else
{
return dispatch_message(
obj, message_id, wparam, lparam,
typename boost::is_same::type());
}
}
/**
* Main message handler.
*
* Messages are dispatched to the superclasses of T one at a time until one is
* found whose message map contains the current message. Then its handler for
* that meassage is invoked. If we reach the end of the chain without finding
* a matching map entry, the message is delivered to the default message
* handler.
*/
template
inline LRESULT dispatch_message(
T* obj, UINT message_id, WPARAM wparam, LPARAM lparam)
{
typedef boost::mpl::begin::type Begin;
typedef boost::mpl::end::type End;
return dispatch_message(
obj, message_id, wparam, lparam,
typename boost::is_same::type());
}
template
class message_map
{
public:
// Zero (0) is used to indicate an unused template parameter. To
// prevent us having to treat 0 as a special case, we filter it out of
// the message map immediately here
typedef typename boost::mpl::copy_if<
boost::mpl::vector_c,
boost::mpl::not_equal_to< boost::mpl::_1, boost::mpl::int_<0> >,
boost::mpl::back_inserter< boost::mpl::vector_c >
>::type messages;
};
}} // namespace washer::gui
#endif
================================================
FILE: ezel/detail/window_impl.hpp
================================================
/**
@file
HWND wrapper implementation.
@if license
Copyright (C) 2010, 2013 Alexander Lamaison
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
@endif
*/
#ifndef EZEL_DETAIL_WINDOW_IMPL_HPP
#define EZEL_DETAIL_WINDOW_IMPL_HPP
#pragma once
#include // command_map
#include // message_map
#include // window_link
#include // window_proc_base, window_proc
#include